Log In  

Cart #nisiwojeho-2 | 2022-06-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Been working on a generic monte-carlo tree search algorithm, which can be supplied w the rules for any turn-based game (even games w/ randomness!) and, after as much time as you like (given pico8's memory), turn out the best move it can think of.

Adjustable parameters include:

  • How intelligent the ai is (how many times it's allowed to explore the state tree)
  • How much time the ai has to explore the state tree
  • How adventurous the ai is (how likely it is to explore paths that might not immediately show promise)

The ai assumes that your game is structured as such
a gamestate (or "board") is a single table representing a possible state of the game
a board also has a "turn id", representing whose turn it is at that state

The ai just needs for the game to have the following functions:

advancedturn(currentturn) => next turn's id
copyboard(board) => copy of the board
allpossiblemoves(board) => table w all possible moves in a given state
result(board,move) => a board w the move done on it
rate(board,player) => a rating of how good the board is for that player (turn id)
winner(board) => returns the turn id of the winner, or nil if there are no winners
isterminal(board) => bool - is the game over?

Once you have those written for your game, you can just call bestmove(board). It will search 324 times through the state space using a Monte Carlo Tree Search technique in order to find the best move it can. 324 is about as many times as I could get before pico8 ran out of memory. It's not really enough for a greeaat Monte Carlo exploration, but it's enough for a moderately competent ai :) In the future, I might look for ways to store the board state in a smaller package. (right now it's 64 strings lol)

Plugged it into a game of connect 4 to see how it works :)

Right now it's a little bit messy, but will be polishing the algorithm soon and sharing it on the forums.

P#113193 2022-06-15 17:21 ( Edited 2022-06-15 17:51)

Cart #disinihoba-2 | 2022-05-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

A fugue approaches


A fun little platformer based on Bach's Fugue in F-Minor.

Land on the notes to blast them.

Blasting notes gives you points.

You can use points to hover with antigravity

Don't fall, or you lose points.


Arrow keys - Move

X - Jump

Z - Antigravity


Art/Design/Programming - Tyler Miles (ohcurtains)

Music - JS Bach, but you knew that

P#112481 2022-05-30 16:47 ( Edited 2022-05-30 16:54)

Cart #fayewewume-0 | 2022-04-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Ascend the infinite tower. Steal as many coins as you can. Avoid their eyeballs. Don't get caught.

A tiny stealth-action game made for the Black and White Jam 2022.


  • Dynamic lighting!
  • Intelligent enemy guard ai!
  • Procedurally generated levels!
  • Play with Keyboard or with Gamepad!
  • Eyeballs!
  • Lasers!


Move - Arrow Keys
Run - Z
Throw - X


Design/Coding - TM (ohcurtains)

Sound/Music - Michael Bibby (SadMonsterParty)

P#110085 2022-04-12 00:24 ( Edited 2022-04-12 00:25)

Follow Lexaloffle:        
Generated 2022-07-02 15:22:05 | 0.064s | Q:17