HOG2
Public Member Functions | Public Attributes | Private Attributes | List of all members
FlingBoard Class Reference

#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
 

Detailed Description

Definition at line 15 of file Fling.h.

Constructor & Destructor Documentation

◆ FlingBoard()

FlingBoard::FlingBoard ( unsigned int  len = 7,
unsigned int  high = 8 
)
inline

Definition at line 18 of file Fling.h.

References board, currId, holes, and obstacles.

Member Function Documentation

◆ AddFling() [1/2]

void FlingBoard::AddFling ( unsigned int  offset)

Definition at line 102 of file Fling.cpp.

References currId, HasPiece(), height, locs, SetPiece(), and width.

◆ AddFling() [2/2]

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().

◆ CanMove()

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().

◆ ClearHole()

void FlingBoard::ClearHole ( int  which)

Definition at line 33 of file Fling.cpp.

References holes.

◆ ClearObstacle()

void FlingBoard::ClearObstacle ( int  which)

Definition at line 45 of file Fling.cpp.

References obstacles.

◆ ClearPiece()

void FlingBoard::ClearPiece ( int  which)

Definition at line 21 of file Fling.cpp.

References board.

Referenced by Fling::IncrementRank(), Move(), RemoveFling(), and Fling::unrankPlayer().

◆ GetIndexInLocs() [1/2]

int FlingBoard::GetIndexInLocs ( int  offset) const

Definition at line 160 of file Fling.cpp.

References locs.

◆ GetIndexInLocs() [2/2]

int FlingBoard::GetIndexInLocs ( int  x,
int  y 
) const

Definition at line 174 of file Fling.cpp.

References width.

Referenced by Move(), and Fling::OpenGLDraw().

◆ GetObstacles()

uint64_t FlingBoard::GetObstacles ( )
inline

Definition at line 54 of file Fling.h.

References obstacles.

◆ GetPieceLocation()

int FlingBoard::GetPieceLocation ( int  which) const
inline

Definition at line 34 of file Fling.h.

References locs.

Referenced by Fling::IncrementRank().

◆ GetRawBoard()

uint64_t FlingBoard::GetRawBoard ( ) const
inline

Definition at line 56 of file Fling.h.

References board.

Referenced by operator!=(), and operator==().

◆ GetRawHoles()

uint64_t FlingBoard::GetRawHoles ( ) const
inline

Definition at line 58 of file Fling.h.

References holes.

◆ GetRawObstacles()

uint64_t FlingBoard::GetRawObstacles ( ) const
inline

Definition at line 57 of file Fling.h.

References obstacles.

◆ HasHole() [1/2]

bool FlingBoard::HasHole ( int  offset) const

Definition at line 63 of file Fling.cpp.

References holes.

◆ HasHole() [2/2]

bool FlingBoard::HasHole ( int  x,
int  y 
) const

Definition at line 69 of file Fling.cpp.

References holes, and width.

Referenced by CanMove(), and Fling::OpenGLDraw().

◆ HasObstacle() [1/2]

bool FlingBoard::HasObstacle ( int  offset) const

Definition at line 75 of file Fling.cpp.

References obstacles.

◆ HasObstacle() [2/2]

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().

◆ HasPiece() [1/2]

bool FlingBoard::HasPiece ( int  offset) const

Definition at line 51 of file Fling.cpp.

References board.

◆ HasPiece() [2/2]

bool FlingBoard::HasPiece ( int  x,
int  y 
) const

◆ LocationAfterAction()

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.

◆ Move()

void FlingBoard::Move ( int  which,
int  x,
int  y 
)

◆ NumPieces()

int FlingBoard::NumPieces ( ) const
inline

Definition at line 33 of file Fling.h.

References locs.

◆ RemoveFling() [1/2]

void FlingBoard::RemoveFling ( unsigned int  offset)

Definition at line 121 of file Fling.cpp.

References ClearPiece(), height, locs, and width.

◆ RemoveFling() [2/2]

void FlingBoard::RemoveFling ( unsigned int  x,
unsigned int  y 
)

Definition at line 114 of file Fling.cpp.

References height, and width.

Referenced by ShiftToCorner().

◆ Reset()

void FlingBoard::Reset ( )
inline

Definition at line 20 of file Fling.h.

References board, currId, holes, locs, and obstacles.

Referenced by GetMirror(), Fling::GetStateFromHash(), and Fling::unrankPlayer().

◆ SetHole()

void FlingBoard::SetHole ( int  which)

Definition at line 27 of file Fling.cpp.

References holes.

◆ SetObstacle()

void FlingBoard::SetObstacle ( int  which)

Definition at line 39 of file Fling.cpp.

References obstacles.

◆ SetObstacles()

void FlingBoard::SetObstacles ( uint64_t  o)
inline

Definition at line 55 of file Fling.h.

References obstacles.

◆ SetPiece()

void FlingBoard::SetPiece ( int  which)

Definition at line 15 of file Fling.cpp.

References board.

Referenced by AddFling(), Fling::IncrementRank(), Move(), and Fling::unrankPlayer().

Member Data Documentation

◆ board

uint64_t FlingBoard::board
private

Definition at line 62 of file Fling.h.

Referenced by ClearPiece(), FlingBoard(), GetRawBoard(), HasPiece(), Reset(), and SetPiece().

◆ currId

int FlingBoard::currId

Definition at line 60 of file Fling.h.

Referenced by AddFling(), FlingBoard(), Fling::OpenGLDraw(), and Reset().

◆ height

unsigned int FlingBoard::height

◆ holes

uint64_t FlingBoard::holes
private

Definition at line 64 of file Fling.h.

Referenced by ClearHole(), FlingBoard(), GetRawHoles(), HasHole(), Reset(), and SetHole().

◆ locs

std::vector<std::pair<int, int> > FlingBoard::locs

◆ obstacles

uint64_t FlingBoard::obstacles
private

◆ width

unsigned int FlingBoard::width

The documentation for this class was generated from the following files: