This is my attempt at using a probability model to mind optimal moves in 2048. Check out my chicken scratch notes for more details.
All code in the src/external directory is, as the name suggests, external and as such is governed by its own license. Because these are submodules, clone with git clone [email protected]:orsonbraines/2048-probability-model.git --recursive. If you have already cloned, you can load the submodules with git submodule update --init --recursive.
I have tested builds using GCC on Ubuntu Linux and using MSVC on Windows, both with an x64 processor. If you would like to have support for other platforms, let me know.
Used to auto-generated code.
Used for the Text User Interface (TUI).
Used for generating and storing tablebases.
- Python3, ncurses, and sqlite3 are probably installed already, but you can double check with
sudo apt install python3 libncurses-dev libsqlite3-dev - Install g++, make, and cmake:
sudo apt install g++ make cmake - Make a build directory:
mkdir build - Configure CMake:
cd build && cmake ../src - Run make:
make
- Install the latest version of Visual Studio (Community Edition is fine) from https://visualstudio.microsoft.com/downloads/
- Install the source code for PDCurses from https://github.com/wmcbrine/PDCurses/releases
- Follow the instructions in PDCurses-3.9/wincon/README.md to build pdcurses.lib. To build a 64-bit library, make sure to run in the 64-bit developer command prompt.
- Download the latest sqlite3 amalgamation from https://www.sqlite.org/2024/sqlite-amalgamation-3450200.zip and copy sqlite3.c and sqlite3.h to this repo's src/external directory
- Open the 2048-probability-model/src directory in Visual Studio as a CMake project
- Make sure to match the configuration to the environment that you build PDCurses for (x64 vs x86). In the CMake configuration, define
CURSES_INCLUDE_PATHandCURSES_LIBRARYso that CMake knows where to find PDCurses.
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "CURSES_INCLUDE_PATH",
"value": "C:/path/to/PDCurses-3.9",
"type": "PATH"
},
{
"name": "CURSES_LIBRARY",
"value": "C:/path/to/PDCurses-3.9/wincon/pdcurses.lib",
"type": "PATH"
}
]
}
- Build All