private void createGame(String gameString) { String[] valueStrings = gameString.split(","); int gid = Integer.parseInt(valueStrings[0].trim()); int white = Integer.parseInt(valueStrings[1].trim()); int black = Integer.parseInt(valueStrings[2].trim()); String srcHandle = valueStrings[3].trim(); int oppId = white; if (oppId == selfId) oppId = black; db.open(); if (db.findPlayer(oppId) == -1) { db.addPlayer(oppId, srcHandle); } db.newGame(gid, white, black); db.close(); }
private void initializeSelfData() { db.open(); selfId = db.getSelfId(); selfHandle = db.getSelfHandle(); db.close(); }