From 8c1f08f2133de108fd354dd07c65e0c24ecc1d38 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 18 Jun 2009 19:37:24 -0400 Subject: Wrote Life solver --- gamestate.h | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'gamestate.h') diff --git a/gamestate.h b/gamestate.h index 727c8f1..c36bcee 100644 --- a/gamestate.h +++ b/gamestate.h @@ -2,20 +2,55 @@ #define GAMESTATE_H class GameState : public State { + public: + GameState(); + void input(SDLKey key); + void tick(); + void render(SDL_Surface* screen); + + class Level + { + private: + int level; + Uint32 alive[5]; + Uint32 dead[5]; + + public: + Level(); + int getLevel(); + int getLevelGroup(); + bool checkSquare(int x, int y); + Uint32 getAliveColor(); + Uint32 getDeadColor(); + }; + + struct Info { + int playerx, playery; + Level level; + }; + + class Board + { + private: + bool blocks[WIDTH][HEIGHT]; + void incrementIfNeighbor(int x, int y, bool temp[WIDTH][HEIGHT], int* tick); + GameState::Info* info; + + public: + Board(); + Board(GameState::Info* info); + bool isObstructed(int x, int y); + void render(SDL_Surface* screen); + void tick(); + }; + private: Uint32 player_color; - int playerx, playery; bool newGame; bool doneMaking; - Level level; + Info info; Board board; void move(int x, int y); - - public: - GameState(); - void input(SDLKey key); - void tick(); - void render(SDL_Surface* screen); }; #endif -- cgit 1.4.1