realm-of-ra / mancala

https://meowing-anteater-cee.notion.site/Mancala-Game-MVP-7521e2f2e5294575b33b17601afde810
MIT License
9 stars 26 forks source link

Add Contract logic to set the MancalaGame state winner after the game is completed. #21

Closed web3technologies closed 3 weeks ago

web3technologies commented 1 month ago

The MancalaGame model is defined like this: `#[derive(Model, Copy, Drop, Serde, Debug)] struct MancalaGame {

[key]

game_id: u128,
player_one: ContractAddress,
player_two: ContractAddress,
current_player: ContractAddress,
winner: ContractAddress, // todo implement logic to set this state
is_finished: bool,

}`

When a game is finished, marked by one of the players having all of their pits emptied, add logic to set the state of the winner = to the winner of the game

Add Unit tests to ensure this is working correctly.

mul1sh commented 1 month ago

@web3technologies @okhaimie-dev Kindly let me have a crack at this 🙂

web3technologies commented 1 month ago

@web3technologies @okhaimie-dev Kindly let me have a crack at this 🙂

All you!

web3technologies commented 1 month ago

@web3technologies @okhaimie-dev Kindly let me have a crack at this 🙂

I updated the description but be sure to add some unit testing!

web3technologies commented 1 month ago

@mul1sh How's progress on this? Do you need any assistance?

mul1sh commented 1 month ago

@mul1sh How's progress on this? Do you need any assistance?

Naah i'm good 🙂 Had to revisit the dojo docs 1 more time, pushing a PR in a few hours

mul1sh commented 4 weeks ago

@web3technologies I think this issue was actually fixed in this commit if i'm not wrong 🤔

Just realized this as I was rebasing my local changes inorder to PR

web3technologies commented 3 weeks ago

Yes that is correct

web3technologies commented 3 weeks ago

Closed per this commit: https://github.com/realm-of-ra/mancala/commit/9e85a1a5269f712f3cc4b167610f05e4b993aba1