- add Gitea sparse registry config for rmath - commit Cargo.lock - add default-members so host tests skip GTK/wasm frontends - fix checkers example to use DraughtsBoard::get - add README with prerequisites and per-frontend commands - add Gitea CI workflow (core, wasm, wasm4, MSRV) - fix repository metadata and stop tracking generated wasm dist
37 lines
1.2 KiB
Rust
37 lines
1.2 KiB
Rust
use glib::ExitCode;
|
|
use rdraught::{DraughtsBoard, DraughtsGame, Move, Piece, Player, Position};
|
|
use rdraught_gtk::run;
|
|
use std::collections::HashMap;
|
|
use std::mem::size_of;
|
|
|
|
fn main() -> ExitCode {
|
|
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)
|
|
}
|