Add Knights Exchange Puzzle

Make the Knights Exchange Puzzle a standalone interactive and add it to the puzzles theme.
This commit is contained in:
gpt-engineer-app[bot] 2025-07-21 09:04:17 +00:00
parent 3c1a209d89
commit 33c4e2dcb7
3 changed files with 44 additions and 4 deletions

View file

@ -28,6 +28,7 @@ import GameOfSimPage from "./pages/GameOfSimPage";
import TernarySearchTrickPage from "./pages/TernarySearchTrickPage"; import TernarySearchTrickPage from "./pages/TernarySearchTrickPage";
import TernarySearchTrickGreenScreen from "./pages/TernarySearchTrickGreenScreen"; import TernarySearchTrickGreenScreen from "./pages/TernarySearchTrickGreenScreen";
import NorthcottsGamePage from "./pages/NorthcottsGamePage"; import NorthcottsGamePage from "./pages/NorthcottsGamePage";
import KnightsPuzzlePage from "./pages/KnightsPuzzlePage";
import Foundations from "./pages/theme-pages/discrete-math/Foundations"; import Foundations from "./pages/theme-pages/discrete-math/Foundations";
import Proofs from "./pages/theme-pages/discrete-math/Proofs"; import Proofs from "./pages/theme-pages/discrete-math/Proofs";
import Counting from "./pages/theme-pages/discrete-math/Counting"; import Counting from "./pages/theme-pages/discrete-math/Counting";
@ -82,6 +83,7 @@ const App = () => (
<Route path="/ternary-search-trick" element={<TernarySearchTrickPage />} /> <Route path="/ternary-search-trick" element={<TernarySearchTrickPage />} />
<Route path="/ternary-search-trick/:mode" element={<TernarySearchTrickGreenScreen />} /> <Route path="/ternary-search-trick/:mode" element={<TernarySearchTrickGreenScreen />} />
<Route path="/northcotts-game" element={<NorthcottsGamePage />} /> <Route path="/northcotts-game" element={<NorthcottsGamePage />} />
<Route path="/knights-puzzle" element={<KnightsPuzzlePage />} />
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
<Route path="*" element={<NotFound />} /> <Route path="*" element={<NotFound />} />

View file

@ -0,0 +1,12 @@
import Layout from "@/components/Layout";
import KnightsPuzzle from "@/components/KnightsPuzzle";
const KnightsPuzzlePage = () => {
return (
<Layout>
<KnightsPuzzle showSocialShare={true} />
</Layout>
);
};
export default KnightsPuzzlePage;

View file

@ -1,8 +1,23 @@
import Layout from "@/components/Layout"; import Layout from "@/components/Layout";
import KnightsPuzzle from "@/components/KnightsPuzzle"; import InteractiveCard from "@/components/InteractiveCard";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { useNavigate } from "react-router-dom";
const Puzzles = () => { const Puzzles = () => {
const navigate = useNavigate();
const puzzles = [
{
id: "knights-puzzle",
title: "Knights Exchange Puzzle",
description: "Can the black and white knights swap places using legal chess moves? A classic puzzle on a 3×3 board.",
path: "/knights-puzzle",
tags: ["Chess", "Logic", "Classic"],
difficulty: "Intermediate" as const,
duration: "5-15 min",
participants: "1 player"
}
];
return ( return (
<Layout> <Layout>
<div className="py-12 px-4"> <div className="py-12 px-4">
@ -14,8 +29,19 @@ const Puzzles = () => {
</p> </p>
</div> </div>
<div className="space-y-8"> <div className="grid lg:grid-cols-3 md:grid-cols-2 gap-6">
<KnightsPuzzle showSocialShare={true} /> {puzzles.map((puzzle) => (
<InteractiveCard
key={puzzle.id}
title={puzzle.title}
description={puzzle.description}
tags={puzzle.tags}
difficulty={puzzle.difficulty}
duration={puzzle.duration}
participants={puzzle.participants}
onClick={() => navigate(puzzle.path)}
/>
))}
</div> </div>
</div> </div>
</div> </div>