00001 /* This file is part of CrossZero 00002 * Copyright (C) 2008 Heikki Laitala 00003 * All rights reserved. 00004 * 00005 * Created: Sun Feb 17 2008 by Heikki Laitala 00006 * 00007 * $Revision:$ 00008 */ 00009 00010 #ifndef _CROSSZEROGAMEFIELD_H_ 00011 #define _CROSSZEROGAMEFIELD_H_ 00012 00013 #include <string> 00014 #include <vector> 00015 #include "CrossZeroGeometricObjects.h" 00020 class CrossZeroGameField 00021 { 00022 public: 00023 00030 CrossZeroGameField(); 00034 ~CrossZeroGameField(); 00040 CrossZeroGameField(int height, int width); 00047 bool addInput(const CrossZeroPoint<int>& point, const std::string& token); 00048 00052 void printGameField() const; 00058 bool hasPlayerWon(const std::string& strToken); 00059 00065 bool isPositionReserved(const CrossZeroPoint<int>& point) const; 00066 00071 CrossZeroPoint<int> getLatestAddedPoint() const { return _latestAddedPoint;} 00072 00077 int getFieldWidth() const { return _iFieldWidth;} 00082 int getFieldHeight() const { return _iFieldHeight;} 00083 00084 private: 00085 00092 bool isTokenOnPosition(const CrossZeroPoint<int>& point,const std::string& strToken); 00093 00094 int _iFieldHeight; 00095 int _iFieldWidth; 00096 //Contains game field data (is a matrix) 00097 std::vector<std::vector<std::string> > *_pFieldData; 00098 CrossZeroPoint<int> _latestAddedPoint; 00099 }; 00100 00101 #endif //_CROSSZEROGAMEFIELD_H_