Skip to content

Version 1

Latest
Compare
Choose a tag to compare
@ArnoUUU ArnoUUU released this 11 Apr 23:48
789f704

2048-bot 😎

A bot that can bash out possible games with a very simple calculation module, which recursively determines which move would result in the most null strings. While bashing out each possible game, it keeps a log of all the moves it has done. The user can decide if they want to keep logs for lost games. If it fails, it outputs the last 2048 field it got to, resets the field, and effectively starts over. Once it succeeds it outputs "THE END" in the console.

The Code:

Automatized User Commands (options.py): 💬

Essentially has 4 possible commands.

  • moveleft: shifts all of the tiles left
  • moveright: shifts all of the tiles right
  • moveup: shifts all of the tiles up
  • movedown: shifts all of the tiles down

Autonomous Commands(addint.py): 🤖

Adds a 2 or 4 (50% chance of each) to a random empty spot in the 2048 field

Calculation (calculate.py): 🧮

Uses a function called compareoptions This recursively checks which

logs (logs.txt): 📜

Where the logs are stored

Main (main.py): 👾

The code which is executed when you run the code. This is where the looping happens and logs are written. This also allows the user to decide what level of depth they would like the bot to calculate, and if they want logs for failed games

Beating the game 🥇:

Making a 2048 "tile" or element in the field

What's Changed

New Contributors

Full Changelog: v0.0.1-alpha...v1.0.0

Future Changelog:

  • In the future, the calculation module will be improved, the depth will be either removed (based on new calculation module), or tuned for high win-rates (at least 95%). The user will no longer be able to control this value.
  • Logs will become easier to read and interact with.
  • A GUI may be added