Moving
This commit is contained in:
11
Masons.qnt
11
Masons.qnt
@ -14,6 +14,7 @@ module mafia {
|
|||||||
voted: bool,
|
voted: bool,
|
||||||
mascot: bool,
|
mascot: bool,
|
||||||
nominated: bool,
|
nominated: bool,
|
||||||
|
hasGun: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
var players_to_features: str -> PlayerFeatures
|
var players_to_features: str -> PlayerFeatures
|
||||||
@ -23,6 +24,7 @@ module mafia {
|
|||||||
var last_saved: Option[str]
|
var last_saved: Option[str]
|
||||||
var last_moved1: Option[str]
|
var last_moved1: Option[str]
|
||||||
var last_moved2: Option[str]
|
var last_moved2: Option[str]
|
||||||
|
var gun_done: bool
|
||||||
|
|
||||||
pure def all_voted(players: str -> PlayerFeatures): bool =
|
pure def all_voted(players: str -> PlayerFeatures): bool =
|
||||||
players.values().filter(p => p.status == Alive).forall(p => p.voted == true)
|
players.values().filter(p => p.status == Alive).forall(p => p.voted == true)
|
||||||
@ -117,7 +119,8 @@ module mafia {
|
|||||||
status: Alive,
|
status: Alive,
|
||||||
voted: false,
|
voted: false,
|
||||||
nominated: false,
|
nominated: false,
|
||||||
mascot: p == mascot_choice
|
mascot: p == mascot_choice,
|
||||||
|
hasGun: false,
|
||||||
}),
|
}),
|
||||||
last_saved' = None,
|
last_saved' = None,
|
||||||
last_moved1' = 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 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 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 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 mover = mover_alive(players_to_features) > 0
|
||||||
val doc = doc_alive(players_to_features) > 0
|
val doc = doc_alive(players_to_features) > 0
|
||||||
val vig0 = vig0_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
|
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
|
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)
|
val new_game_status = update_status(updated_features)
|
||||||
// TODO: Handle gunsmith
|
|
||||||
all {
|
all {
|
||||||
players_to_features.values().exists(p => p.status == Alive and p.role == Mafia),
|
players_to_features.values().exists(p => p.status == Alive and p.role == Mafia),
|
||||||
game_phase == Night,
|
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_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_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,
|
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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user