wip: current project state

This commit is contained in:
Emil
2026-06-21 22:27:20 +03:00
parent 88892db493
commit a5436897ed
48 changed files with 4583 additions and 760 deletions
+60 -12
View File
@@ -1,5 +1,5 @@
use verbatim::ai::GameSession;
use verbatim::ai::AiAction;
use verbatim::ai::GameSession;
fn setup_empty() -> GameSession {
let mut s = GameSession::new_seeded(42);
@@ -11,28 +11,76 @@ fn setup_empty() -> GameSession {
#[test]
fn acid_dissolves_wood() {
let mut s = setup_empty();
s.perform_action(&AiAction::FillRect { x: 100, y: 120, w: 10, h: 1, material: "stone".into() });
s.perform_action(&AiAction::SetCell { x: 104, y: 118, material: "wood".into() });
s.perform_action(&AiAction::SetCell { x: 105, y: 119, material: "acid".into() });
s.perform_action(&AiAction::SetCell { x: 104, y: 119, material: "acid".into() });
s.perform_action(&AiAction::FillRect {
x: 100,
y: 120,
w: 10,
h: 1,
material: "stone".into(),
});
s.perform_action(&AiAction::SetCell {
x: 104,
y: 118,
material: "wood".into(),
});
s.perform_action(&AiAction::SetCell {
x: 105,
y: 119,
material: "acid".into(),
});
s.perform_action(&AiAction::SetCell {
x: 104,
y: 119,
material: "acid".into(),
});
s.step(30);
assert_ne!(s.get_cell(104, 118).material, "wood", "acid should have dissolved the wood");
assert_ne!(
s.get_cell(104, 118).material,
"wood",
"acid should have dissolved the wood"
);
}
#[test]
fn acid_does_not_dissolve_stone() {
let mut s = setup_empty();
s.perform_action(&AiAction::SetCell { x: 105, y: 110, material: "stone".into() });
s.perform_action(&AiAction::SetCell { x: 105, y: 111, material: "acid".into() });
s.perform_action(&AiAction::SetCell {
x: 105,
y: 110,
material: "stone".into(),
});
s.perform_action(&AiAction::SetCell {
x: 105,
y: 111,
material: "acid".into(),
});
s.step(20);
assert_eq!(s.get_cell(105, 110).material, "stone", "acid should not dissolve stone");
assert_eq!(
s.get_cell(105, 110).material,
"stone",
"acid should not dissolve stone"
);
}
#[test]
fn acid_flows_down() {
let mut s = setup_empty();
s.perform_action(&AiAction::FillRect { x: 100, y: 120, w: 10, h: 1, material: "stone".into() });
s.perform_action(&AiAction::SetCell { x: 105, y: 105, material: "acid".into() });
s.perform_action(&AiAction::FillRect {
x: 100,
y: 120,
w: 10,
h: 1,
material: "stone".into(),
});
s.perform_action(&AiAction::SetCell {
x: 105,
y: 105,
material: "acid".into(),
});
s.step(20);
assert_ne!(s.get_cell(105, 105).material, "acid", "acid should have flowed down from y=105");
assert_ne!(
s.get_cell(105, 105).material,
"acid",
"acid should have flowed down from y=105"
);
}