datagod's Feed

datagod
09-23-2019 at 10:44 PM
0 Comment
Rate this Entry

PacDot: high score save kit

This might seem a little silly, but I wrote some code to save the PacDot high score to a file. That way the game can play all day long, and at the end of the day I get to see what the best run was. High Score is displayed after every game. 1162 is only after 2 games. The highest I have seen before was around 20,000. That is pretty good considering dots are worth 1 points and ghosts are worth 5. If pacman gets stuck, it is game over.


I also save the time as 5 minutes in the future. Why would I do that you ask? Raspberry Pi's don't actually have clocks. They rely on a network connection and a time service. If the clock has no network connection (e.g. wifi) then you have to set the time manually. If you power off, the time will be 00:00:00 when it is turned back on. To give the poor human a chance to unplug the clock and move it, I create a 5 minute future window. Yeah, I know. Weird. But I like weird. That is why you and me are pals.



Comments
Join us