diff --git a/app/playground/page.tsx b/app/playground/page.tsx index 7455877..d6efadf 100644 --- a/app/playground/page.tsx +++ b/app/playground/page.tsx @@ -2,19 +2,17 @@ import * as React from "react"; import { useAction, useMutation, useQuery } from "convex/react"; -import { CircleAlertIcon, EraserIcon, SendIcon, UploadIcon, ChevronLeft } from "lucide-react"; -import { CopyMapButton } from "@/components/CopyMapButton"; -import { MapBuilder } from "@/components/MapBuilder"; +import { ChevronLeft, UploadIcon } from "lucide-react"; +import { Map } from "@/components/Map"; import { MapStatus } from "@/components/MapStatus"; import { ModelSelector } from "@/components/ModelSelector"; import { Visualizer } from "@/components/Visualizer"; import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; import { useToast } from "@/components/ui/use-toast"; import { api } from "@/convex/_generated/api"; import { errorMessage } from "@/lib/utils"; import { ZombieSurvival } from "@/simulators/zombie-survival"; -import { Card } from "@/components/ui/card"; -import { Map } from "@/components/Map"; const STORAGE_MAP_KEY = "playground-map"; @@ -112,10 +110,10 @@ export default function PlaygroundPage() { setReasoning(null); setUserPlaying(false); setVisualizingUserSolution(false); - + // Remove players and blocks from the map - const cleanedMap = map.map(row => - row.map(cell => (cell === "P" || cell === "B") ? " " : cell) + const cleanedMap = map.map((row) => + row.map((cell) => (cell === "P" || cell === "B" ? " " : cell)), ); setMap(cleanedMap); window.localStorage.setItem(STORAGE_MAP_KEY, JSON.stringify(cleanedMap)); @@ -181,15 +179,19 @@ export default function PlaygroundPage() { {!visualizing && !userPlaying && (

- Click on the board to place or remove units. Use the buttons below to switch between unit types. + Click on the board to place or remove units. Use the buttons + below to switch between unit types.

)} {!visualizing && userPlaying && (

- Place a player (P) and blocks (B) on the board to create your escape route. Click to toggle between empty, player, and block. + Place a player (P) and blocks (B) on the board to create your + escape route. Click to toggle between empty, player, and block.

)} -
+
{visualizing && ( { @@ -223,8 +229,12 @@ export default function PlaygroundPage() { : [...map]; if (userPlaying) { // Count existing players and blocks - const playerCount = newMap.flat().filter(c => c === "P").length; - const blockCount = newMap.flat().filter(c => c === "B").length; + const playerCount = newMap + .flat() + .filter((c) => c === "P").length; + const blockCount = newMap + .flat() + .filter((c) => c === "B").length; // Toggle logic for play mode if (cell === " ") { @@ -252,7 +262,7 @@ export default function PlaygroundPage() { : handleChangeMap(newMap); }} /> - )) + )), )}