public IGameMove decideMove(IGameState state){
  if (state.isDraw())   return null;
  if (state.isWin())   return null;
  Collection<IGameMove> moves=logic.validMoves(this,state);
  if (moves.size() == 0) {
    return null;
  }
 else {
    IGameMove[] mvs=moves.toArray(new IGameMove[]{});
    int idx=(int)(Math.random() * moves.size());
    return mvs[idx];
  }
}

public IGameMove decideMove ( IGameState state ) { if ( state . isDraw ( ) ) return null ; if ( state . isWin ( ) ) return null ; Collection < IGameMove > moves = logic . validMoves ( this , state ) ; if ( moves . size ( ) == 0 ) { return null ; } else { IGameMove [ ] mvs = moves . toArray ( new IGameMove [ ] { } ) ; int idx = ( int ) ( Math . random ( ) * moves . size ( ) ) ; return mvs [ idx ] ; } }
randomly make a move based upon the available logic of the game . make sure you check that the game is not already won , lost or drawn before calling this method , because you
