From a649d2fc41b6fde3b3b08ca4dd2c9aa7229ea2ed Mon Sep 17 00:00:00 2001
From: "gpt-engineer-app[bot]"
<159125892+gpt-engineer-app[bot]@users.noreply.github.com>
Date: Mon, 21 Jul 2025 07:58:37 +0000
Subject: [PATCH] Refactor index page
Display all interactives and redesign using cards.
---
src/App.tsx | 4 +
src/components/InteractiveIndex.tsx | 27 ++++++
src/pages/BalancedTernaryGamePage.tsx | 13 +++
src/pages/Index.tsx | 117 ++++++++++++++++++++++++++
src/pages/TernaryNumberGamePage.tsx | 13 +++
5 files changed, 174 insertions(+)
create mode 100644 src/pages/BalancedTernaryGamePage.tsx
create mode 100644 src/pages/TernaryNumberGamePage.tsx
diff --git a/src/App.tsx b/src/App.tsx
index 12cd6e5..0b31034 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -19,6 +19,8 @@ import Miscellany from "./pages/theme-pages/Miscellany";
import ContestProblems from "./pages/theme-pages/ContestProblems";
import BinaryNumberGamePage from "./pages/BinaryNumberGamePage";
import BinaryNumberGameGreenScreen from "./pages/BinaryNumberGameGreenScreen";
+import TernaryNumberGamePage from "./pages/TernaryNumberGamePage";
+import BalancedTernaryGamePage from "./pages/BalancedTernaryGamePage";
import BinarySearchTrickPage from "./pages/BinarySearchTrickPage";
import BinarySearchTrickGreenScreen from "./pages/BinarySearchTrickGreenScreen";
import GameOfSimGreenScreen from "./pages/GameOfSimGreenScreen";
@@ -71,6 +73,8 @@ const App = () => (
{/* Direct interactive routes */}
} />
} />
+ } />
+ } />
} />
} />
} />
diff --git a/src/components/InteractiveIndex.tsx b/src/components/InteractiveIndex.tsx
index cbe4515..d89932e 100644
--- a/src/components/InteractiveIndex.tsx
+++ b/src/components/InteractiveIndex.tsx
@@ -28,6 +28,24 @@ const allInteractives: Interactive[] = [
theme: 'Discrete Math',
dateAdded: '2024-01-15'
},
+ {
+ 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', 'conversion', 'representation', 'base-3'],
+ path: '/ternary-number-game',
+ theme: 'Discrete Math',
+ dateAdded: '2024-01-16'
+ },
+ {
+ id: 'balanced-ternary-game',
+ title: 'Balanced Ternary Number 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', 'conversion', 'representation', 'base-3', 'signed-digits'],
+ path: '/balanced-ternary-game',
+ theme: 'Discrete Math',
+ dateAdded: '2024-01-17'
+ },
{
id: 'binary-search-trick',
title: 'Binary Search Magic Trick',
@@ -54,6 +72,15 @@ const allInteractives: Interactive[] = [
path: '/ternary-search-trick',
theme: 'Data Structures',
dateAdded: '2024-07-20'
+ },
+ {
+ 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', 'logic', 'game-theory'],
+ path: '/northcotts-game',
+ theme: 'Games',
+ dateAdded: '2024-03-15'
}
];
diff --git a/src/pages/BalancedTernaryGamePage.tsx b/src/pages/BalancedTernaryGamePage.tsx
new file mode 100644
index 0000000..61f4057
--- /dev/null
+++ b/src/pages/BalancedTernaryGamePage.tsx
@@ -0,0 +1,13 @@
+import BalancedTernaryGame from '@/components/BalancedTernaryGame';
+
+const BalancedTernaryGamePage = () => {
+ return (
+
+ );
+};
+
+export default BalancedTernaryGamePage;
\ No newline at end of file
diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx
index fd9683e..83dcc94 100644
--- a/src/pages/Index.tsx
+++ b/src/pages/Index.tsx
@@ -1,8 +1,70 @@
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, BookOpen, Puzzle, Sparkles } from "lucide-react";
import Layout from "@/components/Layout";
+// Featured interactives to display on index page
+const featuredInteractives = [
+ {
+ 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 Number 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'
+ }
+];
+
const Index = () => {
return (
@@ -36,6 +98,61 @@ const Index = () => {
+
+ {/* Featured Interactives Section */}
+
+
+
+ Featured Interactives
+
+
+
+ {featuredInteractives.map(interactive => (
+
+
+
+
+ {interactive.title}
+
+
+
+ {interactive.theme}
+
+
+
+
+ {interactive.description}
+
+
+ {interactive.tags.slice(0, 3).map(tag => (
+
+ {tag}
+
+ ))}
+
+
+
+
+ ))}
+
+
+
+
+
+
+
);
};
diff --git a/src/pages/TernaryNumberGamePage.tsx b/src/pages/TernaryNumberGamePage.tsx
new file mode 100644
index 0000000..79ba882
--- /dev/null
+++ b/src/pages/TernaryNumberGamePage.tsx
@@ -0,0 +1,13 @@
+import TernaryNumberGame from '@/components/TernaryNumberGame';
+
+const TernaryNumberGamePage = () => {
+ return (
+
+ );
+};
+
+export default TernaryNumberGamePage;
\ No newline at end of file