Figure 2


Pseudocode showing Web-game initialization.

#define MAX_ENTRIES 100  /* max number of CGI input fields */
#define MAXLEN 120       /* max length of a string */
/* CGI data structure for entry */
/* Data structure for Game */

int main()
{
  entry entries[MAX_ENTRIES]; /* for form's name/value pairs */
  int etnum = 0; /* number of name/value pairs in entries[] */
  Game G;
  char user_name[MAXLEN];

  start_reply("Game Initialisation"); 
/* output reply page header */
  cgi_errs();                   /* check for input headers */
  etnum = build_entries(entries);

  if (init_game(entries, etnum, &G, user_name)) {
    printf("

Hello %s

\n", user_name); display_game(G); display_form(G, user_name); } else printf("

Initialisation Error,

\n"); printf(""); return 0; }