[Commit] rrserver dispatch.5c,1.17,1.18 games.5c,1.15,1.16
protocol,1.25,1.26 readreq.5c,1.8,1.9 rr.5c,1.9,1.10
server.5c,1.9,1.10
Keith Packard
commit at keithp.com
Sat May 31 10:13:31 PDT 2003
- Previous message: [Commit] rrserver dispatch.5c,1.16,1.17 games.5c,1.14,1.15
protocol,1.24,1.25 rr.5c,1.8,1.9 send.5c,1.6,1.7 server.5c,1.8,1.9
- Next message: [Commit] fontconfig fonts.conf.in,1.23,1.24
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/rrserver
In directory home.keithp.com:/tmp/cvs-serv17636
Modified Files:
dispatch.5c games.5c protocol readreq.5c rr.5c server.5c
Log Message:
Add NOBID command
Index: dispatch.5c
===================================================================
RCS file: /local/src/CVS/rrserver/dispatch.5c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dispatch.5c 31 May 2003 16:00:09 -0000 1.17
+++ dispatch.5c 31 May 2003 16:13:29 -0000 1.18
@@ -191,6 +191,13 @@
"ABANDON, TURN can be used to move to the next turn.\n"
},
{
+ command = "NOBID",
+ usage = "NOBID",
+ describe =
+ "Give up trying to improve bids in the current turn.\n"+
+ "When all users NOBID, game moves to SHOW state.\n"
+ },
+ {
command = "MOVE",
usage = "MOVE <color> <dir1> <dir2> ...",
describe =
@@ -451,6 +458,13 @@
respond ("ABANDON\n");
}
+ void nobid () {
+ assert_user ();
+ assert_game ();
+ Games::nobid (&c.game.game, &c);
+ respond ("NOBID\n");
+ }
+
void move (Color color, &Direction[*] directions) {
assert_user ();
assert_game ();
@@ -591,6 +605,9 @@
break;
case ABANDON:
abandon ();
+ break;
+ case NOBID:
+ nobid ();
break;
case MOVE m:
move (m.color, &m.directions);
Index: games.5c
===================================================================
RCS file: /local/src/CVS/rrserver/games.5c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- games.5c 31 May 2003 16:00:09 -0000 1.15
+++ games.5c 31 May 2003 16:13:29 -0000 1.16
@@ -153,6 +153,16 @@
iterate_client (&g, abandon_set, true, false);
return all;
}
+
+ bool all_nobid (&Game g) {
+ bool all = true;
+ void nobid_set (&Client c) {
+ if (!c.nobid)
+ all = false;
+ }
+ iterate_client (&g, nobid_set, true, false);
+ return all;
+ }
public ClientRef lowest_bidder (&Game g) {
Bid min = Bid.none;
@@ -271,6 +281,7 @@
void reset_client (&Client c) {
c.bid = Bid.none;
c.abandon = false;
+ c.nobid = false;
}
iterate_client (&g, reset_client, true, false);
game_send (&g, "NOTICE TURN %C %S\n", g.target.color, g.target.shape);
@@ -399,6 +410,7 @@
c.score = 0;
c.bid = Bid.none;
c.abandon = false;
+ c.nobid = false;
Array::append (&g.clients, &c);
game_send (&g, "NOTICE %s %s\n",
playing ? "JOIN" : "WATCH",
@@ -444,6 +456,17 @@
revoke (&g, &c);
if (all_abandon (&g))
set_state (&g, GameState.DONE);
+ }
+ }
+
+ public void nobid (&Game g, &Client c) {
+ assert_playing (&g, &c);
+ assert_bidding (&g);
+ if (!c.nobid) {
+ c.nobid = true;
+ game_send (&g, "NOTICE NOBID %s\n", c.user.username);
+ if (all_nobid (&g))
+ set_state (&g, GameState.SHOW);
}
}
Index: protocol
===================================================================
RCS file: /local/src/CVS/rrserver/protocol,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- protocol 31 May 2003 16:00:09 -0000 1.25
+++ protocol 31 May 2003 16:13:29 -0000 1.26
@@ -1,6 +1,6 @@
Ricochet Robots Game Protocol (RRGP)
- Version 0.1.1
- 2003-5-30
+ Version 0.1.2
+ 2003-5-31
Keith Packard Carl Worth
keithp at keithp.com cworth at isi.edu
@@ -303,7 +303,20 @@
Possible errors: NOTINGAME, NOTBIDDING
Mark this user as having abandoned this turn. If all users
- abandon, then 'TURN' can be used to move to the next turn.
+ abandon, then the game state is switched to DONE.
+
+ 1.5.2.4. No more bids
+
+ NOBID
+
+ ->
+
+ NOBID
+
+ Possible errors: NOTINGAME, NOTBIDDING
+
+ Mark this user as done bidding. If all users NOBID, then
+ the game state is switched to SHOW.
1.5.3. Solving commands
@@ -459,6 +472,14 @@
before bidding has closed. If all players make such
a request, the TURN command may be used to move to the next
turn.
+
+ 2.2.2.5. Nobid request
+
+ NOTICE NOBID <username>
+
+ <username> has announced that they plan on making no more bids
+ in the current turn. If all players make such a request,
+ the game moves to the SHOW state.
2.2.3. Solving notices
Index: readreq.5c
===================================================================
RCS file: /local/src/CVS/rrserver/readreq.5c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- readreq.5c 31 May 2003 02:45:27 -0000 1.8
+++ readreq.5c 31 May 2003 16:13:29 -0000 1.9
@@ -139,6 +139,9 @@
number_ (&packet);
req = (Request.BID) packet;
break;
+ case "NOBID":
+ req = Request.NOBID;
+ break;
case "REVOKE":
req = Request.REVOKE;
break;
Index: rr.5c
===================================================================
RCS file: /local/src/CVS/rrserver/rr.5c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- rr.5c 31 May 2003 16:00:09 -0000 1.9
+++ rr.5c 31 May 2003 16:13:29 -0000 1.10
@@ -105,6 +105,7 @@
struct {
int number;
} BID;
+ void NOBID;
void REVOKE;
void ABANDON;
struct {
Index: server.5c
===================================================================
RCS file: /local/src/CVS/rrserver/server.5c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- server.5c 31 May 2003 16:00:09 -0000 1.9
+++ server.5c 31 May 2003 16:13:29 -0000 1.10
@@ -80,6 +80,7 @@
Bid bid;
bool playing;
bool abandon;
+ bool nobid;
} Client;
public typedef union {
- Previous message: [Commit] rrserver dispatch.5c,1.16,1.17 games.5c,1.14,1.15
protocol,1.24,1.25 rr.5c,1.8,1.9 send.5c,1.6,1.7 server.5c,1.8,1.9
- Next message: [Commit] fontconfig fonts.conf.in,1.23,1.24
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list