public function checkGame(Request $request) { $tigerId = $request->input('tiger'); $goatId = $request->input('goat'); $allActivePosition = Game::getActivePosition($tigerId, $goatId); $moves = Game::getMoves($allActivePosition); return Response::json(array_merge($allActivePosition->getLayout(), $moves)); }
public static function checkMove($tigerId, $goatId, $move, $player) { $return = false; $game = Game::getActivePosition($tigerId, $goatId); $moves = (new Moves($game))->generateAllowedMoves(); $data = array_merge($game->getLayout(), $moves); if ($data['nextMove'][$player]) { switch ($player) { case 'Goat': if ($data['GoatData'] > 20) { foreach ($data['PlaceGoat'] as $places) { if ($places === $move->x . ',' . $move->y) { $return = true; break; } } } else { } break; case 'Tiger': break; } } return $return; }