summaryrefslogtreecommitdiff
path: root/src/strategy.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-04-26 19:43:59 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-04-26 19:43:59 +0200
commitebe7d5cd5cc42d8f3f02ca926f4b920ada03765f (patch)
treea139c6b65182f1fc10d7dcea7eec45a234491048 /src/strategy.rs
parent3e4f70ff90471120818cfb38a6dbde4952c11b8f (diff)
Refactored game map to use less memory
Diffstat (limited to 'src/strategy.rs')
-rw-r--r--src/strategy.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/strategy.rs b/src/strategy.rs
index afebd12..dd15854 100644
--- a/src/strategy.rs
+++ b/src/strategy.rs
@@ -1,5 +1,5 @@
use crate::command::Command;
-use crate::game::{GameBoard, CellType};
+use crate::game::GameBoard;
use crate::geometry::*;
struct GameTree {
@@ -54,8 +54,8 @@ fn valid_moves(state: &GameBoard, player_index: usize) -> Vec<Command> {
.map(Direction::as_vec)
.map(|d| worm.position + d)
.filter_map(|p| match state.map.at(p) {
- Some(CellType::Air) => Some(Command::Move(p.x, p.y)),
- Some(CellType::Dirt) => Some(Command::Dig(p.x, p.y)),
+ Some(false) => Some(Command::Move(p.x, p.y)),
+ Some(true) => Some(Command::Dig(p.x, p.y)),
_ => None
})
.collect::<Vec<_>>();