/** * @test * @dataProvider testChanegeNextCellProvider */ public function testChanegeNextCell($curCell, $destCell, $board, $expectedRet) { $directionCellChanger = new DirectionCellChangerConcrete(); $actualRet = $directionCellChanger->changeNextCell($curCell, $destCell, $board); $this->assertSame($expectedRet, $actualRet); }
$gameRounds[] = $gameRound; //1,2,3と増えていく fscanf(STDIN, "%d %d %d", $x, $y, $backInTimeLeft); $myPositions[$gameRound] = array('x' => $x, 'y' => $y, 'useBackInTime' => $backInTimeLeft); for ($i = 0; $i < $opponentCount; $i++) { fscanf(STDIN, "%d %d %d", $opponentX, $opponentY, $opponentBackInTimeLeft); $opponentsPositions[$gameRound][$opponentCount] = array('x' => $opponentX, 'y' => $opponentY, 'useBackInTime' => $opponentBackInTimeLeft); } for ($i = 0; $i < 20; $i++) { fscanf(STDIN, "%s", $line); $boards[$gameRound][$i] = str_split($line); //str_split:eachchar(string) -> array } /* インスタンス初回生成 */ if (!isset($objectivePointDecider)) { $objectivePointDecider = new ObjectivePointDeciderConcrete(array($x, $y), array(X_BEGIN, Y_BEGIN), array(X_END, Y_END)); } if (!isset($directionCellChanger)) { $directionCellChanger = new DirectionCellChangerConcrete(); } /* ロジック */ list($destX, $destY) = $objectivePointDecider->retObjectiveCell(array($x, $y), $boards[$gameRound]); list($destX, $destY) = $directionCellChanger->changeNextCell(array($x, $y), array($destX, $destY), $boards[$gameRound]); /* 結果の出力 */ echo "{$resultX} {$resultY}\n"; // $x = 34; // $y = 19; // echo("$x $y\n"); // action: "x y" to move or "BACK rounds" to go back in time } // Write an action using echo(). DON'T FORGET THE TRAILING \n // To debug (equivalent to var_dump): error_log(var_export($var, true));