added wasm port
This commit is contained in:
@@ -1,19 +1,35 @@
|
||||
use glib::ExitCode;
|
||||
use rdraught::draughts::DraughtsGame;
|
||||
use rdraught::{draughts::Piece, draughts::Player, position::Position};
|
||||
use rdraught_ui::run;
|
||||
use rdraught::{DraughtsBoard, DraughtsGame, Move, Piece, Player, Position};
|
||||
use rdraught_gtk::run;
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let mut pieces = HashMap::<Position, Piece>::new();
|
||||
pieces.insert(Position::new(2, 4), Piece::CrownedRedPawn);
|
||||
pieces.insert(Position::new(5, 5), Piece::CrownedWhitePawn);
|
||||
let game = DraughtsGame::new(
|
||||
|p| match pieces.get(&p) {
|
||||
None => Piece::NoPiece,
|
||||
Some(piece) => *piece,
|
||||
},
|
||||
Player::Red,
|
||||
);
|
||||
run(game)
|
||||
println!("move: {}", size_of::<Move>());
|
||||
println!("game: {}", size_of::<DraughtsGame>());
|
||||
|
||||
// let boards = [[(Position::new(2, 4), Piece::CrownedRedPawn)]];
|
||||
|
||||
// for pieces in boards.into_iter() {
|
||||
// let map = pieces.into_iter().collect::<HashMap<Position, Piece>>();
|
||||
// let board = DraughtsBoard::new(|p| match map.get(&p) {
|
||||
// None => Piece::NoPiece,
|
||||
// Some(piece) => *piece,
|
||||
// });
|
||||
// println!("{:?}", board);
|
||||
// for (pos, piece) in map.iter() {
|
||||
// assert_eq!(*piece, board.get(*pos));
|
||||
// }
|
||||
// }
|
||||
ExitCode::SUCCESS
|
||||
// let mut pieces = HashMap::<Position, Piece>::new();
|
||||
// pieces.insert(Position::new(2, 4), Piece::CrownedRedPawn);
|
||||
// pieces.insert(Position::new(5, 5), Piece::CrownedWhitePawn);
|
||||
// let game = DraughtsGame::new(
|
||||
// |p| match pieces.get(&p) {
|
||||
// None => Piece::NoPiece,
|
||||
// Some(piece) => *piece,
|
||||
// },
|
||||
// Player::Red,
|
||||
// );
|
||||
// run(game)
|
||||
}
|
||||
|
Reference in New Issue
Block a user