public static Game updateGame(Game g) {
		System.out.println("updating game");
    	PreparedStatement updateGame = null;
    	String updateStatement;
    	if(g.isWinner() || g.isTie)
    		updateStatement =			//logic for prepared statement
			 "UPDATE Game SET g_winner = ?, g_playersTurn = ? WHERE g_id = ?";
    	else
    		updateStatement =			//logic for prepared statement
			 "UPDATE Game SET g_playersTurn = ? WHERE g_id = ?";
    	try{
    		conn = getConnection();
    		updateGame = conn.prepareStatement(updateStatement, Statement.RETURN_GENERATED_KEYS);	//get connection and declare prepared statement
    		int count = 1;
    		if(g.isWinner() || g.isTie) {
    			updateGame.setLong(count, g.getWinnerId()); 		// set input parameter 1
    			count++;
    		} 
    		updateGame.setInt(count, g.playersTurn); 		// set input parameter 2
    		count++;
    		updateGame.setLong(count, g.getId());
    		updateGame.executeUpdate(); 					// execute insert statement
    		
    		updateTilesForGame(g);
       }
       catch (SQLException | ClassNotFoundException s){
           	System.out.println("SQL statement is not executed:");
           	System.out.println(s);
       }
       finally {
           if (updateGame != null) { 
           	try {
           		updateGame.close();
				} catch (SQLException e) {
					e.printStackTrace();
				} 
           }
       }
    	return g;
    }