diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-02 13:18:39 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-02 13:18:39 +0100 |
| commit | 15efc494b99492df189389474bb981d0ec5ce2b3 (patch) | |
| tree | 69fd81b49f0c3f52fd8aa90e3194b06011b68317 /src/position.rs | |
| parent | 5aa6abf0166868f13f9ab64c91f3f4b62e05ed58 (diff) | |
| download | connect4-15efc494b99492df189389474bb981d0ec5ce2b3.tar.gz connect4-15efc494b99492df189389474bb981d0ec5ce2b3.tar.bz2 connect4-15efc494b99492df189389474bb981d0ec5ce2b3.zip | |
Solving bad cache value, Added weak solver
Diffstat (limited to 'src/position.rs')
| -rw-r--r-- | src/position.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/position.rs b/src/position.rs index 9ed617d..7fd65c2 100644 --- a/src/position.rs +++ b/src/position.rs @@ -1,6 +1,7 @@ pub const HEIGHT: u64 = 6; pub const WIDTH: u64 = 7; pub const FULL_HEIGHT: u64 = HEIGHT + 1; +pub const MIN_SCORE: i32 = -((WIDTH * HEIGHT) as i32) / 2 + 3; #[derive(Debug, Eq, PartialEq)] enum Cell { @@ -157,27 +158,27 @@ impl fmt::Debug for Position { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use Cell::*; writeln!(f, "play_count: {}", self.play_count)?; - writeln!(f, "{:10}{:10}{:10}", "position", "mask", "player")?; + writeln!(f, "{:16}{:16}{:16}", "position", "mask", "player")?; for y in (0..FULL_HEIGHT).rev() { for x in 0..WIDTH { match self.at(y, x) { - Empty => write!(f, ".")?, - CurrentPlayer => write!(f, "x")?, - OtherPlayer => write!(f, "o")?, + Empty => write!(f, ". ")?, + CurrentPlayer => write!(f, "x ")?, + OtherPlayer => write!(f, "o ")?, } } write!(f, " ")?; for x in 0..WIDTH { match self.at(y, x) { - Empty => write!(f, ".")?, - CurrentPlayer | OtherPlayer => write!(f, "#")?, + Empty => write!(f, ". ")?, + CurrentPlayer | OtherPlayer => write!(f, "# ")?, } } write!(f, " ")?; for x in 0..WIDTH { match self.at(y, x) { - Empty | OtherPlayer => write!(f, ".")?, - CurrentPlayer => write!(f, "#")?, + Empty | OtherPlayer => write!(f, ". ")?, + CurrentPlayer => write!(f, "# ")?, } } write!(f, "\n")?; |
