Skip to content

evolvingstuff/RobotShamBo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RobotShamBo

Introduction

RobotShamBo aims to explore the capabilities of neuro-evolution applied to the classic game of Rock-Paper-Scissors. This project employs various forms of neural networks to model intelligent agents and observes how they evolve to play the game more optimally.

This project uses an implementation of Iocaine Powder, the winning solution of the first edition of the international RoShamBo competition. The neural networks are evaluated using their performance against Iocaine Powder, and steadily learn to outperform it.

One idea I am experimenting with is that the rewards for winning with Rock, Paper, or Scissors are configurable, and do not have to be equal. So far, it appears that injecting some form of asymmetry in the rewards might help the population escape from the Nash equilibrium strategy of always choosing randomly. This is because if one player chooses the pure random strategy, the other player can beat it by always playing the choice with the highest reward. And that in turn can be countered by whatever beats that choice, etc.. etc.. by removing a simple and stable behavior that (originally) could not be exploited, that dead end attractor is removed from the fitness landscape.

Installation

Clone the repository:

git clone https://github.com/evolvingstuff/RobotShamBo.git

Navigate to the project directory and install the required packages:

cd RobotShamBo
pip install -r requirements.txt

Usage

To run the main program (the evolutionary loop):

python main.py

To play against the evolved champion in a web app:

python simulate_web_app.py

and navigate to http://localhost:8080/.

Features

  • Evolutionary Algorithms: Use evolutionary algorithms (currently configured with SNES) to evolve optimal decision-making strategies.
  • Neural Networks: Utilize various architectures (currently LSTM, but plan to add Transformers, CNNs, etc..)
  • Simulation web app: Interactive mode to play against the evolved champion in the browser.
  • Visualizion tools: Chart fitness over time and parameter distributions.

Future Directions

I have a number of ideas for future features and experiments, described in project ideas.

Libraries Used

  • EvoTorch: This project relies on the EvoTorch library for various evolutionary algorithms in Torch.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • Iocaine Powder Algorithm Implementation: This project makes use of the Iocaine Powder algorithm as found here, by David Bau. This is, in turn, an adaptation of the original code/algorithm, written by Dan Egnor. I have made modifications to fit the requirements of the RobotShamBo project.
  • Images generated by DALL-E 3