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
Owner
Chad Palmer
Yale 2022, majoring in computer science and mathematics. Incoming SWE at Optiver.
Chad Palmer
A simple script which allows you to see how much GEXP you earned for playing in the last Minecraft Hypixel server session

Project Landscape A simple script which allows you to see how much GEXP you earned for playing in the Minecraft Server Hypixel Usage Install python 3.

Vincenzo Deluca 4 Dec 18, 2021
A Pygame Hangman Game coded in Python 3. Run Hangman.py in a terminal if you have Python 3

Hangman A Pygame Hangman Game coded in Python 3. Run python3 Hangman.py in a terminal if you have Python 3.

1 Dec 24, 2022
The Turtle Race Game built in Python with Turtle module.

Turtle Race Game The Turtle Race Game built in Python with Turtle module. Installation If you don't have Turtle module on your computer. You can downl

Aytaç Kaşoğlu 1 Nov 09, 2021
Python module providing simple game networking

nethelper Python module providing simple game networking This module was originally created to facilitate a class on creating multiplayer games in Pyg

Cort 3 Jan 11, 2022
A module for use with Pygame. Includes fully customisable buttons, textboxes, sliders and many more, as well as the ability to create and run animations on these widgets.

Pygame Widgets A helper module for common widgets that may be required in developing applications with Pygame. It supports fully customisable buttons,

37 Jan 02, 2023
Brawl Stars v31.96 server emulator written in Python.

Brawl Stars v31 Brawl Stars v31.96 server emulator written in Python. Requirements: Python 3.7 or higher pymongo dnspython colorama MongoDB configurat

9 Nov 26, 2021
Tic Tac Toe Game build with Python

Tic Tac Toe Game Description two players who take turns marking the spaces in a three-by-three grid with X or O. The player who succeeds in placing th

Kemal Kochekov 2 Jan 21, 2022
Allows you to email people wordle spoilers. Very beta, not as many features

wordlespoiler Allows you to email people wordle spoilers. Very beta, not as many features How to Use 1.) Make a new gmail account. Go to settings (Man

0 Jan 04, 2023
QuizGame is a quiz with different topics. You can choose a topic and take the quiz

QuizGame is a quiz with different topics. You can choose a topic and take the quiz. In the end you will get your result. The program is under active development, so there may be errors or flaws in it

Lev Likhachev 2 Nov 12, 2021
This repository has the lessons of the gamming programming course

learning-python-game-programming This repository has the lessons of the gamming programming course Na faculdade, estou fazendo a disciplina de program

Mateus Faustino 1 Nov 16, 2021
Simple Covid-19 shooter game in python.

Covid_game 🍹 Simple Single Player Covid Game Using Python. 🍹 Has amazing background music theme. 😄 Game Instructions: Initial Health is 5, try to s

Tanya Yadav 2 Aug 05, 2022
A minecraft bedrock server software written in python (3.X)

Podrum README also available in: English 🇺🇸 Français 🇫🇷 Deutsch 🇩🇪 Español 🇪🇸 Tiếng Việt 🇻🇳 Italiana 🇮🇹 Русский 🇷🇺 中文 🇨🇳 Is a Minecraf

Podrum 53 Nov 11, 2022
Python game engine for 2D multiplayer online games.

LAN-Caster The goal of LAN-Caster is to provide an easy-to-use code base (game engine) for developing 2D multiplayer online games. LAN-Caster original

Douglas Bakewell 1 Feb 11, 2022
A hangman game that I created. Thanks to Data Flair for giving me the code!

Hangman A hangman game that I created. Thanks to Data Flair for giving me the code! Run python3 hangman.py in a terminal if you have Python 3. Please

SmashedFrenzy16 0 Dec 24, 2022
Repository containing documentation about the Minecraft Legacy FUI file structure

Repository containing documentation about the Minecraft Legacy FUI file structure

Miku-666 6 Dec 29, 2022
Game of life, with python code.

Game of Life The Game of Life, also known simply as Life, is a cellular automaton. It is a zero-player game, meaning that its evolution is determined

Mohammad Dori 3 Jul 15, 2022
A fun, casual and strategic game made using Python!

Steve's Pixels A fun, casual and strategic game made using Python! Prerequisites See requirements.txt Demo video demo.mp4 Usage python -m steves_pixel

Jaivardhan Bhola 9 Sep 17, 2022
Ice-Walker-Game - This repository is about the Ice Walker game made in Python.

Ice-Walker-Game Ce dépot contient le jeu Ice Walker programmé en Python. Les différentes grilles du jeu sont contenues dans le sous-dossier datas. Vou

Mohamed Amine SABIL 1 Jan 02, 2022
Historical battle simulation package for Python

Jomini v0.1.4 Jomini creates military simulations by using mathematical combat models. Designed to be helpful for game developers, students, history e

Ümit Kaan Usta 36 Dec 08, 2022
Graphical impimetaion of Conway's Game of Life in Python using pyglet

Conway's Game of Life in Python Konstantin Opora Conway's Game of Life: graphical implementation in python using pyglet. developed in Python 3.10.0 Re

Konstantin Opora 1 Nov 30, 2021