fix pruning bug, (increase in workset :()
This commit is contained in:
		
							parent
							
								
									19dd0d3b2c
								
							
						
					
					
						commit
						410e2f3bea
					
				@ -486,7 +486,7 @@ impl Game {
 | 
			
		||||
            },
 | 
			
		||||
            GameMove(1..=9, _, _) => {
 | 
			
		||||
                let board =  &mut self.boards[self.player];
 | 
			
		||||
                if game_move.0 > self.factories.len() - 1 {
 | 
			
		||||
                if game_move.0 > self.factories.len() {
 | 
			
		||||
                    return Err("That factory is out of bounds");
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/main.rs
									
									
									
									
									
								
							@ -19,17 +19,22 @@ fn main() -> Result<(), &'static str> {
 | 
			
		||||
            let mut rng = StdRng::seed_from_u64(42);
 | 
			
		||||
            let mut game = Game::new(2)?;
 | 
			
		||||
            game.fill(StdRng::from_rng(&mut rng).expect("rng error"))?;
 | 
			
		||||
             println!("{:#?}", game);
 | 
			
		||||
            println!("{:#?}", game);
 | 
			
		||||
 | 
			
		||||
              game.do_move(GameMove(3, Tile::Red, 3))?;
 | 
			
		||||
              game.do_move(GameMove(1, Tile::Yellow, 2))?;
 | 
			
		||||
            game.do_move(GameMove(3, Tile::Red, 3))?;
 | 
			
		||||
            game.do_move(GameMove(1, Tile::Yellow, 2))?;
 | 
			
		||||
 | 
			
		||||
              game.do_move(GameMove(4, Tile::Blue, 2))?;
 | 
			
		||||
              game.do_move(GameMove(0, Tile::Black, 4))?;
 | 
			
		||||
            game.do_move(GameMove(4, Tile::Blue, 2))?;
 | 
			
		||||
            game.do_move(GameMove(0, Tile::Black, 4))?;
 | 
			
		||||
 | 
			
		||||
              println!("{}", count_options(game, 1, 2));
 | 
			
		||||
            game.do_move(GameMove(5, Tile::Black, 1))?;
 | 
			
		||||
            game.do_move(GameMove(0, Tile::Blue, 3))?;
 | 
			
		||||
            
 | 
			
		||||
            println!("{:#?}", game);
 | 
			
		||||
 | 
			
		||||
              Ok(())
 | 
			
		||||
            println!("{}", count_options(game, 1, 2));
 | 
			
		||||
 | 
			
		||||
            Ok(())
 | 
			
		||||
        },
 | 
			
		||||
        2 => calculate_options(),
 | 
			
		||||
        _ => Err("Not a valid program")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user