{mode==="touch"?"Swipe to move · tap a glowing stone":"WASD or arrow keys to move"}
{mode==="touch"?context:keyboardContext}
-
+
;
+ return
+ {reading?
{reading}{help}
:help}
Button controls
{children}
+ {moreReading&&}
;
}
diff --git a/web/src/expedition/Game.tsx b/web/src/expedition/Game.tsx
index 1a6e73b..a78a47e 100644
--- a/web/src/expedition/Game.tsx
+++ b/web/src/expedition/Game.tsx
@@ -11,6 +11,7 @@ import Inspect, { commandName, forecast } from "./Inspect";
import { applyCommand, findPosition, legalCommands, packSlots, phaseOf, replayCourt, startCourt } from "./engine";
import { commandAt, movementKey } from "./input";
import ControlHints from "./ControlHints";
+import { scrollReadingRegion } from "./keyboard-scroll";
import { HarborAudio } from "./audio";
import { COURTS } from "./rooms";
import { CONTENT_VERSION, TURN_LIMIT, type Area, type BankedItem, type Command, type CourtEvent, type CourtState, type CourtTransition, type Position, type Tool } from "./types";
@@ -32,8 +33,8 @@ import TideLog from "../tide/TideLog";
import TideHome from "../tide/TideHome";
import TideStamp from "../tide/TideStamp";
import { tideSailReason } from "../tide/sailing";
-import TideRunGame from "../run/TideRunGame";
-import { startTide, type TideStart, type TideState } from "../run/engine";
+import TideRunGame, { TideRunRules } from "../run/TideRunGame";
+import { startTide, tideShape, type TideStart, type TideState } from "../run/engine";
import { bramsGuess } from "../run/bot";
import { CHAPTERS, chapterFor, storyStart } from "../run/story";
import { closeTide, dayResults, emptyBook, readBook, shelfHaul, todayResult, writeBook, type DayResult, type TideBook } from "../run/save";
@@ -86,10 +87,10 @@ function Icon({kind}:{kind:"menu"|"close"|"bag"|"sound"|"silent"|"north"|"south"
return ;
}
-/** `audio`, `initialSound` and `initialMix` carry the title screen's sound choice; `initialSurface` carries its “Continue to today’s ask”. */
-export interface ExpeditionGameProps {session?:HarborSession;accountPanel?:ReactNode;audio?:HarborAudio;initialSound?:boolean;initialMix?:readonly [number,number];initialSurface?:"tide"}
-export default function ExpeditionGame({session,accountPanel,audio:titleAudio,initialSound=false,initialMix=[0.8,1],initialSurface}:ExpeditionGameProps={}){
- const [initial]=useState(readLocal),[save,setSave]=useState(initial.save),[surface,setSurface]=useState(initialSurface??null);
+/** `audio`, `initialSound` and `initialMix` carry the title screen's sound choice. */
+export interface ExpeditionGameProps {session?:HarborSession;accountPanel?:ReactNode;audio?:HarborAudio;initialSound?:boolean;initialMix?:readonly [number,number]}
+export default function ExpeditionGame({session,accountPanel,audio:titleAudio,initialSound=false,initialMix=[0.8,1]}:ExpeditionGameProps={}){
+ const [initial]=useState(readLocal),[save,setSave]=useState(initial.save),[surface,setSurface]=useState(null);
const [problem,setProblem]=useState(initial.problem),[corrupt,setCorrupt]=useState(!!initial.problem),[notice,setNotice]=useState(""),[transition,setTransition]=useState(null),[presentationId,setPresentationId]=useState(0),[busy,setBusy]=useState(false),[finishing,setFinishing]=useState(false),[focused,setFocused]=useState(null);
const [lease,setLease]=useState<"waiting"|"held"|"blocked"|"unavailable">("waiting"),[leaseAttempt,setLeaseAttempt]=useState(0);
const [tool,setTool]=useState("rope"),[area,setArea]=useState(()=>initial.save.home.lit&&!initial.save.home.banked.includes("vane")?"wind":"beacon"),[reduced,setReduced]=useState(()=>matchMedia("(prefers-reduced-motion: reduce)").matches),[hidden,setHidden]=useState(document.hidden),[unfocused,setUnfocused]=useState(false),[fault,setFault]=useState(""),[sceneKey,setSceneKey]=useState(0),[sound,setSound]=useState(initialSound),[motif,setMotif]=useState<"crest"|"moth">("crest"),[recipient,setRecipient]=useState(""),[lastBeat,setLastBeat]=useState("");
@@ -223,7 +224,7 @@ export default function ExpeditionGame({session,accountPanel,audio:titleAudio,in
if(keyRef.current===desiredKey)return;
repairRequest.current=null;setResting(false);
const branch=readLocal(desiredKey);keyRef.current=desiredKey;saveRef.current=branch.save;setSave(branch.save);setProblem(branch.problem);setCorrupt(!!branch.problem);corruptRef.current=!!branch.problem;
- buffer.current=null;if(queuedFrame.current!==null)cancelAnimationFrame(queuedFrame.current);queuedFrame.current=null;busyRef.current=false;setBusy(false);finishEpoch.current++;finishBusy.current=false;setFinishing(false);setTransition(null);presentation.current++;setPresentationId(presentation.current);setSceneKey(k=>k+1);setNotice("");setArrival(null);setSurface(current=>current==="home"?null:current);setFocused(null);
+ buffer.current=null;if(queuedFrame.current!==null)cancelAnimationFrame(queuedFrame.current);queuedFrame.current=null;busyRef.current=false;setBusy(false);finishEpoch.current++;finishBusy.current=false;setFinishing(false);setTransition(null);presentation.current++;setPresentationId(presentation.current);setSceneKey(k=>k+1);setNotice("");setArrival(null);setSurface(current=>current==="home"||current==="story"?null:current);setFocused(null);
sessionRef.current?.setActiveRun(branch.save.active?.context??null);
},[desiredKey]);
useEffect(()=>{
@@ -349,7 +350,7 @@ export default function ExpeditionGame({session,accountPanel,audio:titleAudio,in
function hover(position:Position|null){if(busyRef.current)return;const state=saveRef.current.active?.state;setFocused(position&&state?commandAt(state,position):null);}
/** Safari never focuses a clicked button, so fall back to the last button pressed. */
function opener(){const active=document.activeElement;return active instanceof HTMLElement&&active!==document.body&&active!==gameRef.current?active:pressed.current?.isConnected?pressed.current:active instanceof HTMLElement&&active===gameRef.current?active:null;}
- function open(place:HomePlace|"menu"|"guide"|"lantern"|"inspect"|"crossings"|"chart"|"tide"|"court-tide"|"log"|"home"){if(!panelOpen.current)trigger.current=opener();if(place==="mochi"){setResting(true);setGreeting(n=>n+1);return;}setResting(false);buffer.current=null;restoreInspectFocus.current=place==="inspect"&&trigger.current!==gameRef.current;setSurface(place);}
+ function open(place:HomePlace|"menu"|"guide"|"lantern"|"inspect"|"crossings"|"chart"|"story"|"tide"|"court-tide"|"log"|"home"){if(!panelOpen.current)trigger.current=opener();if(place==="mochi"){setResting(true);setGreeting(n=>n+1);return;}if(place==="tide"&&!savedMode&&tideResume){setTideAway(false);setSurface(null);return;}if(place==="tide")setCurrentTideDay(tideDay());setResting(false);buffer.current=null;restoreInspectFocus.current=place==="inspect"&&trigger.current!==gameRef.current;setSurface(place);}
function closePanel(){const controller=sessionRef.current;if(controller?.state.review){if(controller.state.busy)return;controller.cancelReview();}setSurface(null);}
function request(intent:WorldIntent){void sessionRef.current?.review(intent).catch(()=>{/* The controller keeps the actual failure and original operation visible. */});}
function restore(restoration:"beacon"|"signal"){
@@ -394,8 +395,8 @@ export default function ExpeditionGame({session,accountPanel,audio:titleAudio,in
if(won&&!persist({...saveRef.current,home:{...saveRef.current.home,banked:[...new Set([...saveRef.current.home.banked,prize])]}})){setProblem("");return false;}
const first=!prize&&!tideBook.days.some(day=>day.seed===state.seed);
const closed=closeTide(tideBook,state);
- if(!storeTideBook(again?{...closed,active:startTide(prize?storyStart(prize):{seed:state.seed})}:closed))return false;
- if(again){setTideRound(n=>n+1);return true;}
+ if(!storeTideBook(closed))return false;
+ if(again){setReadySceneKey(-1);setSceneKey(k=>k+1);open(prize?"story":"tide");return true;}
setReadySceneKey(-1);setSceneKey(k=>k+1);
if(prize)setNotice(won?`Mochi brought the ${names[prize]} home.${prize==="moth"?` Bram: “${CHAPTERS.moth.after.join(" ")}”`:""}`:`The ${names[prize]} is back in its shell. The tide will open it again.`);
else{
@@ -426,10 +427,13 @@ export default function ExpeditionGame({session,accountPanel,audio:titleAudio,in
const canPreviewCrest=!savedMode&&home.banked.includes("lens")||previewReturns.some(record=>record.outcome==="returned"&&record.cargo.includes("lens"));
const canPreviewMoth=!savedMode&&home.banked.includes("moth")||previewReturns.some(record=>record.outcome==="returned"&&record.cargo.includes("moth"));
const needsLantern=savedMode?!!session?.state.workshop.creditAvailable:home.lit&&!home.lantern&&canPreviewCrest;
- const nextPlace:HomePlace|"crossings"|"chart"|null=tideResume||storyNext?null:recordReturns.length?"satchel":needLens||needVane?"beacon":chapterComplete?"chart":home.signaled?"crossings":needsLantern?"workbench":null;
- const homeTitle=tideResume?"The tide is waiting.":storyNext?`${CHAPTERS[storyNext].title}.`:recordReturns.length?"A full satchel. A safe harbor.":needLens?"The lens is home.":needVane?"The vane is home.":chapterComplete?"A harbor connected.":lastService==="bell"?"Supplies at Bell Steps.":lastService==="reed"?"The reed skiff is home.":home.signaled?"The harbor finds its bearings.":needsLantern?"A little light of your own.":home.lit?"A light worth coming home to.":"A little help for the harbor.";
- const homeIntent=tideResume?"Mochi’s tide is saved where she stopped.":storyNext?`Bram: “${CHAPTERS[storyNext].before}”`:recordReturns.length?"Bring the original returned satchel to Bram. Review what can be saved before unpacking.":needLens?"Mochi kept it safe. Carry the lens up to the beacon.":needVane?"Bram steadies the bare post. Mochi has brought back the missing arrow.":chapterComplete?(harbor.heardBell?"The bell pull is rigged. Try a different crossing with Mochi, or sit together by the quay.":"Bram has cleared the old arch at Bell Steps. Mochi keeps turning toward it. What does she hear when the water falls?"):lastService==="bell"?"Across the water, Bram’s crates stand on the receiving steps.":lastService==="reed"?"The skiff rocks at its mooring on the near bank.":home.signaled?"Bram has a load for Bell Steps. Mochi is watching a skiff across at Reed.":needsLantern?"Your returned adventure can become one light for home.":home.lit?`Wind Gate has a different tide to understand.${home.banked.includes("moth")?"":" You can also return for the wind-moth."}`:"The beacon’s lens is across the tide. Mochi is ready to help.";
- const primaryLabel=tideResume?"Return to the tide":storyNext?"Set out with Mochi":recordReturns.length?"Unpack the satchel":needLens?"Bring the lens to the beacon":needVane?"Fit the Signal Vane":chapterComplete?"Look over the harbor":home.signaled?"Choose a crossing":needsLantern?"Make a little light":area==="wind"?"Sail to Wind Gate":"Set out with Mochi";
+ const pendingTideReturn=tideResume&&tideBook.active?.outcome!=="active";
+ const storyWork=!savedMode&&(needLens||needVane||!!storyNext);
+ const savedReturnFirst=savedMode&&recordReturns.length>0;
+ const nextPlace:HomePlace|"crossings"|"chart"|null=tideResume?null:savedReturnFirst?"satchel":needLens||needVane?"beacon":storyNext?null:recordReturns.length?"satchel":chapterComplete?"chart":home.signaled?"crossings":needsLantern?"workbench":null;
+ const homeTitle=tideResume?pendingTideReturn?"The return is waiting.":"The outing is waiting.":savedReturnFirst?"A full satchel. A safe harbor.":needLens?"The lens is home.":needVane?"The vane is home.":storyNext?`${CHAPTERS[storyNext].title}.`:recordReturns.length?"A full satchel. A safe harbor.":chapterComplete?"A harbor connected.":lastService==="bell"?"Supplies at Bell Steps.":lastService==="reed"?"The reed skiff is home.":home.signaled?"The harbor finds its bearings.":needsLantern?"A little light of your own.":home.lit?"A light worth coming home to.":"A little help for the harbor.";
+ const homeIntent=tideResume?pendingTideReturn?"Mochi’s outing has ended. Her return still needs to be saved.":"Mochi’s outing is saved where she stopped.":savedReturnFirst?"Bring the original returned satchel to Bram. Review what can be saved before unpacking.":needLens?"Mochi kept it safe. Carry the lens up to the beacon.":needVane?"Bram steadies the bare post. Mochi has brought back the missing arrow.":storyNext?CHAPTERS[storyNext].before:recordReturns.length?"Bring the original returned satchel to Bram. Review what can be saved before unpacking.":chapterComplete?(harbor.heardBell?"The bell pull is rigged. Try a different crossing with Mochi, or sit together by the quay.":"Bram has cleared the old arch at Bell Steps. Mochi keeps turning toward it. What does she hear when the water falls?"):lastService==="bell"?"Across the water, Bram’s crates stand on the receiving steps.":lastService==="reed"?"The skiff rocks at its mooring on the near bank.":home.signaled?"Bram has a load for Bell Steps. Mochi is watching a skiff across at Reed.":needsLantern?"Your returned adventure can become one light for home.":home.lit?`Wind Gate has a different tide to understand.${home.banked.includes("moth")?"":" You can also return for the wind-moth."}`:"The beacon’s lens is across the tide. Mochi is ready to help.";
+ const primaryLabel=tideResume?pendingTideReturn?"Return to the harbor":"Resume outing":savedReturnFirst?"Unpack the satchel":needLens?"Fit the Beacon Lens":needVane?"Fit the Signal Vane":storyNext?`Prepare Chapter ${CHAPTERS[storyNext].number}`:recordReturns.length?"Unpack the satchel":chapterComplete?"Look over the harbor":home.signaled?"Choose a crossing":needsLantern?"Make a little light":area==="wind"?"Sail to Wind Gate":"Set out with Mochi";
const shelved=savedMode?shelvedDay?.scope===tideScope&&shelvedDay.day===today:readPreview(undefined,today)?.docked===today;
const todayHaul=todayTide?shelfHaul(todayTide):null;
const arrivalHaul=!savedMode&&arrival&&"result" in arrival?shelfHaul(arrival.result):null;
@@ -438,9 +442,13 @@ export default function ExpeditionGame({session,accountPanel,audio:titleAudio,in
const outing=replayRun(record.tool,record.commands);
return outing?.state.outcome==="returned"&&outing.state.cargo.length>0;
}):!!todayHaul&&todayHaul.reed+todayHaul.glass>0;
- const tideHome=resting||tideResume?null:harborTide(savedMode?{lit:home.lit,card:cardForDay(today),next:cardForDay(today+1),entry:todayView(today,tideEntries).entry,returnedToday,shelved}:{lit:home.lit,card:cardForDay(today),next:cardForDay(today+1),guess:todayGuess,result:todayTide,returnedToday,shelved}),tidePanel=tideHome?.kind==="panel"?tideHome:null;
- const tideExtra=savedMode||!home.lit||resting?null:needVane?{label:"Fit the vane",hint:"Fit the Signal Vane",go:()=>open("beacon")}:tideResume?{label:"Resume tide",hint:"Return to the tide Mochi left",go:()=>setTideAway(false)}:storyNext?{label:`Chapter ${CHAPTERS[storyNext].number}`,hint:`Chapter ${CHAPTERS[storyNext].number}: ${CHAPTERS[storyNext].title}`,go:()=>departTide(storyStart(storyNext))}:null;
- function tideAction(action:"tide"|"log"|"sail"|"bram"){if(action==="sail"){if(savedMode)sailTide(today);else departTide({seed:today});}else if(action==="log")openLog(today);else open(action);}
+ const tideHome=resting||tideResume||storyWork?null:harborTide(savedMode?{lit:home.lit,card:cardForDay(today),next:cardForDay(today+1),entry:todayView(today,tideEntries).entry,returnedToday,shelved}:{lit:home.lit,card:cardForDay(today),next:cardForDay(today+1),guess:todayGuess,result:todayTide,returnedToday,shelved}),tidePanel=tideHome?.kind==="panel"?tideHome:null;
+ function tideAction(action:"tide"|"log"|"sail"|"bram"){if(action==="sail"){if(savedMode)sailTide(today);else open("tide");}else if(action==="log")openLog(today);else open(action);}
+ function sailDeviceTide(day:number){
+ const current=import.meta.env.DEV?devTideDay(location.search)??tideDay():tideDay();
+ if(day!==current){setCurrentTideDay(current);return;}
+ departTide({seed:day});
+ }
const feedback=
{notice}
;
const beatParts=lastBeat.split(":"),currentBeat=busy&&transition&&Number(beatParts[0])===presentationId?transition.events[Number(beatParts[1])]:null;
const shownForecast=busy?currentBeat?`Resolving: ${eventDescription(currentBeat,run?.area)}`:"Mochi is acting. The tide will follow.":run?forecast(run,focused):"";
@@ -481,9 +489,10 @@ export default function ExpeditionGame({session,accountPanel,audio:titleAudio,in
-
{tidePanel&&}
{resting?"A moment together.":tidePanel?tidePanel.title:homeTitle}
{resting?(greeting?"Mochi rests a paw against your hand, then settles beside you.":harbor.moth?"Mochi tucks a paw under and watches the moth at its perch.":harbor.watchedReeds?"Mochi tucks a paw under, just as at the sheltered reeds.":"Mochi settles beside you. The water moves below the quay."):tidePanel?tidePanel.body:homeIntent}
{COURTS[area].title} · {title(tool)}{tideExtra&&}
+
{tidePanel&&}
{resting?"A moment together.":tidePanel?tidePanel.title:homeTitle}
{resting?(greeting?"Mochi rests a paw against your hand, then settles beside you.":harbor.moth?"Mochi tucks a paw under and watches the moth at its perch.":harbor.watchedReeds?"Mochi tucks a paw under, just as at the sheltered reeds.":"Mochi settles beside you. The water moves below the quay."):tidePanel?tidePanel.body:homeIntent}
{lease==="blocked"?"This expedition is open in another tab. Finish there, or close that tab before continuing here.":"This browser cannot safely coordinate saved expeditions. Web Locks support is required; no move has been taken."}
Choose a source. The wind-wheel, when present, determines its exit.
{(["left","center","right"] as const).map(lane=>)}>:surface==="inspect"&&run?:surface==="guide"?<>
Read the water.
Swipe on the court or tap a glowing neighboring platform. On a keyboard, use WASD or the arrow keys. Crossing the open bridge is one decision. Optional Button controls keep every action available without gestures.
Low: choose your footing. Rising: your resulting column becomes the source. Surge: act first, then the wave opens that column’s bridge and shell. Standing in the wave washes Mochi down one platform.
Rope retrieves an exposed lens or vane from two steps away. Lantern redirects a marked surge. A living moth needs two pack slots. Reach the center dock to return before 24 decisions.
{run?.area==="wind"&&
Current channels: Left → {columns[run.orientation]}, Center → {columns[(1+run.orientation)%3]}, Right → {columns[(2+run.orientation)%3]}. The cradle needs Left and Center charged and wheel alignment zero.
}
Tap Wait beside Mochi, or Home at the dock to come home. E uses a nearby object or opens the lantern; Space waits; R returns at the dock; I inspects. Right-click or hold a world target to inspect for free. Inspection and menus spend no turns.
Choose a source. The wind-wheel, when present, determines its exit.
{(["left","center","right"] as const).map(lane=>)}>:surface==="inspect"&&run?:surface==="guide"&&!savedMode&&!run?<>
How Tide Run works
>:surface==="guide"?<>
Read the water.
Swipe on the court or tap a glowing neighboring platform. On a keyboard, use WASD or the arrow keys. Crossing the open bridge is one decision. Optional Button controls keep every action available without gestures.
Low: choose your footing. Rising: your resulting column becomes the source. Surge: act first, then the wave opens that column’s bridge and shell. Standing in the wave washes Mochi down one platform.
Rope retrieves an exposed lens or vane from two steps away. Lantern redirects a marked surge. A living moth needs two pack slots. Reach the center dock to return before 24 decisions.
{run?.area==="wind"&&
Current channels: Left → {columns[run.orientation]}, Center → {columns[(1+run.orientation)%3]}, Right → {columns[(2+run.orientation)%3]}. The cradle needs Left and Center charged and wheel alignment zero.
}
Tap Wait beside Mochi, or Home at the dock to come home. E uses a nearby object or opens the lantern; Space waits; R returns at the dock; I inspects. Right-click or hold a world target to inspect for free. Inspection and menus spend no turns.
{needVane?"One missing piece.":home.signaled?"Wind on the quay.":home.lit?"The beacon knows the way.":"A light for everyone."}
{needVane?"Bram holds the post while Mochi raises the brass arrow to its spindle.":home.signaled?"The signal arrow swings free above the quay. The beacon lights the way home.":home.lit?"The lens is safe in its lantern. Its light belongs to the whole harbor.":home.banked.includes("lens")?"The recovered lens fits the empty lantern. Mochi is ready to lift it into place.":"The missing lens waits in Beacon Court’s left shell. The Tidekeeper can open it."}
{home.banked.length?home.banked.map(i=>i in names?names[i as keyof typeof names]:title(i)).join(" · "):"An empty satchel. There’s room for a small adventure."}
{save.last.outcome==="returned"?`Mochi came home after ${save.last.turn} decisions with ${save.last.resolve}/3 Resolve.`:"Bram brought Mochi home. Only the unbanked cargo was lost."}
}
{authority}. {savedMode?"Only accepted returns change the saved harbor.":"Device saves are not backed up or transferable. Signing in does not replace this preview."}
>:surface==="bram"?<>
“You’re back.”
{lastService==="bell"?"Bram shades his eyes. Across the channel his crates are stacked high and dry.":lastService==="reed"?"Bram loops the skiff’s painter around the mooring and checks Mochi’s knot.":home.signaled?"Bram watches the arrow swing. “An easterly. I can tell before I untie a single rope.”":home.banked.includes("moth")?"The little wings sound rather like a kettle beginning to sing. Bram makes room beside the hearth.":home.lit?"Bram puts the kettle on. A harbor looks different when everyone can find it.":"Bram looks across the bay. “A lighthouse shouldn’t have to guess where it’s pointing.”"}
{harbor.heardBell&&
“There’s your bell,” Bram says. “I’ve run a pull to the far-center landing at both crossings. One good tug calls the Tidekeeper’s surge left. Choose when to use it.”
The personal Shell commission belongs to an accepted saved return. This preview does not issue currency.
}{Bram is setting out his shelf…}>open("tide")} tideScope={savedMode?session!.state.snapshot!.binding.nearAccountId:"preview"} {...(!savedMode?{run:todayTide}:{})}/>}>:surface==="home"&&arrival?(!savedMode&&"result" in arrival?0&&!shelved} reduced={reduced} notice={arrivalNotice} sailBlockedReason={sailBlockedReason} onBram={()=>open("bram")} onSail={()=>departTide({seed:today})} onOpenLog={()=>openLog(arrival.day)}/>:"run" in arrival?0&&!shelved&&shelvesBeaconCourt(today)} reduced={reduced} notice={arrivalNotice} sailBlockedReason={sailBlockedReason} onBram={()=>open("bram")} onSail={()=>sailTide(arrival.day)} onOpenLog={()=>openLog(arrival.day)}/>:null):surface==="tide"&&!savedMode?departTide({seed:today})} onOpenLog={openLog}/>:surface==="tide"||surface==="court-tide"?:surface==="log"?:surface==="workbench"?<>
Choose an earned motif for one First Light lantern.
{session.state.workshop.motifs.map(m=>)}>:
{session?.state.workshop.items.length?"Your owned lantern keeps the maker’s actual accepted story.":"Bring an accepted Beacon Lens return home to earn the first craft."}
}{!!session?.state.workshop.items.length&&Give a lantern
Gifting moves the owned item. The maker’s achievement stays with its maker. Storage, if needed, is a separate reviewed action.
Illustrated {item.mint.motif==="moth"?"wind-moth rescue":"Beacon Lens return"}, from the maker’s actual accepted event. This is not a recorded screenshot.
One {title(home.lantern.motif)} lantern. Local preview only; not backed up or transferable.
Light’s origin{previewOrigin?<>
Mochi returned with the {home.lantern.motif==="moth"?"wind-moth":"Beacon Lens"}. {previewOrigin.commands.length} choices with the {title(previewOrigin.tool)}.
Static illustration of this device’s validated return, not a recorded screenshot or an accepted NEAR claim.
{needVane?"One missing piece.":home.signaled?"Wind on the quay.":home.lit?"The beacon knows the way.":"A light for everyone."}
{needVane?"Bram holds the post while Mochi raises the brass arrow to its spindle.":home.signaled?"The signal arrow swings free above the quay. The beacon lights the way home.":home.lit?"The lens is safe in its lantern. Its light belongs to the whole harbor.":home.banked.includes("lens")?"The recovered lens fits the empty lantern. Mochi is ready to lift it into place.":"The missing lens waits in Beacon Court’s left shell. The Tidekeeper can open it."}
{home.banked.length?home.banked.map(i=>i in names?names[i as keyof typeof names]:title(i)).join(" · "):"An empty satchel. There’s room for a small adventure."}
{save.last.outcome==="returned"?`Mochi came home after ${save.last.turn} decisions with ${save.last.resolve}/3 Resolve.`:"Bram brought Mochi home. Only the unbanked cargo was lost."}
}
{authority}. {savedMode?"Only accepted returns change the saved harbor.":"Device saves are not backed up or transferable. Signing in does not replace this preview."}
>:surface==="bram"?<>
“You’re back.”
{lastService==="bell"?"Bram shades his eyes. Across the channel his crates are stacked high and dry.":lastService==="reed"?"Bram loops the skiff’s painter around the mooring and checks Mochi’s knot.":home.signaled?"Bram watches the arrow swing. “An easterly. I can tell before I untie a single rope.”":home.banked.includes("moth")?"The little wings sound rather like a kettle beginning to sing. Bram makes room beside the hearth.":home.lit?"Bram puts the kettle on. A harbor looks different when everyone can find it.":"Bram looks across the bay. “A lighthouse shouldn’t have to guess where it’s pointing.”"}
{harbor.heardBell&&
“There’s your bell,” Bram says. “I’ve run a pull to the far-center landing at both crossings. One good tug calls the Tidekeeper’s surge left. Choose when to use it.”
The personal Shell commission belongs to an accepted saved return. This preview does not issue currency.
}{Bram is setting out his shelf…}>open("tide")} tideScope={savedMode?session!.state.snapshot!.binding.nearAccountId:"preview"} {...(!savedMode?{run:todayTide}:{})}/>}>:surface==="home"&&arrival?(!savedMode&&"result" in arrival?0&&!shelved} reduced={reduced} notice={arrivalNotice} sailBlockedReason={sailBlockedReason} onBram={()=>open("bram")} onSail={()=>open("tide")} onOpenLog={()=>openLog(arrival.day)}/>:"run" in arrival?0&&!shelved&&shelvesBeaconCourt(today)} reduced={reduced} notice={arrivalNotice} sailBlockedReason={sailBlockedReason} onBram={()=>open("bram")} onSail={()=>sailTide(arrival.day)} onOpenLog={()=>openLog(arrival.day)}/>:null):surface==="tide"&&!savedMode?:surface==="tide"||surface==="court-tide"?:surface==="log"?:surface==="workbench"?<>
Choose an earned motif for one First Light lantern.
{session.state.workshop.motifs.map(m=>)}>:
{session?.state.workshop.items.length?"Your owned lantern keeps the maker’s actual accepted story.":"Bring an accepted Beacon Lens return home to earn the first craft."}
}{!!session?.state.workshop.items.length&&Give a lantern
Gifting moves the owned item. The maker’s achievement stays with its maker. Storage, if needed, is a separate reviewed action.
Illustrated {item.mint.motif==="moth"?"wind-moth rescue":"Beacon Lens return"}, from the maker’s actual accepted event. This is not a recorded screenshot.
One {title(home.lantern.motif)} lantern. Local preview only; not backed up or transferable.
Light’s origin{previewOrigin?<>
Mochi returned with the {home.lantern.motif==="moth"?"wind-moth":"Beacon Lens"}. {previewOrigin.commands.length} choices with the {title(previewOrigin.tool)}.
Static illustration of this device’s validated return, not a recorded screenshot or an accepted NEAR claim.
The Tidekeeper marks a source, then sends a wave. Cross the connected platforms and it might open the shell you needed. Stay a little longer and you might bring someone home.
+
Read the water. Bring the light home.
+
Each step or wait advances the water. A wave arrives after every third move. Read its lanes, cross the moving bridge, and carry your finds back to the center dock.
@@ -43,20 +43,20 @@ export function Landing() {
- Beacon Court concept art. In the game, Mochi crosses connected platforms.
+ Beacon Court concept art.
-
Bring a little ingenuity.
-
Choose Rope to reel in an exposed find, or Lantern to redirect a marked source. Two uses. Your call.
+
One clear errand.
+
Bring the Beacon Lens home from the left shell. Your first outing has eight calm waves.
-
Make room for a detour.
-
A lens takes one pack slot. A wind-moth takes two. Decide what’s worth one more turn, then carry your finds back to the dock.
+
Keep what you bank.
+
Step onto the center dock to bank cargo. Banking keeps the outing open; finishing returns you to the harbor.
-
Come home with a story.
-
Install what you recover. Watch the lighthouse glow. Mochi remembers a moment from the trip you actually took.
+
Make the return matter.
+
Fit the lens into the beacon. Each repair uncovers another piece of the harbor’s story.
@@ -64,13 +64,12 @@ export function Landing() {
- Wind Gate concept art. This outing opens after you restore the lighthouse.
+ Wind Gate concept art. Optional outings have their own rules on the Harbor chart.
-
You know the tide. Now turn it.
-
Beyond the beacon, the channel sends a familiar wave somewhere new. Align the wheel, trace the exit, and charge Left and Center to recover the harbor’s Signal Vane.
-
Rope or Lantern. A different route. Something else to bring home.
);
diff --git a/web/src/opening/opening.css b/web/src/opening/opening.css
index 35e8fa0..81ac1a0 100644
--- a/web/src/opening/opening.css
+++ b/web/src/opening/opening.css
@@ -7,6 +7,7 @@ html:has(.familiar-opening:not(.framed)),body:has(.familiar-opening:not(.framed)
.familiar-opening .fo-bell:focus-visible{border-radius:8px}
.familiar-opening .fo-paper button:focus-visible{outline-color:#2b5f4d}
.familiar-opening .fo-primary,.familiar-opening .fo-secondary{display:flex;align-items:center;justify-content:center;gap:10px;box-sizing:border-box;border-radius:999px;cursor:pointer;text-wrap:balance}
+.familiar-opening [data-el="begin"][hidden]{display:none}
.familiar-opening .fo-primary{min-height:52px;padding:10px 26px;border:0;background:#2b5f4d;color:#fff6e2;box-shadow:inset 0 1px 0 #5f9a83,inset 0 -3px 0 #1d4436,0 6px 14px rgba(31,68,54,.28);font:650 18px/1.2 'Fraunces Variable',serif}
.familiar-opening .fo-primary:active{transform:translateY(1px);box-shadow:inset 0 1px 0 #5f9a83,inset 0 -1px 0 #1d4436,0 6px 14px rgba(31,68,54,.28)}
.familiar-opening .fo-secondary{min-height:48px;padding:9px 18px;border:1.5px solid #d6c29b;background:#fffaf0;color:var(--fo-ink);font:600 17px/1.2 'Fraunces Variable',serif}
diff --git a/web/src/run/TideRunGame.test.tsx b/web/src/run/TideRunGame.test.tsx
index 82144db..2c6c580 100644
--- a/web/src/run/TideRunGame.test.tsx
+++ b/web/src/run/TideRunGame.test.tsx
@@ -1,6 +1,6 @@
import { expect, mock, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
-import TideRunGame from "./TideRunGame";
+import TideRunGame, { TideRunRules } from "./TideRunGame";
import { applyMove, startTide, type TideState } from "./engine";
import { CHAPTERS, itemName, storyStart } from "./story";
@@ -37,9 +37,9 @@ test("all three story chapters keep their end card and retry button", () => {
expect(html).toContain(CHAPTERS[prize].title);
expect(html).toContain('aria-label="The tide is over"');
expect(html).toContain("Home for the day.");
- expect(html).toContain(`The ${itemName(prize)} is still in its shell. The same tide comes again.`);
+ expect(html).toContain(`The ${itemName(prize)} is back in its shell. You can try the same tide again.`);
expect(html).toContain('data-testid="tide-finish"');
- expect(html).toContain("Back to the harbor");
+ expect(html).toContain("Return to the harbor");
expect(html).toContain('data-testid="tide-again"');
expect(html).toContain("Try this tide again");
expect(onFinish).not.toHaveBeenCalled();
@@ -50,7 +50,7 @@ test("a story prize brought home keeps the return card without offering a retry"
for (const prize of ["lens", "vane", "moth"] as const) {
const finished = applyMove(startTide(storyStart(prize)), "home")!.after;
const { html } = render({ ...finished, banked: [prize], score: 3 });
- expect(html).toContain(`The ${itemName(prize)} is home. Banked 3 besides.`);
+ expect(html).toContain(`The ${itemName(prize)} is safe. Score: 3. Return to the harbor to continue.`);
expect(html).toContain('data-testid="tide-finish"');
expect(html).not.toContain('data-testid="tide-again"');
}
@@ -60,8 +60,8 @@ test("the tide run teaches direct play and keeps a closed native button alternat
const { html } = render(startTide({ seed: 20771 }));
expect(html).toContain("WASD or arrow keys to move");
expect(html).toContain("Space waits");
- expect(html).toContain("R ends the tide at the dock");
- expect(html).toContain("I explains the tide");
+ expect(html).toContain("R finishes at the dock");
+ expect(html).toContain("I opens the guide");
expect(html).not.toContain("E interacts");
expect(html).not.toContain("tap a find to collect it");
expect(html).toContain('Button controls');
@@ -69,3 +69,50 @@ test("the tide run teaches direct play and keeps a closed native button alternat
expect(html).not.toContain(' {
+ for (const prize of ["lens", "vane", "moth"] as const) {
+ const label = prize === "lens" ? "Lens" : prize === "vane" ? "Vane" : "Moth";
+ const active = { ...startTide(storyStart(prize)), moves: ["wait"] as const };
+ const carried = render({ ...active, pack: [prize] }).html;
+ expect(carried).toContain(`${label} carried`);
+ expect(carried).not.toContain(`${label} safe`);
+ const banked = render({ ...active, banked: [prize] }).html;
+ expect(banked).toContain(`${label} safe`);
+ expect(banked).toContain('data-testid="tide-score">0');
+ expect(banked).toContain("Pause outing");
+ expect(banked).toContain("Pause returns you to the harbor with this outing still open.");
+ expect(banked).toContain("Step onto the center dock to bank cargo. Banking keeps the outing open.");
+ expect(banked).toContain('data-testid="tide-finish-return"');
+ expect(banked).toContain("Finish and return");
+ expect(banked).toContain("Keep gathering");
+ expect(banked.indexOf('data-testid="tide-prize-status"')).toBeLessThan(banked.indexOf('class="tide-tray-reading"'));
+ expect(banked.indexOf('data-testid="tide-finish-return"')).toBeLessThan(banked.indexOf('Button controls'));
+ const finished = render({ ...active, banked: [prize], outcome: "home" }).html;
+ expect(finished).toContain(`The ${itemName(prize)} is safe. Score: 0. Return to the harbor to continue.`);
+ }
+});
+
+test("chapter briefings are narration without inventing Bram dialogue", () => {
+ for (const prize of ["lens", "vane", "moth"] as const) {
+ const { html } = render(startTide(storyStart(prize)));
+ expect(html).toContain(`aria-live="polite">${CHAPTERS[prize].before}`);
+ expect(html).not.toContain(`Bram: “${CHAPTERS[prize].before}”`);
+ }
+});
+
+test("the named objective remains visible beside last-wave advice", () => {
+ const { html } = render({ ...startTide(storyStart("lens")), wave: 7, beat: 21 });
+ expect(html).toContain(CHAPTERS.lens.goal);
+ expect(html).toContain("The last wave. Get to the dock.");
+});
+
+test("shared Tide Run rules explain timing, cargo and activity length", () => {
+ for (const story of [undefined, "lens", "vane", "moth"] as const) {
+ const html = renderToStaticMarkup();
+ expect(html).toContain("Every step or wait advances the water by one move. A wave arrives after every third move. Mochi moves first, then the wave lands.");
+ expect(html).toContain("Pause outing keeps the outing open. Reading, inspection, and menus spend no moves.");
+ expect(html).toContain("Story finds restore the harbor and add no points.");
+ expect(html).toContain(story === "lens" ? "This outing is 8 waves." : "This outing is 12 waves. From wave 7, each wave takes two lanes.");
+ }
+});
diff --git a/web/src/run/TideRunGame.tsx b/web/src/run/TideRunGame.tsx
index efddba6..5376d4c 100644
--- a/web/src/run/TideRunGame.tsx
+++ b/web/src/run/TideRunGame.tsx
@@ -1,8 +1,9 @@
import { useEffect, useMemo, useRef, useState } from "react";
import TideWorld from "./TideWorld";
import ControlHints from "../expedition/ControlHints";
+import { scrollReadingRegion } from "../expedition/keyboard-scroll";
import type { TideSnapshot } from "./scene";
-import { HEARTS, PACK_SLOTS, SLOTS, applyMove, countdown, legalMoves, stepDestination, tideShape, type Move, type Position, type TideEvent, type TideState, type TideTransition } from "./engine";
+import { HEARTS, PACK_SLOTS, SLOTS, applyMove, countdown, legalMoves, stepDestination, tideShape, type Move, type Position, type StoryPrize, type TideEvent, type TideState, type TideTransition } from "./engine";
import { bramsGuess } from "./bot";
import { CHAPTERS, aPrize, consequence, itemName, laneNames } from "./story";
import { STAMPS } from "../tide/run-day";
@@ -65,21 +66,39 @@ function sound(event: TideEvent): CourtEvent | null {
}
}
+export function TideRunRules({ story }: { story?: StoryPrize }) {
+ const { waves, roughFrom } = tideShape({ story });
+ return <>
+
+
{icon(WAVE)}Every step or wait advances the water by one move. A wave arrives after every third move. Mochi moves first, then the wave lands.
+
{icon(WAVE)}Read the tinted lanes and the moves left. The quay is safe from waves.
+
{icon(HEART)}A splash costs a heart and the last item Mochi picked up, and washes her toward the quay.
+
{icon(BAG)}Prizes are collected when Mochi steps onto them. The pack holds three slots; the wind-moth needs two.
+
{icon(BAG)}Reed scores 1, sea glass 3, and a pearl 6. Story finds restore the harbor and add no points.
+
{icon(HOME)}Step onto the center dock to bank cargo. Choose Finish and return there to end the outing.
+
{icon(HOME)}Pause outing keeps the outing open. Reading, inspection, and menus spend no moves.
+
{icon("M3 18V6m18 12V6M3 8c4 6 14 6 18 0M3 18h18M7 12v6m5-5v5m5-6v6")}The bridge moves to the wave’s lane. The channel can only be crossed there.
+
{icon(WAVE)}This outing is {waves} waves.{roughFrom < waves ? ` From wave ${roughFrom + 1}, each wave takes two lanes.` : ""} What is still in the pack when it ends is lost.
+
+
Swipe or tap a neighboring platform to move. Tap Wait beside Mochi to let one move pass. WASD or arrow keys to move. Space waits · R finishes at the dock · I opens the guide. Optional Button controls offer the same decisions without gestures.
+ >;
+}
+
export default function TideRunGame({ initial, reduced, sound: soundOn, audio, blocked, onSave, onFinish, onLeave, onToggleSound }: Props) {
const [state, setState] = useState(initial), [result, setResult] = useState(null);
const current = useRef(initial), pending = useRef(null), serial = useRef(0);
const [ready, setReady] = useState(false), [fault, setFault] = useState(""), [sceneKey, setSceneKey] = useState(0);
const [away, setAway] = useState(document.hidden), [guide, setGuide] = useState(false);
const [finishError, setFinishError] = useState(false);
- const finishAttempted = useRef(false), filed = useRef(false);
+ const finishAttempted = useRef(false), filed = useRef(false), explicitFinish = useRef(false);
const chapter = initial.story ? CHAPTERS[initial.story] : null;
- const [notice, setNotice] = useState(() => initial.outcome !== "active" || initial.moves.length ? "" : chapter ? `Bram: “${chapter.before}”` : `The Tidekeeper turns to the ${laneNames(initial.next.lanes).toLowerCase()} lane.`);
+ const [notice, setNotice] = useState(() => initial.outcome !== "active" || initial.moves.length ? "" : chapter ? chapter.before : `The Tidekeeper turns to the ${laneNames(initial.next.lanes).toLowerCase()} lane.`);
const dialog = useRef(null), guideButton = useRef(null), gameRef = useRef(null), guideOpener = useRef(null);
const guess = useMemo(() => initial.story ? null : bramsGuess(initial.seed), [initial.seed, initial.story]);
const busy = !!result, paused = away || blocked || guide || !!fault;
// The board catches up before the numbers do: the status shows the tide as drawn.
const seen = result ? result.before : state, over = state.outcome !== "active" && !busy;
- const { waves, roughFrom } = tideShape(initial), legal = legalMoves(state);
+ const { waves } = tideShape(initial), legal = legalMoves(state);
const used = seen.pack.reduce((sum, item) => sum + SLOTS[item], 0);
const worldActions = useMemo(() => legalMoves(state).filter((move): move is "wait" | "home" => move === "wait" || move === "home" && state.moves.length > 0), [state]);
const snapshot = useMemo(() => ({ tide: state, reducedMotion: reduced, worldActions }), [state, reduced, worldActions]);
@@ -125,16 +144,15 @@ export default function TideRunGame({ initial, reduced, sound: soundOn, audio, b
// The last thing that happened stays up until something else does.
const line = consequence(accepted);
if (line) setNotice(line);
+ if (accepted.after.moves.at(-1) === "home") explicitFinish.current = true;
pending.current = null; setResult(null);
}
function target(position: Position) { const move = moveToward(current.current, position); if (move) take(move); }
function finish(again: boolean) {
- if (!current.current.story) {
- if (!over || !ready || blocked || filed.current) return;
- finishAttempted.current = true;
- }
+ if (current.current.outcome === "active" || pending.current || (!ready && !current.current.story) || blocked || filed.current) return;
+ finishAttempted.current = true;
const saved = onFinish(current.current, again);
- if (!current.current.story && saved) filed.current = true;
+ if (saved) filed.current = true;
setFinishError(!saved);
}
function leave() {
@@ -142,14 +160,14 @@ export default function TideRunGame({ initial, reduced, sound: soundOn, audio, b
if (current.current.outcome !== "active") finish(false); else onLeave();
}
useEffect(() => {
- if (!state.story && over && ready && !blocked && !finishAttempted.current) finish(false);
+ if ((!state.story || explicitFinish.current) && over && ready && !blocked && !finishAttempted.current) finish(false);
}, [state.story, over, ready, blocked, onFinish]);
useEffect(() => {
function keys(event: KeyboardEvent) {
if (event.isComposing || event.repeat || event.metaKey || event.ctrlKey || event.altKey || guide || current.current.outcome !== "active") return;
const target = event.target instanceof Element ? event.target : null;
if (!target || !gameRef.current?.contains(target) || !gameRef.current.contains(document.activeElement)) return;
- if (target.closest("button,a,summary,input,textarea,select,[contenteditable]:not([contenteditable=false]),dialog,[role=dialog],[role=slider],[role=tablist]")) return;
+ if (target.closest("button,a,summary,input,textarea,select,[contenteditable]:not([contenteditable=false]),dialog,[role=dialog],[role=slider],[role=tablist],.exp-input-reading")) return;
const key = event.key.toLowerCase(), move = KEYS[key];
if (!move && key !== "i") return;
event.preventDefault();
@@ -159,8 +177,9 @@ export default function TideRunGame({ initial, reduced, sound: soundOn, audio, b
});
const prizeHome = !!state.story && state.banked.includes(state.story);
+ const prizeSafety = seen.story && (seen.banked.includes(seen.story) ? "safe" : seen.pack.includes(seen.story) ? "carried" : null);
+ const prizeLabel = seen.story === "lens" ? "Lens" : seen.story === "vane" ? "Vane" : "Moth";
const lastWave = state.outcome === "active" && state.wave === waves - 1;
- const objective = lastWave ? "The last wave. Get to the dock." : chapter ? (prizeHome ? "The rest of the tide is yours. Bank what you can." : chapter.goal) : "";
const title = state.outcome === "rescued" ? "Bram wades out for Mochi." : state.outcome === "turned" ? "The tide turns." : "Home for the day.";
const lockControls = !ready || paused || busy;
const feedback =
This tide is paused while another view holds the harbor.
: away && !guide ?
Mochi is waiting. Return to this window to continue.
: null}
{over && (state.story || finishError) &&
{title}
- {state.story ?
{prizeHome ? `The ${itemName(state.story)} is home. Banked ${state.score} besides.` : `The ${itemName(state.story)} is still in its shell. The same tide comes again.`}
- :
Banked {state.score}. Bram guessed {guess}.
}
+ {state.story ?
{prizeHome ? `The ${itemName(state.story)} is safe. Score: ${state.score}. Return to the harbor to continue.` : `The ${itemName(state.story)} is back in its shell. You can try the same tide again.`}
+ :
Score: {state.score}. Bram guessed {guess}.
}
{feedback}
- {finishError &&
This tide could not be saved. Try it again when this browser can save.
}
+ {finishError &&
This return could not be saved. Keep this finished outing open and try again when this browser can save.
Mochi is at {where(seen.position)}. The bridge is at the {LANES[seen.bridge]} lane.
{feedback}
-
-
-
+
Step onto the center dock to bank cargo. Banking keeps the outing open.
+
Pause returns you to the harbor with this outing still open.
+
} id="tide-input-hints" context={worldActions.includes("home") ? "Tap Finish to end the outing · tap Wait." : "Tap Wait · prizes collect as you step."} keyboardContext="Space waits · R finishes at the dock · I opens the guide">
}
{guide && }
;
}
diff --git a/web/src/run/scene.ts b/web/src/run/scene.ts
index dcaa75f..113a67f 100644
--- a/web/src/run/scene.ts
+++ b/web/src/run/scene.ts
@@ -321,7 +321,7 @@ export class TideScene extends Phaser.Scene {
if(!point)continue;
anchors.push({...point,action,width:44,height:44});
this.ground.lineStyle(1.5,0xf5db9c,.85).lineBetween(origin.x,origin.y,point.x,point.y);
- this.keep(this.label(point.x,point.y,action==="wait"?"Wait":"Home",12).setDepth(23));
+ this.keep(this.label(point.x,point.y,action==="wait"?"Wait":"Finish",12).setDepth(23));
let zone=this.actionZones.get(action);
if(!zone){zone=this.add.zone(point.x,point.y,44,44).setInteractive({useHandCursor:true}).setDepth(24).setData("worldAction",action);this.actionZones.set(action,zone);}
zone.setPosition(point.x,point.y).setInteractive();
diff --git a/web/src/run/story.test.ts b/web/src/run/story.test.ts
index f4290f2..d292e63 100644
--- a/web/src/run/story.test.ts
+++ b/web/src/run/story.test.ts
@@ -1,5 +1,5 @@
import { expect, test } from "bun:test";
-import { VALUE, applyMove, replayTide, startTide, tideShape, type StoryPrize, type TideTransition } from "./engine";
+import { STORY_SHELL, VALUE, applyMove, replayTide, startTide, tideShape, type StoryPrize, type TideTransition } from "./engine";
import { bramsGuess, cautiousMove, cautiousTide } from "./bot";
import { CHAPTERS, chapterFor, consequence, storyStart } from "./story";
import { closeTide, dayResult, dayResults, emptyBook, readBook, shelfHaul, todayResult, writeBook, type DayResult } from "./save";
@@ -38,14 +38,41 @@ test("every line said during a tide is about something that happened", () => {
const said = (["lens", "vane", "moth"] as const).flatMap(prize => careful(prize).turns.map(consequence));
expect(said.every(line => !line.includes("undefined"))).toBe(true);
expect(said.some(line => line.includes("The left shell opens. The lens is inside."))).toBe(true);
- expect(said.some(line => line.includes("Mochi cradles the moth."))).toBe(true);
- expect(said.some(line => line.includes("The lens is home."))).toBe(true);
+ expect(said.some(line => line.includes("Mochi cradles the wind-moth."))).toBe(true);
+ expect(said.some(line => line.includes("Lens safe. Finish and return to fit it into the beacon."))).toBe(true);
expect(said).toContain("Banked three pieces of sea glass: +9.");
expect(said.some(line => line.includes("The wave takes the sea glass and the reed back."))).toBe(true);
const first = applyMove(startTide({ seed: 20771 }), "wait")!;
expect(consequence(first)).toBe("");
});
+test("chapter briefings name the errand and preserve its established tide", () => {
+ expect(CHAPTERS.lens.before).toBe("The storm carried the Beacon Lens into the left shell. Bring it back so we can light the beacon.");
+ expect(CHAPTERS.vane.before).toBe("The beacon is lit. Bram needs the Signal Vane to read the wind. Bring it home from the right shell.");
+ expect(CHAPTERS.lens.goal).toBe("Bring the Beacon Lens home from the left shell.");
+ expect(CHAPTERS.vane.goal).toBe("Bring the Signal Vane home from the right shell.");
+ expect(CHAPTERS.moth.goal).toBe("Bring the wind-moth home from the right shell. It needs two pack slots.");
+ expect(Object.values(CHAPTERS).map(chapter => chapter.seed)).toEqual([5, 4, 15]);
+ expect(CHAPTERS.vane.after).toContain("Reeds from Wren’s garden. Glass from her windows. That’s not flotsam. The crab is bringing her house back.");
+});
+
+test("consequences describe settled possession instead of an obsolete same-move pickup", () => {
+ const state = startTide(storyStart("lens")), at = STORY_SHELL.lens;
+ const pickup = { kind: "pickup", item: "lens", at } as const;
+ const splash = { kind: "splash", from: at, to: { x: 0, y: 3 }, lost: "lens", hearts: 2 } as const;
+ const active: TideTransition = { before: state, after: { ...state, items: [{ ...at, kind: "lens" }] }, events: [pickup, splash] };
+ expect(consequence(active)).not.toContain("Mochi carries");
+ expect(consequence(active)).toContain("goes back to its shell");
+ const ended: TideTransition = { before: state, after: { ...state, outcome: "turned" }, events: [pickup, { kind: "end", reason: "turned", lost: ["lens"] }] };
+ expect(consequence(ended)).not.toContain("Mochi carries");
+ expect(consequence(ended)).toContain("The tide turns and takes what was still in the pack.");
+ const carried: TideTransition = { before: state, after: { ...state, pack: ["lens"] }, events: [pickup] };
+ expect(consequence(carried)).toBe("Mochi carries the Beacon Lens. Bring it to the center dock to bank it.");
+ const banked: TideTransition = { before: state, after: { ...state, banked: ["lens"] }, events: [pickup, { kind: "bank", items: ["lens"], gained: 0 }] };
+ expect(consequence(banked)).toBe("Lens safe. Finish and return to fit it into the beacon.");
+ expect(consequence({ ...ended, events: [pickup, splash, { kind: "end", reason: "rescued", lost: [] }] })).not.toContain("goes back to its shell");
+});
+
function memory() {
const data = new Map();
return { data, getItem: (key: string) => data.get(key) ?? null, setItem: (key: string, value: string) => { data.set(key, value); } };
@@ -87,6 +114,29 @@ test("a tide book survives a reload and keeps each day's first tide", () => {
});
+test("a rescued or voluntary zero-score first result survives better practice and reload", () => {
+ const seed = 20771;
+ let rescued = startTide({ seed });
+ while (rescued.outcome === "active") {
+ const move = rescued.position.y === 0 ? "north" : "wait";
+ rescued = applyMove(rescued, move)!.after;
+ }
+ expect(rescued.outcome).toBe("rescued");
+ expect(rescued.score).toBe(0);
+ const voluntary = applyMove(startTide({ seed }), "home")!.after;
+ const better = cautiousTide(seed);
+ expect(better.score).toBeGreaterThan(0);
+ for (const first of [rescued, voluntary]) {
+ const storage = memory(), key = "tide";
+ writeBook(storage, key, closeTide({ active: first, days: [] }, first));
+ const restored = readBook(storage, key);
+ const practiced = closeTide({ ...restored, active: better }, better);
+ writeBook(storage, key, practiced);
+ expect(readBook(storage, key).days).toEqual([first]);
+ expect(todayResult(readBook(storage, key), seed)).toEqual(dayResult(first));
+ }
+});
+
test("day results put the newest day first without changing the book", () => {
const first = cautiousTide(20771), second = cautiousTide(20772);
const book = { active: null, days: [first, second] };
diff --git a/web/src/run/story.ts b/web/src/run/story.ts
index ad74261..dd97d69 100644
--- a/web/src/run/story.ts
+++ b/web/src/run/story.ts
@@ -17,23 +17,24 @@ export interface Chapter {
export const CHAPTERS: Readonly> = {
lens: {
number: 1, title: "First light", seed: 5,
- before: "The lens went over the wall in the storm. It’s in the left shell. The old crab won’t let anyone near it.",
- goal: "Grab what the tide leaves. Don’t be in a lane when its wave lands. Step on the dock to bank.",
+ before: "The storm carried the Beacon Lens into the left shell. Bring it back so we can light the beacon.",
+ goal: "Bring the Beacon Lens home from the left shell.",
after: ["Forty years I’ve known that crab. Never once seen it hold still."],
},
vane: {
number: 2, title: "What the tide brings", seed: 4,
- before: "Reeds from Wren’s garden. Glass from her windows. That’s not flotsam. The crab is bringing her house back.",
- goal: "The Signal Vane is in the right shell. Bring it home, and anything else the tide leaves.",
+ before: "The beacon is lit. Bram needs the Signal Vane to read the wind. Bring it home from the right shell.",
+ goal: "Bring the Signal Vane home from the right shell.",
after: [
"Wren kept this light. The night it failed she rowed out to guide the boats in by hand. The boats came home.",
+ "Reeds from Wren’s garden. Glass from her windows. That’s not flotsam. The crab is bringing her house back.",
"The Tidekeeper was her familiar. It has been waiting for her light ever since. And now it’s on.",
],
},
moth: {
number: 3, title: "The last thing", seed: 15,
before: "There’s one thing it never gave up. Her wind-moth. Kept it dry in that shell through the whole storm.",
- goal: "The moth is in the right shell. It takes two places in the pack.",
+ goal: "Bring the wind-moth home from the right shell. It needs two pack slots.",
after: ["It knows she isn’t coming. It gave you the moth anyway.", "Two familiars and one light. That’ll do for a harbor."],
},
};
@@ -71,33 +72,39 @@ const OPENED: Readonly> = {
moth: "The right shell opens. Something inside is glowing.",
};
const CARRIED: Readonly> = {
- lens: "Mochi has the lens. Home is the dock.",
- vane: "Mochi has the vane. Home is the dock.",
- moth: "Mochi cradles the moth. It takes two places in her pack.",
+ lens: "Mochi carries the Beacon Lens. Bring it to the center dock to bank it.",
+ vane: "Mochi carries the Signal Vane. Bring it to the center dock to bank it.",
+ moth: "Mochi cradles the wind-moth. Bring it to the center dock to bank it.",
};
const HOME: Readonly> = {
- lens: "The lens is home. The rest of the tide is yours.",
- vane: "The vane is home. The rest of the tide is yours.",
- moth: "The moth is home.",
+ lens: "Lens safe. Finish and return to fit it into the beacon.",
+ vane: "Vane safe. Finish and return to fit it onto the signal post.",
+ moth: "Moth safe. Finish and return to bring it into the harbor.",
};
const isStory = (item: Item | null): item is StoryPrize => item === "lens" || item === "vane" || item === "moth";
/** One or two sentences about what this move really did, or nothing. Nothing is said that did not happen. */
-export function consequence({ events }: TideTransition): string {
+export function consequence({ events, after }: TideTransition): string {
const facts: string[] = [];
for (const event of events) switch (event.kind) {
- case "pickup": facts.push(isStory(event.item) ? CARRIED[event.item] : `Mochi takes the ${itemName(event.item)}.`); break;
+ case "pickup":
+ if (after.outcome === "active" && after.pack.includes(event.item) && !events.some(later => later.kind === "splash" && later.lost === event.item))
+ facts.push(isStory(event.item) ? CARRIED[event.item] : `Mochi takes the ${itemName(event.item)}.`);
+ break;
case "full": facts.push(`No room for the ${itemName(event.item)}. Bank at the dock first.`); break;
case "bank": {
const story = event.items.find(isStory);
- facts.push(story ? HOME[story] : `Banked ${list(event.items)}: +${event.gained}.`);
+ if (!story || after.banked.includes(story)) facts.push(story ? HOME[story] : `Banked ${list(event.items)}: +${event.gained}.`);
break;
}
case "sweep": facts.push(`The wave takes ${list(event.items.map(item => item.kind), true)} back.`); break;
case "shield": facts.push("The Tidekeeper puts a claw in the water. The wave goes around."); break;
- case "splash": facts.push(event.lost
- ? `Splashed. The ${itemName(event.lost)} ${isStory(event.lost) ? "goes back to its shell" : "is gone"}.`
- : "Splashed. Mochi shakes it off."); break;
+ case "splash": {
+ const returned = after.outcome === "active" && after.items.some(item => item.kind === event.lost);
+ const lost = isStory(event.lost) ? returned ? "goes back to its shell" : "was not banked" : "is gone";
+ facts.push(event.lost ? `Splashed. The ${itemName(event.lost)} ${lost}.` : "Splashed. Mochi shakes it off.");
+ break;
+ }
case "open": facts.push(OPENED[event.item]); break;
case "leave": facts.push(`The tide leaves ${list(event.items.map(item => item.kind))}.`); break;
case "end":
diff --git a/web/src/run/tide-run.css b/web/src/run/tide-run.css
index bf8cb17..3a89d40 100644
--- a/web/src/run/tide-run.css
+++ b/web/src/run/tide-run.css
@@ -22,7 +22,6 @@
.tide-run .tide-asks { flex: none; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 3px; }
.tide-run .tide-asks > li { flex: none; min-height: 32px; gap: 3px; padding: 3px; font: 500 12px/1.25 "Figtree Variable", sans-serif; white-space: nowrap; }
.tide-run .tide-asks .tide-ask-icon img { width: 24px; height: 24px; }
-.tide-run .tide-tray-reading { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tide-run .exp-current-controls { flex: none; }
.tide-run .exp-objective-row { gap: 12px; align-items: center; margin-bottom: 10px; }
.tide-run .exp-objective { font: 600 17px/1.3 "Fraunces Variable", serif; margin: 0!important; }
@@ -53,12 +52,12 @@
.tide-run .tide-stamps li[data-earned=true] .tide-stamp-mark { border: 1px solid #80927b; background: #e6e7cf; }
.tide-run .tide-stamps li[data-earned=true] img { opacity: 1; filter: none; }
.tide-run .tide-stamps li[data-earned=true] svg { background: var(--exp-sea); color: var(--exp-paper); }
-.tide-run .passage-panel { width: min(580px, calc(100% - 24px)); padding: 24px; }
+.tide-run .passage-panel { --exp-panel-pad: 24px; width: min(580px, calc(100% - 24px)); padding: var(--exp-panel-pad); }
.tide-run .passage-panel h2 { margin-bottom: 6px; font-size: 28px; }
-.tide-run .tide-guide { margin: 0; padding: 0; list-style: none; }
-.tide-run .tide-guide li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--exp-hairline); font-size: 15px; line-height: 1.5; }
-.tide-run .tide-guide li > svg { flex: none; margin-top: 2px; color: var(--exp-sea); }
-.tide-run .tide-guide-keys { margin: 18px 0 0; font-size: 13px; line-height: 1.5; color: var(--exp-secondary-ink); }
+.exp-game .tide-guide { margin: 0; padding: 0; list-style: none; }
+.exp-game .tide-guide li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--exp-hairline); font-size: 15px; line-height: 1.5; }
+.exp-game .tide-guide li > svg { flex: none; margin-top: 2px; color: var(--exp-sea); }
+.exp-game .tide-guide-keys { margin: 18px 0 0; font-size: 13px; line-height: 1.5; color: var(--exp-secondary-ink); }
@media (max-width: 899px) and (orientation: portrait) {
.tide-run .exp-mast { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.tide-run .exp-brand { justify-self: start; max-width: 182px; padding: 7px 10px; }
@@ -85,8 +84,8 @@
.tide-run .tide-finish { padding: 24px 20px; }
.tide-run .tide-finish h2 { font-size: 28px; }
.tide-run .tide-stamps { gap: 8px; }
- .tide-run .passage-panel { padding: 18px; }
- .tide-run .tide-guide li { font-size: 14px; gap: 12px; padding: 12px 0; }
+ .tide-run .passage-panel { --exp-panel-pad: 18px; }
+ .exp-game .tide-guide li { font-size: 14px; gap: 12px; padding: 12px 0; }
}
@media (orientation: landscape) and (max-height: 500px) {
.tide-run .exp-brand { padding: 6px 12px; }
@@ -101,7 +100,6 @@
.tide-run .passage-tray { top: 140px; bottom: 10px; left: auto; right: 10px; width: 260px; max-height: none; padding: 10px; gap: 6px; overflow: hidden; }
.tide-run .tide-asks { justify-content: flex-start; gap: 6px; }
.tide-run .tide-asks .tide-ask-label { display: none; }
- .tide-run .tide-tray-reading { flex: 1; }
.tide-run .exp-objective-row { flex-direction: column; align-items: stretch; gap: 0; margin: 0; }
.tide-run .exp-objective { font-size: 15px; }
.tide-run .exp-forecast { display: block; clear: both; padding: 8px 0; margin: 0 0 6px!important; font-size: 13px; line-height: 1.35; }
@@ -128,7 +126,7 @@
.tide-run .tide-stamp-mark { flex: none; width: 36px; height: 36px; }
.tide-run .tide-stamp-mark img { width: 28px; height: 28px; }
.tide-run .tide-stamp-mark > svg { width: 16px; height: 16px; }
- .tide-run .passage-panel { max-height: calc(100dvh - 20px); padding: 16px 22px; }
+ .tide-run .passage-panel { --exp-panel-pad: 22px; max-height: calc(100dvh - 20px); }
}
@media (pointer: coarse) {
.tide-run .exp-directions { grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); }
@@ -145,18 +143,27 @@
/* Direct play keeps only guidance visible; the full pad opens on request. */
.tide-run .passage-tray{gap:8px;overflow:visible}
-.tide-run .tide-controls{position:relative;flex:none}
-.tide-run .tide-controls .exp-control-hints{display:block}
+.tide-run .tide-controls{position:relative;display:grid;flex:1;min-height:0;grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:minmax(48px,1fr) auto;gap:4px}
+.tide-run .tide-controls .exp-control-hints{display:contents}
+.tide-run .tide-controls .exp-input-reading{grid-column:1/-1;grid-row:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-color:#8b734c var(--exp-card);scroll-padding:6px;pointer-events:auto}
+.tide-run .exp-input-more{grid-column:2;grid-row:2;width:44px;min-height:44px;padding:8px;pointer-events:auto}
+.tide-run .tide-controls .exp-button-controls{position:static;grid-column:1;grid-row:2;align-self:stretch}
.tide-run .exp-button-controls>summary{justify-content:flex-start;width:max-content}
-.tide-run .tide-guide-control{position:absolute;bottom:0;right:0;min-height:44px;min-width:44px;margin:0;white-space:nowrap}
+.tide-run .tide-guide-control{position:static;grid-column:3;grid-row:2;min-height:44px;min-width:44px;margin:0;white-space:nowrap}
.tide-run .exp-button-controls-body .exp-current-controls{display:flex;flex-direction:column;gap:8px}
.tide-run .exp-button-controls-body .exp-directions{display:flex;justify-content:space-between;width:100%;gap:4px}
.tide-run .exp-button-controls-body .exp-directions button{width:44px;height:44px;min-height:44px;flex:none}
.tide-run .exp-button-controls-body .exp-context-actions{display:flex;flex-direction:column;align-items:stretch;min-height:0}
.tide-run .exp-button-controls-body .exp-context-actions button{min-height:44px}
-.tide-run .tide-tray-reading{scrollbar-color:#8b734c var(--exp-card);scroll-padding:6px}
+.tide-run .tide-prize-status{flex:none;margin:0;font:650 17px/1.3 "Fraunces Variable",serif;color:var(--exp-sea)}
+.tide-run .tide-return-advice,.tide-run .tide-dock-instruction,.tide-run .tide-pause-explanation{margin:6px 0;font-size:13px;line-height:1.4;white-space:normal}
+.tide-run .tide-pause-explanation{color:var(--exp-secondary-ink)}
+.tide-run .tide-bank-actions{display:flex;flex:none;align-items:center;gap:8px;margin:0}
+.tide-run .tide-bank-actions .exp-primary{min-height:56px;flex:1;white-space:normal;line-height:1.3;padding:10px 14px}
+.tide-run .tide-bank-actions .exp-text-button{min-height:44px;max-width:90px;white-space:normal;font-size:13px;line-height:1.3}
@media(max-width:899px) and (orientation:portrait){
- .tide-run .passage-tray{max-height:200px;padding:8px 10px;gap:5px}
+ /* Reserve the HUD, four 44px board intervals and dock clearance before expanding the reading. */
+ .tide-run .passage-tray{max-height:clamp(200px,calc(100dvh - 484px),360px);padding:8px 10px;gap:5px}
.tide-run .exp-forecast{padding:5px 0;margin-bottom:5px!important;font-size:13px;line-height:1.35}
.tide-run .exp-objective{font-size:14px}
.tide-run .tide-asks{gap:3px}
@@ -173,9 +180,11 @@
.tide-run .tide-tally>svg{display:none}
.tide-run .tide-tally b{font-size:16px}
.tide-run .passage-tray{max-height:176px}
+ .tide-run .passage-tray:has(.tide-bank-actions){max-height:212px}
}
@media(orientation:landscape) and (max-height:500px){
.tide-run .passage-tray{overflow:visible;gap:5px}
.tide-run .tide-controls .exp-input-context{font-size:12px}
+ .tide-run .tide-guide-control{font-size:13px;padding-inline:0}
.tide-run .exp-button-controls-body{max-height:calc(100dvh - 160px)}
}
diff --git a/web/src/tide/TideAsk.tsx b/web/src/tide/TideAsk.tsx
index 8b1c884..3d75943 100644
--- a/web/src/tide/TideAsk.tsx
+++ b/web/src/tide/TideAsk.tsx
@@ -30,12 +30,12 @@ function RunAsk({ day, card, guess, result, sailBlockedReason, onSail, onOpenLog
const canSail = sailBlockedReason === null;
return
-
Today’s tide
+
Today’s Tide Run
{dayLabel(day)}
-
{card.name}
Twelve waves, two lanes at a time from the seventh. Each wave leaves a prize; bank it at the dock.
+
Bring finds home before the tide turns.
Twelve waves; two lanes at a time from the seventh. Waves can leave finds. Bring them to the center dock to bank them.
Bram plays it safe: he never ends a wave in the water. His guess is what that careful tide banks.
- {result &&
Today’s tide: {resultLine(result)}. Another sail is practice; the first tide each day is the one that counts.
}
+ {result &&
Today’s Tide Run: {resultLine(result)}.
}
+
Your first finished daily outing sets that day’s score and stamps, even if the tide turns or Bram brings Mochi home. Later sails are practice. Pausing does not finish an outing.
+
A paused outing keeps its original day.
{!canSail &&
{sailBlockedReason}
}
diff --git a/web/src/tide/TideHome.tsx b/web/src/tide/TideHome.tsx
index eb46b9b..5d419d6 100644
--- a/web/src/tide/TideHome.tsx
+++ b/web/src/tide/TideHome.tsx
@@ -1,6 +1,6 @@
import { useId, type CSSProperties, type JSX } from "react";
import { cardStatus, type Run, type TideCard } from "./asks";
-import { askLine } from "./cards";
+import { askLine, dayLabel } from "./cards";
import { CARD_PICTURE, sealArt } from "./art";
import { homeResult } from "./pages";
import TideStamp from "./TideStamp";
@@ -32,6 +32,7 @@ function RunHome({ card, result, canShelve, reduced, notice, sailBlockedReason,
{kept && }
Reed and glass go to Bram’s shelf. Pearls stay with Mochi.
-
Banked
{result.score}
+
Score
{result.score}
Bram’s guess
{result.guess}
Splashes
{result.splashes}
diff --git a/web/src/tide/ask-ui.test.tsx b/web/src/tide/ask-ui.test.tsx
index 1c6a513..6e5aef2 100644
--- a/web/src/tide/ask-ui.test.tsx
+++ b/web/src/tide/ask-ui.test.tsx
@@ -1,11 +1,12 @@
import { expect, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
import { replayRun, solve, startRun, type Ask } from "./asks";
-import { askChip, askLine, cardForDay } from "./cards";
+import { askChip, askLine, cardForDay, TIDE_POOL } from "./cards";
import type { TideEntry } from "./log";
import TideAsk from "./TideAsk";
import TideHud from "./TideHud";
import TideLog from "./TideLog";
+import { CARD_PICTURE } from "./art";
import type { DayResult } from "./run-day";
const day = 20771, card = cardForDay(day);
@@ -68,10 +69,10 @@ const runAsk = { day, card, guess: 6, result: null, sailBlockedReason: null, onS
test("today’s tide run keeps the card, painted asks and Bram’s guess together", () => {
const html = renderToStaticMarkup();
- expect(html).toContain("Today’s tide");
- expect(html).toContain(`
${card.name}
`);
+ expect(html).toContain("Today’s Tide Run");
+ expect(html).toContain("Bring finds home before the tide turns.");
expect(html).toContain("Saturday 14 November");
- expect(html).toContain("Twelve waves, two lanes at a time from the seventh. Each wave leaves a prize; bank it at the dock.");
+ expect(html).toContain("Twelve waves; two lanes at a time from the seventh. Waves can leave finds. Bring them to the center dock to bank them.");
expect(html).toContain("The Tidekeeper asks");
for (const line of ["Come home with something.", "Match or beat Bram’s guess of 6.", "Keep Mochi dry the whole tide."]) expect(html).toContain(line);
for (const icon of ["/assets/season/purse.webp", "/assets/ui/ask-all-marks.webp", "/assets/ui/ask-dry.webp"]) {
@@ -94,13 +95,34 @@ test("a recorded tide run marks the three asks and offers practice", () => {
expect(html.match(/class="tide-ask-mark"/g)).toHaveLength(3);
expect(html.match(/\(kept\)/g)).toHaveLength(2);
expect(html.match(/\(slipped\)/g)).toHaveLength(1);
- expect(html).toContain("Today’s tide: Banked 7 · Bram guessed 6. Another sail is practice; the first tide each day is the one that counts.");
+ expect(html).toContain("Today’s Tide Run: Banked 7 · Bram guessed 6.");
expect(html).toContain("Sail again for practice");
expect(html).not.toContain("tide-stamp-seal");
const allThree = renderToStaticMarkup();
expect(allThree).toContain('class="tide-stamp-seal"');
});
+test("all fourteen device cards retain their picture but use neutral Tide Run preparation and disclose first-finished scoring before Sail", () => {
+ const disclosure = "Your first finished daily outing sets that day’s score and stamps, even if the tide turns or Bram brings Mochi home. Later sails are practice. Pausing does not finish an outing.";
+ for (const daily of TIDE_POOL) {
+ const retained = renderToStaticMarkup( {}} onOpenLog={() => {}}/>);
+ expect(retained).toContain(`
${daily.name}
`);
+ for (const ask of daily.asks) expect(retained).toContain(askLine(ask, daily.tool));
+ for (const result of [null, runResult]) {
+ const html = renderToStaticMarkup();
+ expect(html).toContain("Today’s Tide Run");
+ expect(html).toContain(`alt="${CARD_PICTURE[daily.id]}"`);
+ expect(html).not.toContain(`
${daily.name}
`);
+ expect(html).toContain(disclosure);
+ expect(html.indexOf(disclosure)).toBeLessThan(html.indexOf('class="exp-primary"'));
+ expect(html).toContain("A paused outing keeps its original day.");
+ expect(html).not.toContain("Each wave leaves a prize");
+ expect(html).not.toContain("No waiting");
+ expect(html).not.toContain("Surf home");
+ }
+ }
+});
+
test("a blocked run sail stays focusable and describes its reason", () => {
for (const result of [null, runResult]) {
const reason = "Finish the outing in progress first.";
diff --git a/web/src/tide/home-ui.test.tsx b/web/src/tide/home-ui.test.tsx
index 0582ff5..e3359e1 100644
--- a/web/src/tide/home-ui.test.tsx
+++ b/web/src/tide/home-ui.test.tsx
@@ -1,6 +1,7 @@
import { expect, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
-import { cardForDay } from "./cards";
+import { cardForDay, dayLabel, TIDE_POOL } from "./cards";
+import { CARD_PICTURE } from "./art";
import { replayRun, solve } from "./asks";
import TideHome from "./TideHome";
import type { DayResult } from "./run-day";
@@ -87,6 +88,17 @@ test("the run Home sheet celebrates all three with one primary and a compact, re
expect(html).not.toContain("Sail again for practice");
});
+test("all device Home sheets name Tide Run and preserve the card picture without court constraints", () => {
+ for (const daily of TIDE_POOL) {
+ const html = renderToStaticMarkup();
+ expect(html).toContain(`Tide Run · ${dayLabel(runResult.day)}`);
+ expect(html).toContain(`alt="${CARD_PICTURE[daily.id]}"`);
+ expect(html).not.toContain(`>${daily.name}`);
+ expect(html).not.toContain("No waiting");
+ expect(html).not.toContain("Surf home");
+ }
+});
+
test("partial run results show slipped labels without a proud portrait or all-three seal", () => {
const partial = { ...runResult, score: 5, stamps: { home: true, guess: false, dry: false }, splashes: 1 };
const html = renderToStaticMarkup();
diff --git a/web/src/tide/log-ui.test.tsx b/web/src/tide/log-ui.test.tsx
index 0fdb6a7..72f2ee3 100644
--- a/web/src/tide/log-ui.test.tsx
+++ b/web/src/tide/log-ui.test.tsx
@@ -1,7 +1,7 @@
import { expect, test } from "bun:test";
import { renderToStaticMarkup } from "react-dom/server";
import { CARD_PICTURE } from "./art";
-import { cardForDay, dayLabel } from "./cards";
+import { cardForDay, dayLabel, TIDE_POOL } from "./cards";
import { tideSummary, type TideEntry } from "./log";
import { logPages } from "./pages";
import type { DayResult } from "./run-day";
@@ -25,8 +25,7 @@ function render(run = result, entries: readonly TideEntry[] = []) {
test("a tide-run page shows its card, paper, haul, facts and three final stamp lines", () => {
const html = render();
- expect(html).toContain(`
`);
expect(html).toContain('class="tide-log-chart tide-log-run"');
expect(html).toContain('--tide-paper:url(/assets/tide/log-page.webp)');
expect(html).toContain('--stamp:84px;--tilt:5deg');
@@ -37,7 +36,7 @@ test("a tide-run page shows its card, paper, haul, facts and three final stamp l
expect(html).toContain(`src="${prize}" width="24" height="24" alt="" decoding="async"`);
}
expect(html).toContain("Reed and glass go to Bram’s shelf. Pearls stay with Mochi.");
- expect(html).toContain('
Banked
6
');
+ expect(html).toContain('
Score
6
');
expect(html).toContain('
Bram’s guess
6
');
expect(html).toContain('
Splashes
0
');
for (const line of ["Came home with something", "Matched Bram’s guess", "Dry paws"]) expect(html).toContain(line);
@@ -55,14 +54,14 @@ test("a tide-run page shows its card, paper, haul, facts and three final stamp l
test("a run-only stamp is collected, sealed and labelled with its kept count", () => {
const html = render();
- expect(html).toContain('aria-label="Surf home stamp, 3 of 3 kept. Open its page."');
+ expect(html).toContain('aria-label="Tide Run stamp, 3 of 3 kept. Open its page."');
expect(html).toContain("1 of 14 collected, 1 with the brass seal");
expect(html.match(/class="tide-stamp-seal"/g)).toHaveLength(2);
});
test("an empty run still collects its card and shows slipped stamps without a haul", () => {
const html = render({ ...result, score: 0, banked: [], stamps: { home: false, guess: false, dry: false }, splashes: 2 });
- expect(html).toContain('aria-label="Surf home stamp, 0 of 3 kept. Open its page."');
+ expect(html).toContain('aria-label="Tide Run stamp, 0 of 3 kept. Open its page."');
expect(html).toContain("1 of 14 collected");
expect(html).not.toContain("brass seal");
expect(html).not.toContain('class="tide-stamp-seal"');
@@ -72,6 +71,17 @@ test("an empty run still collects its card and shows slipped stamps without a ha
expect(html.match(/\(slipped\)/g)).toHaveLength(3);
});
+test("every device stamp and run page keeps its art without borrowing the retained court name", () => {
+ for (const daily of TIDE_POOL) {
+ const date = Array.from({ length: 14 }, (_, i) => day + i).find(value => cardForDay(value).id === daily.id)!;
+ const html = render({ ...result, day: date });
+ expect(html).toContain(`
Tide Run · ${dayLabel(date)}
`);
+ expect(html).toContain('aria-label="Tide Run stamp, 3 of 3 kept. Open its page."');
+ expect(html).toContain(`alt="${CARD_PICTURE[daily.id]}"`);
+ expect(html).not.toContain(`
${daily.name}
`);
+ }
+});
+
test("mixed logs retain the legacy stamp label while crediting a run's brass seal", () => {
const html = render(result, [legacy]);
expect(html).toContain('aria-label="Surf home stamp, 2 of 3 asks kept. Open its page."');
diff --git a/web/src/tide/pages.test.ts b/web/src/tide/pages.test.ts
index 05b7d87..b1dec74 100644
--- a/web/src/tide/pages.test.ts
+++ b/web/src/tide/pages.test.ts
@@ -464,14 +464,14 @@ describe("tide-run harbor card", () => {
test("introduces today's tide and Bram's guess", () => {
expect(harborTide({ ...base, result: null })).toEqual({
- kind: "panel", title: "Today’s tide: Surf home.", body: "Twelve waves. Bram guesses 6.",
+ kind: "panel", title: "Today’s Tide Run.", body: "Twelve waves. Bram guesses 6.",
primary: { label: "See today’s tide", target: "tide" }, links: [],
});
});
test("a shelved day with a missing result still shows tomorrow", () => {
expect(harborTide({ ...base, shelved: true, result: null })).toEqual({
- kind: "panel", title: "Tomorrow: Bram’s bridge.", body: "Today’s haul is on Bram’s shelf.", primary: null,
+ kind: "panel", title: "Tomorrow’s Tide Run.", body: "Today’s haul is on Bram’s shelf.", primary: null,
links: [{ label: "Sail today’s tide", action: "sail" }, { label: "Open the tide log", action: "log" }],
});
});
@@ -485,7 +485,7 @@ describe("tide-run harbor card", () => {
test("a shelved result shows tomorrow with the day's score", () => {
for (const returnedToday of [false, true]) expect(harborTide({ ...base, returnedToday, shelved: true, result: result() })).toEqual({
- kind: "panel", title: "Tomorrow: Bram’s bridge.",
+ kind: "panel", title: "Tomorrow’s Tide Run.",
body: "All three kept. Banked 6 · Bram guessed 6. Today’s haul is on Bram’s shelf.", primary: null, links: practice,
});
});
diff --git a/web/src/tide/pages.ts b/web/src/tide/pages.ts
index c07fe16..d97d1c2 100644
--- a/web/src/tide/pages.ts
+++ b/web/src/tide/pages.ts
@@ -142,13 +142,13 @@ type ClassicHarbor = { lit: boolean; card: TideCard; next: TideCard; entry: Tide
/** A device harbor's card, driven by today's tide-run result. */
export type RunHarbor = { lit: boolean; card: TideCard; next: TideCard; guess: number; result: DayResult | null; returnedToday: boolean; shelved: boolean };
-function harborRun({ lit, card, next, guess, result, returnedToday, shelved }: RunHarbor): HarborTide | null {
+function harborRun({ lit, guess, result, returnedToday, shelved }: RunHarbor): HarborTide | null {
if (!lit) return null;
const links: TideLink[] = [{ label: result ? "Sail again for practice" : "Sail today’s tide", action: "sail" }, { label: "Open the tide log", action: "log" }];
if (!result) return shelved
- ? { kind: "panel", title: `Tomorrow: ${next.name}.`, body: "Today’s haul is on Bram’s shelf.", primary: null, links }
- : { kind: "panel", title: `Today’s tide: ${card.name}.`, body: `Twelve waves. Bram guesses ${guess}.`, primary: { label: "See today’s tide", target: "tide" }, links: [] };
- if (shelved) return { kind: "panel", title: `Tomorrow: ${next.name}.`, body: `${resultTitle(result)} ${resultLine(result)}. Today’s haul is on Bram’s shelf.`, primary: null, links };
+ ? { kind: "panel", title: "Tomorrow’s Tide Run.", body: "Today’s haul is on Bram’s shelf.", primary: null, links }
+ : { kind: "panel", title: "Today’s Tide Run.", body: `Twelve waves. Bram guesses ${guess}.`, primary: { label: "See today’s tide", target: "tide" }, links: [] };
+ if (shelved) return { kind: "panel", title: "Tomorrow’s Tide Run.", body: `${resultTitle(result)} ${resultLine(result)}. Today’s haul is on Bram’s shelf.`, primary: null, links };
return { kind: "panel", title: resultTitle(result), body: `${resultLine(result)}.`, primary: returnedToday ? { label: "Take it to Bram", target: "bram" } : null, links };
}