make benchmark game static
This commit is contained in:
parent
a2c23cf433
commit
2435458e15
33
src/azul.rs
33
src/azul.rs
|
@ -678,6 +678,39 @@ pub fn complicated() -> Result<Game, &'static str> {
|
|||
Ok(game)
|
||||
}
|
||||
|
||||
pub fn some_game() -> Result<Game, &'static str> {
|
||||
let mut game = Game::new(2)?;
|
||||
|
||||
let factories = &mut game.factories;
|
||||
|
||||
factories[0].push(Tile::Blue);
|
||||
factories[0].push(Tile::Blue);
|
||||
factories[0].push(Tile::Yellow);
|
||||
factories[0].push(Tile::Black);
|
||||
|
||||
factories[1].push(Tile::Blue);
|
||||
factories[1].push(Tile::Red);
|
||||
factories[1].push(Tile::Red);
|
||||
factories[1].push(Tile::Red);
|
||||
|
||||
factories[2].push(Tile::Blue);
|
||||
factories[2].push(Tile::Red);
|
||||
factories[2].push(Tile::Black);
|
||||
factories[2].push(Tile::Teal);
|
||||
|
||||
factories[3].push(Tile::Blue);
|
||||
factories[3].push(Tile::Red);
|
||||
factories[3].push(Tile::Black);
|
||||
factories[3].push(Tile::Teal);
|
||||
|
||||
factories[4].push(Tile::Yellow);
|
||||
factories[4].push(Tile::Yellow);
|
||||
factories[4].push(Tile::Black);
|
||||
factories[4].push(Tile::Teal);
|
||||
|
||||
Ok(game)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connected() -> Result<(), String> {
|
||||
let mut board = Board::default();
|
||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -22,24 +22,18 @@ fn main() -> Result<(), &'static str> {
|
|||
|
||||
return match program {
|
||||
1 => {
|
||||
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);
|
||||
let mut game = some_game()?;
|
||||
|
||||
game.do_move(GameMove(1, Tile::Blue, 2))?;
|
||||
game.do_move(GameMove(3, Tile::Yellow, 2))?;
|
||||
game.do_move(GameMove(2, Tile::Red, 3))?;
|
||||
game.do_move(GameMove(5, Tile::Yellow, 2))?;
|
||||
|
||||
game.do_move(GameMove(0, Tile::Teal, 4))?;
|
||||
game.do_move(GameMove(5, Tile::Teal, 4))?;
|
||||
game.do_move(GameMove(3, Tile::Blue, 2))?;
|
||||
game.do_move(GameMove(0, Tile::Black, 4))?;
|
||||
|
||||
//game.do_move(GameMove(4, Tile::Yellow, 1))?;
|
||||
game.do_move(GameMove(5, Tile::Black, 1))?;
|
||||
//game.do_move(GameMove(0, Tile::Blue, 3))?;
|
||||
|
||||
// println!("{:#?}", game);
|
||||
|
||||
println!("{}", count_options(game, 1, 2));
|
||||
|
||||
Ok(())
|
||||
},
|
||||
2 => calculate_options(),
|
||||
|
|
Loading…
Reference in New Issue