semvec/pypi-packages huggingface dataset:
c2048 0.1.0
A Python implementation of the game 2048 written in rust
License: MIT
Requires Python: >=3.8
Keywords: 2048

# C2048
C2048 is a Python library that implements the 2048 game written in Rust.

The game loop should look like this
```python
from c2048 import C2048, Move
game = C2048()

while True:
    print(f"Score: {game.score()}")
    print(game)
    # pick a random move
    move = Move.random()
    game.move(move)
    
    if game.has_moved:
        # Probability of getting a 2
        game.spawn_tile(0.9)
        # resets the game.has_moved
        game.reset()
    
    if game.is_win():
        print("You win, max tile: ", game.highest())
        break
    elif game.is_lose():
        print("You lose, max tile: ", game.highest())
        break
```
truth-tables 0.1.1
Create pretty-printed truth tables from boolean expressions!
License: MIT
Requires Python: >=3.11

# truth_tables

Create pretty-printed truth tables and abstract syntax trees from boolean expressions! Installation is as easy as `pip install truth_tables`.

Example usage:

```py
>>> from truth_tables import TruthTable
>>> my_table = TruthTable('p or q', '~p -> q', 'T and ~T')
>>> print(my_table)
┌───┬───┬────────┬─────────┬──────────┐
│ p │ q │ p or q │ ~p -> q │ T and ~T │
├───┼───┼────────┼─────────┼──────────┤
│ F │ F │   F    │    F    │    F     │
│ F │ T │   T    │    T    │    F     │
│ T │ F │   T    │    T    │    F     │
│ T │ T │   T    │    T    │    F     │
└───┴───┴────────┴─────────┴──────────┘
>>> print(my_table.ast)
Or
├─Variable('p')
╰─Variable('q')

Implies
├─Negate
│ ╰─Variable('p')
╰─Variable('q')

And
├─LiteralTrue
╰─Negate
  ╰─LiteralTrue

>>> my_table = TruthTable('~((p xor (q and ~r) or q) and ~(p <-> r))')
>>> print(my_table)
┌───┬───┬───┬───────────────────────────────────────────┐
│ p | q | r | ~((p xor (q and ~r) or q) and ~(p <-> r)) │
├───┼───┼───┼───────────────────────────────────────────┤
│ F | F | F |                     T                     │
│ F | F | T |                     T                     │
│ F | T | F |                     T                     │
│ F | T | T |                     F                     │
│ T | F | F |                     F                     │
│ T | F | T |                     T                     │
│ T | T | F |                     F                     │
│ T | T | T |                     T                     │
└───┴───┴───┴───────────────────────────────────────────┘
```

Two truth tables are equal if they have the same variables and the same truth values (not necessarily the same propositions).

```py
>>> TruthTable('p -> q') == TruthTable('~p or q')
True
```

## Notes on the Parser

- The parser will accept symbolic or english names for boolean operators:
  | operator  | symbolic | english   |
  | :-------: | :------: | :-------: |
  | `Not`     | `~`      | `not`     |
  | `And`     | `&`      | `and`     |
  | `Or`      | `\|`     | `or`      |
  | `Implies` | `->`     | `implies` |
  | `Iff`     | `<->`    | `iff`     |
  | `Xor`     | `^`      | `xor`     |

- `Not` has greater precendence than `And` and `And` has greater precedence than `Or`, `Implies`, `Iff`, and `Xor`.
- `T` and `F` are parsed as boolean literals.
- Other than the english operator names and boolean literals, variable names may be any sequence of word characters that don't start with a digit.