本文整理匯總了PHP中Board::minimumDiceRolls方法的典型用法代碼示例。如果您正苦於以下問題:PHP Board::minimumDiceRolls方法的具體用法?PHP Board::minimumDiceRolls怎麽用?PHP Board::minimumDiceRolls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Board
的用法示例。
在下文中一共展示了Board::minimumDiceRolls方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fscanf
fscanf($fh, "%d", $testCases);
for ($a = 1; $a <= $testCases; $a++) {
fscanf($fh, "%d", $ladderCount);
$ladders = [];
for ($b = 1; $b <= $ladderCount; $b++) {
fscanf($fh, "%d %d", $bottom, $top);
$ladders[] = new Ladder($bottom, $top);
}
fscanf($fh, "%d", $snakeCount);
$snakes = [];
for ($c = 1; $c <= $snakeCount; $c++) {
fscanf($fh, "%d %d", $mouth, $tail);
$snakes[] = new Snake($mouth, $tail);
}
$board = new Board($ladders, $snakes);
echo $board->minimumDiceRolls() . PHP_EOL;
}
}
/**
* Responsible for finding the minimum number of dice-rolls to get from square 1
* to square 100.
*/
class Board
{
/**
* const int MIN_POSITION Lowest number of a square on the board.
* const int MAX_POSITION Highest number of a square on the board.
*/
const MIN_POSITION = 1;
const MAX_POSITION = 100;
/**