//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.16; //Erc20 contract User { /*modifier enoughmoney { require(balanceOf[msg.sender>=1]); _; }*/ function DefineUserA() public { address PlayerA = msg.sender; } function DefineUserB() public { address PlayerB = msg.sender; } //needs a lock, so functions can't be called while game is still going on } contract Fields { struct Field { uint row; uint column; bytes32 value; //bytes32 takes too much space } modifier occupation(Field field) { require(field.value[i][k] == "N"); _; } function Fieldchange (uint _i,uint _k, bytes32 _newValue){ value.Field[i, k, "N"] = _newValue; } Field[] public fields; function createFields () public { for (uint i=1, i<=3, i++) { for (uint k=1, k<=3, k++) { fields.push(Field(i, k, "N")); } } } function PlayA(uint _i, uint _k) public occupation{ require(msg.sender == PlayerA); Fieldchange (_i, _k, "A"); } function PlayB(uint _i, uint _k) public occupation{ require(msg.sender == PlayerB); Fieldchange (_i, _k, "B"); } }
0.4.16