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) |
Simple form, calls the complex form and ignores bool results. | |
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. | |
SgPoint | TryLadder (const GoBoard &bd, SgPoint prey, SgBlackWhite firstPlayer) |
try to escape/capture prey block Possible return values:
|
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 543 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 567 of file GoLadder.cpp.
References SgVector< T >::Front(), GoBoard::GetHashCode(), GoBoard::GetStone(), GO_LADDER_CAPTURED, GO_LADDER_ESCAPED, GO_LADDER_UNSETTLED, GoBoard::IsValidPoint(), GoLadder::Ladder(), SgVector< T >::NonEmpty(), GoBoard::Occupied(), SG_ASSERT, SG_PASS, and SgOppBW().
Referenced by GoGtpExtraCommands::CmdLadder().
bool GoLadderUtil::IsProtectedLiberty | ( | const GoBoard & | bd, | |
SgPoint | liberty, | |||
SgBlackWhite | color | |||
) |
Simple form, calls the complex form and ignores bool results.
Definition at line 612 of file GoLadder.cpp.
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 621 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().
SgPoint GoLadderUtil::TryLadder | ( | const GoBoard & | bd, | |
SgPoint | prey, | |||
SgBlackWhite | firstPlayer | |||
) |
try to escape/capture prey block Possible return values:
Definition at line 684 of file GoLadder.cpp.
References SgVector< T >::Front(), GoBoard::GetStone(), SgVector< T >::IsEmpty(), Ladder(), SG_NULLMOVE, and SG_PASS.