function open(uint id)
    checkPrized(id)
    checkFounder
    checkOpen
    checkGameFinish
    {
        bytes32 max=0;
        Bet storage bet=games[id];
        bytes32 random=getLuckNumber(bet);
        address tmp;
        address[] memory users=bet.keys;
        for(uint i=0;i<users.length;i++){

            address key=users[i];
            Participant storage p=bet.participants[key];
            if(p.committed==true){
                bytes32 distance=random^p.origin;
                if(distance>max){
                    max=distance;
                    tmp=key;
                }
            }else{
                if(p.returned==false){
                    if(key.send(p.value*8/10)){
                        p.returned=true;
                    }

                }
            }

        }
        bet.lucky=tmp;
        bet.luckNumber=random;
        uint prize=bet.valiadValue*refund/100;

        founder.send((bet.valiadValue-prize));
        if(tmp.send(prize)){
            bet.prized=true;
            Open(tmp,random,prize,id);
        }

        finished=true;
    }