add examples

This commit is contained in:
Joeri Exelmans 2024-11-13 10:07:16 +01:00
parent 8504ba52f6
commit 42757ddc4f
35 changed files with 1104 additions and 609 deletions

View file

@ -98,7 +98,14 @@ port_rt_mm_cs = port_mm_cs + """
BerthState:Class {
# status == empty <=> numShips == 0
constraint = `(get_slot_value(this, "numShips") == 0) == (get_slot_value(this, "status") == "empty")`;
constraint = ```
errors = []
numShips = get_slot_value(this, "numShips")
status = get_slot_value(this, "status")
if (numShips == 0) != (status == "empty"):
errors.append(f"Inconsistent: numShips = {numShips}, but status = {status}")
errors
```;
}
:Inheritance (BerthState -> PlaceState)