Etheria v1.1—an early on-chain hexagonal tile world and pioneering NFT project—deployed on October 29, 2015, with new locking and naming features.
Key Facts
Description
Etheria v1.1 was deployed at block 459,708 on October 29, 2015 (21:11:55 UTC), by the same pseudonymous developer responsible for the earlier Etheria versions. The contract governed a 33×33 hexagonal world stored entirely in Ethereum state, where players could own, name, farm, and trade tiles. Compared to v1.0, the v1.1 deployment added the setLocked() function and related locking logic, which the developer subsequently used to permanently lock the contract against self-destruction (locking transaction: 0x97341f4...), ensuring the game world could not be deleted even by its creator.
Tiles in v1.1 were purchased for 1 ETH each, with an in-contract offer system enabling secondary market transfers between players. Ownership was tracked directly in Solidity state mappings rather than via a transferable token standard—ERC-721 would not be proposed until 2018. Despite this, each tile functioned as a unique, non-fungible on-chain asset, making Etheria a direct ancestor of the NFT concept. The source code, compiled with Solidity v0.1.6, is preserved and verified on Etherscan.
In the original 2015 description on etheria.world, the developer wrote: "Etheria cannot be taken down. Not by the government, not by its owner-players, not even by the developer (me). Etheria will exist as long as Ethereum does." This philosophy—full decentralization of a virtual world—was unprecedented at the time. The locking of v1.1 made good on that promise, permanently rendering the contract immutable even to the deployer.
Etheria v1.1 sold out all 33×33 = 1,089 tiles, generating significant early interest from the Ethereum community. The contract has since become a historical artifact, with its tiles traded on secondary markets. The developer later acknowledged in a 2021 site update that Etheria was "the first true NFT project in history, by more than a year."
Source Verified
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified on Etherscan.
Show source code (Solidity)
/*
Etheria v1.1
Block 459708
Oct-29-2015 09:11:55 PM +UTC
0x169332ae7d143e4b5c6baedb2fef77bfbddb4011
{
"54385526": "setStatus(uint8,uint8,string)", // unused (costs 1 ETH)
"2ef761d3": "buyTile(uint8,uint8)", // unused (sold out - attempting to buy already-owned tiles will lose your ETH)
"8cae1374": "editBlock(uint8,uint8,uint256,int8[5])", // unused under modern build mechanics
"f2a75fe4": "empty()",
"90fd53ec": "farmTile(uint8,uint8,int8)", // unused under modern build mechanics
"fa93019c": "getBlocks(uint8,uint8)", // unused under modern build mechanics
"8435be4b": "getLastFarm(uint8,uint8)", // unused under modern build mechanics
"2d49ffcd": "getLocked()",
"a55cab95": "getName(uint8,uint8)",
"e039e4a1": "getOwner(uint8,uint8)",
"d39eb301": "getStatus(uint8,uint8)", // unused (setStatus costs 1 ETH)
"182db370": "getWhatHappened()",
"41c0e1b5": "kill()", // unkillable due to lock
"10c1952f": "setLocked()", // locking tx: 0x97341f4098ffda41df50ee719ed38ee572098d2a4c0620b70005771da989b451
"93eec1fb": "setName(uint8,uint8,string)",
"7d5fec5a": "setOwner(uint8,uint8,address)" // uses tx.origin - tiles can only be owned by end-user accounts ( DO NOT SEND TO A CONTRACT. YOUR TILE WILL BE LOST)
}
var etheriaAddress = "0x169332ae7d143e4b5c6baedb2fef77bfbddb4011";
var abi = var abi = [
{"constant":false,"inputs":[],"name":"setLocked","outputs":[],"type":"functin"},
{"constant":true,"inputs":[],"name":"getWhatHappened","outputs":[{"name":"","type":"string"}],"type":"function"},
{"constant":true,"inputs":[],"name":"getLocked","outputs":[{"name":"","type":"bool"}],"type":"function"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"buyTile","outputs":[],"type":"function"},
{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"_s","type":"string"}],"name":"setStatus","outputs":[],"type":"function"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"newowner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getLastFarm","outputs":[{"name":"","type":"uint256"}],"type":"function"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"index","type":"uint256"},{"name":"_block","type":"int8[5]"}],"name":"editBlock","outputs":[],"type":"function"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"blocktype","type":"int8"}],"name":"farmTile","outputs":[],"type":"function"},
{"constant":false,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"},{"name":"_n","type":"string"}],"name":"setName","outputs":[],"type":"function"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getName","outputs":[{"name":"","type":"string"}],"type":"function"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getStatus","outputs":[{"name":"","type":"string"}],"type":"function"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function"},
{"constant":false,"inputs":[],"name":"empty","outputs":[],"type":"function"},
{"constant":true,"inputs":[{"name":"col","type":"uint8"},{"name":"row","type":"uint8"}],"name":"getBlocks","outputs":[{"name":"","type":"int8[5][]"}],"type":"function"},
{"inputs":[],"type":"constructor"},
{"anonymous":false,"inputs":[{"indexed":false,"name":"col","type":"uint8"},{"indexed":false,"name":"row","type":"uint8"}],"name":"TileChanged","type":"event"}
];
var etheria = new web3.eth.Contract(abi, etheriaAddress);
Exact bytecode match of source below w/ solidity 0.1.6 + 200 optimization, compiled twice.
chain: 0x606060405236156100c45760e060020a600035046310c1952f81146100ea578063182db370146101155780632d49ffcd1461017f5780632ef761d31461018e57806341c0e1b5146102fb57806354385526146103065780637d5fec5a1461043d5780638435be4b146104ac5780638cae1374146104e757806390fd53ec1461063857806393eec1fb14610720578063a55cab95146107d4578063d39eb3011461086f578063e039e4a11461090a578063f2a75fe41461094b578063fa93019c14610977575b610a45604051600160a060020a03321690600090349082818181858883f150505050505b565b610a456119875433600160a060020a03908116911614156100e85761198b805460ff19166001179055565b610a47604080516020818101835260008252825161198a805460026001821615610100026000190190911604601f810184900484028301840190955284825292939092918301828280156121d95780601f106121ae576101008083540402835291602001916121d9565b610ab55b61198b5460ff165b90565b610a4560043560243560006001836021811015610002575060c6840201826021811015610002579090600602016000508054909150600160a060020a0316600014156110195734670de0b6b3a7640000141580610265575060408051611989547f4166c1fd00000000000000000000000000000000000000000000000000000000825260ff8087166004840152851660248301529151607d92600160a060020a031691634166c1fd91604482810192602092919082900301816000876161da5a03f1156100025750506040515160ff169190911090505b156110e457604051600160a060020a03321690600090349082818181858883f1506040818101905260208082527f333a62757954696c653a4552523a77726f6e672076616c206f7220776174657291810191825261198a805494819052945060026001851615610100026000190190941693909304601f01839004600080516020612a8b833981519152908101939250906110b4565b610a456121e5610183565b604080516020604435600481810135601f8101849004840285018401909552848452610a459481359460248035959394606494929391019181908401838280828437509496505050505050506000670de0b6b3a76400003414610daf57604051600160a060020a033216908290349082818181858883f150606081016040908152602482527f34313a7365745374617475733a4552523a76616c756520776173206e6f74203160208381019182527f20455448000000000000000000000000000000000000000000000000000000009284019290925261198a80549581905260498155955060026001861615610100026000190190951694909404601f0104600080516020612a8b833981519152908101939250906044015b82811115610c4e57825182600050559160200191906001019061041f565b610a45600435602435604435600160a060020a0332166001846021811015610002575060c68502018360218110156100025790906006020160005054600160a060020a03161480610b41575061198754600160a060020a0390811632909116148015610b415750610b3f610183565b610ab560043560243560006001836021811015610002575060c684020182602181101561000257909060060201600050600401549050610945565b6040805160a0818101909252610a459160048035926024359260443592916101049160649060059083908390808284375090955050505050506000610300604051908101604052806018905b60008152602001906001900390816105335750506040805161030081019091526018815b600081526020019060019003908161055757506000905080808060018b6021811015610002575060c68c02018a6021811015610002579090600602016000508054909750600160a060020a039081163291909116146116ab5760408051808201909152601a8082527f32313a65646974426c6f636b3a4552523a6e6f74206f776e6572000000000000602092830190815261198a8054818652825160ff19166034178255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192915b5061169b929150610c56565b610a456004356024356044356000600060008360000b128061065d575060118360000b135b156112185760408051606081018252602181527f33343a6661726d54696c653a4552523a696e76616c696420626c6f636b74797060208281019182527f65000000000000000000000000000000000000000000000000000000000000009383019390935261198a8054600082905260438255909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101926041015b828111156112d7578251826000505591602001919060010190610702565b604080516020604435600481810135601f8101849004840285018401909552848452610a4594813594602480359593946064949293910191819084018382808284375094965050505050505060006001846021811015610002575060c6850201836021811015610002579090600602016000508054909150600160a060020a03908116329190911614801590610bcb575061198754600160a060020a0390811632909116148015610bc95750610bc7610183565b610a476004356024356040805160208101909152600081526001836021811015610002575060c68402018260218110156100025750506040805160026006850260c68702018101805460206001821615610100026000190190911692909204601f8101839004830284018301909452838352919290830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b610a4760043560243560408051602081019091526000815260018360218110156100025760c602016000508260218110156100025760060201600050604080516002928301805460206001821615610100026000190190911694909404601f81018590048502830185019093528282529092909190830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b610ac7600435602435600060018360218110156100025760c602018150826021811015610002576006020160005054600160a060020a031690505b92915050565b610a4560405161198754600160a060020a03908116916000913016319082818181858883f15050505050565b610ae460043560243560408051602081019091526000815260018360218110156100025760c602016000508260218110156100025760060201600050600301600050805480602002602001604051908101604052809291908181526020016000905b828210156111e3576000848152604080516020832060a08201928390529092908501916005918390855b825461010083900a900460000b815260206001928301818104948501949093039092029101808411610a035790505050505050815260200190600101906109d9565b005b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f168015610aa75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051918252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610b2e5760208481028401015160a08083818460006004601ef1509050019260010192610b02565b925050509250505060405180910390f35b155b15610b8b57806001846021811015610002575060c685020183602181101561000257909060060201600050805473ffffffffffffffffffffffffffffffffffffffff191690911790555b505050565b820191906000526020600020905b815481529060010190602001808311610b9e57829003601f168201915b50505050509050610945565b155b155b15610c6a576040805180820190915260188082527f35303a7365744e616d653a4552523a6e6f74206f776e65720000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff191660301785555b50610cc39291505b80821115610ccb5760008155600101610c56565b81816001016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610ccf57805160ff19168380011785555b50610cff929150610c56565b505050505050565b5090565b82800160010185558215610cb7579182015b82811115610cb7578251826000505591602001919060010190610ce1565b50506040805160ff8087168252851660208201528151600080516020612a6b833981519152929181900390910190a16040805180820190915260128082527f35323a7365744e616d653a535543434553530000000000000000000000000000602092830190815261198a80546000829052825160ff191660241782559093600080516020612a8b83398151915260026001841615610100026000190190931692909204601f010481019291610c4e565b6001846021811015610002575060c6850201836021811015610002579090600602016000508054909150600160a060020a03908116329190911614801590610e19575061198754600160a060020a0390811632909116148015610e175750610e15610183565b155b155b15610ec057604051600160a060020a03321690600090349082818181858883f15060408181019052601a8082527f34333a7365745374617475733a4552523a6e6f74206f776e6572000000000000602092830190815261198a8054958190528151603460ff19909116178155955060026001861615610100026000190190951694909404601f0191909104600080516020612a8b8339815191529081019391925090610c4e565b81816002016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f1957805160ff19168380011785555b50610f49929150610c56565b82800160010185558215610f0d579182015b82811115610f0d578251826000505591602001919060010190610f2b565b505060405161198754600160a060020a031690600090349082818181858883f15060ff80891682528716602082015260408051600080516020612a6b8339815191529550918290030192509050a16040805180820190915260148082527f34343a7365745374617475733a53554343455353000000000000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff19166028178555610c4e565b6040805160608101825260228082527f353a62757954696c653a4552523a4f4f42206f7220616c7265616479206f776e60208381019182527f6564000000000000000000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101925b828001600101855582156111d0579182015b828111156111d05782518260005055916020019190600101906110c6565b60405161198754600160a060020a031690600090349082818181858883f15050835473ffffffffffffffffffffffffffffffffffffffff19163217845550506040805160ff8087168252851660208201528151600080516020612a6b83398151915293509081900390910190a16040805180820190915260118082527f343a62757954696c653a53554343455353000000000000000000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff19168380011785555b506111dc929150610c56565b5050610b8b565b505050509050610945565b5050604051600160a060020a03321690600090349082818181858883f150505050505b5050505050565b6001856021811015610002575060c6860201846021811015610002579090600602016000508054909250600160a060020a039081163291909116146112e3576040805180820190915260198082527f33313a6661726d54696c653a4552523a6e6f74206f776e657200000000000000602092830190815261198a805460008290528251603260ff19909116178255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192915b506111ee929150610c56565b6109c48260040160005054430310156113e057670de0b6b3a7640000341461144b57604051600160a060020a03321690600090349082818181858883f150606081016040908152602382527f33313a6661726d54696c653a4552523a76616c756520776173206e6f7420312060208381019182527f45544800000000000000000000000000000000000000000000000000000000009284019290925261198a80549581905260478155955060026001861615610100026000190190951694909404601f0104600080516020612a8b833981519152908101939250906043015b828111156115245782518260005055916020019190600101906113c2565b600034111561140a57604051600160a060020a03321690600090349082818181858883f150505050505b5060005b600a8160ff161015611473576003820180546001810180835591908290801582901161153757600083815260209020611537918101908301610c56565b60405161198754600160a060020a031690600090349082818181858883f1505050505061140a565b4360048301556040805160ff8781168252861660208201528151600080516020612a6b833981519152929181900390910190a16040805180820190915260138082527f33333a6661726d54696c653a5355434345535300000000000000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff191660261785555b50611530929150610c56565b5050611211565b505050506003820180548491906000198101908110156100025750805460008281526020812091909101600019908101805460ff191660f860020a958602959095049490941790935581549092810190811015610002579082526020822001815060016101000a81548160ff021916908360f860020a90810204021790555060008260030160005060018460030160005080549050038154811015610002579082526020822001815060026101000a81548160ff021916908360f860020a908102040217905550600019826003016000506001846003016000508054905003815481101561000257906000526020600020900160005060036101000a81548160ff021916908360f860020a90810204021790555060008260030160005060018460030160005080549050038154811015610002579082526020822001815060046101000a81548160ff021916908360f860020a90810204021790555060010161140e565b50505b5050505050505050505050565b6060880151600090810b1215611786576040805160608101825260238082527f32323a65646974426c6f636b3a4552523a63616e6e6f74206869646520626c6f60208381019182527f636b730000000000000000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101925b8280016001018555821561062c579182015b8281111561062c578251826000505591602001919060010190611768565b600387015460001901891115611835576040805160608101825260298082527f32333a65646974426c6f636b3a4552523a626c6f636b20696e646578206f757460208381019182527f206f662072616e67650000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192611756565b875160000b600019141561192b5760038701805460808a015191908b908110156100025750600090815260208082208c01805460f860020a948502949094046401000000000264ff0000000019909416939093179092556040805160608101825260288082527f32343a65646974426c6f636b3a535543434553533a626c6f636b20636f6c6f728286019081527f206368616e676564000000000000000000000000000000000000000000000000929093019190915261198a8054938190529360026001851615610100026000190190941693909304601f0192909204600080516020612a8b8339815191529081019291611756565b6003870180548a9081101561000257506000908152602081208a0154810b810b808a52604080516119885460e360020a630379eaeb02825260ff9390931660048201529051600160a060020a039290921692631bcf5758926024838101936103009390839003909101908290876161da5a03f115610002575060408051610300818101808452611988548e5160e360020a630379eaeb0290925260ff919091166103048401529251919a50600160a060020a03929092169350610324808b01929190818c0301816000876161da5a03f1156100025750505060405180610300016040529450600093505b60188460ff161015611ca857602088015185856018811015610002579090602002015101858560188110156100025760009290920b602092909202015287600290906020020151858560010160188110156100025790906020020151018585600101601881101561000257600092830b602091820290920191909152860151600290820b07810b14801590611ac75750600285856001016018811015610002579090602002015160000b0760000b6000145b15611af95784846018811015610002576020020151600101858560188110156100025760009290920b60209290920201525b606088015185600286016018811015610002579090602002015101858560020160188110156100025760009290920b60209290920201526003870180548a9081101561000257506000908152602081208a01546101009004900b86856018811015610002579090602002015101868560188110156100025760009290920b60209290920201526003870180548a9081101561000257906000526020600020900160005060029054906101000a900460000b868560010160188110156100025790906020020151018685600101601881101561000257600092830b602091820290920191909152870151600290820b07810b14801590611c155750600286856001016018811015610002579090602002015160000b0760000b6000145b15611c475785846018811015610002576020020151600101868560188110156100025760009290920b60209290920201525b6003870180548a9081101561000257506000908152602081208a015463010000009004900b8660028601601881101561000257602081028201519092019160188110156100025760009290920b602092909202015260039390930192611a15565b611d5d8b8b8a8860006000600060006000610600604051908101604052806030905b6000815260200190600190039081611cca57506000905060018b6021811015610002575060c68c02018a6021811015610002579090600602016000509450600093505b60188460ff16101561221557612390888560188110156100025760200201518960018701601881101561000257602002015160006000600060008560000b121561293b576000198502915061293f565b1515611d685761169e565b6000876003016000508a815481101561000257508152602081208a015463010000009004810b810b12611f6257600092505b60188360ff161015611fa357600091505b6005870154821015612013576005870180548390811015610002576000918252602082200154810b900b86846018811015610002579090602002015160000b148015611e2f575060058701805483908110156100025760206000908120909101546101009004810b900b90508660018501601881101561000257602002015160000b145b8015611e7257506005870180548390811015610002576000918252602082200154620100009004810b900b8660028501601881101561000257602002015160000b145b15611f5657848360188110156100025760200201516005880180548490811015610002576000918252602090912001805460ff191660f860020a9283029290920491909117905584600184016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a90810204021790555084836002016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a9081020402179055505b60019190910190611dab565b5060005b60188160ff161015611fa3576005870180546001810180835590919082801582901161201f5760008381526020902061201f918101908301610c56565b87876003016000508a815481101561000257506000908152602081208b01916001830191839060a08301905b8382111561212c57835183826101000a81548160ff021916908360f860020a9081020402179055509260200192600101602081600001049283019260010302611fcf565b60039290920191611d9a565b505050508481601881101561000257602002015160058801805460001981019081101561000257906000526020600020900160005060006101000a81548160ff021916908360f860020a908102040217905550848160010160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a908102040217905550848160020160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a908102040217905550600301611f66565b80156121595782816101000a81549060ff021916905560010160208160000104928301926001030261212c565b505061217a9291505b80821115610ccb57805460ff19168155600101612162565b50506040805160ff8d811682528c1660208201528151600080516020612a6b833981519152929181900390910190a161169e565b820191906000526020600020905b8154815290600101906020018083116121bc57829003601f168201915b5050505050905061018b565b15801561220157506119875433600160a060020a039081169116145b156100e85761198754600160a060020a0316ff5b856000141561260b5761198854600160a060020a0316630878bc518a60006040805192517f0878bc5100000000000000000000000000000000000000000000000000000000845260ff166004840152516024838101936106009390839003909101908290876161da5a03f1156100025750505060405180610600016040529150600090505b60308160ff161080156122ab575085155b1561230e5781816030811015610002576020020151600090810b1480156122e7575081816001016030811015610002576020020151600090810b145b8015612308575081816002016030811015610002576020020151600090810b145b156126d6575b6040805180820190915260198082527f31333a65646974426c6f636b3a4552523a666c6f6174696e6700000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff19166032178555612416565b1515612422576040805180820190915260148082527f31303a65646974426c6f636b3a4552523a4f4f42000000000000000000000000602092830190815261198a805460008290528251602860ff19909116178255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192915b506125af929150610c56565b600092505b60058501548310156125c4576005850180548490811015610002576000918252602082200154810b900b8885601881101561000257602002015160000b1480156124a9575060058501805484908110156100025760206000908120909101546101009004810b900b90508860018601601881101561000257602002015160000b145b80156124ec57506005850180548490811015610002576000918252602082200154620100009004810b900b8860028601601881101561000257602002015160000b145b156125ff5760408051606081018252602c81527f31313a65646974426c6f636b3a4552523a636f6e666c6963742077697468206160208281019182527f6e6f7468657220626c6f636b00000000000000000000000000000000000000009383019390935261198a8054600082905260598255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192604c015b82811115612416578251826000505591602001919060010190612591565b5050600096505b505050505050949350505050565b8560001480156125e9575087846002016018811015610002576020020151600090810b145b156125f357600195505b60039390930192611d0d565b60019290920191612427565b6040805160608101825260288082527f31343a65646974426c6f636b3a535543434553533a626c6f636b20707574206f60208381019182527f6e2067726f756e64000000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101925b82800160010185558215612917579182015b828111156129175782518260005055916020019190600101906126b8565b604089015182600183016030811015610002576020020151018260018301603081101561000257600092830b602091820290920191909152830151600290820b07810b148015906127445750600282826001016030811015610002579090602002015160000b0760000b6000145b156127765781816030811015610002576020020151600101828260308110156100025760009290920b60209290920201525b600092505b60058501548310801561278c575085155b1561290357600585018054849081101561000257600091825260208083209190910154908b015190820b90910b90838360308110156100025760200201510160000b1480156128135750600585018054849081101561000257602060009081209281529101546101009004810b900b8260018301603081101561000257602002015160000b145b801561285f5750600585018054849081101561000257600091825260208220015460608b015162010000909104820b90910b90836002840160308110156100025760200201510160000b145b1561290b576040805160608101825260298082527f31323a65646974426c6f636b3a535543434553533a626c6f636b20707574206f60208381019182527f6e20616e6f746865720000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101926126a6565b60030161229a565b6001929092019161277b565b50612923929150610c56565b5050600196506125b6565b600092505b505092915050565b8491505b60008460000b121561295657506000198302612959565b50825b602160ff82161161299e5760028460000b0760000b6000141515612a06578460000b60311913158015612990575060318560000b13155b1561292e5760019250612933565b60008460000b121580156129b6575060008560000b12155b806129d2575060008460000b1280156129d2575060008560000b135b15612a1a5760028460000b0760000b6000141515612a485760c660028302600383020160ff161161292e5760019250612933565b603160ff83161161292e5760019250612933565b60028460000b0760000b60001415612a485760c660028302600383020160ff161161292e5760019250612933565b60c660ff60018401600202600019840160030201161161292e576001925061293356962cd36cf694aa154c5d3a551f19c98f356d906e96828eeb616e16fae64157389122e0c2cf84605d9b01a64c349fe202a66c35f9275f5369bd0bb827330d7391
compile2:606060405236156100c45760e060020a600035046310c1952f81146100ea578063182db370146101155780632d49ffcd1461017f5780632ef761d31461018e57806341c0e1b5146102fb57806354385526146103065780637d5fec5a1461043d5780638435be4b146104ac5780638cae1374146104e757806390fd53ec1461063857806393eec1fb14610720578063a55cab95146107d4578063d39eb3011461086f578063e039e4a11461090a578063f2a75fe41461094b578063fa93019c14610977575b610a45604051600160a060020a03321690600090349082818181858883f150505050505b565b610a456119875433600160a060020a03908116911614156100e85761198b805460ff19166001179055565b610a47604080516020818101835260008252825161198a805460026001821615610100026000190190911604601f810184900484028301840190955284825292939092918301828280156121d95780601f106121ae576101008083540402835291602001916121d9565b610ab55b61198b5460ff165b90565b610a4560043560243560006001836021811015610002575060c6840201826021811015610002579090600602016000508054909150600160a060020a0316600014156110195734670de0b6b3a7640000141580610265575060408051611989547f4166c1fd00000000000000000000000000000000000000000000000000000000825260ff8087166004840152851660248301529151607d92600160a060020a031691634166c1fd91604482810192602092919082900301816000876161da5a03f1156100025750506040515160ff169190911090505b156110e457604051600160a060020a03321690600090349082818181858883f1506040818101905260208082527f333a62757954696c653a4552523a77726f6e672076616c206f7220776174657291810191825261198a805494819052945060026001851615610100026000190190941693909304601f01839004600080516020612a8b833981519152908101939250906110b4565b610a456121e5610183565b604080516020604435600481810135601f8101849004840285018401909552848452610a459481359460248035959394606494929391019181908401838280828437509496505050505050506000670de0b6b3a76400003414610daf57604051600160a060020a033216908290349082818181858883f150606081016040908152602482527f34313a7365745374617475733a4552523a76616c756520776173206e6f74203160208381019182527f20455448000000000000000000000000000000000000000000000000000000009284019290925261198a80549581905260498155955060026001861615610100026000190190951694909404601f0104600080516020612a8b833981519152908101939250906044015b82811115610c4e57825182600050559160200191906001019061041f565b610a45600435602435604435600160a060020a0332166001846021811015610002575060c68502018360218110156100025790906006020160005054600160a060020a03161480610b41575061198754600160a060020a0390811632909116148015610b415750610b3f610183565b610ab560043560243560006001836021811015610002575060c684020182602181101561000257909060060201600050600401549050610945565b6040805160a0818101909252610a459160048035926024359260443592916101049160649060059083908390808284375090955050505050506000610300604051908101604052806018905b60008152602001906001900390816105335750506040805161030081019091526018815b600081526020019060019003908161055757506000905080808060018b6021811015610002575060c68c02018a6021811015610002579090600602016000508054909750600160a060020a039081163291909116146116ab5760408051808201909152601a8082527f32313a65646974426c6f636b3a4552523a6e6f74206f776e6572000000000000602092830190815261198a8054818652825160ff19166034178255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192915b5061169b929150610c56565b610a456004356024356044356000600060008360000b128061065d575060118360000b135b156112185760408051606081018252602181527f33343a6661726d54696c653a4552523a696e76616c696420626c6f636b74797060208281019182527f65000000000000000000000000000000000000000000000000000000000000009383019390935261198a8054600082905260438255909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101926041015b828111156112d7578251826000505591602001919060010190610702565b604080516020604435600481810135601f8101849004840285018401909552848452610a4594813594602480359593946064949293910191819084018382808284375094965050505050505060006001846021811015610002575060c6850201836021811015610002579090600602016000508054909150600160a060020a03908116329190911614801590610bcb575061198754600160a060020a0390811632909116148015610bc95750610bc7610183565b610a476004356024356040805160208101909152600081526001836021811015610002575060c68402018260218110156100025750506040805160026006850260c68702018101805460206001821615610100026000190190911692909204601f8101839004830284018301909452838352919290830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b610a4760043560243560408051602081019091526000815260018360218110156100025760c602016000508260218110156100025760060201600050604080516002928301805460206001821615610100026000190190911694909404601f81018590048502830185019093528282529092909190830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b610ac7600435602435600060018360218110156100025760c602018150826021811015610002576006020160005054600160a060020a031690505b92915050565b610a4560405161198754600160a060020a03908116916000913016319082818181858883f15050505050565b610ae460043560243560408051602081019091526000815260018360218110156100025760c602016000508260218110156100025760060201600050600301600050805480602002602001604051908101604052809291908181526020016000905b828210156111e3576000848152604080516020832060a08201928390529092908501916005918390855b825461010083900a900460000b815260206001928301818104948501949093039092029101808411610a035790505050505050815260200190600101906109d9565b005b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f168015610aa75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051918252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b60405180806020018281038252838181518152602001915080516000925b81841015610b2e5760208481028401015160a08083818460006004601ef1509050019260010192610b02565b925050509250505060405180910390f35b155b15610b8b57806001846021811015610002575060c685020183602181101561000257909060060201600050805473ffffffffffffffffffffffffffffffffffffffff191690911790555b505050565b820191906000526020600020905b815481529060010190602001808311610b9e57829003601f168201915b50505050509050610945565b155b155b15610c6a576040805180820190915260188082527f35303a7365744e616d653a4552523a6e6f74206f776e65720000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff191660301785555b50610cc39291505b80821115610ccb5760008155600101610c56565b81816001016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610ccf57805160ff19168380011785555b50610cff929150610c56565b505050505050565b5090565b82800160010185558215610cb7579182015b82811115610cb7578251826000505591602001919060010190610ce1565b50506040805160ff8087168252851660208201528151600080516020612a6b833981519152929181900390910190a16040805180820190915260128082527f35323a7365744e616d653a535543434553530000000000000000000000000000602092830190815261198a80546000829052825160ff191660241782559093600080516020612a8b83398151915260026001841615610100026000190190931692909204601f010481019291610c4e565b6001846021811015610002575060c6850201836021811015610002579090600602016000508054909150600160a060020a03908116329190911614801590610e19575061198754600160a060020a0390811632909116148015610e175750610e15610183565b155b155b15610ec057604051600160a060020a03321690600090349082818181858883f15060408181019052601a8082527f34333a7365745374617475733a4552523a6e6f74206f776e6572000000000000602092830190815261198a8054958190528151603460ff19909116178155955060026001861615610100026000190190951694909404601f0191909104600080516020612a8b8339815191529081019391925090610c4e565b81816002016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f1957805160ff19168380011785555b50610f49929150610c56565b82800160010185558215610f0d579182015b82811115610f0d578251826000505591602001919060010190610f2b565b505060405161198754600160a060020a031690600090349082818181858883f15060ff80891682528716602082015260408051600080516020612a6b8339815191529550918290030192509050a16040805180820190915260148082527f34343a7365745374617475733a53554343455353000000000000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff19166028178555610c4e565b6040805160608101825260228082527f353a62757954696c653a4552523a4f4f42206f7220616c7265616479206f776e60208381019182527f6564000000000000000000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101925b828001600101855582156111d0579182015b828111156111d05782518260005055916020019190600101906110c6565b60405161198754600160a060020a031690600090349082818181858883f15050835473ffffffffffffffffffffffffffffffffffffffff19163217845550506040805160ff8087168252851660208201528151600080516020612a6b83398151915293509081900390910190a16040805180820190915260118082527f343a62757954696c653a53554343455353000000000000000000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff19168380011785555b506111dc929150610c56565b5050610b8b565b505050509050610945565b5050604051600160a060020a03321690600090349082818181858883f150505050505b5050505050565b6001856021811015610002575060c6860201846021811015610002579090600602016000508054909250600160a060020a039081163291909116146112e3576040805180820190915260198082527f33313a6661726d54696c653a4552523a6e6f74206f776e657200000000000000602092830190815261198a805460008290528251603260ff19909116178255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192915b506111ee929150610c56565b6109c48260040160005054430310156113e057670de0b6b3a7640000341461144b57604051600160a060020a03321690600090349082818181858883f150606081016040908152602382527f33313a6661726d54696c653a4552523a76616c756520776173206e6f7420312060208381019182527f45544800000000000000000000000000000000000000000000000000000000009284019290925261198a80549581905260478155955060026001861615610100026000190190951694909404601f0104600080516020612a8b833981519152908101939250906043015b828111156115245782518260005055916020019190600101906113c2565b600034111561140a57604051600160a060020a03321690600090349082818181858883f150505050505b5060005b600a8160ff161015611473576003820180546001810180835591908290801582901161153757600083815260209020611537918101908301610c56565b60405161198754600160a060020a031690600090349082818181858883f1505050505061140a565b4360048301556040805160ff8781168252861660208201528151600080516020612a6b833981519152929181900390910190a16040805180820190915260138082527f33333a6661726d54696c653a5355434345535300000000000000000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff191660261785555b50611530929150610c56565b5050611211565b505050506003820180548491906000198101908110156100025750805460008281526020812091909101600019908101805460ff191660f860020a958602959095049490941790935581549092810190811015610002579082526020822001815060016101000a81548160ff021916908360f860020a90810204021790555060008260030160005060018460030160005080549050038154811015610002579082526020822001815060026101000a81548160ff021916908360f860020a908102040217905550600019826003016000506001846003016000508054905003815481101561000257906000526020600020900160005060036101000a81548160ff021916908360f860020a90810204021790555060008260030160005060018460030160005080549050038154811015610002579082526020822001815060046101000a81548160ff021916908360f860020a90810204021790555060010161140e565b50505b5050505050505050505050565b6060880151600090810b1215611786576040805160608101825260238082527f32323a65646974426c6f636b3a4552523a63616e6e6f74206869646520626c6f60208381019182527f636b730000000000000000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101925b8280016001018555821561062c579182015b8281111561062c578251826000505591602001919060010190611768565b600387015460001901891115611835576040805160608101825260298082527f32333a65646974426c6f636b3a4552523a626c6f636b20696e646578206f757460208381019182527f206f662072616e67650000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192611756565b875160000b600019141561192b5760038701805460808a015191908b908110156100025750600090815260208082208c01805460f860020a948502949094046401000000000264ff0000000019909416939093179092556040805160608101825260288082527f32343a65646974426c6f636b3a535543434553533a626c6f636b20636f6c6f728286019081527f206368616e676564000000000000000000000000000000000000000000000000929093019190915261198a8054938190529360026001851615610100026000190190941693909304601f0192909204600080516020612a8b8339815191529081019291611756565b6003870180548a9081101561000257506000908152602081208a0154810b810b808a52604080516119885460e360020a630379eaeb02825260ff9390931660048201529051600160a060020a039290921692631bcf5758926024838101936103009390839003909101908290876161da5a03f115610002575060408051610300818101808452611988548e5160e360020a630379eaeb0290925260ff919091166103048401529251919a50600160a060020a03929092169350610324808b01929190818c0301816000876161da5a03f1156100025750505060405180610300016040529450600093505b60188460ff161015611ca857602088015185856018811015610002579090602002015101858560188110156100025760009290920b602092909202015287600290906020020151858560010160188110156100025790906020020151018585600101601881101561000257600092830b602091820290920191909152860151600290820b07810b14801590611ac75750600285856001016018811015610002579090602002015160000b0760000b6000145b15611af95784846018811015610002576020020151600101858560188110156100025760009290920b60209290920201525b606088015185600286016018811015610002579090602002015101858560020160188110156100025760009290920b60209290920201526003870180548a9081101561000257506000908152602081208a01546101009004900b86856018811015610002579090602002015101868560188110156100025760009290920b60209290920201526003870180548a9081101561000257906000526020600020900160005060029054906101000a900460000b868560010160188110156100025790906020020151018685600101601881101561000257600092830b602091820290920191909152870151600290820b07810b14801590611c155750600286856001016018811015610002579090602002015160000b0760000b6000145b15611c475785846018811015610002576020020151600101868560188110156100025760009290920b60209290920201525b6003870180548a9081101561000257506000908152602081208a015463010000009004900b8660028601601881101561000257602081028201519092019160188110156100025760009290920b602092909202015260039390930192611a15565b611d5d8b8b8a8860006000600060006000610600604051908101604052806030905b6000815260200190600190039081611cca57506000905060018b6021811015610002575060c68c02018a6021811015610002579090600602016000509450600093505b60188460ff16101561221557612390888560188110156100025760200201518960018701601881101561000257602002015160006000600060008560000b121561293b576000198502915061293f565b1515611d685761169e565b6000876003016000508a815481101561000257508152602081208a015463010000009004810b810b12611f6257600092505b60188360ff161015611fa357600091505b6005870154821015612013576005870180548390811015610002576000918252602082200154810b900b86846018811015610002579090602002015160000b148015611e2f575060058701805483908110156100025760206000908120909101546101009004810b900b90508660018501601881101561000257602002015160000b145b8015611e7257506005870180548390811015610002576000918252602082200154620100009004810b900b8660028501601881101561000257602002015160000b145b15611f5657848360188110156100025760200201516005880180548490811015610002576000918252602090912001805460ff191660f860020a9283029290920491909117905584600184016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a90810204021790555084836002016018811015610002576020020151600588018054849081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a9081020402179055505b60019190910190611dab565b5060005b60188160ff161015611fa3576005870180546001810180835590919082801582901161201f5760008381526020902061201f918101908301610c56565b87876003016000508a815481101561000257506000908152602081208b01916001830191839060a08301905b8382111561212c57835183826101000a81548160ff021916908360f860020a9081020402179055509260200192600101602081600001049283019260010302611fcf565b60039290920191611d9a565b505050508481601881101561000257602002015160058801805460001981019081101561000257906000526020600020900160005060006101000a81548160ff021916908360f860020a908102040217905550848160010160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060016101000a81548160ff021916908360f860020a908102040217905550848160020160188110156100025760058901805460209290920290920151919060001981019081101561000257906000526020600020900160005060026101000a81548160ff021916908360f860020a908102040217905550600301611f66565b80156121595782816101000a81549060ff021916905560010160208160000104928301926001030261212c565b505061217a9291505b80821115610ccb57805460ff19168155600101612162565b50506040805160ff8d811682528c1660208201528151600080516020612a6b833981519152929181900390910190a161169e565b820191906000526020600020905b8154815290600101906020018083116121bc57829003601f168201915b5050505050905061018b565b15801561220157506119875433600160a060020a039081169116145b156100e85761198754600160a060020a0316ff5b856000141561260b5761198854600160a060020a0316630878bc518a60006040805192517f0878bc5100000000000000000000000000000000000000000000000000000000845260ff166004840152516024838101936106009390839003909101908290876161da5a03f1156100025750505060405180610600016040529150600090505b60308160ff161080156122ab575085155b1561230e5781816030811015610002576020020151600090810b1480156122e7575081816001016030811015610002576020020151600090810b145b8015612308575081816002016030811015610002576020020151600090810b145b156126d6575b6040805180820190915260198082527f31333a65646974426c6f636b3a4552523a666c6f6174696e6700000000000000602092830190815261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b8339815191529081019291805160ff19166032178555612416565b1515612422576040805180820190915260148082527f31303a65646974426c6f636b3a4552523a4f4f42000000000000000000000000602092830190815261198a805460008290528251602860ff19909116178255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192915b506125af929150610c56565b600092505b60058501548310156125c4576005850180548490811015610002576000918252602082200154810b900b8885601881101561000257602002015160000b1480156124a9575060058501805484908110156100025760206000908120909101546101009004810b900b90508860018601601881101561000257602002015160000b145b80156124ec57506005850180548490811015610002576000918252602082200154620100009004810b900b8860028601601881101561000257602002015160000b145b156125ff5760408051606081018252602c81527f31313a65646974426c6f636b3a4552523a636f6e666c6963742077697468206160208281019182527f6e6f7468657220626c6f636b00000000000000000000000000000000000000009383019390935261198a8054600082905260598255909360026001831615610100026000190190921691909104601f0104600080516020612a8b83398151915290810192604c015b82811115612416578251826000505591602001919060010190612591565b5050600096505b505050505050949350505050565b8560001480156125e9575087846002016018811015610002576020020151600090810b145b156125f357600195505b60039390930192611d0d565b60019290920191612427565b6040805160608101825260288082527f31343a65646974426c6f636b3a535543434553533a626c6f636b20707574206f60208381019182527f6e2067726f756e64000000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101925b82800160010185558215612917579182015b828111156129175782518260005055916020019190600101906126b8565b604089015182600183016030811015610002576020020151018260018301603081101561000257600092830b602091820290920191909152830151600290820b07810b148015906127445750600282826001016030811015610002579090602002015160000b0760000b6000145b156127765781816030811015610002576020020151600101828260308110156100025760009290920b60209290920201525b600092505b60058501548310801561278c575085155b1561290357600585018054849081101561000257600091825260208083209190910154908b015190820b90910b90838360308110156100025760200201510160000b1480156128135750600585018054849081101561000257602060009081209281529101546101009004810b900b8260018301603081101561000257602002015160000b145b801561285f5750600585018054849081101561000257600091825260208220015460608b015162010000909104820b90910b90836002840160308110156100025760200201510160000b145b1561290b576040805160608101825260298082527f31323a65646974426c6f636b3a535543434553533a626c6f636b20707574206f60208381019182527f6e20616e6f746865720000000000000000000000000000000000000000000000939094019290925261198a80546000829052909360026001831615610100026000190190921691909104601f0104600080516020612a8b833981519152908101926126a6565b60030161229a565b6001929092019161277b565b50612923929150610c56565b5050600196506125b6565b600092505b505092915050565b8491505b60008460000b121561295657506000198302612959565b50825b602160ff82161161299e5760028460000b0760000b6000141515612a06578460000b60311913158015612990575060318560000b13155b1561292e5760019250612933565b60008460000b121580156129b6575060008560000b12155b806129d2575060008460000b1280156129d2575060008560000b135b15612a1a5760028460000b0760000b6000141515612a485760c660028302600383020160ff161161292e5760019250612933565b603160ff83161161292e5760019250612933565b60028460000b0760000b60001415612a485760c660028302600383020160ff161161292e5760019250612933565b60c660ff60018401600202600019840160030201161161292e576001925061293356962cd36cf694aa154c5d3a551f19c98f356d906e96828eeb616e16fae64157389122e0c2cf84605d9b01a64c349fe202a66c35f9275f5369bd0bb827330d7391
*/
contract BlockDefStorage
{
function getOccupies(uint8 blocktype) public returns (int8[24])
{}
function getAttachesto(uint8 blocktype) public returns (int8[48])
{}
}
contract MapElevationRetriever
{
function getElevation(uint8 col, uint8 row) public constant returns (uint8)
{}
}
contract Etheria
{
event TileChanged(uint8 col, uint8 row);//, address owner, string name, string status, uint lastfarm, address[] offerers, uint[] offers, int8[5][] blocks);
uint8 mapsize = 33;
Tile[33][33] tiles;
address creator;
struct Tile
{
address owner;
string name;
string status;
int8[5][] blocks; //0 = blocktype,1 = blockx,2 = blocky,3 = blockz, 4 = color
uint lastfarm;
int8[3][] occupado; // the only one not reported in the //TileChanged event
}
BlockDefStorage bds;
MapElevationRetriever mer;
function Etheria() {
creator = tx.origin;
bds = BlockDefStorage(0xd4e686a1fbf1bfe058510f07cd3936d3d5a70589);
mer = MapElevationRetriever(0x68549d7dbb7a956f955ec1263f55494f05972a6b);
}
function getOwner(uint8 col, uint8 row) public constant returns(address)
{
return tiles[col][row].owner; // no harm if col,row are invalid
}
function setOwner(uint8 col, uint8 row, address newowner)
{
if(tiles[col][row].owner == tx.origin ||
(tx.origin == creator && !getLocked()))
tiles[col][row].owner = newowner; // needs whathappened here.
}
/***
* _ _ ___ ___ ___ _____ _____ _____ ___ _____ _ _ _____
* | \ | | / _ \ | \/ || ___| ___ / ___|_ _/ _ \_ _| | | / ___|
* | \| |/ /_\ \| . . || |__ ( _ ) \ `--. | |/ /_\ \| | | | | \ `--.
* | . ` || _ || |\/| || __| / _ \/\ `--. \ | || _ || | | | | |`--. \
* | |\ || | | || | | || |___ | (_> < /\__/ / | || | | || | | |_| /\__/ /
* \_| \_/\_| |_/\_| |_/\____/ \___/\/ \____/ \_/\_| |_/\_/ \___/\____/
*
*
*/
function getName(uint8 col, uint8 row) public constant returns(string)
{
return tiles[col][row].name; // no harm if col,row are invalid
}
function setName(uint8 col, uint8 row, string _n) public
{
Tile tile = tiles[col][row];
if(tile.owner != tx.origin && !(tx.origin == creator && !getLocked()))
{
whathappened = "50:setName:ERR:not owner";
return;
}
tile.name = _n;
TileChanged(col,row);
whathappened = "52:setName:SUCCESS";
return;
}
function getStatus(uint8 col, uint8 row) public constant returns(string)
{
return tiles[col][row].status; // no harm if col,row are invalid
}
function setStatus(uint8 col, uint8 row, string _s) public // setting status costs 1 eth to prevent spam
{
if(msg.value != 1000000000000000000)
{
tx.origin.send(msg.value); // return their money
whathappened = "41:setStatus:ERR:value was not 1 ETH";
return;
}
Tile tile = tiles[col][row];
if(tile.owner != tx.origin && !(tx.origin == creator && !getLocked()))
{
tx.origin.send(msg.value); // return their money
whathappened = "43:setStatus:ERR:not owner";
return;
}
tile.status = _s;
creator.send(msg.value);
TileChanged(col,row);
whathappened = "44:setStatus:SUCCESS";
return;
}
/***
* ______ ___ _________ ________ _ _ _____ ___________ _____ _____ _____ _ _ _____
* | ___/ _ \ | ___ \ \/ |_ _| \ | | __ \ ___ | ___| _ \_ _|_ _|_ _| \ | | __ \
* | |_ / /_\ \| |_/ / . . | | | | \| | | \/ ( _ ) | |__ | | | | | | | | | | | \| | | \/
* | _|| _ || /| |\/| | | | | . ` | | __ / _ \/\ | __|| | | | | | | | | | | . ` | | __
* | | | | | || |\ \| | | |_| |_| |\ | |_\ \ | (_> < | |___| |/ / _| |_ | | _| |_| |\ | |_\ \
* \_| \_| |_/\_| \_\_| |_/\___/\_| \_/\____/ \___/\/ \____/|___/ \___/ \_/ \___/\_| \_/\____/
*
*/
function getLastFarm(uint8 col, uint8 row) public constant returns (uint)
{
return tiles[col][row].lastfarm;
}
function farmTile(uint8 col, uint8 row, int8 blocktype) public
{
if(blocktype < 0 || blocktype > 17) // invalid blocktype
{
whathappened = "34:farmTile:ERR:invalid blocktype";
tx.origin.send(msg.value); // in case they sent ether, return it.
return;
}
Tile tile = tiles[col][row];
if(tile.owner != tx.origin)
{
whathappened = "31:farmTile:ERR:not owner";
tx.origin.send(msg.value); // in case they sent ether, return it.
return;
}
if((block.number - tile.lastfarm) < 2500) // ~12 hours of blocks
{
if(msg.value != 1000000000000000000)
{
tx.origin.send(msg.value); // return their money
whathappened = "31:farmTile:ERR:value was not 1 ETH";
return;
}
else // they paid 1 ETH
{
creator.send(msg.value);
// If they haven't waited long enough, but they've paid 1 eth, let them farm again.
}
}
else
{
if(msg.value > 0) // they've waited long enough but also sent money. Return it and continue normally.
{
tx.origin.send(msg.value); // return their money
}
}
// by this point, they've either waited 2500 blocks or paid 1 ETH
for(uint8 i = 0; i < 10; i++)
{
tile.blocks.length+=1;
tile.blocks[tile.blocks.length - 1][0] = int8(blocktype); // blocktype 0-17
tile.blocks[tile.blocks.length - 1][1] = 0; // x
tile.blocks[tile.blocks.length - 1][2] = 0; // y
tile.blocks[tile.blocks.length - 1][3] = -1; // z
tile.blocks[tile.blocks.length - 1][4] = 0; // color
}
tile.lastfarm = block.number;
TileChanged(col,row);
whathappened = "33:farmTile:SUCCESS";
return;
}
function editBlock(uint8 col, uint8 row, uint index, int8[5] _block)
{
Tile tile = tiles[col][row];
if(tile.owner != tx.origin) // 1. DID THE OWNER SEND THIS MESSAGE?
{
whathappened = "21:editBlock:ERR:not owner";
return;
}
if(_block[3] < 0) // 2. IS THE Z LOCATION OF THE BLOCK BELOW ZERO? BLOCKS CANNOT BE HIDDEN
{
whathappened = "22:editBlock:ERR:cannot hide blocks";
return;
}
if(index > (tile.blocks.length-1))
{
whathappened = "23:editBlock:ERR:block index out of range";
return;
}
if(_block[0] == -1) // user has signified they want to only change the color of this block
{
tile.blocks[index][4] = _block[4];
whathappened = "24:editBlock:SUCCESS:block color changed";
return;
}
_block[0] = tile.blocks[index][0]; // can't change the blocktype, so set it to whatever it already was
int8[24] memory didoccupy = bds.getOccupies(uint8(_block[0]));
int8[24] memory wouldoccupy = bds.getOccupies(uint8(_block[0]));
for(uint8 b = 0; b < 24; b+=3) // always 8 hexes, calculate the didoccupy
{
wouldoccupy[b] = wouldoccupy[b]+_block[1];
wouldoccupy[b+1] = wouldoccupy[b+1]+_block[2];
if(wouldoccupy[1] % 2 != 0 && wouldoccupy[b+1] % 2 == 0) // if anchor y is odd and this hex y is even, (SW NE beam goes 11,`2`2,23,`3`4,35,`4`6,47,`5`8 ` = x value incremented by 1. Same applies to SW NE beam from 01,12,13,24,25,36,37,48)
wouldoccupy[b] = wouldoccupy[b]+1; // then offset x by +1
wouldoccupy[b+2] = wouldoccupy[b+2]+_block[3];
didoccupy[b] = didoccupy[b]+tile.blocks[index][1];
didoccupy[b+1] = didoccupy[b+1]+tile.blocks[index][2];
if(didoccupy[1] % 2 != 0 && didoccupy[b+1] % 2 == 0) // if anchor y and this hex y are both odd,
didoccupy[b] = didoccupy[b]+1; // then offset x by +1
didoccupy[b+2] = didoccupy[b+2]+tile.blocks[index][3];
}
if(!isValidLocation(col,row,_block, wouldoccupy))
{
return; // whathappened is already set
}
// EVERYTHING CHECKED OUT, WRITE OR OVERWRITE THE HEXES IN OCCUPADO
if(tile.blocks[index][3] >= 0) // If the previous z was greater than 0 (i.e. not hidden) ...
{
for(uint8 l = 0; l < 24; l+=3) // loop 8 times,find the previous occupado entries and overwrite them
{
for(uint o = 0; o < tile.occupado.length; o++)
{
if(didoccupy[l] == tile.occupado[o][0] && didoccupy[l+1] == tile.occupado[o][1] && didoccupy[l+2] == tile.occupado[o][2]) // x,y,z equal?
{
tile.occupado[o][0] = wouldoccupy[l]; // found it. Overwrite it
tile.occupado[o][1] = wouldoccupy[l+1];
tile.occupado[o][2] = wouldoccupy[l+2];
}
}
}
}
else // previous block was hidden
{
for(uint8 ll = 0; ll < 24; ll+=3) // add the 8 new hexes to occupado
{
tile.occupado.length++;
tile.occupado[tile.occupado.length-1][0] = wouldoccupy[ll];
tile.occupado[tile.occupado.length-1][1] = wouldoccupy[ll+1];
tile.occupado[tile.occupado.length-1][2] = wouldoccupy[ll+2];
}
}
tile.blocks[index] = _block;
TileChanged(col,row);
return;
}
function getBlocks(uint8 col, uint8 row) public constant returns (int8[5][])
{
return tiles[col][row].blocks; // no harm if col,row are invalid
}
/***
* _________________ ___________ _____
* | _ | ___| ___| ___| ___ \/ ___|
* | | | | |_ | |_ | |__ | |_/ /\ `--.
* | | | | _| | _| | __|| / `--. \
* \ \_/ / | | | | |___| |\ \ /\__/ /
* \___/\_| \_| \____/\_| \_|\____/
*
*/
// three success conditions:
// 1. Valid offer on unowned tile. (whathap = 4)
// 2. Valid offer on owned tile where offerer did not previously have an offer on file (whathap = 7)
// 3. Valid offer on owned tile where offerer DID have a previous offer on file (whathap = 6)
function buyTile(uint8 col, uint8 row)
{
Tile tile = tiles[col][row];
if(tile.owner == address(0x0000000000000000000000000000000000000000)) // if UNOWNED
{
if(msg.value != 1000000000000000000 || mer.getElevation(col,row) < 125) // 1 ETH is the starting value. If not return; // Also, if below sea level, return.
{
tx.origin.send(msg.value); // return their money
whathappened = "3:buyTile:ERR:wrong val or water";
return;
}
else
{
creator.send(msg.value); // this was a valid offer, send money to contract creator
tile.owner = tx.origin; // set tile owner to the buyer
TileChanged(col,row);
whathappened = "4:buyTile:SUCCESS";
return;
}
}
else
{
whathappened = "5:buyTile:ERR:OOB or already owned";
return;
}
}
/***
* _ _ _____ _____ _ _____ _______ __
* | | | |_ _|_ _| | |_ _|_ _\ \ / /
* | | | | | | | | | | | | | | \ V /
* | | | | | | | | | | | | | | \ /
* | |_| | | | _| |_| |_____| |_ | | | |
* \___/ \_/ \___/\_____/\___/ \_/ \_/
*
*/
// this logic COULD be reduced a little, but the gain is minimal and readability suffers
function blockHexCoordsValid(int8 x, int8 y) private constant returns (bool)
{
uint8 absx;
uint8 absy;
if(x < 0)
absx = uint8(x*-1);
else
absx = uint8(x);
if(y < 0)
absy = uint8(y*-1);
else
absy = uint8(y);
if(absy <= 33) // middle rectangle
{
if(y % 2 != 0 ) // odd
{
if(-50 <= x && x <= 49)
return true;
}
else // even
{
if(absx <= 49)
return true;
}
}
else
{
if((y >= 0 && x >= 0) || (y < 0 && x > 0)) // first or 4th quadrants
{
if(y % 2 != 0 ) // odd
{
if (((absx*2) + (absy*3)) <= 198)
return true;
}
else // even
{
if ((((absx+1)*2) + ((absy-1)*3)) <= 198)
return true;
}
}
else
{
if(y % 2 == 0 ) // even
{
if (((absx*2) + (absy*3)) <= 198)
return true;
}
else // odd
{
if ((((absx+1)*2) + ((absy-1)*3)) <= 198)
return true;
}
}
}
return false;
}
// SEVERAL CHECKS TO BE PERFORMED
// 1. DID THE OWNER SEND THIS MESSAGE? (SEE editBlock)
// 2. IS THE Z LOCATION OF THE BLOCK BELOW ZERO? BLOCKS CANNOT BE HIDDEN AFTER SHOWING (SEE editBlock)
// 3. DO ANY OF THE PROPOSED HEXES FALL OUTSIDE OF THE TILE?
// 4. DO ANY OF THE PROPOSED HEXES CONFLICT WITH ENTRIES IN OCCUPADO?
// 5. DO ANY OF THE BLOCKS TOUCH ANOTHER?
// 6. NONE OF THE OCCUPY BLOCKS TOUCHED THE GROUND. BUT MAYBE THEY TOUCH ANOTHER BLOCK?
function isValidLocation(uint8 col, uint8 row, int8[5] _block, int8[24] wouldoccupy) private constant returns (bool)
{
bool touches;
Tile tile = tiles[col][row]; // since this is a private method, we don't need to check col,row validity
for(uint8 b = 0; b < 24; b+=3) // always 8 hexes, calculate the wouldoccupy and the didoccupy
{
if(!blockHexCoordsValid(wouldoccupy[b], wouldoccupy[b+1])) // 3. DO ANY OF THE PROPOSED HEXES FALL OUTSIDE OF THE TILE?
{
whathappened = "10:editBlock:ERR:OOB";
return false;
}
for(uint o = 0; o < tile.occupado.length; o++) // 4. DO ANY OF THE PROPOSED HEXES CONFLICT WITH ENTRIES IN OCCUPADO?
{
if(wouldoccupy[b] == tile.occupado[o][0] && wouldoccupy[b+1] == tile.occupado[o][1] && wouldoccupy[b+2] == tile.occupado[o][2]) // do the x,y,z entries of each match?
{
whathappened = "11:editBlock:ERR:conflict with another block";
return false; // this hex conflicts. The proposed block does not avoid overlap. Return false immediately.
}
}
if(touches == false && wouldoccupy[b+2] == 0) // 5. DO ANY OF THE BLOCKS TOUCH ANOTHER? (GROUND ONLY FOR NOW)
{
touches = true; // once true, always true til the end of this method. We must keep looping to check all the hexes for conflicts and tile boundaries, though, so we can't return true here.
}
}
// now if we're out of the loop and here, there were no conflicts and the block was found to be in the tile boundary.
// touches may be true or false, so we need to check
if(touches == false) // 6. NONE OF THE OCCUPY BLOCKS TOUCHED THE GROUND. BUT MAYBE THEY TOUCH ANOTHER BLOCK?
{
int8[48] memory attachesto = bds.getAttachesto(uint8(_block[0]));
for(uint8 a = 0; a < 48 && !touches; a+=3) // always 8 hexes, calculate the wouldoccupy and the didoccupy
{
if(attachesto[a] == 0 && attachesto[a+1] == 0 && attachesto[a+2] == 0) // there are no more attachestos available, break (0,0,0 signifies end)
break;
//attachesto[a] = attachesto[a]+_block[1];
attachesto[a+1] = attachesto[a+1]+_block[2];
if(attachesto[1] % 2 != 0 && attachesto[a+1] % 2 == 0) // (for attachesto, anchory is the same as for occupies, but the z is different. Nothing to worry about)
attachesto[a] = attachesto[a]+1; // then offset x by +1
//attachesto[a+2] = attachesto[a+2]+_block[3];
for(o = 0; o < tile.occupado.length && !touches; o++)
{
if((attachesto[a]+_block[1]) == tile.occupado[o][0] && attachesto[a+1] == tile.occupado[o][1] && (attachesto[a+2]+_block[3]) == tile.occupado[o][2]) // a valid attachesto found in occupado?
{
whathappened = "12:editBlock:SUCCESS:block put on another";
return true; // in bounds, didn't conflict and now touches is true. All good. Return.
}
}
}
whathappened = "13:editBlock:ERR:floating";
return false;
}
else // touches was true by virtue of a z = 0 above (touching the ground). Return true;
{
whathappened = "14:editBlock:SUCCESS:block put on ground";
return true;
}
}
string whathappened;
function getWhatHappened() public constant returns (string)
{
return whathappened;
}
/***
Return money fallback and empty random funds, if any
*/
function()
{
tx.origin.send(msg.value);
}
function empty()
{
creator.send(address(this).balance); // etheria should never hold a balance. But in case it does, at least provide a way to retrieve them.
}
/**********
Standard lock-kill methods
**********/
bool locked; // until locked, creator can kill, set names, statuses and tile ownership.
function setLocked()
{
if (msg.sender == creator)
locked = true;
}
function getLocked() public constant returns (bool)
{
return locked;
}
function kill()
{
if (!getLocked() && msg.sender == creator)
suicide(creator); // kills this contract and sends remaining funds back to creator
}
}