function resolveBet() public {
        Bet bet = bets[msg.sender];
        uint dist = block.number - bet.height;
        require( dist < 255 && dist > 3 );
        bytes32 h1 = block.blockhash(bet.height);
        bytes32 h2 = block.blockhash(bet.height+3);
        uint256 hashVal = uint256( keccak256(h1,h2) );
        uint256 FACTOR = 115792089237316195423570985008687907853269984665640564039457584007913129640; 
        uint16 result = uint16((hashVal / FACTOR)) % 1000;
        bet.height = 0;
        if( result <= 495 ) { 
            msg.sender.transfer(address(this).balance);
        }
        
        emit Result(hashVal, result);
    }