Z
Z
zuckonit2016-10-02 21:16:10
Algorithms
zuckonit, 2016-10-02 21:16:10

Which algorithm to choose for the game Pac-man?

I'm writing a game on the pluses, pacman. I don't know how to make the ghost catch up with pacman. Prompt algorithms

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2016-10-02
@GavriKos

The classic pacman has well-defined behavioral algorithms for each cast (pursuit, in a circle, etc.), look on Habré, there was a description.

E
evgeniy_lm, 2016-10-03
@evgeniy_lm

According to Wikipedia

Blinky is a red ghost[3]. The original Japanese name is "Oikake" (Japanese: 追いかけ, "chaser"). In pursuit mode, it uses the point where Pac-Man is located as a target.
Pinky is a pink ghost[3]. The original Japanese name is "Machibuse" (Japanese: 待ち伏せ, "sitting in ambush"). Uses a point 4 spaces ahead of Pac-Man as the target (except when moving up, when the target is a point 4 spaces up and 4 spaces to the left of Pac-Man). Together with Blinky, this behavior is supposed to block Pac-Man, as Blinky chases from behind and Pinky tends to get in front of Pac-Man.
Inky is a blue ghost[3]. The original Japanese name is "Kimagure" (Japanese: 気まぐれ, "moody"). It uses the most complex pursuit algorithm: to determine the direction of movement, a segment is built, one of the ends of which is determined by the position of Blinky, and the middle is 2 cells in front of Pac-Man. The second end of the segment is the desired target point. The resulting point is very difficult to predict, so the Inki is considered the most dangerous ghost.
Clyde is an orange ghost[3]. The original Japanese name is "Otoboke" (お惚け, "pretending to be a fool"). If Clyde is further than 9 cells from Pac-Man, then he uses Pac-Man as a target (like Blinky), if Pac-Man is closer than 9 cells, then Clyde changes the target to a point "below" the lower right corner.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question