<commit_before># Gamer (a better name still to be found)

Little proof of concept framework to playtest AIs at various games.<br>
Still very WIP.

There is a Match class, where the game and the players are plugged in.
So you can basically devise your own AI, and make it play against
another AI, or even yourself.

In full [codingame](https://www.codingame.com) fashion, I wanted
players and the "referee" of the game to communicate with sequences
strings, so that easily players could be external programs.

I tried to write most of docstring and comments in english, but
probably something in italian survived so, if ever some english
speaking fellow reads this code: sorry pal.

## Requirements

This software has been developed with python 3.6; probably it'll work
also with previous versions, but sooner or later I'll throw in
asyncio, so 3.4+ will be required.

As non-standard dependencies, I use tensorflow (I used the dumbest
installation for macos without gpu), numpy (which is actually
required for tensorflow, so I'm not sure I should write it here),
colorama (right now just for Connect4), and python fire for
firing the neural network trainers.

Many thanks to <NAME> from whom
I copypasted some [slices of code](https://github.com/DanielSlater/AlphaToe), and learned some techniques
(here's an excellent [youtube video](https://www.youtube.com/watch?v=Meb5hApAnj4)).

## Usage

For starters, you could run
```
python3 play.py {gamename}
```
from main directory.
Right now, the only implemented games are `ttt` for tic tac toe
 and `c4` for connect four.
It would ask some interactive input for the game configuration.
Neural networks won't work until trained, so you will be getting an
exception if you select them as an opponent.

### Network Training

To train for instance your tictactoe network, you could run:
```
python3 tictactoe/nn.py --train-with-minimax
```
It will take a lot of hours, so maybe do it overnight (*and* the day after, probably).
If you're just interested in making it work quickly you could use:
```
python3 tictactoe/nn.py --train-with-random
```
but AI will suck.
<commit_msg>minor fix to readme file<commit_after># Gamer (a better name still to be found)

Little proof of concept framework to playtest AIs at various games.<br>
Still very WIP.

There is a Match class, where the game and the players are plugged in.
So you can basically devise your own AI, and make it play against
another AI, or even yourself.

In full [codingame](https://www.codingame.com) fashion, I wanted
players and the "referee" of the game to communicate with sequences of
strings, so that easily players could be external programs.

I tried to write most of docstring and comments in english, but
probably something in italian survived so, if ever some english
speaking fellow reads this code: sorry pal.

## Requirements

This software has been developed with python 3.6; probably it'll work
also with previous versions, but sooner or later I'll throw in
asyncio, so 3.4+ will be required.

As non-standard dependencies, I use tensorflow (I used the dumbest
installation for macos without gpu), numpy (which is actually
required for tensorflow, so I'm not sure I should write it here),
colorama (right now just for Connect Four), and Python Fire for
CLI.

Many thanks to <NAME> from whom
I copypasted some [pieces of code](https://github.com/DanielSlater/AlphaToe), and learned some techniques
(here's an excellent [youtube video](https://www.youtube.com/watch?v=Meb5hApAnj4)).

## Usage

For starters, you could run
```
python3 play.py {gamename}
```
from main directory.
Right now, the only implemented games are `ttt` for tic tac toe
 and `c4` for connect four.
It would ask some interactive input for the game configuration.
Neural networks won't work until trained, so you will be getting an
exception if you select them as an opponent.

### Network Training

To train for instance your tictactoe network, you could run:
```
python3 tictactoe/nn.py --train-with-minimax
```
It will take a lot of hours, so maybe do it overnight (*and* the day after, probably).
If you're just interested in making it work quickly you could use:
```
python3 tictactoe/nn.py --train-with-random
```
but AI will suck.

{'fraction_non_alphanumeric': 0.07053254437869823, 'fraction_numerical': 0.004970414201183432, 'mean_word_length': 4.495448634590377, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2291824', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1154, 'n_words': 634}