项目作者: NathanWine

项目描述 :
Collection of AI algorithms to solve/optimize 2048 games.
高级语言: C++
项目地址: git://github.com/NathanWine/2048-AI-Solvers.git
创建时间: 2021-05-22T19:54:03Z
项目社区:https://github.com/NathanWine/2048-AI-Solvers

开源协议:

下载


2048 AI Solvers

AI solvers for the puzzle game 2048.

Python to C++ ported code from codebase made by
Daniel Wu,
Nathaniel Wine, and
Yang Yang.

Port done by
Nathaniel Wine.

Some modifications/improvements are present with the goal of further improved performance/quality.

About

The original project (as well as this one) was created with the goal of implementing
algorithms to achieve as high of a score as possible in the game 2048. Game.cpp
contains the code for the game logic, Heuristics.cpp contains several heuristic
metrics/functions to evaluate game state quality, and algorithm implementations are
split between MonteCarlo.cpp, Minimax.cpp, and Expectimax.cpp.

If unfamiliar with the game rules, check out 2048.

Setup

First, navigate to the proper directory and run

  1. make all

…and then follow usage. Note that this codebase was written and tested in a Linux environment.
Other operating systems may need to follow additional steps / procedures in order to run the program.

Usage

  1. AISolver < flag_1 > < flag_1_val > < flag_2 > < flag_2_val > ...

Flag list:

  • -a: Integer/String value; Algorithm to run. 0 = MonteCarlo, 1 = Minimax, 2 = Expectimax
  • -n: Integer value; # times to run the algorithm. Stats displayed at program completion
  • -r: Integer value; # runs MonteCarlo completes for each move. Higher=better but slower. Recommend 10-100
  • -d: Integer value; # depth level for Minimax / Expectimax
  • -p: Integer value; Print level. Higher=more display. 0 = minimal, 1 = medium, 2 = high, 3 = full

Ex:

  1. AISolver -a minimax -n 1 -d 1 -p 3