# README for `mazechallenge` module ## Overview The `mazechallenge` module contains `AMstartup.c` which runs the entire game. It connects to the maze server, gets a maze port and starts n_avatar threads. * `AMstartup.c` (maze challenge driver) ## Implementation Strategy #### `AMstartup` First we connect to server and send an AM_INIT message based on user input (See usage above). Then we (hopefully) get an AM_INIT_OK from the server which contains a maze port. We open a log file. Then we start `n_avatar` threads and pass the maze port, along with a lot of other information to them (along with log file). We use a couple of helper functions: ``` /* Takes a hostname and port number and * returns a communication socket * * Parameters: * char *hostname: host of server * int port: port * Returns: * int comm_sock: communication socket */ int get_comm_sock (char *hostname, int port) ``` ``` /* Opens log file and prints the user's name, maze * port number and the date/time * * Parameters: * uint32_t maze_port * Return: * char *log_file: name of log file */ char *open_log_file (uint32_t maze_port) ``` ## Compilation To build, run `make`. To clean up, run `make clean`.