Sverdle

Sverdle

{ // prevent default callback from resetting the form return ({ update }) => { update({ reset: false }); }; }} > How to play
{#each Array.from(Array(6).keys()) as row (row)} {@const current = row === i}

Row {row + 1}

{#each Array.from(Array(5).keys()) as column (column)} {@const guess = current ? currentGuess : data.guesses[row]} {@const answer = data.answers[row]?.[column]} {@const value = guess?.[column] ?? ''} {@const selected = current && column === guess.length} {@const exact = answer === 'x'} {@const close = answer === 'c'} {@const missing = answer === '_'}
{value} {#if exact} (correct) {:else if close} (present) {:else if missing} (absent) {:else} empty {/if}
{/each}
{/each}
{#if won || data.answers.length >= 6} {#if !won && data.answer}

the answer was "{data.answer}"

{/if} {:else}
{#each ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] as row}
{#each row as letter} {/each}
{/each}
{/if}
{#if won}
{/if}