next up previous
Next: C++ Implementation 6/11 Up: Von C++ zu Java Previous: C++ Implementation 4/11

C++ Implementation 5/11

Board.h

#ifndef __BOARD_H__
#define __BOARD_H__ 

#include "FourInaRow.h"
#include "Cell.h"

class Board 
{
public:
  Board(const int rows=DEF_ROWS, const int columns=DEF_COLUMNS);
  void reset(const int rows=DEF_ROWS, const int columns=DEF_COLUMNS);
  void drop_in_column(const int, const Counter);
  Boolean move_ok_for_column(const int) const;
  void display(void) const;
  BoardState situation(void) const;
protected:
  int check_for_a_win(const int, const int, const int, const char) const;
  void add_counter_to_board(const int, const Counter);
  Boolean is_there_a_win(void) const;
private:
  Cell the_grid[MAXROW][MAXCOLUMN]; // Board played on
  int the_height[MAXCOLUMN]; // Current height of counters col
  int the_row_size;
  int the_column_size; // Size of playing area
  int the_last_col;
  int the_last_row; // Last counter placed
  int the_no_empty_cells; // No. of cells still empty
};

#endif


next up previous
Next: C++ Implementation 6/11 Up: Von C++ zu Java Previous: C++ Implementation 4/11

© 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 3/19/1998