Add Bulgarian Solitaire interactive
Create a new interactive component for Bulgarian Solitaire. This component will allow users to select a number `n` (2-6), visualize a container with `1+2+...+n` boxes, and arrange these boxes into `1+2+...+n` columns. Users can drag and drop boxes between columns and return them to the container by double-clicking. A "Play" button will initiate the simulation of the Bulgarian Solitaire process until a steady state is reached. This interactive will be added to the Puzzles section.
This commit is contained in:
parent
dcdfa9e5f5
commit
cb484c418e
4 changed files with 348 additions and 0 deletions
29
src/pages/BulgarianSolitairePage.tsx
Normal file
29
src/pages/BulgarianSolitairePage.tsx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import BulgarianSolitaire from "@/components/BulgarianSolitaire";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
|
||||
const BulgarianSolitairePage = () => {
|
||||
const [searchParams] = useSearchParams();
|
||||
const from = searchParams.get('from');
|
||||
|
||||
if (from === 'puzzles') {
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<div className="container mx-auto px-4 py-8 space-y-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<button
|
||||
onClick={() => window.location.href = '/themes/puzzles'}
|
||||
className="text-primary hover:text-primary/80 font-medium"
|
||||
>
|
||||
← Back to Puzzles
|
||||
</button>
|
||||
</div>
|
||||
<BulgarianSolitaire showSocialShare={true} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <BulgarianSolitaire showSocialShare={true} />;
|
||||
};
|
||||
|
||||
export default BulgarianSolitairePage;
|
||||
|
|
@ -16,6 +16,16 @@ const Puzzles = () => {
|
|||
duration: "5-15 min",
|
||||
participants: "1 player"
|
||||
},
|
||||
{
|
||||
id: "bulgarian-solitaire",
|
||||
title: "Bulgarian Solitaire",
|
||||
description: "Explore this fascinating mathematical puzzle where boxes rearrange themselves into a triangular configuration through iterative processes.",
|
||||
path: "/puzzles/bulgarian-solitaire",
|
||||
tags: ["Mathematical", "Solitaire", "Algorithm", "Convergence"],
|
||||
difficulty: "Intermediate" as const,
|
||||
duration: "5-10 min",
|
||||
participants: "1 player"
|
||||
},
|
||||
{
|
||||
id: "sikinia-parliament",
|
||||
title: "Parliament of Sikinia Puzzle",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue