-
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
Showing
14 changed files
with
547 additions
and
30 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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,13 @@ | ||
[package] | ||
name = "pebbles-game-state" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
gstd = { git = "https://github.com/gear-tech/gear.git", tag = "v1.4.1",features = ["debug"] } | ||
gmeta = { git = "https://github.com/gear-tech/gear.git", tag = "v1.4.1" } | ||
pebbles-game-io.path = "io" | ||
|
||
[build-dependencies] | ||
gear-wasm-builder = { git = "https://github.com/gear-tech/gear.git", tag = "v1.4.1" } | ||
pebbles-game-io.path = "io" |
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,3 @@ | ||
fn main() { | ||
gear_wasm_builder::build_metawasm(); | ||
} |
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,42 @@ | ||
#[no_std] | ||
|
||
use gmeta::metawasm; | ||
use gstd::{exec, prelude::*}; | ||
use pebbles_game_io::*; | ||
|
||
/// customsize game state function | ||
#[metawasm] | ||
pub mod metafns { | ||
pub type State = GameState; | ||
|
||
pub fn game_state(state: State) -> State { | ||
State { | ||
pebbles_count: state.pebbles_count, | ||
max_pebbles_per_turn: state.max_pebbles_per_turn, | ||
pebbles_remaining: state.pebbles_remaining, | ||
difficulty: state.difficulty, | ||
first_player: state.first_player, | ||
winner: state.winner, | ||
} | ||
} | ||
|
||
pub fn pebbles_count(state: State) -> u32 { | ||
state.pebbles_count | ||
} | ||
pub fn max_pebbles_per_turn(state: State) -> u32 { | ||
state.max_pebbles_per_turn | ||
} | ||
pub fn pebbles_remaining(state: State) -> u32 { | ||
state.pebbles_remaining | ||
} | ||
pub fn get_difficulty(state: State) -> DifficultyLevel { | ||
state.difficulty | ||
} | ||
pub fn first_player(state: State) -> Player { | ||
state.first_player | ||
} | ||
pub fn get_winner(state: State) -> Player { | ||
state.winner | ||
} | ||
|
||
} |
Oops, something went wrong.