Skip to content

Instantly share code, notes, and snippets.

@frame-lang
Last active May 13, 2021 03:13
Show Gist options
  • Save frame-lang/e71c2d74e3c2cba31f9dec32d4a63a3e to your computer and use it in GitHub Desktop.
Save frame-lang/e71c2d74e3c2cba31f9dec32d4a63a3e to your computer and use it in GitHub Desktop.
#PacManGhost.frm
--- 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 ^
##
@frame-lang
Copy link
Author

frame-lang commented Feb 27, 2021

Frame System Notation
http://frame-lang.org

From the article The Machine in the Ghost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment