Created
February 13, 2019 17:20
-
-
Save Vitali8/04d0eb2a971ce18f45bc9356be1aff39 to your computer and use it in GitHub Desktop.
TicTacToeTon's contract for Titanium labs BA
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
pragma solidity 0.5.0; | |
import "./TicTacToe.sol"; | |
contract Player{ | |
uint256 public wins; | |
uint256 loses; | |
string name; | |
address owner; | |
address latestGame; | |
address _gm; | |
constructor(address user, address gm, string memory nickName) public { | |
owner = user; | |
_gm = gm; | |
name = nickName; | |
wins = 0; | |
loses = 0; | |
} | |
modifier onlyGame() { | |
require(msg.sender == latestGame, "Only game can use that"); | |
_; | |
} | |
modifier onlyGameManager() { | |
require(msg.sender == _gm, "Only game manager can use that"); | |
_; | |
} | |
function incWins() public onlyGame{ | |
wins++; | |
} | |
function incLoses() public onlyGame{ | |
loses++; | |
} | |
function setLatestGame(address gameAddress) public onlyGameManager{ | |
latestGame = gameAddress; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment