Last active
May 13, 2021 03:13
-
-
Save frame-lang/e71c2d74e3c2cba31f9dec32d4a63a3e to your computer and use it in GitHub Desktop.
#PacManGhost.frm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- see https://jaredemitchell.com/ai-examples/ | |
--- Cut and paste the spec below into http://framepiler.frame-lang.org/ --- | |
#PacManGhost | |
-interface- | |
start @(|>>|) | |
stop @(|<<|) | |
update | |
-machine- | |
$GameStart => $Default | |
|>>| | |
init() | |
startUpdateTimer() | |
-> $WanderAroundBase ^ | |
$WanderAroundBase => $Default | |
|update| | |
isPastSpawnTime() ? | |
isPowerPelletActive() ? -> $FleeFromPlayer ^ :: | |
isPlayerDistanceClose() ? | |
-> $SeekTowardsPlayer ^ | |
: | |
-> $WanderAroundMaze ^ | |
:: | |
:: ^ | |
$WanderAroundMaze => $Default | |
|update| | |
isPowerPelletActive() ? -> $FleeFromPlayer ^ :: | |
isPlayerDistanceClose() ? -> $SeekTowardsPlayer ^ :: | |
^ | |
$SeekTowardsPlayer => $Default | |
|update| | |
isPowerPelletActive() ? -> $FleeFromPlayer ^ :: | |
isPlayerDistanceClose() ? -> $WanderAroundMaze ^ :: | |
^ | |
$FleeFromPlayer => $Default | |
|update| | |
isEaten() ? -> $ReturnToBase() ^ :: | |
isPowerPelletActive() ?! | |
isPlayerDistanceClose() ? | |
-> $SeekTowardsPlayer ^ | |
: | |
-> $WanderAroundMaze ^ | |
:: | |
:: ^ | |
$ReturnToBase => $Default | |
|>| headToBase() ^ | |
|update| | |
atBase() ? | |
clearTimerAndEatenFlag() -> $WanderAroundBase | |
:: ^ | |
$End | |
|>| stopUpdateTimer() ^ | |
$Default | |
|<<| -> $End ^ | |
## | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Frame System Notation
http://frame-lang.org
From the article The Machine in the Ghost.