HOG2
|
#include <Fling.h>
Public Member Functions | |
FlingBoard (unsigned int len=7, unsigned int high=8) | |
void | Reset () |
void | AddFling (unsigned int x, unsigned int y) |
void | AddFling (unsigned int offset) |
void | RemoveFling (unsigned int x, unsigned int y) |
void | RemoveFling (unsigned int offset) |
bool | CanMove (int which, int x, int y) const |
void | Move (int which, int x, int y) |
int | LocationAfterAction (FlingMove m) |
int | NumPieces () const |
int | GetPieceLocation (int which) const |
bool | HasPiece (int x, int y) const |
bool | HasPiece (int offset) const |
bool | HasHole (int x, int y) const |
bool | HasHole (int offset) const |
bool | HasObstacle (int x, int y) const |
bool | HasObstacle (int offset) const |
int | GetIndexInLocs (int x, int y) const |
int | GetIndexInLocs (int offset) const |
void | SetPiece (int which) |
void | ClearPiece (int which) |
void | SetHole (int which) |
void | ClearHole (int which) |
void | SetObstacle (int which) |
void | ClearObstacle (int which) |
uint64_t | GetObstacles () |
void | SetObstacles (uint64_t o) |
uint64_t | GetRawBoard () const |
uint64_t | GetRawObstacles () const |
uint64_t | GetRawHoles () const |
Public Attributes | |
unsigned int | width |
unsigned int | height |
std::vector< std::pair< int, int > > | locs |
int | currId |
Private Attributes | |
uint64_t | board |
uint64_t | obstacles |
uint64_t | holes |
|
inline |
void FlingBoard::AddFling | ( | unsigned int | offset | ) |
Definition at line 102 of file Fling.cpp.
References currId, HasPiece(), height, locs, SetPiece(), and width.
void FlingBoard::AddFling | ( | unsigned int | x, |
unsigned int | y | ||
) |
Definition at line 87 of file Fling.cpp.
References currId, HasPiece(), height, locs, SetPiece(), and width.
Referenced by GetMirror(), Fling::GetStateFromHash(), and ShiftToCorner().
bool FlingBoard::CanMove | ( | int | which, |
int | x, | ||
int | y | ||
) | const |
Definition at line 138 of file Fling.cpp.
References HasHole(), HasObstacle(), HasPiece(), height, and width.
Referenced by Fling::GetActions(), Fling::GetSuccessors(), and Fling::LegalMove().
void FlingBoard::ClearObstacle | ( | int | which | ) |
void FlingBoard::ClearPiece | ( | int | which | ) |
Definition at line 21 of file Fling.cpp.
References board.
Referenced by Fling::IncrementRank(), Move(), RemoveFling(), and Fling::unrankPlayer().
int FlingBoard::GetIndexInLocs | ( | int | offset | ) | const |
int FlingBoard::GetIndexInLocs | ( | int | x, |
int | y | ||
) | const |
Definition at line 174 of file Fling.cpp.
References width.
Referenced by Move(), and Fling::OpenGLDraw().
|
inline |
|
inline |
|
inline |
Definition at line 56 of file Fling.h.
References board.
Referenced by operator!=(), and operator==().
|
inline |
|
inline |
bool FlingBoard::HasHole | ( | int | offset | ) | const |
bool FlingBoard::HasHole | ( | int | x, |
int | y | ||
) | const |
bool FlingBoard::HasObstacle | ( | int | offset | ) | const |
bool FlingBoard::HasObstacle | ( | int | x, |
int | y | ||
) | const |
Definition at line 81 of file Fling.cpp.
References obstacles, and width.
Referenced by CanMove(), LocationAfterAction(), Move(), and Fling::OpenGLDraw().
bool FlingBoard::HasPiece | ( | int | offset | ) | const |
bool FlingBoard::HasPiece | ( | int | x, |
int | y | ||
) | const |
Definition at line 57 of file Fling.cpp.
Referenced by AddFling(), CanMove(), GetMirror(), Fling::GLLabelState(), Fling::LegalMove(), LocationAfterAction(), Move(), Fling::OpenGLDraw(), Fling::OpenGLDrawAlternate(), Fling::OpenGLDrawPlain(), and ShiftToCorner().
int FlingBoard::LocationAfterAction | ( | FlingMove | m | ) |
Definition at line 228 of file Fling.cpp.
References FlingMove::dir, HasObstacle(), HasPiece(), height, kDown, kLeft, kRight, kUp, FlingMove::startLoc, and width.
void FlingBoard::Move | ( | int | which, |
int | x, | ||
int | y | ||
) |
Definition at line 179 of file Fling.cpp.
References ClearPiece(), GetIndexInLocs(), HasObstacle(), HasPiece(), height, locs, SetPiece(), and width.
Referenced by Fling::ApplyAction(), and Fling::GetSuccessors().
void FlingBoard::RemoveFling | ( | unsigned int | offset | ) |
void FlingBoard::RemoveFling | ( | unsigned int | x, |
unsigned int | y | ||
) |
Definition at line 114 of file Fling.cpp.
Referenced by ShiftToCorner().
|
inline |
Definition at line 20 of file Fling.h.
References board, currId, holes, locs, and obstacles.
Referenced by GetMirror(), Fling::GetStateFromHash(), and Fling::unrankPlayer().
void FlingBoard::SetObstacle | ( | int | which | ) |
|
inline |
void FlingBoard::SetPiece | ( | int | which | ) |
Definition at line 15 of file Fling.cpp.
References board.
Referenced by AddFling(), Fling::IncrementRank(), Move(), and Fling::unrankPlayer().
|
private |
Definition at line 62 of file Fling.h.
Referenced by ClearPiece(), FlingBoard(), GetRawBoard(), HasPiece(), Reset(), and SetPiece().
int FlingBoard::currId |
Definition at line 60 of file Fling.h.
Referenced by AddFling(), FlingBoard(), Fling::OpenGLDraw(), and Reset().
unsigned int FlingBoard::height |
Definition at line 44 of file Fling.h.
Referenced by AddFling(), CanMove(), GetMirror(), Fling::GetStateFromHash(), Fling::GetXYFromPoint(), Fling::GLLabelState(), Fling::IncrementRank(), LocationAfterAction(), Move(), Fling::OpenGLDraw(), Fling::OpenGLDrawAlternate(), Fling::OpenGLDrawPlain(), operator!=(), operator==(), Fling::rankPlayer(), Fling::rankPlayerFirstTwo(), Fling::rankPlayerRemaining(), RemoveFling(), ShiftToCorner(), and Fling::unrankPlayer().
|
private |
Definition at line 64 of file Fling.h.
Referenced by ClearHole(), FlingBoard(), GetRawHoles(), HasHole(), Reset(), and SetHole().
std::vector<std::pair<int, int> > FlingBoard::locs |
Definition at line 46 of file Fling.h.
Referenced by AddFling(), Fling::GetActions(), GetIndexInLocs(), GetPieceLocation(), Fling::GetSuccessors(), Fling::IncrementRank(), Move(), NumPieces(), Fling::OpenGLDraw(), Fling::rankPlayer(), Fling::rankPlayerFirstTwo(), Fling::rankPlayerRemaining(), RemoveFling(), Reset(), and Fling::unrankPlayer().
|
private |
Definition at line 63 of file Fling.h.
Referenced by ClearObstacle(), FlingBoard(), GetObstacles(), GetRawObstacles(), HasObstacle(), Reset(), SetObstacle(), and SetObstacles().
unsigned int FlingBoard::width |
Definition at line 43 of file Fling.h.
Referenced by AddFling(), CanMove(), GetIndexInLocs(), GetMirror(), Fling::GetStateFromHash(), Fling::GetXYFromPoint(), Fling::GLLabelState(), HasHole(), HasObstacle(), HasPiece(), Fling::IncrementRank(), LocationAfterAction(), Move(), Fling::OpenGLDraw(), Fling::OpenGLDrawAlternate(), Fling::OpenGLDrawPlain(), operator!=(), operator==(), Fling::rankPlayer(), Fling::rankPlayerFirstTwo(), Fling::rankPlayerRemaining(), RemoveFling(), ShiftToCorner(), and Fling::unrankPlayer().