https://github.com/956mb/connect-four.py
Connect Four in the terminal, written in Python.
https://github.com/956mb/connect-four.py
connect-four game python terminal
Last synced: 25 days ago
JSON representation
Connect Four in the terminal, written in Python.
- Host: GitHub
- URL: https://github.com/956mb/connect-four.py
- Owner: 956MB
- Created: 2020-03-19T04:21:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-18T08:34:03.000Z (about 4 years ago)
- Last Synced: 2025-02-06T10:53:22.189Z (over 1 year ago)
- Topics: connect-four, game, python, terminal
- Language: Python
- Homepage:
- Size: 173 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# connect-four.py
[Board games collection repo](https://github.com/956MB/board-games)
```
this is nothing
. . . . . . . . . . . . . . ┌─┬─┬─┬─┬─┬─┬─┐
. . . . . . . │ . . . ● . . . │ ├─┼─┼─┼─┼─┼─┼─┤
. . ● ○ . . . │ . . ● . . . . │ ├─┼─┼─┼─┼─┼─┼─┤
○ ● ○ ● . . . │ . ● . . . . . │ ├─┼─┼─┼─┼─┼─┼─┤
● ○ ○ ○ ● . . │ ● . . . . . . │ ├─┼─┼─┼─┼─┼─┼─┤
● ○ ○ ● ● ○ ● . . . . . . . ├─┼─┼─┼─┼─┼─┼─┤
└─┴─┴─┴─┴─┴─┴─┘
⭠ ⭢ to move. WINNER: ●
SPACE to select.
ESC to exit.
```
Usage:
```shell
usage: connect-four.py [-h] [-V] [-n] [-r] [-d DATASET] [-s [{1,2,3}]] [-l]
Play Connect Four in the terminal. Written in Python.
optional arguments:
-h, --help show this help message and exit
-V, --version show script version
-n, --net play against trained neural net
-r, --random play against random moves
-d DATASET, --dataset DATASET
path to .csv moves dataset to load random game
-s [{1,2,3}], --style [{1,2,3}]
style of Connect Four game. 1, 2 or 3.
-l, --log log moves of game to logs/
```
### 'test-output-moves.csv' dataset format:
```
[starter, moves..., winner]
Starter: The first moves piece color that was randomly picked (1 or -1, for red/yellow)
Moves: Integer made from array row/col of where the moves were placed ([5,5] = 55, [5,3] = 53, etc...)
Winner: Winner of the game (1 or -1, for red/yellow)
Example:
[1],(55),53,50,45,43,33,56,51,40,30,35,54,44,34,25,52,{-1}
[]: red went first, (): red first move 55, {}: yellow ended up winning
```
# TODO:
* Finish implementing argument features for play.py:
* --net, figure out neural net stuff to make moves in connect four. wow, difficult.
* --log, log things like total moves, red/yellow moves, time/date, win method
# LOOKS:
