CSPP 51090: Software Construction Assignment 7: Networking

Due: Feb 26, 2006 @ 5pm

Design a new server infrastructure that simulates the administrator for a remote player. This should be a program that listens to the network, interprets the data, consults one of your existing players for the actual strategy and then sends the results back over the network.

Design a new player that accepts its strategy from a remote site, vita tcp/ip.

For now, test your new system on a local machine. Use port 8000 to communicate via TCP.


Each interaction across the network consists of a pair of messages, one in each direction. The sequence of the messages is governed by this sequence contract:

 start-game . do-move * 
The end of the game is signalled by the server just closing the connection.

The content of the messages is governed by the method type specifications in the Player interface.

  • When the server sends a start-game message, the response must be name.
  • When the server sends a do-move message, the response must be player-move.

This is the specification for the data that passes over the network connection (it builds on the test case file specification in Assignment 4):

Multiple element on a single line are always separated by a single space; with the exception of a newline (there is no space before it).


start-game :==
  start <color> <newline>

name :==
  <any-characters-except-newline> <newline>

do-move :==
  do-move
  <map> 
  <tilename> <newline>        ;; tile-id
  <meeple-count> <newline>    ;; number of meeples
  end-do-move

player-move :==
  player-move <newline>
  <pos-neg-number> <newline>  ;; x coordinate
  <pos-neg-number> <newline>  ;; y coordinate
  <r> <newline>               ;; rotation (0-3)
  <meeple-placement>
  end-player-move <newline>

meeple-placement :== <nomeeple> | <meeple>

nomeeple :==
  nomeeple <newline>

meeple :==
  meeple <side> <index> <newline>

meeple-count :==
  0 | 1 | 2 | 3 | 4 | 5 | 6 | 7

Hints First, develop the programs that can translate method calls into text messages and text messages into method calls (test the parsing!). Second, wire in your existing code and test each half independently by simulating messages from the other half for simple interactions. Finally, wire everything together and play some games.



CSPP 51090: Software Construction