Posts

Showing posts with the label #Highscore

"Highscore Contract" Example

Keep a highscore of a certain game with the assumption that the game name is unique pragma solidity ^0.4.0; contract GameHighScoreAresh{ struct GameHighScore{ string username;//the name of the user who got the highscore (unique) uint score; //the score acquired string dateOfScore; //date of highscore string game; //name of the game uint8 flag; } struct gameName { string name; uint highscore; string username; bool isData; } mapping (bytes32 => gameName) ListOfGames; mapping (bytes32 => GameHighScore) TableOfHighScore; function GameHighScoreAresh() public{ } function AddUserHighScore(string _username, uint _score, string _game) public { GameHighScore memory currentHighScore = GameHighScore(_username, _score, "_dateofScore", _game, 1); bytes32 hash = keccak256(_username, _score, "_dateofScore", _game, 1); ...