3 ms·
Looking at the bottom of the JS file [1], it looks like OP already started working on a genetic algorithm for this. I don't have time right now, but for anyone
by bschne 7y ago
Looking at the bottom of the JS file [1], it looks like OP already started working on a genetic algorithm for this. I don't have time right now, but for anyone who's curious to try, you can just call
myRPG.parseKeyPress({keyCode: 40})
replacing keyCode with the respective key's code, to automate moves. The global variable "dead" should tell you if you've failed, and "score.innerText" should tell you how well you've done :-)
1. https://smitop.com/square-game/rpg.js https://smitop.com/square-game/rpg.js
- numakerg 7y agoI think living state, score and x,y position is all you would need to train a player. Is there any advantage to consuming the state of nearby cells if the game is entirely deterministic?
- personjerry 7y ago`mutate` in this code means "altering state". It does NOT hint at a "genetic algorithm". This game is solvable using floodfill where each floodfill state is a series of moves and the boundary condition is whether you've ended up alive or dead.