generated from just-the-docs/just-the-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca36b0f
commit 0b6474a
Showing
3 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use serde::{Serialize, Deserialize}; | ||
use crate::components::board::SavedBoard; | ||
use crate::components::opponent::Opponent; | ||
|
||
#[derive(Clone, Serialize, Deserialize)] | ||
pub struct GameState { | ||
pub player1: String, // Current player's name | ||
pub player2: Option<Opponent>, // Selected opponent | ||
pub current_round: usize, | ||
pub player1_score: i32, | ||
pub player2_score: i32, | ||
pub player1_board: Option<SavedBoard>, | ||
pub player2_board: Option<SavedBoard>, | ||
} | ||
|
||
impl GameState { | ||
pub fn new(player_name: String, opponent: Opponent) -> Self { | ||
GameState { | ||
player1: player_name, | ||
player2: Some(opponent), | ||
current_round: 1, | ||
player1_score: 0, | ||
player2_score: 0, | ||
player1_board: None, | ||
player2_board: None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod opponent; | ||
pub mod board; | ||
pub mod game; | ||
pub mod saved_boards; | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters