Repository navigation
feat: add varandinha garden rules and record types - #723
Merged
Merged
Conversation
Pure rules for the Varandinha game in @varanda/rpc (lib/garden.js): pots, plants, growth on the reader clock, the play reducer, the help and given folds, the balcony fold and the writer checks. Nothing throws and every value is read once from its own data property. Three record types in core records, with builders and reason codes: garden and garden-state (latest-wins) and garden-help (a watering in the helper's diary, addressed to the owner). Old readers skip them as malformed. Protocol section 2 describes the records and the rules.
Main added the device record type. Both sides keep their record types, with device before the three garden types in TYPES and its pin, and the rpc.md re-export list keeps garden and the devices.changed event.
# Conflicts: # docs/rpc.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O que muda e por quê
Primeiro de cinco PRs da Varandinha (fase 1). O jogo é opcional:
Não há dinheiro, compra, pontuação, ranking, prêmio nem texto livre. Tudo fica no diário assinado de cada pessoa.
Este PR traz só as regras e os registros, sem rota, sem nó e sem tela:
@varanda/rpcganhalib/garden.js, as regras puras do jogo:Nada lança exceção, e cada valor é lido uma vez da própria propriedade. O nó, o semeador e o app usam este mesmo módulo nos próximos PRs.
packages/core/lib/records.jsganha três tipos de registro, com construtores e códigos de recusa:garden(entrou ou saiu) egarden-state(os seis vasos), os dois "o mais recente vale";garden-help, uma rega no diário de quem rega, endereçada ao dono.Leitores antigos pulam os três como malformados, sem recusar o diário.
docs/protocol.md§2 descreve os registros, as regras e o que fica de fora.docs/rpc.md§12 cita o módulo.A ordem da pilha:
feat/varandinha-index(índice do semeador);feat/varandinha-node(métodos RPC e nó do navegador);feat/varandinha-model(modelo do app e Vitrine);feat/varandinha-app(telas e Termos 77).Limites, escritos também em
docs/protocol.md:followjá substituído parece vivo numa espiada só.Issue
Sem issue (fase 1 da Varandinha).
Como verificar
npm test -w packages/rpc -- test/garden.test.jsnpm test -w packages/core -- test/records.test.js test/garden.test.jsdocs/verification/feat-varandinha-records.md.main; depois dela, rodou no topo da pilha (feat/varandinha-app), que contém este ramo. A CI do GitHub roda neste PR.Checklist
npm run lint,npm test(ounpm test -- --affected=origin/main) enpm run demopassamdocs/changelog/<branch>.mde verificação emdocs/verification/<branch>.md, se houver, sem editar o CHANGELOG.md nem acrescentar seção ao docs/verification.md (só verificação: nada aqui chega à pessoa usuária ainda)