Functions | |
bool | Ladder (const GoBoard &board, SgPoint prey, SgBlackWhite toPlay, bool fTwoLibIsEscape=false, SgVector< SgPoint > *sequence=0) |
Return whether or not the block at 'prey' can be captured in a ladder when 'toPlay' plays first. | |
GoLadderStatus | LadderStatus (const GoBoard &bd, SgPoint prey, bool fTwoLibIsEscape=false, SgPoint *toCapture=0, SgPoint *toEscape=0) |
Return whether the block at 'prey' is captured, escaped, or unsettled with regards to capture in a ladder. | |
bool | IsProtectedLiberty (const GoBoard &bd, SgPoint liberty, SgBlackWhite col, bool &byLadder, bool &isKoCut, bool tryLadder=true) |
Check if this is a chain connection point, or a ko cut point. | |
bool | IsProtectedLiberty (const GoBoard &bd, SgPoint liberty, SgBlackWhite col) |
Simple form, calls the complex form and ignores bool results. | |
SgPoint | TryLadder (const GoBoard &bd, SgPoint prey, SgBlackWhite firstPlayer) |
try to escape/capture prey block Possible return values:
|
bool GoLadderUtil::IsProtectedLiberty | ( | const GoBoard & | bd, | |
SgPoint | liberty, | |||
SgBlackWhite | col, | |||
bool & | byLadder, | |||
bool & | isKoCut, | |||
bool | tryLadder = true | |||
) |
Check if this is a chain connection point, or a ko cut point.
Try to play there as opponent, then check:
Definition at line 615 of file GoLadder.cpp.
References GoModBoard::Board(), GO_MOVEFLAG_SUICIDE, GoBoard::InAtari(), Ladder(), GoBoard::LastMoveInfo(), GoBoard::NumLiberties(), GoBoard::NumStones(), GoBoardUtil::PlayIfLegal(), GoBoard::SetToPlay(), SgOppBW(), GoBoard::TheLiberty(), GoBoard::ToPlay(), and GoBoard::Undo().
Referenced by IsProtectedLiberty().
bool GoLadderUtil::IsProtectedLiberty | ( | const GoBoard & | bd, | |
SgPoint | liberty, | |||
SgBlackWhite | col | |||
) |
Simple form, calls the complex form and ignores bool results.
Definition at line 606 of file GoLadder.cpp.
References IsProtectedLiberty().
bool GoLadderUtil::Ladder | ( | const GoBoard & | board, | |
SgPoint | prey, | |||
SgBlackWhite | toPlay, | |||
bool | fTwoLibIsEscape = false , |
|||
SgVector< SgPoint > * | sequence = 0 | |||
) |
Return whether or not the block at 'prey' can be captured in a ladder when 'toPlay' plays first.
True means capture, false means escape. If 'sequence' is not 0, return a sequence of moves to capture or escape (need not be the optimal sequence). Return an empty sequence if the prey is already captured or has escaped, without needing to play a move. If the prey can be temporarily removed from the board but can capture back immediately (snapback), return that the prey cannot be captured.
Definition at line 537 of file GoLadder.cpp.
References GoBoard::GetHashCode(), GoBoard::IsValidPoint(), GoLadder::Ladder(), GoBoard::Occupied(), and SG_ASSERT.
Referenced by IsProtectedLiberty(), and TryLadder().
GoLadderStatus GoLadderUtil::LadderStatus | ( | const GoBoard & | bd, | |
SgPoint | prey, | |||
bool | fTwoLibIsEscape = false , |
|||
SgPoint * | toCapture = 0 , |
|||
SgPoint * | toEscape = 0 | |||
) |
Return whether the block at 'prey' is captured, escaped, or unsettled with regards to capture in a ladder.
If it is unsettled, set '*toCapture' and '*toEscape' (if not 0) to the capturing/escaping move to play. Otherwise, leave '*toCapture' and '*toEscape' unchanged. The point at 'prey' must be occupied.
Definition at line 561 of file GoLadder.cpp.
References SgVector< T >::Front(), GoBoard::GetHashCode(), GoBoard::GetStone(), GO_LADDER_CAPTURED, SgVector< T >::IsEmpty(), GoBoard::IsValidPoint(), GoLadder::Ladder(), SgVector< T >::NonEmpty(), GoBoard::Occupied(), SG_ASSERT, SG_PASS, and SgOppBW().
Referenced by GoGtpExtraCommands::CmdLadder().
SgPoint GoLadderUtil::TryLadder | ( | const GoBoard & | bd, | |
SgPoint | prey, | |||
SgBlackWhite | firstPlayer | |||
) |
try to escape/capture prey block Possible return values:
Definition at line 677 of file GoLadder.cpp.
References SgVector< T >::Front(), GoBoard::GetStone(), SgVector< T >::IsEmpty(), Ladder(), SG_NULLMOVE, and SG_PASS.