function checkRoundAndDraw(address _addr)
        private
        returns(uint256)
    {
        if (lID_ > 0
            && round_[lID_].state == Mildatasets.RoundState.STOPPED
            && (block.number.sub(lBlockNumber_) >= 7)) {
            
            round_[lID_].drawCode = calcDrawCode();
            round_[lID_].claimDeadline = now + claimMax_;
            round_[lID_].state = Mildatasets.RoundState.DRAWN;
            round_[lID_].blockNumber = block.number;
            
            round_[rID_].roundDeadline = now + rndMax_;
            
            if (round_[rID_].pot > COMMON_REWARD_AMOUNT) {
                round_[rID_].pot = round_[rID_].pot.sub(COMMON_REWARD_AMOUNT);
                
                _addr.transfer(COMMON_REWARD_AMOUNT);
                
                emit onReward(_addr, Mildatasets.RewardType.DRAW, COMMON_REWARD_AMOUNT);
            }
            return lID_ << 96 | round_[lID_].claimDeadline << 64 | round_[lID_].drawCode << 32 | uint256(Mildatasets.TxAction.DRAW) << 8 | uint256(Mildatasets.RoundState.DRAWN);
        } else if (lID_ > 0
            && round_[lID_].state == Mildatasets.RoundState.DRAWN
            && now > round_[lID_].claimDeadline) {
            
            if (round_[lID_].totalNum > 0) {
                assignCore();
            }
            round_[lID_].state = Mildatasets.RoundState.ASSIGNED;
            
            if (round_[rID_].pot > COMMON_REWARD_AMOUNT) {
                round_[rID_].pot = round_[rID_].pot.sub(COMMON_REWARD_AMOUNT);
                
                _addr.transfer(COMMON_REWARD_AMOUNT);
                
                emit onReward(_addr, Mildatasets.RewardType.ASSIGN, COMMON_REWARD_AMOUNT);
            }
            return lID_ << 96 | uint256(Mildatasets.TxAction.ASSIGN) << 8 | uint256(Mildatasets.RoundState.ASSIGNED);
        } else if ((rID_ == 1 || round_[lID_].state == Mildatasets.RoundState.ASSIGNED)
            && now >= round_[rID_].roundDeadline) {
            
            lID_ = rID_;
            lBlockNumber_ = block.number;
            round_[lID_].state = Mildatasets.RoundState.STOPPED;

            rID_ = rID_ + 1;

            
            round_[rID_].state = Mildatasets.RoundState.STARTED;
            if (round_[lID_].pot > COMMON_REWARD_AMOUNT) {
                round_[rID_].pot = round_[lID_].pot.sub(COMMON_REWARD_AMOUNT);
                
                
                _addr.transfer(COMMON_REWARD_AMOUNT);
                
                emit onReward(_addr, Mildatasets.RewardType.END, COMMON_REWARD_AMOUNT);
            } else {
                round_[rID_].pot = round_[lID_].pot;
            }
            

            return rID_ << 96 | uint256(Mildatasets.TxAction.ENDROUND) << 8 | uint256(Mildatasets.RoundState.STARTED);
        } 
        return rID_ << 96 | uint256(Mildatasets.TxAction.BUY) << 8 | uint256(round_[rID_].state);
    }