本文整理汇总了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;
/**