implemented create new game closes #2 #6
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the create_new_game function to the Blockopoly smart contract, enabling registered players to initiate new game instances on-chain. The function validates that the caller is registered, ensures the number of players is between 2 and 8, and assigns the initiating player their chosen symbol. It generates a unique game ID, captures the current timestamp, and initializes the game with appropriate metadata and player details. Depending on the game mode, the game status is set to either Pending (multiplayer) or Ongoing (single-player). The new game instance is saved to the world state, and a GameCreated event is emitted to record the creation. This feature is essential to the decentralized game setup flow in Blockopoly. closes #2