News for hackers. Stuff that matters.
Re:1D Pac-Man by irjustin on Tuesday January 02, 2024 @08:04PM (#38849406)
This is super awesome!

The trouble I ran into was after eating the ghost, the spawn point of the new ghost was too close to my current position and simply sped over me.

With this and all the considerations you've noted above, I'd probably throw an ML solution at it - imagine it takes less coding time.

Re:1D Pac-Man by pushedx on Tuesday January 02, 2024 @10:03PM (#38850177)
The script took, at most, 5 hours to write (inclduing the time for this poster to play the game, understand the game, reverse engineer the game, and implement a bot). What type of "ML solution" to the same problem would take less than 5 hours?
Re:1D Pac-Man by eru on Tuesday January 02, 2024 @11:29PM (#38850759)
You are right about the time, but 1D Pac-Man might still be a good fun toy problem to hone your ML skills on.
Re:1D Pac-Man by mrb on Wednesday January 03, 2024 @04:38AM (#38852249)
For the record, it took me about 30 minutes of playing, reverse-engineering, and writing the bot. So, indeed, no need for an ML solution :)
Re:1D Pac-Man by wegfawefgawefg on Tuesday January 02, 2024 @11:19PM (#38850687)
deep reinforcement learning guy here. Youre looking at coding up double dqn, and probably training it for about 5 to 30 minutes. Very likely it would not outperform a simple near perfect algorithm, and would fail in some weird ways that would annoy you a few tens of thousands of times. Youd have issues like it refusing to go left, ever, after dying. So youd need to know about epsilon then epsilon decay etc.

Coding that from nothing (and understanding it) could take days. Weeks to months if you dont know ml stuff.

In this particular case I think basic Q Tabular Learning could play optimally, no neural net required.

I could be wrong though, throw a full conv at it without temporal difference and see what happens! (probably a kinda okayish score)

Re:1D Pac-Man by eru on Tuesday January 02, 2024 @11:29PM (#38850754)
You could probably throw a small fully connected net at it, and 'train' it via genetic algorithms: ie have a population of nets, let them each run a few games, and pick a few top scorers to seed the next generation with some mutation and cross-over.

This random exploration is less efficient than back propagation, but at least you don't have to muck around with temporal differences. (And it would be hard to figure out how to tweak the weights for backpropagation in this multi-step game; without falling back to reinforcement learning.)

The problem seems simple enough that evolution via mutation and artificial selection has a decent chance to get good in a reasonable amount of computing time.

Re:1D Pac-Man by wegfawefgawefg on Wednesday January 03, 2024 @12:03AM (#38850942)
NEAT? An added bonus of the evolutionary neural search is that you can still explore the solution space with small networks, which isnt really true of backpropogation without evolution. You run out of states.
Re:1D Pac-Man by Matumio on Wednesday January 03, 2024 @11:44AM (#38856192)
With the right small neural network architecture you could probably just repeat random weight initialization until you find one that works. This is known to work for some of the Atari games. The trick is, of course, to engineer a good input encoding and to find the right model complexity and architecture in the first place.
Re:1D Pac-Man by kqr on Wednesday January 03, 2024 @05:31AM (#38852526)
This sounds like a simple enough problem that one could work out a provably optimal algorithm in less time than it takes to get even a non-optimal ML solution working.

But both approaches would be an interesting exercise in their respective domain!

Come to think of it, it might even be an interesting toy problem for a SAT solver! Overkill in the same way as an ML approach, of course.