Persona K60: verdict_faults covers the turn's room alone, a hold opened twice asks one verdict; readers pin (mutants)
The lines she may reply to and add to are the turn room's alone, so a hold opened from one covers every line and addition, here or anywhere: the opening's place and an addition's own room decided nothing (four equivalent survivors). Pins: one verdict per hold opened twice; a direct message's readers exclude her own line and another room's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
785b4d35c8
commit
aa431fc139
3 changed files with 30 additions and 31 deletions
|
|
@ -1594,41 +1594,28 @@ fn overruled(report: &mut Vec<Value>, draft: &Draft, clear_of: &[String], holds:
|
|||
}
|
||||
|
||||
/// The lines and additions of an answer with no verdict on a hold that covers where they go (K60, map 16.33.5), a
|
||||
/// contract fault found before anything is decided. Covering is code's: a hold listed in `packet.holds` or opened by this
|
||||
/// answer from a listed line, covering anywhere or the room the draft goes into (the turn's room for a line, the target's
|
||||
/// room for an addition). Each such hold is named in the line's `holds` or `clear_of`. A line whose number names no draft,
|
||||
/// and a line on a turn with no room, go nowhere, and need no verdict.
|
||||
/// contract fault found before anything is decided. Covering is code's: a hold listed in `packet.holds` that covers
|
||||
/// anywhere or the turn's room, and a hold this answer opens from a listed line, here or anywhere. A line and an addition
|
||||
/// both go into the turn's room, since the lines she may reply to and add to are that room's alone (`select`), so a hold
|
||||
/// opened from one covers it either way. Each such hold is named in the line's `holds` or `clear_of`, once each. A line
|
||||
/// whose number names no draft, and every line on a turn with no room, go nowhere, and need no verdict.
|
||||
fn verdict_faults(answer: &Answer, packet: &Packet, found: &Drafts) -> Vec<Unverdicted> {
|
||||
let opening: Vec<(&str, Option<&str>)> = answer
|
||||
.hold
|
||||
.iter()
|
||||
.filter_map(|raw| serde_json::from_value::<ProposedHold>(raw.clone()).ok())
|
||||
.filter_map(|hold| packet.quotable.iter().find(|line| line.id == hold.line.trim()).map(|line| (line.id.as_str(), (hold.place == Where::Here).then_some(line.room.as_str()))))
|
||||
.collect();
|
||||
let covering = |into: &str| -> Vec<String> {
|
||||
let mut handles: Vec<String> = packet.holds.iter().filter(|hold| hold.room.as_deref().is_none_or(|room| room == into)).map(|hold| hold.id.clone()).collect();
|
||||
for (line, covers) in &opening {
|
||||
if covers.is_none_or(|room| room == into) && !handles.iter().any(|handle| handle.as_str() == *line) {
|
||||
handles.push((*line).to_owned());
|
||||
}
|
||||
let Some(room) = packet.room.as_deref() else { return Vec::new() };
|
||||
let mut covering: Vec<&str> = packet.holds.iter().filter(|hold| hold.room.as_deref().is_none_or(|covers| covers == room)).map(|hold| hold.id.as_str()).collect();
|
||||
for raw in &answer.hold {
|
||||
let opens = serde_json::from_value::<ProposedHold>(raw.clone()).ok().and_then(|hold| packet.quotable.iter().find(|line| line.id == hold.line.trim()));
|
||||
if let Some(line) = opens.filter(|line| !covering.contains(&line.id.as_str())) {
|
||||
covering.push(&line.id);
|
||||
}
|
||||
handles
|
||||
};
|
||||
let mut faults = Vec::new();
|
||||
let mut check = |act: Act, at: usize, draft: Option<i64>, into: Option<&str>, holds: &[String], clear_of: &[String]| {
|
||||
let (Some(draft), Some(into)) = (draft.and_then(|n| found.numbered(n)), into) else { return };
|
||||
for hold in covering(into) {
|
||||
if !holds.iter().chain(clear_of).any(|named| named.trim() == hold) {
|
||||
faults.push(Unverdicted { act, at, draft: draft.n, hold });
|
||||
}
|
||||
}
|
||||
};
|
||||
for (at, line) in answer.say.iter().enumerate() {
|
||||
check(Act::Say, at, line.draft, packet.room.as_deref(), &line.holds, &line.clear_of);
|
||||
}
|
||||
for (at, amend) in answer.amend.iter().enumerate() {
|
||||
let into = amend.target.as_deref().and_then(|id| packet.amendable.iter().find(|line| line.id == id.trim())).map(|line| line.room.as_str()).or(packet.room.as_deref());
|
||||
check(Act::Amend, at, amend.draft, into, &amend.holds, &amend.clear_of);
|
||||
let lines = answer.say.iter().enumerate().map(|(at, line)| (Act::Say, at, line.draft, &line.holds, &line.clear_of));
|
||||
let additions = answer.amend.iter().enumerate().map(|(at, amend)| (Act::Amend, at, amend.draft, &amend.holds, &amend.clear_of));
|
||||
let mut faults = Vec::new();
|
||||
for (act, at, draft, holds, clear_of) in lines.chain(additions) {
|
||||
let Some(draft) = draft.and_then(|n| found.numbered(n)) else { continue };
|
||||
for hold in covering.iter().filter(|hold| !holds.iter().chain(clear_of).any(|named| named.trim() == **hold)) {
|
||||
faults.push(Unverdicted { act, at, draft: draft.n, hold: (*hold).to_owned() });
|
||||
}
|
||||
}
|
||||
faults
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3303,3 +3303,12 @@ fn k60_the_contract_requires_the_verdict() {
|
|||
assert!(prompt.contains("`clear_of` names each such hold covering where it goes whose held thing it does not carry. Under every hold that covers where a draft goes, the draft names it in one of the two; one left out fails the answer."), "{prompt}");
|
||||
assert!(!prompt.contains("goes; else empty"), "{prompt}");
|
||||
}
|
||||
|
||||
/// A hold opened twice from one line asks one verdict, and a line with none is faulted once for it.
|
||||
#[test]
|
||||
fn k60_a_hold_opened_twice_asks_one_verdict() {
|
||||
let mut answer = x3_r1_no_verdict();
|
||||
answer["hold"] = json!([{ "line": "q3", "words": "hold it, don't post it in here yet", "where": "here" }, { "line": "q3", "words": "don't post it in here yet", "where": "anywhere" }]);
|
||||
let decision = decide(&answering(vec![answer.to_string()]), "test", &x3_r1_packet(), "The room is warm.", X3_LIBBY_R1, &Tuning::default());
|
||||
assert_eq!(decision["unverdicted"], json!([{ "act": "say", "draft": 1, "hold": "q3" }]), "{decision}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3055,6 +3055,9 @@ fn k62_a_direct_message_names_its_reader() {
|
|||
let form = narrate::persona_speech_form(&packet);
|
||||
assert!(form.contains("goes into this direct message, whole, where only Meta, the operator reads it; or it is a note for Self"), "{form}");
|
||||
assert!(!form.contains("everyone in it") && !form.contains(dm), "{form}");
|
||||
// Her own line in it, and a line in another room, name no reader.
|
||||
let mixed = Room { messages: vec![message("#swarm:gamecult.org", "@kiko:gamecult.org", "Kiko", "Anyone around?", 3, false), message(dm, OWN, "Eureka", "Here.", 2, false), message(dm, OPERATOR, "Meta", "Write the two lines here, just for me.", 1, true)], here: Some(dm.into()), ..Room::default() };
|
||||
assert_eq!(packet_of(TurnKind::Chat, &state(), &mixed, &History::default(), 1).readers, ["Meta, the operator"]);
|
||||
// Two others in it: both named, and the verb agrees.
|
||||
let two = Room { messages: vec![message(dm, OPERATOR, "Meta", "Hi.", 2, true), message(dm, "@kiko:gamecult.org", "Kiko", "Hi both.", 1, true)], here: Some(dm.into()), ..Room::default() };
|
||||
assert!(narrate::persona_speech_form(&packet_of(TurnKind::Chat, &state(), &two, &History::default(), 1)).contains("where only Meta, the operator and Kiko read it;"));
|
||||
|
|
|
|||
Loading…
Reference in a new issue