2026-10-17 10:49:38 +00:00
< script setup lang = "ts" >
2026-10-20 17:29:16 +00:00
import { shortCount } from '~/lib/logic/analyze'
2026-10-17 10:49:38 +00:00
import { CHALLENGES } from '~/lib/logic/challenges'
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
import { campaignProgress , challengeName , challengeOpen , defUsable , isCampaign , KIND _UNLOCK , NEEDS } from '~/lib/logic/progress'
import { weekKey , weeklyId } from '~/lib/logic/puzzles'
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
import { BASIC _GROUPS } from '~/composables/useParts'
2026-10-17 10:49:38 +00:00
import type { ComponentDef , NodeKind } from '~/lib/logic/types'
const ed = useEditor ( )
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
const tab = ed . paletteTab
2026-10-17 10:49:38 +00:00
const query = ref ( '' )
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
const { componentGroups , search , recentParts } = useParts ( )
// ── Search: type to narrow everything down; arrows pick, Enter places ──
const searchInput = ref < HTMLInputElement > ( )
const hits = computed ( ( ) => ( query . value . trim ( ) ? search ( query . value , 30 ) : [ ] ) )
const at = ref ( 0 )
watch ( query , ( ) => ( at . value = 0 ) )
watch (
( ) => ed . partSearch . value ,
( ) => {
tab . value = 'parts'
nextTick ( ( ) => {
searchInput . value ? . focus ( )
searchInput . value ? . select ( )
} )
} ,
)
function onSearchKey ( e : KeyboardEvent ) {
const n = hits . value . length
if ( e . key === 'ArrowDown' || e . key === 'ArrowUp' ) {
e . preventDefault ( )
if ( n ) at . value = ( at . value + ( e . key === 'ArrowDown' ? 1 : - 1 ) + n ) % n
} else if ( e . key === 'Enter' ) {
e . preventDefault ( )
const h = hits . value [ at . value ]
if ( h ) {
pick ( h . kind , h . chip )
query . value = ''
searchInput . value ? . blur ( )
}
} else if ( e . key === 'Escape' ) {
query . value = ''
searchInput . value ? . blur ( )
2026-10-17 10:49:38 +00:00
}
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
}
// ── Groups that can be folded away; remembered in this browser ──
const FOLD _KEY = 'logigate:palette-folded'
const folded = ref < Set < string > > (
( ( ) => {
try {
return new Set < string > ( JSON . parse ( localStorage . getItem ( FOLD _KEY ) ? ? '[]' ) )
} catch {
return new Set < string > ( )
}
} ) ( ) ,
)
function fold ( name : string ) {
const next = new Set ( folded . value )
if ( ! next . delete ( name ) ) next . add ( name )
folded . value = next
try {
localStorage . setItem ( FOLD _KEY , JSON . stringify ( [ ... next ] ) )
} catch { }
}
2026-10-17 10:49:38 +00:00
function pick ( kind : NodeKind , chip ? : string ) {
if ( chip && ! ed . canPlace ( chip ) ) return
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
if ( ! ed . canPlaceKind ( kind ) ) {
ed . play ( 'error' )
return ed . notify ( lockedHint ( kind ) , 'error' )
}
2026-10-17 10:49:38 +00:00
ed . placing . value = { kind , chip }
}
2026-10-22 16:59:56 +00:00
// ── Connector ports ──
const connectors = computed ( ( ) => ed . project . value . connectors ? ? [ ] )
const PORT _SIDES = [
{ kind : 'portout' as NodeKind , label : 'Out' , hint : ( n : string ) => ` ${ n } out: where a ${ n } cable leaves this circuit. On its box it is one port on the right. ` } ,
{ kind : 'portin' as NodeKind , label : 'In' , hint : ( n : string ) => ` ${ n } in: where a ${ n } cable comes into this circuit. On its box it is one port on the left. ` } ,
]
/** In a campaign, ports come with cables. */
const portsOk = computed ( ( ) => ed . canPlaceKind ( 'portin' ) )
function pickPort ( kind : NodeKind , conn : string ) {
if ( ! portsOk . value ) {
ed . play ( 'error' )
return ed . notify ( lockedHint ( kind ) , 'error' )
}
ed . placing . value = { kind , conn }
}
function newConnector ( ) {
if ( ! portsOk . value ) return ed . notify ( lockedHint ( 'portin' ) , 'error' )
ed . addConnector ( )
}
function onDragStart ( e : DragEvent , kind : NodeKind , chip ? : string , conn ? : string ) {
2026-10-17 10:49:38 +00:00
if ( chip && ! ed . canPlace ( chip ) ) {
e . preventDefault ( )
return
}
2026-10-22 16:59:56 +00:00
e . dataTransfer ? . setData ( 'application/x-logigate' , JSON . stringify ( { kind , chip , conn } ) )
2026-10-17 10:49:38 +00:00
if ( e . dataTransfer ) e . dataTransfer . effectAllowed = 'copy'
2026-10-22 16:59:56 +00:00
ed . dragPart . value = { kind , chip , conn }
2026-10-17 10:49:38 +00:00
}
const solved = computed ( ( ) => new Set ( ed . project . value . solved ) )
2026-10-20 17:29:16 +00:00
const best = computed ( ( ) => ed . project . value . best ? ? { } )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const solvedCount = computed ( ( ) => CHALLENGES . filter ( c => solved . value . has ( c . id ) ) . length )
const campaign = computed ( ( ) => isCampaign ( ed . project . value ) )
const progress = computed ( ( ) => campaignProgress ( ed . project . value ) )
const open = ( id : string ) => challengeOpen ( ed . project . value , id )
const needsText = ( id : string ) => ` Solve ${ ( NEEDS [ id ] ? ? [ ] ) . filter ( n => ! solved . value . has ( n ) ) . map ( challengeName ) . join ( ' and ' ) } first `
const puzzles = computed ( ( ) => ( ed . project . value . puzzles ? ? [ ] ) . filter ( p => ! p . id . startsWith ( 'week:' ) || p . id === weeklyId ( weekKey ( ) ) ) )
const weeklyStarted = computed ( ( ) => ed . project . value . components . some ( d => d . challenge === weeklyId ( weekKey ( ) ) ) )
function lockedHint ( kind : NodeKind ) {
const by = KIND _UNLOCK [ kind ]
return by ? ` Solve the ${ challengeName ( by ) } challenge to unlock this part ` : ''
}
function openWeekly ( ) {
const spec = ed . project . value . puzzles ? . find ( p => p . id === weeklyId ( weekKey ( ) ) )
if ( spec ) ed . beginPuzzle ( spec )
else void ed . openPuzzle ( 'weekly' )
}
function compTitle ( d : ComponentDef ) {
if ( d . id === ed . def . value . id ) return 'You are editing this one'
if ( ! defUsable ( ed . project . value , d ) ) return 'Solve this challenge to use it as a part'
if ( ! ed . canPlace ( d . id ) ) return 'Contains the circuit you are editing'
return d . description || 'Click, then click on the canvas to place'
}
2026-10-17 10:49:38 +00:00
const started = computed ( ( ) => new Map ( ed . project . value . components . filter ( d => d . challenge ) . map ( d => [ d . challenge ! , d ] ) ) )
< / script >
< template >
< aside class = "palette" >
< div class = "tabs" >
< button : class = "{ active: tab === 'parts' }" @ click = "tab = 'parts'" > Parts < / button >
< button : class = "{ active: tab === 'challenges' }" @ click = "tab = 'challenges'" >
Challenges
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< span class = "count" > { { solvedCount } } / { { CHALLENGES . length } } < / span >
2026-10-17 10:49:38 +00:00
< / button >
2026-10-21 08:09:43 +00:00
< button class = "collapse-btn" title = "Hide this panel ([)" @ click = "ed.toggleSidebar('left', false)" >
< Icon name = "lucide:panel-left-close" class = "size-4" / >
< / button >
2026-10-17 10:49:38 +00:00
< / div >
< div v-if ="tab === 'parts'" class="scroll" >
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
< div class = "search part-search" >
2026-10-17 10:49:38 +00:00
< Icon name = "lucide:search" class = "size-3.5 text-(--muted)" / >
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
< input ref = "searchInput" v -model = " query " placeholder = "Find a part" @keydown ="onSearchKey" / >
< kbd v-if ="!query" title="Press / on the canvas to search, Shift+A to add at the mouse" > / < / kbd >
< button v -else class = "icon-btn" title = "Clear (Esc)" @ click = "query = ''" > < Icon name = "lucide:x" class = "size-3.5" / > < / button >
2026-10-17 10:49:38 +00:00
< / div >
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
<!-- Searching : one list of everything that matches -- >
< template v-if ="query.trim()" >
< p v-if ="!hits.length" class="hint px-3 pt-3" > Nothing called " {{ query.trim ( ) }} " fits here. < / p >
< ul class = "items mt-2" >
< li v-for ="(h, i) in hits" :key="h.chip ?? h.kind" >
2026-10-17 10:49:38 +00:00
< button
class = "item"
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
: class = "{ active: i === at }"
: draggable = "true"
@ click = "pick(h.kind, h.chip)"
@ dragstart = "onDragStart($event, h.kind, h.chip)"
2026-10-21 12:21:40 +00:00
@ dragend = "ed.dragPart.value = null"
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
@ pointerenter = "at = i"
2026-10-17 10:49:38 +00:00
>
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
< span v-if ="h.kind === 'nand'" class="nand-badge" > & amp ; < / span >
< Icon v -else :name ="h.icon" class = "size-4 shrink-0 text-(--muted)" / >
< span class = "grow truncate" > { { h . name } } < / span >
< span class = "group-tag" > { { h . group } } < / span >
2026-10-17 10:49:38 +00:00
< / button >
< / li >
< / ul >
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
< p class = "hint px-3 pt-2" > ↑ ↓ to choose , Enter to place , Esc to clear . < / p >
2026-10-17 10:49:38 +00:00
< / template >
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
< template v-else >
< template v-if ="recentParts.length" >
< h3 > Recent < / h3 >
< div class = "recent-parts" >
< button
v - for = "r in recentParts"
: key = "r.chip ?? r.kind"
class = "recent-chip"
: title = "`Place ${r.name}`"
draggable = "true"
@ click = "pick(r.kind, r.chip)"
@ dragstart = "onDragStart($event, r.kind, r.chip)"
@ dragend = "ed.dragPart.value = null"
>
< Icon :name ="r.icon" class = "size-3.5 shrink-0" / >
< span class = "truncate" > { { r . name } } < / span >
< / button >
< / div >
< / template >
< template v-for ="g in BASIC_GROUPS" :key="g.name" >
< button class = "group-head" @click ="fold(g.name)" >
< Icon : name = "folded.has(g.name) ? 'lucide:chevron-right' : 'lucide:chevron-down'" class = "size-3.5" / >
< span > { { g . name } } < / span >
< / button >
< ul v-if ="!folded.has(g.name)" class="items" >
< li v-for ="item in g.parts" :key="item.kind" >
< button
class = "item"
: class = "{ active: ed.placing.value?.kind === item.kind && !ed.placing.value?.chip, blocked: !ed.canPlaceKind(item.kind) }"
: title = "ed.canPlaceKind(item.kind) ? item.hint : lockedHint(item.kind)"
: draggable = "ed.canPlaceKind(item.kind)"
@ click = "pick(item.kind)"
@ dragstart = "onDragStart($event, item.kind)"
@ dragend = "ed.dragPart.value = null"
>
< span v-if ="item.kind === 'nand'" class="nand-badge" > & amp ; < / span >
< Icon v -else :name ="item.icon" class = "size-4 shrink-0 text-(--muted)" / >
< span class = "grow truncate" > { { item . name } } < / span >
< span v-if ="item.kind === 'nand'" class="tcount" title="4 transistors: a CMOS NAND gate" > 4T < / span >
< Icon v -if = " ! ed.canPlaceKind ( item.kind ) " name = "lucide:lock" class = "size-3.5 shrink-0 text-(--muted)" / >
< kbd v -else -if = " item.key " > { { item . key } } < / kbd >
< / button >
< / li >
< / ul >
< / template >
2026-10-22 16:59:56 +00:00
<!-- Connector types you made : place their ports , edit them , add new ones -- >
< button class = "group-head" @click ="fold('connectors')" >
< Icon : name = "folded.has('connectors') ? 'lucide:chevron-right' : 'lucide:chevron-down'" class = "size-3.5" / >
< span > Connectors < / span >
< span v-if ="connectors.length" class="group-count" > {{ connectors.length }} < / span >
< / button >
< ul v-if ="!folded.has('connectors')" class="items" >
< li v-for ="c in connectors" :key="c.id" class="comp-row conn-row" :class="{ blocked: !portsOk }" >
< span class = "conn-swatch" : class = "c.color ? `c-${c.color}` : ''" / >
< span class = "grow truncate" : title = "`${c.lines.length} lines: ${c.lines.map(l => (l.back ? `${l.name} (back)` : l.name)).join(', ')}`" > { { c . name } } < / span >
< button
v - for = "side in PORT_SIDES"
: key = "side.kind"
class = "btn-sm port-pick"
: class = "{ active: ed.placing.value?.kind === side.kind && ed.placing.value?.conn === c.id }"
: title = "side.hint(c.name)"
: draggable = "portsOk"
@ click = "pickPort(side.kind, c.id)"
@ dragstart = "onDragStart($event, side.kind, undefined, c.id)"
@ dragend = "ed.dragPart.value = null"
>
{ { side . label } }
< / button >
< button class = "open" title = "Edit this connector type: name, colour, lines" @click ="ed.editConnector(c.id)" >
< Icon name = "lucide:pencil" class = "size-3.5" / >
< / button >
< / li >
< li >
< button class = "item" : class = "{ blocked: !portsOk }" title = "Make a connector type of your own, like HDMI or RJ45: a name, a colour and its lines" @click ="newConnector" >
< Icon name = "lucide:plus" class = "size-4 shrink-0 text-(--muted)" / >
< span class = "grow truncate" > New connector type < / span >
< / button >
< / li >
< / ul >
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
< template v-for ="g in componentGroups" :key="g.name" >
< button class = "group-head" @click ="fold(`c:${g.name}`)" >
< Icon : name = "folded.has(`c:${g.name}`) ? 'lucide:chevron-right' : 'lucide:chevron-down'" class = "size-3.5" / >
< span > { { g . name } } < / span >
< span class = "group-count" > { { g . defs . length } } < / span >
< / button >
< ul v-if ="!folded.has(`c:${g.name}`)" class="items" >
< li v-for ="d in g.defs" :key="d.id" class="comp-row" >
< button
class = "item"
: class = "{ active: ed.placing.value?.chip === d.id, current: d.id === ed.def.value.id, blocked: !ed.canPlace(d.id) }"
: title = "compTitle(d)"
: draggable = "ed.canPlace(d.id)"
@ click = "pick('chip', d.id)"
@ dragstart = "onDragStart($event, 'chip', d.id)"
@ dragend = "ed.dragPart.value = null"
>
< Icon : name = "d.challenge && solved.has(d.challenge) ? 'lucide:badge-check' : 'lucide:box'" class = "size-4 shrink-0" : class = "d.challenge && solved.has(d.challenge) ? 'text-(--on)' : 'text-(--muted)'" / >
< span class = "grow truncate" > { { d . name } } < / span >
< span v-if ="d.id === ed.def.value.id" class="editing" > editing < / span >
< span v -else -if = " ed.transistors ( d.id ) " class = "tcount" : title = "`${ed.transistors(d.id).toLocaleString()} transistors`" > { { shortCount ( ed . transistors ( d . id ) ) } } T < / span >
< / button >
< button v-if ="d.id !== ed.def.value.id" class="open" title="Open and edit" @click="ed.open(d.id)" >
< Icon name = "lucide:pencil" class = "size-3.5" / >
< / button >
< / li >
< / ul >
< / template >
< div class = "grid gap-2 px-3 pt-3 pb-4" >
< button class = "btn w-full" @click ="ed.createComponent()" >
< Icon name = "lucide:plus" class = "size-4" / > New component
< / button >
< button class = "btn btn-ghost w-full" title = "NOT, AND, … up to a 4-bit counter, all built from NAND" @click ="ed.loadExamples()" >
< Icon name = "lucide:library" class = "size-4" / > Add example parts
< / button >
< / div >
< / template >
2026-10-17 10:49:38 +00:00
< / div >
< div v -else class = "scroll" >
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< div v-if ="campaign" class="campaign" >
< div class = "flex items-center justify-between" >
< span class = "font-semibold" > Campaign < / span >
< span class = "tabular-nums text-(--muted)" > { { solvedCount } } / { { CHALLENGES . length } } < / span >
< / div >
< div class = "bar" > < span : style = "{ width: `${progress * 100}%` }" / > < / div >
< p > Every part you solve becomes yours to use . New parts and challenges open as you go . < / p >
< / div >
< p v -else class = "intro" >
2026-10-17 10:49:38 +00:00
Build each part from NAND and the parts you already made . Start a challenge , wire it up , then press
< strong > Check < / strong > on the right .
< / p >
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< div class = "weekly" >
< div class = "flex items-center gap-2" >
< Icon name = "lucide:calendar-days" class = "size-4 shrink-0 text-(--accent)" / >
< span class = "grow font-medium" > Puzzle of the week < / span >
< button class = "btn-sm" @click ="openWeekly" > {{ weeklyStarted ? ' Open ' : ' Play ' }} < / button >
< / div >
< p > A new logic puzzle every Monday , the same for everyone . Fewest transistors wins . < / p >
< / div >
< template v-if ="puzzles.length" >
< h3 > Puzzles < / h3 >
< ul class = "challenges" >
< li v-for ="p in puzzles" :key="p.id" :class="{ solved: solved.has(p.id) }" >
< div class = "flex items-center gap-2" >
< Icon : name = "solved.has(p.id) ? 'lucide:circle-check' : 'lucide:puzzle'" class = "size-4 shrink-0" : class = "solved.has(p.id) ? 'text-(--on)' : 'text-(--muted)'" / >
< span class = "grow font-medium" > { { p . name } } < / span >
< button class = "btn-sm" @click ="ed.beginPuzzle(p)" > Open < / button >
< / div >
< p class = "pins" >
{ { p . inputs . join ( ', ' ) } } → { { p . outputs . join ( ', ' ) } }
< span v-if ="best[p.id] !== undefined" class="best" > · best {{ best [ p.id ] ! .toLocaleString ( ) }} transistors < / span >
< / p >
< / li >
< / ul >
< / template >
< h3 > Challenges < / h3 >
2026-10-17 10:49:38 +00:00
< ul class = "challenges" >
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< li v-for ="c in CHALLENGES" :key="c.id" :class="{ solved: solved.has(c.id), locked: !open(c.id) }" >
2026-10-17 10:49:38 +00:00
< div class = "flex items-center gap-2" >
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< Icon
: name = "solved.has(c.id) ? 'lucide:circle-check' : open(c.id) ? 'lucide:circle' : 'lucide:lock'"
class = "size-4 shrink-0"
: class = "solved.has(c.id) ? 'text-(--on)' : 'text-(--muted)'"
/ >
2026-10-17 10:49:38 +00:00
< span class = "grow font-medium" > { { c . name } } < / span >
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< button class = "btn-sm" : disabled = "!open(c.id) && !started.has(c.id)" : title = "open(c.id) ? '' : needsText(c.id)" @click ="ed.beginChallenge(c)" >
{ { started . has ( c . id ) ? 'Open' : 'Start' } }
< / button >
2026-10-17 10:49:38 +00:00
< / div >
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
< p v-if ="!open(c.id)" class="needs" > {{ needsText ( c.id ) }} < / p >
2026-10-17 10:49:38 +00:00
< p > { { c . goal } } < / p >
2026-10-20 17:29:16 +00:00
< p class = "pins" >
{ { c . inputs . join ( ', ' ) } } → { { c . outputs . join ( ', ' ) } }
< span v-if ="best[c.id] !== undefined" class="best" title="Fewest transistors in a passing solution so far" >
· best { { best [ c . id ] ! . toLocaleString ( ) } } transistors
< / span >
< / p >
2026-10-17 10:49:38 +00:00
< / li >
< / ul >
< / div >
< / aside >
< / template >