josafath.dev
← All projects

~/Rock-Paper-Scissors · Since 2020

Rock-Paper-Scissors

Rock-Paper-Scissors against a CPU that learns how you play.

The same game written twice, years apart. On the hardest level the CPU uses Markov chains to learn your patterns, and it also plays Rock-Paper-Scissors-Lizard-Spock.

GitHub ActionsPythonTkinter

Versions

  1. v12020

    One 118-line script with random.choice.

  2. v22026

    Three levels; the hardest learns your patterns with Markov chains.

What changed

AspectBeforeAfter
CPUrandom.choice→ Learns your patterns with Markov chains
RulesHand-written if/else for every move→ Rules are data: Lizard-Spock took a table, not code
StructureOne 118-line script→ Package split into rules, AI, match, stats and GUI
TestsNone→ 30+ pytest tests on GitHub Actions