cs32projectsolutions

cs32projectsolutions - Project 1 Solution In this solution...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Project 1 Solution In this solution to Project 1 , here is what was affected by the addition of the history feature: The files History.h and History.cpp , containing the declaration and the implementation of the History class. The declarations of Arena::history and Arena::m_history in Arena.h . The implementations of Arena::Arena and Arena::history in Arena.cpp . The implementation of the h command in Game::play in Game.cpp . The implementations of the Player::stand and Player::move in Player.cpp . To help you understand why each header was included, and why some were not (e.g., why Arena.h does not include Robot.h ), here's a synopsis of each file: // globals.h #ifndef GLOBALS_INCLUDED #define GLOBALS_INCLUDED ... class Arena; ... #endif // GLOBALS_INCLUDED // Arena.h #ifndef ARENA_INCLUDED #define ARENA_INCLUDED #include "globals.h" Arena uses MAXROBOTS, etc. #include "History.h" Arena declares a History data member #include <string> Arena uses std::string class Robot; Arena uses Robot* class Player; Arena uses Player* class Arena { ... }; #endif // ARENA_INCLUDED // Game.h #ifndef GAME_INCLUDED #define GAME_INCLUDED #include <string> Game uses std::string class Arena; Game uses Arena*
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
class Game { ... }; #endif // GAME_INCLUDED // History.h #ifndef HISTORY_INCLUDED #define HISTORY_INCLUDED #include "globals.h" History uses MAXROWS and MAXCOLS class History { ... }; #endif // HISTORY_INCLUDED // Player.h #ifndef PLAYER_INCLUDED #define PLAYER_INCLUDED #include "globals.h" Player uses Dir #include <string> Player uses std::string class Arena; Player uses Arena* class Player { ... }; #endif // PLAYER_INCLUDED // Robot.h #ifndef ROBOT_INCLUDED #define ROBOT_INCLUDED #include "globals.h" Robot uses Dir class Arena; Robot uses Arena* class Robot { ... }; // Arena.cpp #include "Arena.h" We define Arena::Arena, etc. #include "Player.h" We use Player::Player, etc.
Background image of page 2
#include "Robot.h" We use Robot::Robot, etc. #include "History.h" We use History::History, etc. #include "globals.h" We use MAXROWS, etc. #include <iostream> We use std::cout, etc. #include <string> We use std::string #include <cstdlib> We use std::exit, etc. using namespace std; ... // Game.cpp #include "Game.h" We define Game::Game, etc. #include "Arena.h" We use Arena::Arena, etc. #include "Player.h" We use Player::move, etc. #include "History.h" We use History::display #include "globals.h" We use MAXROBOTS, etc. #include <iostream> We use std::cout, etc. #include <string> We use std::string #include <cctype> We use std::tolower #include <cstdlib> We use std::exit, etc. #include <cassert> We use assert using namespace std; ... // History.cpp #include "History.h" We define History::History, etc. #include "globals.h"
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2010 for the course CS 31 taught by Professor Melkanoff during the Fall '00 term at UCLA.

Page1 / 34

cs32projectsolutions - Project 1 Solution In this solution...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online