A one-dimensional Pac-Man 'PAKU PAKU' that can only move left and right has appeared, and engineers are also appearing one after another to take on the challenge of developing algorithms that can earn high scores.

Pac-Man is a game where you earn scores by eating food while running away from enemies on a two-dimensional board (up, down, left, and right), but a game called 'PAKU PAKU' has appeared that reduces this board to a one-dimensional board with only left and right sides. Since it is a simple game, the news site Hacker News has posted the topic ``What is the algorithm that can get a high score?''



1D Pac-Man | Hacker News

PAKU The state of play of PAKU is like this.

I tried playing the one-dimensional Pac-Man game 'PAKU PAKU' - YouTube

When you access the page, you will see a screen like this. It's a fairly simple game, as all you have to do is tap or use any key to flip Pac-Man.

The player controls the green Pac-Man and ``eats'' the yellow dots while running away from the red enemies, increasing his score. There is only one large dot among the yellow dots, and eating this will give you a power-up state.

When powered up, enemies will be weakened for a certain period of time, and you can defeat them by ramming them.

Defeated enemies will only have eyes, and will respawn after moving to the edge of the screen. By eating all the yellow dots, all points including power-ups will be restored, so the game aims to get a high score by eating all the yellow dots while running away from the enemy.

On Hacker News , a news site where engineers gather, in addition to the usual strategies such as ``How to get a high score on PAKU PAKU,'' posts that challenge algorithms to get a high score on PAKU PAKU are gaining popularity. Mr. mrb posted the following code with the sentence ``I got 9000 points with this code. Please feel free to modify it to make Pac-Man survive longer.''
[code]function bot() {
/* Enemy direction: '1' if Pac-Man's right, '-1' if left */
dir = (enemy.x > player.x) ? 1 : -1;
/* What if Pac-Man... */
if (
/* Normal state or power-up expires within 10 ticks */ powerTicks < 10 &&
/* Heading towards the enemy */ player.vx == dir &&
/* very close to enemy */ abs(player.x - enemy.x) < 25 &&
/* And if the enemy is not just an eye */ enemy.eyeVx == 0
) {
//Press 'ArrowUp' or any key to change Pac-Man's direction
document.dispatchEvent(new KeyboardEvent('keydown', {code: 'ArrowUp'}));
document.dispatchEvent(new KeyboardEvent('keyup', {code: 'ArrowUp'}));
setInterval(bot, 100);[/code]

The strategy in the above code is simple: every 100 milliseconds, Pac-Man's status and distance from the enemy are checked and he turns if he is in danger. PAKU You can run the code by pressing the 'Ctrl + Shift + i' keys on the PAKU page to open the developer tools, pasting the above code in the 'Console' tab and pressing the Enter key.

You can see how to actually play PAKU PAKU using the code in the movie below.

I tried playing the one-dimensional Pac-Man game 'PAKU PAKU' using the code - YouTube

In addition, since the source code of PAKU PAKU is open to the public , it is possible to obtain the necessary variables by looking at the source code. It is stated that strategies such as prioritizing eating the middle point or prioritizing power-ups are possible.

in Review,   Video,   Game, Posted by log1d_ts