Reorganize board code in engine
Just a bit
This commit is contained in:
@@ -242,6 +242,11 @@ pub struct Board {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Board {
|
impl Board {
|
||||||
|
pub fn new() -> Board {
|
||||||
|
Board {
|
||||||
|
state: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
fn get_at(&self, position: &Position) -> Option<&Piece> {
|
fn get_at(&self, position: &Position) -> Option<&Piece> {
|
||||||
self.state.get(position)
|
self.state.get(position)
|
||||||
}
|
}
|
||||||
@@ -260,11 +265,8 @@ impl Board {
|
|||||||
self.set_at(target, Some(piece));
|
self.set_at(target, Some(piece));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
pub fn clear(&mut self) {
|
||||||
pub fn new() -> Board {
|
self.state.clear();
|
||||||
Board {
|
|
||||||
state: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.state.clear();
|
self.state.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user