// Represents a square on the checkers board, for example A2, or B4 class position { }; friend class game_state: private: public: }; position (void); // Default constructor void from_text(const char *str); // Sets a position from a string char *to_text(void): bool is valid( void): void operator (const position &p): void offset(const int x, const int y): class move { private: Represents a move to be made // Put in your internal representation public: move(void): move( position &from position &to); void from_text(const char *str); charto_text(void): void set from(const position &from ): void set to const position &to); position &get_from(void); position &get_to(void): class game state ( private: // Allow game state to directly access private parts // Put in your internal representation Represents the state of a game public: // Converts the internal representation to a string // Returns true if the position is valid // Copies the contents of a position into this one // Offsets a position by x in the alpha value game state void ); game_stategame_state &g); // The types of pieces enum piece { EMPTY, RED PAWN, GREEN_PAWN, RED_KING, GREEN_KING }; // From two positions // Converts a string to a move // Gets either the starting // or ending position // Put in your internal representation // Sets the from using a position // Sets the to using a position // Default constructor // Default constructor // Copy constructor // Converts the internal representation to a string game_state(): void new game (void); bool is_game_over(void); // Check the game status bool is red turn (void): bool is green_turn (void); // String must be in the form "A4-B3" // and y in the numeric value // Destructor: do any tidying up required // Initialises state for the start of a new game
// Represents a square on the checkers board, for example A2, or B4 class position { }; friend class game_state: private: public: }; position (void); // Default constructor void from_text(const char *str); // Sets a position from a string char *to_text(void): bool is valid( void): void operator (const position &p): void offset(const int x, const int y): class move { private: Represents a move to be made // Put in your internal representation public: move(void): move( position &from position &to); void from_text(const char *str); charto_text(void): void set from(const position &from ): void set to const position &to); position &get_from(void); position &get_to(void): class game state ( private: // Allow game state to directly access private parts // Put in your internal representation Represents the state of a game public: // Converts the internal representation to a string // Returns true if the position is valid // Copies the contents of a position into this one // Offsets a position by x in the alpha value game state void ); game_stategame_state &g); // The types of pieces enum piece { EMPTY, RED PAWN, GREEN_PAWN, RED_KING, GREEN_KING }; // From two positions // Converts a string to a move // Gets either the starting // or ending position // Put in your internal representation // Sets the from using a position // Sets the to using a position // Default constructor // Default constructor // Copy constructor // Converts the internal representation to a string game_state(): void new game (void); bool is_game_over(void); // Check the game status bool is red turn (void): bool is green_turn (void); // String must be in the form "A4-B3" // and y in the numeric value // Destructor: do any tidying up required // Initialises state for the start of a new game
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Write classes for representing game state and move
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY