An AI bot for the game 2048.
Made for the competition of NTU Taiwan 2048 BOT Competition in my second half semester of first grade.
(current support windows and linux)
$ make
$ ./bot2048
$ make manual
$ ./manual2048
-
Compile in Ubuntu docker manually
-
$ docker run -it --name test2048 -v "$(pwd)":/app ubuntu:latest
-
Install compilation tool
$ apt-get update
$ apt-get install -y g++ build-essential
-
Compile (using instructions above)
$ cd /app
$ make
-
Rerun the container (after you stop the container)
$ docker start -i test2048
-
(Optional) Save the container using export
$ docker export test2048 > test2048.tar
Pros: The package is small and clean (only about 158 MB for g++ compiler and 62.7MB for build-essential)
Cons: Too many manual steps (we need to install everything and run the container and then run the program by ourself)
To Test:
- Commit the changes of container to build an new image
- Make a Dockerfile (i.e. Build an image only include our essential c compile tools) based on our manual installation (Act like my second method but take less space)
-
-
Build a image based on gcc and compile it automatically in it and save the image
-
Dockerfile:
-
AI version
FROM gcc:4.9 COPY . /2048-AI WORKDIR /2048-AI RUN make CMD ["./bot2048"]
-
Manual play version
FROM gcc:4.9 COPY . /2048-AI WORKDIR /2048-AI RUN make manual CMD ["./manual2048"]
-
-
Build image
$ docker build -t ai2048:v1 .
-
Run image
$ docker run -it --rm --name test ai2048:v1
Pros: Very quick (after build an image, each time we want to execute program just need to run the container)
Cons: The new image we built is as big as gcc image (1.37GB) (so it take double space in computer because of two images exist)
-
-
Cross compile using gcc image and run it in a clean ubuntu image
-
Compile using gcc image (it will save in the current directory)
$ docker run --rm -v "$PWD":/usr/src/ai2048 -w /usr/src/ai2048 gcc:4.9 make
-
Run in ubuntu container
$ docker run -it --rm --name 2048AI -v "$PWD:/app" -w /app ubuntu:latest ./bot2048
Pros: Very small and easy to maintain
Cons: Haven't thought one
-
- David Lee
- Tom Chang