A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
// The campaign page of the title menu: how far you are, what is next.
|
|
|
|
|
import { CHALLENGES } from '~/lib/logic/challenges'
|
|
|
|
|
import { campaignProgress, challengeOpen, KIND_NAMES, KIND_UNLOCK } from '~/lib/logic/progress'
|
|
|
|
|
import type { NodeKind } from '~/lib/logic/types'
|
|
|
|
|
|
|
|
|
|
const ed = useEditor()
|
|
|
|
|
const p = ed.projectOf('campaign')
|
|
|
|
|
const solved = new Set(p?.solved ?? [])
|
|
|
|
|
const next = p ? CHALLENGES.find(c => !solved.has(c.id) && challengeOpen(p, c.id)) : CHALLENGES[0]
|
|
|
|
|
const parts = (id: string) =>
|
|
|
|
|
(Object.keys(KIND_UNLOCK) as NodeKind[])
|
|
|
|
|
.filter(k => KIND_UNLOCK[k] === id)
|
|
|
|
|
.map(k => KIND_NAMES[k])
|
|
|
|
|
.join(', ')
|
|
|
|
|
|
|
|
|
|
function fresh() {
|
|
|
|
|
ed.newProject(false, true)
|
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
|
|
|
ed.challengesOpen.value = true
|
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
|
|
|
ed.enterGame()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="menu-campaign">
|
|
|
|
|
<p class="hint">
|
|
|
|
|
You start with a NAND gate, switches and lamps. Each challenge you solve becomes a part you can use, and opens the next ones. Clocks, buttons, panels and
|
|
|
|
|
displays are earned on the way.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<div class="menu-card">
|
|
|
|
|
<template v-if="p">
|
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
|
<span class="font-semibold">{{ solved.size }} of {{ CHALLENGES.length }} solved</span>
|
|
|
|
|
<span class="tabular-nums text-(--muted)">{{ Math.round(campaignProgress(p) * 100) }}%</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="bar"><span :style="{ width: `${campaignProgress(p) * 100}%` }" /></div>
|
|
|
|
|
<p v-if="next" class="mt-2">Next: <strong>{{ next.name }}</strong>, {{ next.goal }}</p>
|
|
|
|
|
<p v-else class="mt-2">Every challenge solved. You built it all from NAND.</p>
|
|
|
|
|
</template>
|
|
|
|
|
<p v-else>Not started yet. The first task: build NOT from a single NAND gate.</p>
|
|
|
|
|
<div class="mt-3 flex flex-wrap gap-2">
|
|
|
|
|
<button class="btn btn-primary" @click="ed.playCampaign()">
|
|
|
|
|
<Icon name="lucide:play" class="size-4" /> {{ p ? 'Continue the campaign' : 'Start the campaign' }}
|
|
|
|
|
</button>
|
|
|
|
|
<button v-if="p" class="btn" title="A second campaign from the start; the first one stays in your projects" @click="fresh">
|
|
|
|
|
<Icon name="lucide:rotate-ccw" class="size-4" /> Start over
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<ol class="menu-steps">
|
|
|
|
|
<li
|
|
|
|
|
v-for="c in CHALLENGES"
|
|
|
|
|
:key="c.id"
|
|
|
|
|
:class="{ solved: solved.has(c.id), locked: p ? !challengeOpen(p, c.id) : c !== CHALLENGES[0], next: c === next }"
|
|
|
|
|
>
|
|
|
|
|
<Icon
|
|
|
|
|
:name="solved.has(c.id) ? 'lucide:circle-check' : (p ? challengeOpen(p, c.id) : c === CHALLENGES[0]) ? 'lucide:circle-dot' : 'lucide:lock'"
|
|
|
|
|
class="size-4 shrink-0"
|
|
|
|
|
/>
|
|
|
|
|
<span class="grow">
|
|
|
|
|
<span class="font-medium">{{ c.name }}</span>
|
|
|
|
|
<span v-if="parts(c.id)" class="unlocks"> · unlocks {{ parts(c.id) }}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span v-if="p?.best?.[c.id] !== undefined" class="tabular-nums text-xs text-(--muted)">{{ p.best[c.id] }} transistors</span>
|
|
|
|
|
</li>
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|