From 4f9a8b6f10da47568d5035ab690525bbf60c14a2 Mon Sep 17 00:00:00 2001 From: pingu Date: Wed, 22 Oct 2025 22:02:08 +0200 Subject: [PATCH] Moving --- Masons.qnt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Masons.qnt b/Masons.qnt index 7e27a66..358e0cc 100644 --- a/Masons.qnt +++ b/Masons.qnt @@ -14,6 +14,7 @@ module mafia { voted: bool, mascot: bool, nominated: bool, + hasGun: bool, } var players_to_features: str -> PlayerFeatures @@ -23,6 +24,7 @@ module mafia { var last_saved: Option[str] var last_moved1: Option[str] var last_moved2: Option[str] + var gun_done: bool pure def all_voted(players: str -> PlayerFeatures): bool = players.values().filter(p => p.status == Alive).forall(p => p.voted == true) @@ -117,7 +119,8 @@ module mafia { status: Alive, voted: false, nominated: false, - mascot: p == mascot_choice + mascot: p == mascot_choice, + hasGun: false, }), last_saved' = None, last_moved1' = None, @@ -135,6 +138,8 @@ module mafia { nondet victimVig1 = players_to_features.values().filter(p => p.status == Alive and p.role != Vigilante(1)).oneOf() nondet move1 = players_to_features.values().filter(p => p.status == Alive and Some(p.name) != last_moved1 and Some(p.name) != last_moved2 ).oneOf() nondet move2 = players_to_features.values().filter(p => p.status == Alive and Some(p.name) != last_moved1 and Some(p.name) != last_moved2 and p.name != move1.name).oneOf() + nondet gunChoice = players_to_features.values().filter(p => p.status == Alive and p.role != Gunsmith).oneOf() + nondet handoutGun = Set(true,false).oneOf() val mover = mover_alive(players_to_features) > 0 val doc = doc_alive(players_to_features) > 0 val vig0 = vig0_alive(players_to_features) > 0 @@ -146,9 +151,8 @@ module mafia { val temp = if (vig0) victim.append({...victimVig0, name: moved.get(victimVig0.name)}) else victim if (vig1) temp.append({...victimVig1, name: moved.get(victimVig1.name)}) else temp } - val updated_features = update_after_kill(victims.listMap(p => p.name),players_to_features) + val updated_features = update_after_kill(victims.listMap(p => p.name),players_to_features).setBy(gunChoice.name, p => {...p, hasGun: handoutGun and not(gun_done)}) val new_game_status = update_status(updated_features) - // TODO: Handle gunsmith all { players_to_features.values().exists(p => p.status == Alive and p.role == Mafia), game_phase == Night, @@ -159,6 +163,7 @@ module mafia { last_saved' = if (doc and victimScum == doctorSave) None else if (doc) Some(doctorSave.name) else None, last_moved1' = if (mover and (move1 == victimScum or move2 == victimScum)) None else if (mover) Some(move1.name) else None, last_moved2' = if (mover and (move1 == victimScum or move2 == victimScum)) None else if (mover) Some(move2.name) else None, + gun_done' = (handoutGun or gun_done), } }