super Turnable[G]
type BUCKET: HashSet[Bucketable[G]]
- private var buckets: Array[BUCKET]
+ private var buckets: Array[BUCKET] is noinit
private var next_bucket: nullable BUCKET = null
private var current_bucket_key: Int = -1
end
# Game related event
-class GameEvent
+interface GameEvent
fun apply( game : ThinGame ) is abstract
end
# Game logic on the client
class ThinGame
- var tick: Int protected writable = 0
+ var tick: Int = 0 is protected writable
end
# Game turn on the client
class ThinGameTurn[G: ThinGame]
- var tick: Int protected writable = 0
+ var tick: Int = 0 is protected writable
- var events: List[GameEvent] protected writable = new List[GameEvent]
+ var events: List[GameEvent] = new List[GameEvent] is protected writable
init (t: Int) do tick = t
end
var buckets: Buckets[G] = new Buckets[G]
+ # Last turn executed in this game
+ # Can be used to consult the latest events (by the display for example),
+ # but cannot be used to add new Events.
+ var last_turn: nullable ThinGameTurn[G] = null
+
init do end
fun do_turn: GameTurn[G]
buckets.do_turn(turn)
do_post_turn(turn)
+ last_turn = turn
+
tick += 1
return turn