contract Charbetto is CommonGame, BlockRandomLibrary, BalanceInfo, PrizeLibrary, EllipticPrize16x, 
        MoneyContract, StartGame, GameManager, LinearGameLibrary, BalanceSharePrizeContract {
    constructor(address _admin) public
        CommonGame(_admin) 
        BlockRandomLibrary(250)
        BalanceInfo()
        PrizeLibrary()
        EllipticPrize16x()
        MoneyContract(
            10 finney /*1 percent*/, 
            5, /*5 developers at maximum*/
            100 finney /*10 percent*/, 
            100 finney /*10 percent*/, 
            20000, 200000)
        StartGame(5, 3)  
        GameManager()
        LinearGameLibrary(50, 1000, 3)
        // from one dollar to 1/10 of the prize
        BalanceSharePrizeContract(10 finney, 100 finney)
    {
        // not using alter methods to prevent deployment only from admin acc
        totalV = 1000;
        minLength = 20;
        maxLength = 30;
        transferInteractions = true;
    }

    //Terrible ugly hack to prevent the balance share contract to calculate the prize in wrong way
    function betInGame(uint gameId) public payable {
        bool exists = gameExists(gameId);

        if (!exists) {
            reserveBalance(msg.value);
        }

        super.betInGame(gameId);

        if (!exists) {
            freeBalance(msg.value);
        }
    }


    function isItReallyCharbetto() public pure returns (bool) {
        return true;
    }

    // The default fallback function should be specified
    function () payable public {
        processTransferInteraction();
    }
}
function betInGame(uint gameId) public payable {
        bool exists = gameExists(gameId);

        if (!exists) {
            reserveBalance(msg.value);
        }

        super.betInGame(gameId);

        if (!exists) {
            freeBalance(msg.value);
        }
    }
//Terrible ugly hack to prevent the balance share contract to calculate the prize in wrong way