galb-dai commited on
Commit
3210445
·
1 Parent(s): dd8b186

Add links, improve formatting.

Browse files
Files changed (3) hide show
  1. app.py +2 -2
  2. src/about.py +74 -31
  3. src/display/css_html_js.py +2 -1
app.py CHANGED
@@ -191,12 +191,12 @@ with blocks:
191
  with gr.TabItem("What is FormulaOne", id=0):
192
  gr.HTML(WHAT_IS_F1_HTML)
193
 
194
- with gr.TabItem("🏅 FormulaOne Leaderboard", elem_id="formulaone-leaderboard-tab-table", id=1):
195
  refresh_leaderboard_data()
196
  assert leaderboard_df is not None
197
  leaderboard_component = init_leaderboard(leaderboard_df)
198
 
199
- with gr.TabItem("🚀 Submit Solutions", elem_id="formulaone-submit-tab-table", id=2):
200
  logger.info("Tab submission")
201
  with gr.Column():
202
  with gr.Row():
 
191
  with gr.TabItem("What is FormulaOne", id=0):
192
  gr.HTML(WHAT_IS_F1_HTML)
193
 
194
+ with gr.TabItem("FormulaOne Leaderboard", elem_id="formulaone-leaderboard-tab-table", id=1):
195
  refresh_leaderboard_data()
196
  assert leaderboard_df is not None
197
  leaderboard_component = init_leaderboard(leaderboard_df)
198
 
199
+ with gr.TabItem("Submit Solutions", elem_id="formulaone-submit-tab-table", id=2):
200
  logger.info("Tab submission")
201
  with gr.Column():
202
  with gr.Row():
src/about.py CHANGED
@@ -5,72 +5,79 @@ WHAT_IS_F1_HTML = f"""
5
  <!DOCTYPE html>
6
  <html lang="en">
7
  <body>
8
- <main class="max-w-4xl mx-auto">
9
  <header class="text-center mb-12">
10
  <h1 class="text-4xl md:text-5xl font-bold text-gray-900 f1-h1">FormulaOne</h1>
11
  </header>
12
  <section>
13
- <p class="text-lg mb-4 f1-p">Frontier AI models have recently demonstrated strong performance on mathematical and algorithmic benchmarks, including earning gold medals in olympiads, and attaining top percentile ratings in competitive programming contests. How well do such benchmarks capture the true depth of algorithmic reasoning, as it arises in real-world research problems?</p>
14
- <p class="text-lg mb-4 f1-p">We believe that existing benchmarks fail to capture the deep reasoning skills required for complex, research-level algorithmic problems. To address this gap, we introduce <strong>FormulaOne</strong>.</p>
15
  <p class="mb-4 f1-p"><strong>FormulaOne</strong> consists of 220 novel dynamic programming problems over graphs. The problems are organised into three categories, ranging from moderate difficulty and all the way up to research-level.</p>
16
- <div class="overflow-x-auto">
17
- <table class="f1-table">
18
- <thead>
 
 
19
  <tr>
20
- <th class="f1-th">Category</th>
21
- <th class="f1-th">Description</th>
22
  </tr>
23
  </thead>
24
- <tbody>
25
  <tr>
26
- <td class="f1-td"><strong>FormulaOne Warmup</strong></td>
27
- <td class="f1-td">A set of 100 “easier” problems.</td>
28
  </tr>
29
  <tr>
30
- <td class="f1-td"><strong>FormulaOne Tier 1</strong></td>
31
- <td class="f1-td">A set of 100 challenging problems.</td>
32
  </tr>
33
  <tr>
34
- <td class="f1-td"><strong>FormulaOne Tier 2</strong></td>
35
- <td class="f1-td">A set of 20 highly challenging problems.</td>
36
  </tr>
37
  </tbody>
38
  </table>
39
  </div>
 
 
40
  <div class="mt-8">
41
  <div class="border-b border-gray-200">
42
- <nav class="-mb-px flex space-x-8" aria-label="Tabs">
43
- <p class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm border-blue-600 text-blue-600">Example Problems</p>
 
 
44
  </nav>
45
  </div>
46
  <div class="mt-4">
47
- <div class="f1-problem-box">
48
- <p class="font-bold text-lg mb-2">Warmup: Union-of-Paths-and-Cycles</p>
49
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, is a collection of disjoint paths and cycles.</p>
50
  </div>
51
- <div class="f1-problem-box">
52
- <p class="font-bold text-lg mb-2">Tier 1: Maximal-Union-of-Paths-and-Cycles</p>
53
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, is a collection of disjoint paths and cycles, and S is maximal with respect to this property.</p>
54
  </div>
55
- <div class="f1-problem-box">
56
- <p class="font-bold text-lg mb-2">Tier 2: Maximal-Union-of-Cycles</p>
57
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, is a collection of disjoint cycles, and S is maximal with respect to this property.</p>
58
  </div>
59
  </div>
60
  </div>
 
61
  <p class="mt-6 mb-4 f1-p">The latter category is incredibly demanding, requiring resolution of many points of uncertainty, and involving an array of reasoning steps, including topological and geometric insight, knowledge of mathematical domains such as extremal graph theory and logic, combinatorial considerations, precise implementation, and more.</p>
62
- <p class="f1-p">Despite Frontier models’ impressive performance on existing benchmarks, presently <strong>no model solves even a single FormulaOne Tier 2 problem</strong>.<sup><a href="#evaluation" class="f1-a">1</a></sup></p>
63
  </section>
64
  <section>
65
  <h2 class="text-3xl font-bold text-gray-900 f1-h2">An “Infinite Well” of Problems</h2>
66
- <p class="mb-4 f1-p">The novelty and vastness of FormulaOne stems from its theoretical foundation. The questions are not arbitrary puzzles, but are instead drawn from the highly expressive framework of <strong>Monadic Second-Order</strong> (MSO) logic on graphs. This provides a principled, semi-automatic way to generate a virtually infinite supply of mathematically deep algorithmic challenges. Despite their theoretical underpinnings, the problems in FormulaOne are natural and succinct:</p>
67
  <div class="f1-problem-box">
68
  <p class="font-bold text-lg mb-2">Problem #44</p>
69
  <p class="mb-2"><strong>Input:</strong> A tree-like graph G=(V,E), a tree decomposition T of G, and a weight function w:V→N.</p>
70
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, does not contain any cycle of length four.</p>
71
  <p class="text-sm text-gray-600"><strong>Notation:</strong> The weight of a set of vertices S is defined as w(S) ≜ ∑<sub>v∈S</sub>w(v). The final result should be returned modulo 10<sup>9</sup>+7.</p>
72
  </div>
73
- <p class="mb-4 f1-p">While the problems are often natural to state, their solutions are far from obvious. The solvability of this vast class of problems is guaranteed by an algorithmic <strong>meta-theorem</strong> due to Courcelle, which broadly states:</p>
74
  <blockquote class="my-6 f1-blockquote">
75
  “For every sufficiently tree-like graph, any problem definable in an expressive formal logic — Monadic Second-Order (MSO) logic — can be solved by a dynamic programming algorithm that operates in time linear in the order of the graph.”
76
  </blockquote>
@@ -87,24 +94,24 @@ WHAT_IS_F1_HTML = f"""
87
  </video>
88
  <figcaption class="f1-figcaption">Animation showing the design of a compressed dynamic programming state-space.</figcaption>
89
  </figure>
90
- <p class="f1-p">The deceptive simplicity of the problem statements belies the <strong>extraordinary difficulty</strong> of discovering the correct dynamic programming solution. This process is riddled with subtle combinatorial and logical pitfalls, demanding a profound understanding of the problem’s underlying structure. For a detailed walkthrough of the fifteen interdependent reasoning steps required to solve a single hard problem – <strong>Maximal-Cluster-Graph</strong> – see the <a href="{PAPER_URL}" target="_blank" rel="noopener noreferrer" class="f1-a">appendix of our paper</a>.</p>
91
  </section>
92
  <section>
93
  <h2 class="text-3xl font-bold text-gray-900 f1-h2">Guiding Principles</h2>
94
  <ul class="list-disc list-inside space-y-4">
95
- <li class="f1-li"><strong>An In-Distribution Benchmark for Reasoning.</strong> Unlike benchmarks that test for out-of-distribution generalisation, FormulaOne presents problems that are squarely <strong>in-distribution</strong> for models trained on code. Essentially, dynamic programming on graphs is the “bread and butter” of algorithmic programming. Thus, models’ current failure on FormulaOne highlights a fundamental deficit in deep, multi-step reasoning, rather than a lack of domain exposure.</li>
96
  <li class="f1-li"><strong>An Unbounded Environment for Reinforcement Learning.</strong> The MSO framework allows for the generation of a nearly infinite stream of algorithmic problems with verifiable solutions, making it an ideal environment for training and evaluating agents with Reinforcement Learning with Verifiable Rewards (RLVR).</li>
97
- <li class="f1-li"><strong>Probing the Frontiers of Complexity Theory.</strong> Many problems in our dataset are related to central conjectures in fine-grained complexity, such as the Strong Exponential Time Hypothesis. If a model were to discover a significantly faster algorithm for one of these problems, that would constitute a significant contribution to theoretical computer science.</li>
98
  </ul>
99
  </section>
100
  <section id="evaluation">
101
  <h2 class="text-3xl font-bold text-gray-900 f1-h2">Evaluation</h2>
102
  <p class="mb-4 f1-p">To give models the best possible chance of success, we provide a generous few-shot prompt that covers a broad array of the ideas and techniques involved in solving these problems. All models were evaluated using their highest available reasoning settings and with the maximum context length permitted.</p>
103
- <p class="mb-4 f1-p">Each submitted solution is subjected to a rigorous and automated test suite that measures three key aspects of its validity:</p>
104
  <ul class="list-disc list-inside space-y-2 mb-6">
105
  <li class="f1-li"><strong>Correctness:</strong> The output of the submitted algorithm must be correct on all graphs.</li>
106
  <li class="f1-li"><strong>Consistency:</strong> The solution must produce the same output for a given graph, regardless of the specific structure of its tree decomposition.</li>
107
- <li class="f1-li"><strong>Efficiency:</strong> The solution must be truly fixed-parameter linear.</li>
108
  </ul>
109
  <p class="mb-4 f1-p">To support research and encourage community contributions, the <code>FormulaOne-Warmup</code> dataset is released as a public resource for training and fine-tuning models. The complete test suite for all 100 Warmup problems is available, alongside a standalone evaluation environment, in our public GitHub repository: <a href="https://github.com/double-ai/formulaone-dataset/tree/main" target="_blank" rel="noopener noreferrer" class="f1-a">https://github.com/double-ai/formulaone-dataset/tree/main</a>.</p>
110
  <p class="f1-p">In contrast, to maintain the integrity of the core benchmark, only a minimal subset of tests is released for the <code>FormulaOne Tier 1</code> and <code>Tier 2</code> problems.</p>
@@ -122,6 +129,42 @@ WHAT_IS_F1_HTML = f"""
122
  <p class="f1-p">This trend culminates in <strong>FormulaOne Tier 2</strong>, where the difficulty is characteristic of exploratory research problems. On this set of 20 problems, no current frontier model solves even a single one. This result starkly illustrates the gap that remains between high performance on existing benchmarks and the deep algorithmic reasoning required for truly complex problems.</p>
123
  </section>
124
  </main>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  </body>
126
  </html>
127
  """
 
5
  <!DOCTYPE html>
6
  <html lang="en">
7
  <body>
8
+ <main class="max-w-3xl mx-auto">
9
  <header class="text-center mb-12">
10
  <h1 class="text-4xl md:text-5xl font-bold text-gray-900 f1-h1">FormulaOne</h1>
11
  </header>
12
  <section>
13
+ <p class="text-lg mb-4 f1-p">Frontier AI models have recently demonstrated strong performance on mathematical and algorithmic benchmarks, including earning <a href="https://deepmind.google/discover/blog/advanced-version-of-gemini-with-deep-think-officially-achieves-gold-medal-standard-at-the-international-mathematical-olympiad/" target="_blank" rel="noopener noreferrer" class="f1-a">gold medals in olympiads</a>, and attaining <a href="https://arxiv.org/html/2502.06807v1" target="_blank" rel="noopener noreferrer" class="f1-a">top percentile ratings</a> in competitive programming contests. How well do such benchmarks capture the true depth of algorithmic reasoning, as it arises in real-world research problems?</p>
14
+ <p class="text-lg mb-4 f1-p">We believe that existing benchmarks fail to capture the deep reasoning skills required for complex, research-level algorithmic problems. To address this gap, <a href="{PAPER_URL}" target="_blank" rel="noopener noreferrer" class="f1-a">we introduce <strong>FormulaOne</strong></a>.</p>
15
  <p class="mb-4 f1-p"><strong>FormulaOne</strong> consists of 220 novel dynamic programming problems over graphs. The problems are organised into three categories, ranging from moderate difficulty and all the way up to research-level.</p>
16
+
17
+ <!-- Nicely Styled Table -->
18
+ <div class="overflow-hidden overflow-x-auto rounded-lg border border-gray-200 my-8">
19
+ <table class="min-w-full divide-y divide-gray-200 text-sm">
20
+ <thead class="bg-gray-100">
21
  <tr>
22
+ <th class="whitespace-nowrap px-4 py-2 text-left font-medium text-gray-900">Category</th>
23
+ <th class="whitespace-nowrap px-4 py-2 text-left font-medium text-gray-900">Description</th>
24
  </tr>
25
  </thead>
26
+ <tbody class="divide-y divide-gray-200">
27
  <tr>
28
+ <td class="whitespace-nowrap px-4 py-2 font-medium text-gray-900"><strong>FormulaOne Warmup</strong></td>
29
+ <td class="whitespace-nowrap px-4 py-2 text-gray-700">A set of 100 “easier” problems.</td>
30
  </tr>
31
  <tr>
32
+ <td class="whitespace-nowrap px-4 py-2 font-medium text-gray-900"><strong>FormulaOne Tier 1</strong></td>
33
+ <td class="whitespace-nowrap px-4 py-2 text-gray-700">A set of 100 challenging problems.</td>
34
  </tr>
35
  <tr>
36
+ <td class="whitespace-nowrap px-4 py-2 font-medium text-gray-900"><strong>FormulaOne Tier 2</strong></td>
37
+ <td class="whitespace-nowrap px-4 py-2 text-gray-700">A set of 20 highly challenging problems.</td>
38
  </tr>
39
  </tbody>
40
  </table>
41
  </div>
42
+
43
+ <!-- Tabbed Problem Viewer -->
44
  <div class="mt-8">
45
  <div class="border-b border-gray-200">
46
+ <nav class="-mb-px flex space-x-6" aria-label="Tabs">
47
+ <button id="problem-tab-btn-warmup" class="problem-tab-button shrink-0 border-b-2 px-1 pb-4 text-sm font-medium">Warmup Example</button>
48
+ <button id="problem-tab-btn-tier1" class="problem-tab-button shrink-0 border-b-2 px-1 pb-4 text-sm font-medium">Tier 1 Example</button>
49
+ <button id="problem-tab-btn-tier2" class="problem-tab-button shrink-0 border-b-2 px-1 pb-4 text-sm font-medium">Tier 2 Example</button>
50
  </nav>
51
  </div>
52
  <div class="mt-4">
53
+ <div id="problem-tab-content-warmup" class="problem-tab-content f1-problem-box">
54
+ <p class="font-bold text-lg mb-2">Union-of-Paths-and-Cycles</p>
55
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, is a collection of disjoint paths and cycles.</p>
56
  </div>
57
+ <div id="problem-tab-content-tier1" class="problem-tab-content f1-problem-box hidden">
58
+ <p class="font-bold text-lg mb-2">Maximal-Union-of-Paths-and-Cycles</p>
59
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, is a collection of disjoint paths and cycles, and S is maximal with respect to this property.</p>
60
  </div>
61
+ <div id="problem-tab-content-tier2" class="problem-tab-content f1-problem-box hidden">
62
+ <p class="font-bold text-lg mb-2">Maximal-Union-of-Cycles</p>
63
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, is a collection of disjoint cycles, and S is maximal with respect to this property.</p>
64
  </div>
65
  </div>
66
  </div>
67
+
68
  <p class="mt-6 mb-4 f1-p">The latter category is incredibly demanding, requiring resolution of many points of uncertainty, and involving an array of reasoning steps, including topological and geometric insight, knowledge of mathematical domains such as extremal graph theory and logic, combinatorial considerations, precise implementation, and more.</p>
69
+ <p class="f1-p">Despite <a href="https://epoch.ai/frontiermath" target="_blank" rel="noopener noreferrer" class="f1-a">impressive</a> <a href="https://artificialanalysis.ai/evaluations/gpqa-diamond" target="_blank" rel="noopener noreferrer" class="f1-a">performance</a> on existing benchmarks, presently <strong>no model solves even a single FormulaOne Tier 2 problem</strong>.<sup><a href="#evaluation" class="f1-a">1</a></sup></p>
70
  </section>
71
  <section>
72
  <h2 class="text-3xl font-bold text-gray-900 f1-h2">An “Infinite Well” of Problems</h2>
73
+ <p class="mb-4 f1-p">The novelty and vastness of FormulaOne stems from its theoretical foundation. The questions are not arbitrary puzzles, but are instead drawn from the highly expressive framework of <a href="https://en.wikipedia.org/wiki/Monadic_second-order_logic" target="_blank" rel="noopener noreferrer" class="f1-a"><strong>Monadic Second-Order</strong> (MSO) logic on graphs</a>. This provides a principled, semi-automatic way to generate a virtually infinite supply of mathematically deep algorithmic challenges. Despite their theoretical underpinnings, the problems in FormulaOne are natural and succinct:</p>
74
  <div class="f1-problem-box">
75
  <p class="font-bold text-lg mb-2">Problem #44</p>
76
  <p class="mb-2"><strong>Input:</strong> A tree-like graph G=(V,E), a tree decomposition T of G, and a weight function w:V→N.</p>
77
  <p class="mb-2"><strong>Objective:</strong> Compute the sum of all weights of sets S⊆V such that the graph G[S], induced over S, does not contain any cycle of length four.</p>
78
  <p class="text-sm text-gray-600"><strong>Notation:</strong> The weight of a set of vertices S is defined as w(S) ≜ ∑<sub>v∈S</sub>w(v). The final result should be returned modulo 10<sup>9</sup>+7.</p>
79
  </div>
80
+ <p class="mb-4 f1-p">While the problems are often natural to state, their solutions are far from obvious. The solvability of this vast class of problems is guaranteed by an algorithmic <strong>meta-theorem</strong> due to <a href="https://en.wikipedia.org/wiki/Courcelle%27s_theorem" target="_blank" rel="noopener noreferrer" class="f1-a">Courcelle</a>, which broadly states:</p>
81
  <blockquote class="my-6 f1-blockquote">
82
  “For every sufficiently tree-like graph, any problem definable in an expressive formal logic — Monadic Second-Order (MSO) logic — can be solved by a dynamic programming algorithm that operates in time linear in the order of the graph.”
83
  </blockquote>
 
94
  </video>
95
  <figcaption class="f1-figcaption">Animation showing the design of a compressed dynamic programming state-space.</figcaption>
96
  </figure>
97
+ <p class="f1-p">The deceptive simplicity of the problem statements belies the <strong>extraordinary difficulty</strong> of discovering the correct dynamic programming solution. This process is riddled with subtle combinatorial and logical pitfalls, demanding a profound understanding of the problem’s underlying structure. For a detailed walkthrough of the fifteen interdependent reasoning steps required to solve a single hard problem – <strong>Maximal-Cluster-Graph</strong> – <a href="https://arxiv.org/pdf/2507.13337#appendix.A" target="_blank" rel="noopener noreferrer" class="f1-a">see the appendix of our paper</a>.</p>
98
  </section>
99
  <section>
100
  <h2 class="text-3xl font-bold text-gray-900 f1-h2">Guiding Principles</h2>
101
  <ul class="list-disc list-inside space-y-4">
102
+ <li class="f1-li"><strong>An In-Distribution Benchmark for Reasoning.</strong> Unlike <a href="https://arcprize.org/arc-agi" target="_blank" rel="noopener noreferrer" class="f1-a">benchmarks</a> that test for out-of-distribution generalisation, FormulaOne presents problems that are squarely <strong>in-distribution</strong> for models trained on code. Essentially, dynamic programming on graphs is the “bread and butter” of algorithmic programming. Thus, models’ current failure on FormulaOne highlights a fundamental deficit in deep, multi-step reasoning, rather than a lack of domain exposure.</li>
103
  <li class="f1-li"><strong>An Unbounded Environment for Reinforcement Learning.</strong> The MSO framework allows for the generation of a nearly infinite stream of algorithmic problems with verifiable solutions, making it an ideal environment for training and evaluating agents with Reinforcement Learning with Verifiable Rewards (RLVR).</li>
104
+ <li class="f1-li"><strong>Probing the Frontiers of Complexity Theory.</strong> Many problems in our dataset are related to central conjectures in fine-grained complexity, such as the <a href="https://en.wikipedia.org/wiki/Exponential_time_hypothesis" target="_blank" rel="noopener noreferrer" class="f1-a">Strong Exponential Time Hypothesis</a> (SETH). If a model were to discover a significantly faster algorithm for one of these problems, that would constitute a significant contribution to theoretical computer science.</li>
105
  </ul>
106
  </section>
107
  <section id="evaluation">
108
  <h2 class="text-3xl font-bold text-gray-900 f1-h2">Evaluation</h2>
109
  <p class="mb-4 f1-p">To give models the best possible chance of success, we provide a generous few-shot prompt that covers a broad array of the ideas and techniques involved in solving these problems. All models were evaluated using their highest available reasoning settings and with the maximum context length permitted.</p>
110
+ <p class="mb-4 f1-p">Each submitted solution is subjected to a rigorous and automated <a href="https://arxiv.org/pdf/2507.13337#section.4" target="_blank" rel="noopener noreferrer" class="f1-a">test suite</a> that measures three key aspects of its validity:</p>
111
  <ul class="list-disc list-inside space-y-2 mb-6">
112
  <li class="f1-li"><strong>Correctness:</strong> The output of the submitted algorithm must be correct on all graphs.</li>
113
  <li class="f1-li"><strong>Consistency:</strong> The solution must produce the same output for a given graph, regardless of the specific structure of its tree decomposition.</li>
114
+ <li class="f1-li"><strong>Efficiency:</strong> The solution must be truly <a href="https://en.wikipedia.org/wiki/Parameterized_complexity" target="_blank" rel="noopener noreferrer" class="f1-a">fixed-parameter linear</a>.</li>
115
  </ul>
116
  <p class="mb-4 f1-p">To support research and encourage community contributions, the <code>FormulaOne-Warmup</code> dataset is released as a public resource for training and fine-tuning models. The complete test suite for all 100 Warmup problems is available, alongside a standalone evaluation environment, in our public GitHub repository: <a href="https://github.com/double-ai/formulaone-dataset/tree/main" target="_blank" rel="noopener noreferrer" class="f1-a">https://github.com/double-ai/formulaone-dataset/tree/main</a>.</p>
117
  <p class="f1-p">In contrast, to maintain the integrity of the core benchmark, only a minimal subset of tests is released for the <code>FormulaOne Tier 1</code> and <code>Tier 2</code> problems.</p>
 
129
  <p class="f1-p">This trend culminates in <strong>FormulaOne Tier 2</strong>, where the difficulty is characteristic of exploratory research problems. On this set of 20 problems, no current frontier model solves even a single one. This result starkly illustrates the gap that remains between high performance on existing benchmarks and the deep algorithmic reasoning required for truly complex problems.</p>
130
  </section>
131
  </main>
132
+ <script>
133
+ // This script needs to be run after the DOM is loaded.
134
+ // Gradio's gr.HTML component loads content dynamically, so we use a small delay.
135
+ setTimeout(() => {
136
+ const problemTabs = [
137
+ { btn: document.getElementById('problem-tab-btn-warmup'), content: document.getElementById('problem-tab-content-warmup') },
138
+ { btn: document.getElementById('problem-tab-btn-tier1'), content: document.getElementById('problem-tab-content-tier1') },
139
+ { btn: document.getElementById('problem-tab-btn-tier2'), content: document.getElementById('problem-tab-content-tier2') }
140
+ ];
141
+
142
+ const activeClasses = 'border-blue-600 text-blue-600';
143
+ const inactiveClasses = 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300';
144
+
145
+ problemTabs.forEach(tab => {
146
+ if(tab.btn) {
147
+ tab.btn.addEventListener('click', () => {
148
+ problemTabs.forEach(t => {
149
+ if(t.btn) {
150
+ t.btn.classList.remove(...activeClasses.split(' '));
151
+ t.btn.classList.add(...inactiveClasses.split(' '));
152
+ t.content.classList.add('hidden');
153
+ }
154
+ });
155
+ tab.btn.classList.add(...activeClasses.split(' '));
156
+ tab.btn.classList.remove(...inactiveClasses.split(' '));
157
+ tab.content.classList.remove('hidden');
158
+ });
159
+ }
160
+ });
161
+
162
+ // Set initial active tab
163
+ if (problemTabs.length > 0 && problemTabs[0].btn) {
164
+ problemTabs[0].btn.click();
165
+ }
166
+ }, 100); // 100ms delay to ensure elements are in the DOM
167
+ </script>
168
  </body>
169
  </html>
170
  """
src/display/css_html_js.py CHANGED
@@ -36,7 +36,7 @@ button[role="tab"] {
36
  #box-filter > .form{ border: 0 }
37
 
38
  /* Light Theme Styles for the "What is FormulaOne" HTML content */
39
- .f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: #111827; text-align: center; margin-bottom: 2rem;}
40
  .f1-h2 { font-weight: 700; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; margin-top: 2.5rem; margin-bottom: 1.5rem; color: #111827; font-size: 1.875rem; line-height: 2.25rem; }
41
  .f1-p, .f1-li { line-height: 1.75; color: #374151; }
42
  .f1-a { color: #2563eb; text-decoration: none; font-weight: 500; }
@@ -49,6 +49,7 @@ button[role="tab"] {
49
  .f1-th { background-color: #f9fafb; font-weight: 600; color: #374151; }
50
  .f1-figure { margin-top: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
51
  .f1-figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: #6b7280; font-style: italic; }
 
52
  """
53
 
54
  get_window_url_params = """
 
36
  #box-filter > .form{ border: 0 }
37
 
38
  /* Light Theme Styles for the "What is FormulaOne" HTML content */
39
+ .f1-h1 { font-weight: 700; font-size: 2.25rem; line-height: 2.5rem; color: #111827; text-align: center; margin-bottom: 3rem;}
40
  .f1-h2 { font-weight: 700; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; margin-top: 2.5rem; margin-bottom: 1.5rem; color: #111827; font-size: 1.875rem; line-height: 2.25rem; }
41
  .f1-p, .f1-li { line-height: 1.75; color: #374151; }
42
  .f1-a { color: #2563eb; text-decoration: none; font-weight: 500; }
 
49
  .f1-th { background-color: #f9fafb; font-weight: 600; color: #374151; }
50
  .f1-figure { margin-top: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
51
  .f1-figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: #6b7280; font-style: italic; }
52
+ .problem-tab-button { cursor: pointer; }
53
  """
54
 
55
  get_window_url_params = """