Skip to content

Instantly share code, notes, and snippets.

@mpgarate
Created November 15, 2015 00:22
Show Gist options
  • Save mpgarate/dc5d5fa62c042633c319 to your computer and use it in GitHub Desktop.
Save mpgarate/dc5d5fa62c042633c319 to your computer and use it in GitHub Desktop.
diff --git a/src/game/mod.rs b/src/game/mod.rs
index 61f833c..65105c3 100644
--- a/src/game/mod.rs
+++ b/src/game/mod.rs
@@ -1,5 +1,8 @@
pub use self::bitboard::BitBoard;
pub use self::position::Position;
+pub use self::state::GameState;
+
mod bitboard;
mod position;
+mod state;
diff --git a/src/game/state.rs b/src/game/state.rs
new file mode 100644
index 0000000..dadd51b
--- /dev/null
+++ b/src/game/state.rs
@@ -0,0 +1,27 @@
+use game::bitboard::BitBoard;
+
+pub struct GameState {
+ board: BitBoard
+}
+
+impl GameState {
+ pub fn new() -> GameState {
+ GameState { board: BitBoard::new() }
+ }
+
+ pub fn is_solved(&self) -> bool {
+ self.board.is_solved()
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn new_state_is_solved() {
+ let s: GameState = GameState::new();
+
+ assert!(s.is_solved());
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment