[board] Implement a simple Move struct
This commit is contained in:
		
							parent
							
								
									852b7a848f
								
							
						
					
					
						commit
						164122a140
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
// Eryn Wells <eryn@erynwells.me>
 | 
					// Eryn Wells <eryn@erynwells.me>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mod r#move;
 | 
				
			||||||
mod move_generator;
 | 
					mod move_generator;
 | 
				
			||||||
mod pawn;
 | 
					mod pawn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub use move_generator::MoveGenerator;
 | 
					pub use move_generator::MoveGenerator;
 | 
				
			||||||
 | 
					pub use r#move::Move;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								board/src/moves/move.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								board/src/moves/move.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					// Eryn Wells <eryn@erynwells.me>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use crate::piece::Piece;
 | 
				
			||||||
 | 
					use crate::Square;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub struct Move {
 | 
				
			||||||
 | 
					    pub piece: Piece,
 | 
				
			||||||
 | 
					    pub from: Square,
 | 
				
			||||||
 | 
					    pub to: Square,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl Move {
 | 
				
			||||||
 | 
					    pub fn new(piece: Piece, from: Square, to: Square) -> Move {
 | 
				
			||||||
 | 
					        Move { piece, from, to }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue