#include <old_board.h>
Public Member Functions | |
| void | add (coord_t) |
| Add piece position to array. | |
| void | del (coord_t) |
| Delte piece from array. | |
| void | clear () |
| Remove all elements. | |
| uint | getLen () const |
| coord_t | operator[] (uint) const |
| string | toString () const |
| Representation. | |
| coord_t | getRandom () const |
| Random square in piece array. | |
Private Attributes | |
| coord_t | elems [MAX_PIECES] |
| uint | len |
This class is used to hold squares where pieces for one of the players are positioned, order of pieces is not fixed, just their presence is ensured.
| void PieceArray::add | ( | coord_t | elem | ) |
Add piece position to array.
Adds to the end in constant time.
| void PieceArray::del | ( | coord_t | elem | ) |
Delte piece from array.
Goes through array, when found deletes item and replaces empty space with item from the end.
1.5.7.1