[explorer] Print some question marks if a move is generated without target/origin squares
The move I observed in my testing was a castling move, which doesn't set target and origin squares because those are provided by the castling parameters struct from the board crate. Fix the missing squares on castle moves by looking up castling parameters and populating them. This requires Move::castle() to take a Color in addition to the Wing. Update all the call sites.
This commit is contained in:
		
							parent
							
								
									659ffb6130
								
							
						
					
					
						commit
						9815a63ebb
					
				
					 6 changed files with 27 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -234,8 +234,12 @@ fn do_moves_command(
 | 
			
		|||
    let formatted_moves: Vec<String> = moves
 | 
			
		||||
        .iter()
 | 
			
		||||
        .map(|ply| {
 | 
			
		||||
            let piece = state.position.get_piece(ply.origin()).unwrap();
 | 
			
		||||
            format!("{piece}{ply}")
 | 
			
		||||
            let origin = ply.origin();
 | 
			
		||||
            if let Some(piece) = state.position.get_piece(origin) {
 | 
			
		||||
                format!("{piece}{ply}")
 | 
			
		||||
            } else {
 | 
			
		||||
                format!("{ply}??")
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
        .collect();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue