import { Link } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { ArrowRight, Sparkles } from "lucide-react"; import Layout from "@/components/Layout"; // All interactives data const allInteractives = [{ id: 'guessing-game', title: 'Number Guessing Game', description: 'Experience different search algorithms through interactive gameplay. Compare random, linear, and binary search strategies!', tags: ['algorithms', 'search', 'educational', 'interactive'], path: '/games/guessing', theme: 'Data Structures' }, { id: 'binary-number-game', title: 'Binary Number Representation', description: 'Learn how numbers are represented in binary (base-2) format through an interactive guessing game.', tags: ['binary', 'numbers', 'conversion'], path: '/binary-number-game', theme: 'Discrete Math' }, { id: 'ternary-number-game', title: 'Ternary Number Representation', description: 'Learn how numbers are represented in ternary (base-3) format by toggling between 0, 1, or 2 copies of powers of three.', tags: ['ternary', 'numbers', 'base-3'], path: '/ternary-number-game', theme: 'Discrete Math' }, { id: 'balanced-ternary-game', title: 'Balanced Ternary Representation', description: 'Explore balanced ternary using digits T (-1), 0, and 1. Add or subtract powers of three to match the target number.', tags: ['balanced-ternary', 'numbers', 'signed-digits'], path: '/balanced-ternary-game', theme: 'Discrete Math' }, { id: 'binary-search-trick', title: 'Binary Search Magic Trick', description: 'Perform an amazing magic trick that reveals how binary numbers work. Think of a number and watch the magic happen!', tags: ['binary', 'magic', 'trick'], path: '/binary-search-trick', theme: 'Data Structures' }, { id: 'game-of-sim', title: 'Game of Sim', description: 'A strategic two-player game where you take turns coloring edges between vertices, trying to avoid creating a triangle of your own color.', tags: ['strategy', 'graph-theory', 'two-player'], path: '/game-of-sim', theme: 'Games' }, { id: 'ternary-search-trick', title: 'Ternary Search Magic Trick', description: 'Experience the magic of ternary search! Think of a number and watch as the cards reveal it through mathematical calculations.', tags: ['ternary', 'magic', 'search'], path: '/ternary-search-trick', theme: 'Data Structures' }, { id: 'northcotts-game', title: "Northcott's Game", description: 'A strategic board game where players move their pieces to outmaneuver their opponent in a tactical race.', tags: ['strategy', 'board-game', 'two-player'], path: '/northcotts-game', theme: 'Games' }, { id: 'knights-puzzle', title: 'Knights Exchange Puzzle', description: 'A classic chess puzzle where you must exchange the positions of white and black knights using legal knight moves.', tags: ['chess', 'knights', 'puzzle'], path: '/knights-puzzle', theme: 'Puzzles' }, { id: 'nim', title: 'Game of Nim', description: 'A classic two-player game of strategy. Take turns removing stones from heaps. The player to take the last stone wins!', tags: ['strategy', 'two-player', 'math', 'logic'], path: '/games/nim', theme: 'Games' }, { id: 'assisted-nim', title: 'Assisted Game of Nim', description: 'Learn the XOR strategy! Visualize how powers of 2 determine winning moves with color-coded borders.', tags: ['strategy', 'two-player', 'math', 'logic', 'xor-strategy', 'educational'], path: '/games/assisted-nim', theme: 'Games' }, { id: 'sikinia-parliament', title: 'Parliament of Sikinia Puzzle', description: 'Separate parliament members into two houses so each has at most one enemy in their house. A graph theory puzzle!', tags: ['graph-theory', 'logic', 'coloring'], path: '/puzzles/sikinia-parliament', theme: 'Puzzles' }]; // Featured interactives (4 fixed ones) const featuredInteractives = allInteractives.filter(interactive => ['guessing-game', 'northcotts-game', 'ternary-search-trick', 'sikinia-parliament'].includes(interactive.id)); // Function to get random interactives (excluding featured ones) const getRandomInteractives = (count: number) => { const availableInteractives = allInteractives.filter(interactive => !['guessing-game', 'northcotts-game', 'ternary-search-trick', 'sikinia-parliament'].includes(interactive.id)); const shuffled = [...availableInteractives].sort(() => 0.5 - Math.random()); return shuffled.slice(0, count); }; const Index = () => { const randomInteractives = getRandomInteractives(3); return {/* Hero Section */} {/* Featured Interactives Section */}

Featured Interactives

{featuredInteractives.map(interactive => {interactive.title} {interactive.theme}

{interactive.description}

{interactive.tags.slice(0, 3).map(tag => {tag} )}
)}
{/* Random Interactives Section */}

Random Interactives

Explore something new with these randomly selected interactives

{randomInteractives.map(interactive => {interactive.title} {interactive.theme}

{interactive.description}

{interactive.tags.slice(0, 3).map(tag => {tag} )}
)}
; }; export default Index;