This file contains hidden or 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 experimental ABIEncoderV2; | |
pragma solidity ^0.4.23; | |
contract BattleHash { | |
uint256 public numGames; | |
modifier validShot(uint256 gameId) { | |
Game storage game = games[gameId]; | |
address lastShooter = getLastShooter(game); |
This file contains hidden or 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.4.21; | |
contract GCDLCMCache { | |
mapping (bytes32 => uint256) public cache; | |
enum CacheType { GCD, LCM } | |
function gcd(uint256[] input) |
This file contains hidden or 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
// Reference: https://radicalrafi.github.io/posts/homomorphic-encryption/ | |
// npm i --save big-integer | |
const bigInt = require('big-integer'); | |
const L = (x, n) => x.minus(1).divide(n); | |
function createEncryptor({ n, g }) { | |
return (m, r) => g.pow(m).times(r.pow(n)).mod(n.pow(2)); | |
} |
This file contains hidden or 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.4.21; | |
contract LinkedList { | |
bool public isEmpty = true; | |
uint public length = 0; | |
bytes32 public head; | |
bytes32 public tail; | |
struct LinkNode { | |
string value; |
This file contains hidden or 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.4.21; | |
contract MultiplayerGame { | |
uint[3] public SEMVER = [0, 1, 0]; | |
uint public numGames; | |
enum ListType { | |
None, | |
Whitelist, | |
Blacklist |
This file contains hidden or 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.4.10; | |
contract ReLike { | |
function ReLike() { | |
} | |
enum Rating { | |
UNRATED, | |
LIKE, | |
DISLIKE |
This file contains hidden or 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.4.11; | |
contract Wiki { | |
function Wiki() { | |
} | |
struct Diff { | |
address owner; | |
uint currentSwarmHash; |
This file contains hidden or 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.4.11; | |
contract DMail { | |
address owner; | |
function DMail() public { | |
owner = msg.sender; | |
} | |
struct Message { |
This file contains hidden or 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.4.11; | |
contract AnsweringMachine { | |
enum Status { | |
Here, | |
Busy, | |
Away | |
} | |
struct AwayStatus { |
This file contains hidden or 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.4.11; | |
contract Interviewer { | |
address public answerer; | |
address public asker; | |
function Interviewer(address _asker, address _answerer) { | |
asker = _asker; | |
answerer = _answerer; | |
} |