# Bulls & Cows
> ⚠️ **Experimental — generated with no human supervision.** This realm was
> produced automatically by an MCP-driven agent to exercise the gno MCP server
> and tooling, and to generate test content for gno compilers, linters and
> formatters. **Not audited. Not for production.** Full context & folder README:
> [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md)
---
A shared on-chain [Bulls & Cows](https://en.wikipedia.org/wiki/Bulls_and_Cows) puzzle
(the classic ancestor of Mastermind and Wordle-for-digits). One secret 4-digit code
with no repeated digits is live at a time; anyone can call `Guess` with a candidate
code and gets back **bulls** (right digit, right position) and **cows** (right digit,
wrong position). First caller to land 4 bulls cracks the round, lands on the
leaderboard, and a fresh secret is drawn immediately so the next round starts at once.
Realm: `gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/bullscows`
## Example calls
```
Guess("1972") -> "1972 -> 1 bulls, 2 cows"
Guess("7192") -> "*** SOLVED *** 7192 was it — round 3 cracked in 5 guesses. New round 4 has begun, good luck!"
GiveUp() -> "round 4's code was 4082 — round 5 is live now."
```
`Render("")` shows the current round, attempts so far, the last 10 guesses with
their bulls/cows, and the top-5 fastest-solve leaderboard.
The secret is generated deterministically from the on-chain block height and the
round counter via a small LCG (`newSecret`/`nextRand` in `bullscows.gno`) — no
external randomness needed, and nobody can precompute the next code before its
round actually starts.
## Toolchain status
Verified locally with `gno test -v .` and `gno lint .` against a `gno.land/gnolang/gno`
master checkout used as `GNOROOT` (the default installed `gno` binary had a stale/
missing `GNOROOT`, so `GNOROOT=<path-to-gnolang/gno> gno test .` was used instead).
All 7 tests pass, lint is clean. This exercises current sapphire (gno 0.9) stdlib
paths (`chain/runtime`, no `std` package) and the `cur realm` / `cross(cur)` crossing
convention.
<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->
---
Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
> 🧪 **Highly experimental — potentially vibe-coded.** Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).
<!-- END GNOCONTRACTS FOOTER -->
GiveUp(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string
Guess(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, guess string) string
Render(path string) string
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.