Skip to content

Instantly share code, notes, and snippets.

@mattmils
Created July 13, 2011 21:14
Show Gist options
  • Save mattmils/1081354 to your computer and use it in GitHub Desktop.
Save mattmils/1081354 to your computer and use it in GitHub Desktop.
Tema 30/06 LTSA
const NS = 4
const NUM = 3
range Ids = 1..NS
const FALSE = 0
const TRUE = 1
range BOOL = FALSE..TRUE
const IDLE = 0
const READY = 1
const BACK = 2
range STATE = IDLE..BACK
CAPO = C[IDLE][0],
C[s:STATE][n:0..NUM] = (
when (s == IDLE) riceviAllarme -> accendiElicottero -> C[READY][n] |
when (s == READY && n < NUM) s[Ids].saliBordo -> C[READY][n + 1] |
when (s == READY && n == NUM) iniziaMissione -> concludiMissione -> C[BACK][n] |
when (s == BACK && n > 0) s[Ids].scendi -> C[s][n - 1] |
when (s == BACK && n == 0) spegniElicottero -> C[IDLE][0]
).
PILOTA = ( riceviAllarme -> accendiElicottero -> spegniElicottero -> PILOTA ).
ELICOTTERO = ( iniziaMissione -> concludiMissione -> ELICOTTERO ).
SOCCORRITORE = ( saliBordo -> scendi -> SOCCORRITORE).
|| SYS = ( PILOTA || CAPO || ELICOTTERO || s[Ids]:SOCCORRITORE ).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment