MCTS (among other things) for 2048

Overview

2048

Created by Chad Palmer for CPSC 474, Fall 2021

Overview:

This is an application which can play 2048 and simulate games of 2048 with a variety of different computational intelligences, the highest performing of which is MCTS. With MCTS with 1000 iterations (./Driver -simulate m 1000 -display), the agent achieves scores comparable to a skilled human player (usually wins, occasionally achieves the 4096 tile). Flat Monte Carlo also works very well. The entire program runs a bit slower than I would like; that the 2048 game tree is very deep and moves require matrix operations slowed down execution time such that running the same number of games as MCTS for Kalah was infeasible. (A potential speedup could be implementing the game as bitboards and introducing a move lookup table to prevent unnecessary overcalculation, but that is a project for another day.) All code is my own; mcts.py is adapted to single-player, stochastic play from my work on the Kalah project.

Usage:

./Driver -readme View this page ./Driver -play Play the game yourself ./Driver -simulate [agent] [agent args] Simulate games with a given computational intelligence Available agents: r - random g - greedy (highest score after next turn) b - bottom left (choose first legal move in following order: left, down, right, up) f [number of games] - flat monte carlo (arg indicates how many random rollouts performed, evenly split between legal moves) m [number of iterations] - MCTS (arg indicates how many tree iterations performed) Optional additional args: -size [size] - Change size of game board (available to -play as well) -games [number of games] - Change number of games simulated (defaults to 1) -display - View games as they are played (can slow down execution) ./Driver -compete [agent1] [agent1 args] [agent2] [agent2 args] Compete two computational intelligences against each other (win condition is a higher score) Optional additional args from -simulate also available (except display)

Sample commands:

./Driver -readme ./Driver -play ./Driver -play -size 3 ./Driver -simulate r -display ./Driver -simulate r -games 1000 ./Driver -simulate f 100 -display ./Driver -simulate m 1000 -display ./Driver -compete r r -games 1000 ./Driver -compete b g -games 1000 ./Driver -compete g m 100

...

Thank you for a great semester!

  • Chad
You might also like...
This is game 2048 created with moudle of python tkinter and OOP.

Game 2048 This is game 2048 created with moudle of python tkinter and OOP. This game build on classes. For start this game run: If you have python ver

A Simple 2048 Game Built Using Python
A Simple 2048 Game Built Using Python

Game 2048_Python Dựa trên trò chơi nổi tiếng 2048 của Gabriele Cirulli. Mục tiêu của trò chơi là trượt các khối được đánh số trên một lưới để kết hợp

Simulating an AI playing 2048 using the Expectimax algorithm

2048-expectimax Simulating an AI playing 2048 using the Expectimax algorithm The base game engine uses code from here. The AI player is modeled as a m

The repository that hosts the code that teaches a reinforcement learning - based bot to play 2048

The repository that hosts the code that teaches a reinforcement learning - based bot (based on policy gradients method) to play 2048

Proxy server that records responses for UI testing (and other things)

Welcome to playback-proxy 👋 A proxy tool that records communication (requests, websockets) between client and server. This recording can later be use

Beautiful visualizations of how language differs among document types.
Beautiful visualizations of how language differs among document types.

Scattertext 0.1.0.0 A tool for finding distinguishing terms in corpora and displaying them in an interactive HTML scatter plot. Points corresponding t

Beautiful visualizations of how language differs among document types.
Beautiful visualizations of how language differs among document types.

Scattertext 0.1.0.0 A tool for finding distinguishing terms in corpora and displaying them in an interactive HTML scatter plot. Points corresponding t

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.

MMdnn MMdnn is a comprehensive and cross-framework tool to convert, visualize and diagnose deep learning (DL) models. The "MM" stands for model manage

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)

English | 简体中文 Introduction PaddleOCR aims to create multilingual, awesome, leading, and practical OCR tools that help users train better models and a

Switch among Guest VMs organized by Resource Pool
Switch among Guest VMs organized by Resource Pool

Proxmox PCI Switcher Switch among Guest VMs organized by Resource Pool. main features: ONE GPU card, N OS (at once) Guest VM command client Handler po

A python script to convert images to animated sus among us crewmate twerk jifs as seen on r/196
A python script to convert images to animated sus among us crewmate twerk jifs as seen on r/196

img_sussifier A python script to convert images to animated sus among us crewmate twerk jifs as seen on r/196 Examples How to use install python pip i

Among AIs is a (prototype of) PC Game we developed as part of the Smart Applications course @ University of Pisa.
Among AIs is a (prototype of) PC Game we developed as part of the Smart Applications course @ University of Pisa.

Among AIs is a PC Game we developed as part of the Smart Applications course @ Department of Computer Science of University of Pisa, under t

Recommendation systems are among most widely preffered marketing strategies.
Recommendation systems are among most widely preffered marketing strategies.

Recommendation systems are among most widely preffered marketing strategies. Their popularity comes from close prediction scores obtained from relationships of users and items. In this project, two recommendation systems are used for two different datasets: Association Recommendation Learning and Collaborative Filtering. Please read the description for more info.

A tool to make dumpy among us GIFS
A tool to make dumpy among us GIFS

Among Us Dumpy Gif Maker Made by ThatOneCalculator & Pixer415 With help from Telk, karl-police, and auguwu! Please credit this repository when you use

A SageMaker Projects template to deploy a model from Model Registry, choosing your preferred method of deployment among async (Asynchronous Inference), batch (Batch Transform), realtime (Real-time Inference Endpoint). More to be added soon!
Among Us Editor written in Python, for newer versions of the game

Among Us Editor Remake Among Us Editor written in Python, for newer versions of the game. Credits GUI Code by Vresod Data dumping and some GUI code by

We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them.
We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them.

We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them. This module is designed to do the URL/web attestation by using the API from NUS-Phishperida-Project.

THERE IS AN IMPOSTER AMONG US. VOTE HIM OUT BEFORE HE [ R E D A C T E D ].

🛡️ Guardian There is an impostor among us. Can you help us find out who it is? ⚙️ Installation and Usage Make sure to install Tesseract-OCR before ru

Play a game of Phazed with a bot or with other players or watch bots play with each other
Play a game of Phazed with a bot or with other players or watch bots play with each other

Phazed Game and Player play a game of Phazed with a bot or with other players or watch bots play with each other Live Demo hosted on repl.it (makes su

Owner
Chad Palmer
Yale 2022, majoring in computer science and mathematics. Incoming SWE at Optiver.
Chad Palmer
This is game 2048 created with moudle of python tkinter and OOP.

Game 2048 This is game 2048 created with moudle of python tkinter and OOP. This game build on classes. For start this game run: If you have python ver

null 0 Nov 2, 2021
A Simple 2048 Game Built Using Python

Game 2048_Python Dựa trên trò chơi nổi tiếng 2048 của Gabriele Cirulli. Mục tiêu của trò chơi là trượt các khối được đánh số trên một lưới để kết hợp

Le Phuong Anh 3 Dec 13, 2021
The repository that hosts the code that teaches a reinforcement learning - based bot to play 2048

The repository that hosts the code that teaches a reinforcement learning - based bot (based on policy gradients method) to play 2048

Maxim Rud 1 Dec 16, 2021
Among AIs is a (prototype of) PC Game we developed as part of the Smart Applications course @ University of Pisa.

Among AIs is a PC Game we developed as part of the Smart Applications course @ Department of Computer Science of University of Pisa, under t

Gabriele Pisciotta 5 Dec 5, 2021
Among Us Editor written in Python, for newer versions of the game

Among Us Editor Remake Among Us Editor written in Python, for newer versions of the game. Credits GUI Code by Vresod Data dumping and some GUI code by

Vresod 7 Nov 18, 2022
Play a game of Phazed with a bot or with other players or watch bots play with each other

Phazed Game and Player play a game of Phazed with a bot or with other players or watch bots play with each other Live Demo hosted on repl.it (makes su

Xin Yu 0 Aug 28, 2021
SpiderArcadeGame - A game where the player controls a little spider who is trying to protect herself from other invasive bugs

SpiderArcadeGame - A game where the player controls a little spider who is trying to protect herself from other invasive bugs

Matheus Farias de Oliveira Matsumoto 1 Mar 17, 2022
ckan 3.6k Dec 27, 2022
:tada: 2048 in your terminal

term2048 term2048 is a terminal-based version of 2048. Install pip install term2048 To upgrade a previous installation, use: pip install -U term2048

Baptiste Fontaine 798 Nov 21, 2022
term2048 is a terminal-based version of 2048.

term2048 is a terminal-based version of 2048.

Baptiste Fontaine 798 Nov 21, 2022