Skip to content

Commit

Permalink
Fixed bug in WhatWord.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Jul 7, 2024
1 parent cd71256 commit 258875b
Showing 1 changed file with 51 additions and 100 deletions.
151 changes: 51 additions & 100 deletions static/examples/WhatWord.wp
Original file line number Diff line number Diff line change
Expand Up @@ -6,126 +6,77 @@ WhatWord
``El estado del juego es una lista de conjeturas y una palabra secreta.``/es
``قائمة التخمينات وكلمة سرية``/ar
•Game/en,Juego/es,لعبة/ar(guesses/en,suposiciones/es,التخمينات/ar•[""] remaining•[""] start•?) (
secret: start ? remaining[1] ""
guessesRemaining/en,conjeturasRestantes/es,التخميناتالمتبقية/ar: (secret.📏() · 3) - guesses.📏()
status/en,estado/es,حالة/ar:
secret = "" ? "start"
secret → [""].all(ƒ(letter•"") guesses.has(letter)) ? "won"
guessesRemaining ≤ 0 ? "lost"
"playing"
secret: start ? remaining[1] ""
guessesRemaining/en,conjeturasRestantes/es,التخميناتالمتبقية/ar: (secret.📏() · 3) - guesses.📏()
status/en,estado/es,حالة/ar:
secret = "" ? "start"
secret → [""].all(ƒ(letter•"") guesses.has(letter)) ? "won"
guessesRemaining ≤ 0 ? "lost"
"playing"
)

key/en,tecla/es,مفتاح/ar: ⌨️()

``When the keyboard state changes, the game state changes.``/en
``Cuando cambia el estado del teclado, cambia el estado del juego.``/es
``عندما تتغير حالة لوحة المفاتيح ، تتغير حالة اللعبة.``/ar
state/en,estado/es,حالة/ar•Game: Game([] words.sorted(ƒ () Random()) ⊥) … ∆ key …
key = "Escape" ? Game([] words.sorted(ƒ () Random()) ⊥)
(state.status ≠ "playing") & (key = " ") ? Game([] words.sansFirst() ⊤)
(state.status = "playing") & (key.length() = 1) & ~state.guesses.has(key) ?
Game(state.guesses.add(key) state.remaining ⊤)
state
state/en,estado/es,حالة/ar•Game: Game([] words.sorted(ƒ() Random()) ⊥) … ∆ key …
key = "Escape" ? Game([] words.sorted(ƒ() Random()) ⊥)
(state.status ≠ "playing") & (key = " ") ? Game([] state.remaining.sansFirst() ⊤)
(state.status = "playing") & (key.length() = 1) & ~state.guesses.has(key) ?
Game(state.guesses.add(key) state.remaining ⊤)
state

``The board is a translation of the secret, accounting for guesses``/en
``El tablero es una traducción del secreto, teniendo en cuenta las conjeturas.``/es
``اللوحة عبارة عن ترجمة للسرية ، مع مراعاة التخمينات``/ar
board/en,tabelro/es,طاولة/ar: 💬(
state.secret → [""].translate(ƒ(letter•"") ((state.status = "lost") | state.guesses.has(letter)) ? letter ".").join(' ')
2m
)
state.secret → [""].translate(ƒ(letter•"") ((state.status = "lost") | state.guesses.has(letter)) ? letter ".").join(' ')
2m
)

fade/en,descolorar/es,يختفي/ar: Pose(opacity: 0)

``Construct the game scene``/en
``Construye la escena del juego``/es
``قم ببناء مشهد اللعبة``/ar
screen/en,cine/es,إظهار/ar:
state.status ???
"start": Group(⬇() [
💬(`What*Word*`/en`Que*Palabra*`/es`اي كلمة`/ar
3m
place: 📍(z: -1m)
entering: Pose(opacity: 0%)
resting: Sequence(sway() 1s)
)
💬(`press *space* to begin`/en`presiona espacio para comenzar`/es`اضغط على * مسافة * للبدء`/ar)
]
exiting:fade
)
"lost": Group(⬇() [
board
💬( `You lost. Press *space* to play again.`/en`Perdiste. Presiona *espacio* para volver a jugar`/es`لقد خسرت. اضغط على * مسافة * للعب مرة أخرى.`/ar
entering: Pose(rotation: 0°)
resting: Pose(rotation: -5°)
)
] exiting:fade)
"won": Group(⬇() [
board.resting:Sequence(bounce(3m) 1s)
💬("You won, nice job! Press space to play again."/en"¡Ganaste, buen trabajo! Presiona la barra espaciadora para volver a jugar"/es"لقد فزت ، عمل جيد! اضغط على الفضاء للعب مرة أخرى."/ar
)
] exiting:fade)
Group(⬇() [
board
💬(state.guesses.length() = 0 ?
"Type a letter to guess"/en"Escribe una carta a"/es"اكتب حرفًا للتخمين"/ar "اكتب حرفًا للتخمين"/ar"Guesses: \state.guesses.join(' ')\"/en"Suposiciones: \state.guesses.join(' ')\"/es"التخمينات \state.guesses.join(' ')\"/ar
screen/en,cine/es,إظهار/ar:
state.status ???
"start": Group(⬇() [
💬(`What*Word*`/en`Que*Palabra*`/es`اي كلمة`/ar
3m
place: 📍(z: -1m)
entering: Pose(opacity: 0%)
resting: Sequence(sway() 1s)
)
💬(`press *space* to begin`/en`presiona espacio para comenzar`/es`اضغط على * مسافة * للبدء`/ar)
]
exiting: fade
)
💬("\state.guessesRemaining\ remaining"/en"\state.guessesRemaining\ restante"/es"متبقي \state.guessesRemaining\"/ar
resting: Sequence(sway(2°) (state.guessesRemaining ÷ 5) · 1s
)
)
])
"lost": Group(⬇() [
board
💬(`You lost. Press *space* to play again.`/en`Perdiste. Presiona *espacio* para volver a jugar`/es`لقد خسرت. اضغط على * مسافة * للعب مرة أخرى.`/ar
entering: Pose(rotation: 0°)
resting: Pose(rotation: -5°)
)
] exiting: fade)
"won": Group(⬇() [
board.resting:Sequence(bounce(3m) 1s)
💬("You won, nice job! Press space to play again."/en"¡Ganaste, buen trabajo! Presiona la barra espaciadora para volver a jugar"/es"لقد فزت ، عمل جيد! اضغط على الفضاء للعب مرة أخرى."/ar
)
] exiting: fade)
Group(⬇() [
board
💬(state.guesses.length() = 0 ?
"Type a letter to guess"/en"Escribe una carta a"/es"اكتب حرفًا للتخمين"/ar "اكتب حرفًا للتخمين"/ar"Guesses: \state.guesses.join(' ')\"/en"Suposiciones: \state.guesses.join(' ')\"/es"التخمينات \state.guesses.join(' ')\"/ar
)
💬("\state.guessesRemaining\ remaining"/en"\state.guessesRemaining\ restante"/es"متبقي \state.guessesRemaining\"/ar
resting: Sequence(sway(2°) (state.guessesRemaining ÷ 5) · 1s
)
)
])

``Create a world with the screen in it``/en
``Crea un mundo con la pantalla en él``/es
``اصنع عالمًا مع الشاشة بداخله``/ar
Stage([screen] place: Place(0m 0m -12m) face: "Poor Story" background: 🌈(0% 0 0°) color: 🌈(100% 0 0°))




=== words/en,palabras/es,كلمات/ar
``These are the secret words. Don't tell anyone!``/en
``Estas son las palabras secretas. ¡No se lo digas a nadie!``/es
``هذه هي الكلمات السرية. لا تخبر أحدا!``/ar
[
"fox"
"monkey"
"beaver"
"cow"
"wolf"
"goat"
"deer"
"pig"
"chinchilla"
"squirrel"
"rat"
"shrew"
"mole"
"armadillo"
"opossum"
"elephant"
"bat"
"donkey"
"horse"
"hedgehog"
"cat"
"giraffe"
"gorilla"
"seal"
"human"
"kangaroo"
"marmot"
"hamster"
"mouse"
"rabbit"
"sheep"
"jaguar"
"chimpanzee"
"baboon"
"raccoon"
"mole"
"shrew"
"echidna"
"tapir
].sorted(ƒ () Random())
Stage([screen] place: Place(0m 0m -12m) face: "Poor Story" background: 🌈(0% 0 0°) color: 🌈(100% 0 0°))

0 comments on commit 258875b

Please sign in to comment.