Skip to content

Commit

Permalink
wrote a better README.md and added PRINCIPLE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengKeli committed Dec 2, 2017
1 parent 1ef41c6 commit 5a0f4e3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions PRINCIPLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#Working principle
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,47 @@

[2048](https://gabrielecirulli.github.io/2048/) should be a well-known game. If you've never played it, I suggest you to play several times and learn about its game rules.

This is a project making an AI to play the game 2048. To be honest, this is my first try in making AI for a game. (And it is the first practical project about deep learning that succeeds)
This is a project making an AI to play the 2048 game. To be honest, this is my first try in making AI for a game. (And it is the first practical project about deep learning that succeeds)

In fact, it is not hard at all to make the AI for this game. (Maybe that's why I can succeed 🙂 ) So I think this project may be suitable for beginners and that's why I share this project here.


# Project structure
The main enters of this project is the runnable python scripts in directory `./py`. And the other codes are place in the subdirectory of `./py`. Such as:
- `./py/game` the game logic and game process
- `./py/nerve` the tools for nerve network
- `./py/ai` the tools for game AI

The main enters of this project is the python scripts in directory `./py`. All these scripts are suggested to run under its directory (i.e. working directory is `./py`).
- `./py/game_console.py` - a console-based game 2048
- `./py/game_random.py` - the game played by a AI that actions randomly (well, maybe is not really "intelligence")
- `./py/game_aix-corex.py` - a set of AIs, they are built step by step. And they are stronger and stronger.
- `./py/game_ai2-core3_extreme.py` - this is almost the best AI in this project. It can play until "2048" turns out almost every time, but it takes a lot of time to computes.
- `./py/game_assist2_core3_extreme.py` - scripts that can let the best AI assist you when playing 2048.
- `./py/train_corex.py` - a set of scripts, which can train the nerve network "core" using in AIs.
- `./py/match.py` - a script that test all the AIs and compare how strong they are.

The directory `./graph` is storing the well-trained nerve network graph of the cores. And of course you can move it to some other place and train you own core.
The directory `./graph` stores the well-trained nerve network graph of the cores. And you can also move it to some other place and train you own core.

The directory `./.idea` and file `./AI2048.iml` are project files of **Intellij IDEA**. If you are using it, you can import this project.


# Expected result of the AIs
Here I place the expected average max rounds of the AIs in tests. This may help you to judge if your own AI works normally.
# Running the project
## Environment
To run this project you need to build the environment first. This project mainly needs **Python3** with **TensorFlow** (including **Numpy**). The exact versions I used in project are placed here for reference:
- Python 3.5.2
- TensorFlow 1.4.0
- Numpy 1.13.3

## Runnable scripts
All the runnable scripts are placed in directory `./py`. All these scripts are supposed to run under its directory (i.e. working directory is `./py`). Here are the introduction of these runnable scripts.
- `./py/game_console.py` - launch a console-based 2048 game
- `./py/game_random.py` - the game played by a AI that actions randomly (well, maybe is not really "intelligence")
- `./py/game_aix-corex.py` - a set of AIs, they are built step by step. And they are more and more powerful.
- `./py/game_ai2-core3_extreme.py` - this is the best AI in this project. It can play until it turns out "2048" almost every time, but it also takes a lot of time to compute.
- `./py/game_assist2_core3_extreme.py` - scripts that can let the best AI assist you when playing 2048.
- `./py/train_corex.py` - a set of scripts, which can train the nerve network "core" using in AIs.
- `./py/match.py` - a script that test all the AIs and compare how powerful they are.

## Expected result of `match.py`
Here I place the expected average max rounds of the AIs in tests. This may help you to judge if your the AIs work normally.
- `random` - about 100 rounds
- `ai1_core1` - about 170 rounds
- `ai1_core2` - about 300 rounds
- `ai2_core2` - about 700 rounds
- `ai2_core3` - about 1000 rounds


#Working principle
The working principle has been placed in an other .md file: [`PRINCIPLE.md`](https://github.com/ZhengKeli/AI2048/blob/master/PRINCIPLE.md). If you want to learn about the working principle of the AIs, you can refer to it.

0 comments on commit 5a0f4e3

Please sign in to comment.