Play.oppselect = Play.oppmove; //reveal opponent's move only now
if (Win[Play.mymove].includes(Play.oppmove)) {
if (++Play.mypoints == MAX_POINTS) Play.endGame(true);
+ socket.emit("inc_pts", {uid: getV("uid"), gid:Play.gid});
}
else if (Win[Play.oppmove].includes(Play.mymove)) {
if (++Play.oppoints == MAX_POINTS) Play.endGame(false);
con.commit()
con.close()
+@sio.event
+def inc_pts(sid, data):
+ """ Add a point to the player (who won last round) """
+ con = sqlite3.connect(DB_PATH)
+ cur = con.cursor()
+ cur.execute("update Players set points=points+1 where uid=? and gid=?",
+ (data["uid"],data["gid"]))
+ con.commit()
+ con.close()
+
static_files = {
'/': RPSLS_PATH + 'index.html',
'/rpsls.js': RPSLS_PATH + 'rpsls.js',