diff --git a/onchain/src/models/game.cairo b/onchain/src/models/game.cairo index 26c3446..17289d4 100644 --- a/onchain/src/models/game.cairo +++ b/onchain/src/models/game.cairo @@ -5,7 +5,6 @@ use starkludo::models::player::{Player}; // Can either be Ongoing or Ended #[derive(Serde, Copy, Drop, Introspect, PartialEq, Debug)] pub enum GameStatus { - Initialised, // Game has been created Pending, // Waiting for players to join (in multiplayer mode) Ongoing, // Game is ongoing Ended // Game has ended @@ -69,7 +68,7 @@ pub struct Game { pub b0: felt252, // blue piece position on board pub b1: felt252, // blue piece position on board pub b2: felt252, // blue piece position on board - pub b3: felt252, // blue piece position on board + pub b3: felt252, } pub trait GameTrait { @@ -104,7 +103,7 @@ impl GameImpl of GameTrait { id, created_by, is_initialised: true, - status: GameStatus::Initialised, + status: GameStatus::Pending, mode: game_mode, ready_to_start: false, player_green, diff --git a/onchain/src/tests/test_game.cairo b/onchain/src/tests/test_game.cairo index e411d91..a43163c 100644 --- a/onchain/src/tests/test_game.cairo +++ b/onchain/src/tests/test_game.cairo @@ -309,7 +309,7 @@ mod tests { assert(created_game.number_of_players == 3, 'Wrong number of players'); assert(created_game.player_blue == username, 'Wrong player color assignment'); assert(created_game.player_red == 0, 'Red should not be assigned'); - assert(created_game.status == GameStatus::Initialised, 'Wrong game status'); + assert(created_game.status == GameStatus::Pending, 'Wrong game status'); } #[test] @@ -771,22 +771,6 @@ mod tests { game_action_system.join(PlayerColor::Red, game_id); } - #[test] - #[should_panic(expected: ('GAME NOT PENDING', 'ENTRYPOINT_FAILED'))] - fn test_join_game_not_pending() { - let (_, game_action_system) = setup_world(); - let caller = contract_address_const::<'test_gamer'>(); - let username = 'gamer'; - - testing::set_contract_address(caller); - game_action_system.create_new_player(username, false); - - let game_id = game_action_system - .create_new_game(GameMode::MultiPlayer, PlayerColor::Red, 2); - - game_action_system.join(PlayerColor::Red, game_id); - } - #[test] #[should_panic(expected: ('PLAYER NOT REGISTERED', 'ENTRYPOINT_FAILED'))] fn test_join_game_unregistered_player() {