Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / models / Algo.model
  1. channel turnA{
  2. ref handsB(b:List, drawA(target:Int, guess:Int, b, d))
  3. ref deck(d:List, drawA(target, guess, b, d))
  4. out handsA(a:List, drawA(target, guess, b, d)) == if(eq(get(b, target), guess), cons(tuple(fst(head(d)), false), a), cons(tuple(fst(head(d)), true), a))
  5. out handsB(a:List, drawA(target, guess, b, d)) == if(eq(get(b, target), guess), set(a, target, tuple(fst(get(a, target)), true)), a)
  6. out deck(t:List, drawA(target, guess, b, d)) == tail(d)
  7. }
  8. channel turnAA{
  9. ref handsB(b:List, selectA(target:Int, guess:Int, attacker:Int, b))
  10. out handsA(a:List, selectA(target, guess, attacker, b)) == if(eq(get(b, target), guess), a, set(a, attacker, tuple(fst(get(a, attacker)), true)))
  11. out handsB(a:List, selectA(target, guess, attacker, b)) == if(eq(get(b, target), guess), set(a, target, tuple(fst(get(a, target)), true)), a)
  12. }