function bet(uint256 _tableId,uint8 _position) safe() external payable{
        uint256 _value=msg.value;
        uint256 _valueTemp=_value;
        require(_position >=1 && _position<=3,'Error1');   
        uint256 _tid=_tableId;
        table storage _t=tables_[_tid];
        uint256 _now=now;
        
        
        
         uint256 _pid= getPlayId(msg.sender);
        if(_tid==0 || _tableId>autoTableId_ ||  _t.position[_position] >0  || _t.status >=3 || (_t.status==2 && _now > _t.endTime)){
            
            _valueTemp= _position==3?mul(_value,gameConfig_.buyDrawScale):_value;
            require(_valueTemp >=gameConfig_.minBetWei && 
            _valueTemp<=gameConfig_.maxBetWei,'The amount of bet is in the range of 0.06-12 ETH');   
            require(_valueTemp%gameConfig_.minBetWei==0,'The amount of bet is in the range of 0.06-12 ETH');
            autoTableId_++;
            _tid=autoTableId_;
            _t=tables_[_tid];
           
           
           _t.betAmount=_valueTemp;
           uint8 openIndex= getOpenTableIndex();
           require(openIndex<200,'Error 8');
           openTable_[openIndex]=_tid;
           _t.openIndex=openIndex;
            
       }else{
        
        require(_t.position[1]!=_pid &&  _t.position[2]!=_pid  && _t.position[3]!=_pid,'Error7'); 
              
              if(_position==3){
                require (_value == div(_t.betAmount,gameConfig_.buyDrawScale),'Error5');
              }else{
                
                require (_value ==_t.betAmount,'Error6');
              }
       }
       _t.status++;
        
      if(_t.status==2){
         _t.endTime=add(_now,gameConfig_.countdown);
         
      
      require(address(this).balance>=gameConfig_.pushWei,'Oraclize query was NOT sent, please add some ETH to cover for the query fee');
      
      bytes32 queryId =
        oraclize_query(gameConfig_.countdown, "URL", 
        "html(https:
        CUSTOM_GASLIMIT);
       validQueryId[queryId]=_tid;
     }
        _t.position[_position]=_pid;
        emit Bet(msg.sender,_tid,_value,_position,_t.status,getPosStatus(_tid),_t.endTime);
}