Skip to content

Commit

Permalink
Merge pull request #16 from dmbates/sortedtree
Browse files Browse the repository at this point in the history
Sort siblings in the tree representation by tree size
  • Loading branch information
dmbates authored Mar 15, 2022
2 parents 8b4c61a + cf37529 commit 6a62e74
Show file tree
Hide file tree
Showing 9 changed files with 8,973 additions and 92 deletions.
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## MixedModels v0.2.0 Release Notes
## Wordlegames v0.3.0 Release Notes

- Sort siblings in tree by size of tree rooted at a node.
- Drop the index from the output of print_node
- add targets and validguesses for Greek game from https://github.com/gvarnavi/wordle-greek

## Wordlegames v0.2.0 Release Notes

- Bugfix release Issue #8, *Incorrect scoring when characters are repeated in guess*
- Fixing this led to slightly better mean number of guesses to solution.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Wordlegames"
uuid = "1cb69566-e1cf-455f-a587-fd79a2e00f5a"
authors = ["Douglas Bates <[email protected]> and contributors"]
version = "0.2.0"
version = "0.3.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
122 changes: 61 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,38 +351,38 @@ For illustration, consider just a portion of the tree of Wordle games using the
Games with targets `["super", "hobby", "mince", "goner", "watch"]` are shown above.
They can be combined into a tree as

```jl
julia> print_tree(tree(wordle, ["super", "hobby", "mince", "goner", "watch"]), maxdepth=8)
missing, raise, 1535, 2315, 5.87791, 61.0009
├─ 🟫🟫🟨🟫🟩, binge, 198, 25, 3.28386, 3.64
│ └─ 🟫🟩🟩🟫🟩, mince, 1234, 2, 1.0, 1.0
├─ 🟨🟫🟫🟫🟨, deter, 546, 102, 4.37007, 9.23529
│ └─ 🟫🟫🟫🟩🟩, cower, 454, 26, 2.74682, 5.23077
│ └─ 🟫🟩🟫🟩🟩, hover, 999, 9, 1.65774, 3.44444
│ └─ 🟫🟩🟫🟩🟩, joker, 1059, 5, 1.37095, 2.2
│ └─ 🟫🟩🟫🟩🟩, boxer, 258, 3, 0.918296, 1.66667
│ └─ 🟫🟩🟫🟩🟩, foyer, 800, 2, 1.0, 1.0
└─ 🟫🟩🟫🟩🟩, goner, 884, 1, -0.0, 1.0
├─ 🟫🟫🟫🟫🟫, mulch, 1275, 168, 5.21165, 6.85714
│ └─ 🟫🟫🟫🟫🟨, whoop, 2262, 6, 2.58496, 1.0
│ └─ 🟫🟨🟨🟫🟫, hobby, 985, 1, -0.0, 1.0
├─ 🟨🟫🟫🟨🟨, sheer, 1720, 18, 3.28104, 2.11111
│ └─ 🟩🟫🟫🟩🟩, sober, 1835, 4, 1.5, 1.5
│ └─ 🟩🟫🟫🟩🟩, super, 1969, 2, 1.0, 1.0
└─ 🟫🟩🟫🟫🟫, tangy, 2012, 91, 4.03061, 7.48352
└─ 🟨🟩🟫🟫🟫, caput, 334, 13, 2.4997, 2.84615
─ 🟨🟩🟫🟫🟨, batch, 160, 5, 0.721928, 3.4
└─ 🟫🟩🟩🟩🟩, hatch, 959, 4, 0.811278, 2.5
└─ 🟫🟩🟩🟩🟩, latch, 1102, 3, 0.918296, 1.66667
└─ 🟫🟩🟩🟩🟩, match, 1206, 2, 1.0, 1.0
└─ 🟫🟩🟩🟩🟩, watch, 2233, 1, -0.0, 1.0
```julia
julia> print_tree(tree(wordle, ["super","hobby","mince","goner","watch"]); maxdepth=8)
missing, raise, 2315, 5.87791, 61.0009
├─ 🟨🟫🟫🟫🟨, deter, 102, 4.37007, 9.23529
│ └─ 🟫🟫🟫🟩🟩, cower, 26, 2.74682, 5.23077
│ └─ 🟫🟩🟫🟩🟩, hover, 9, 1.65774, 3.44444
└─ 🟫🟩🟫🟩🟩, joker, 5, 1.37095, 2.2
└─ 🟫🟩🟫🟩🟩, boxer, 3, 0.918296, 1.66667
└─ 🟫🟩🟫🟩🟩, foyer, 2, 1.0, 1.0
└─ 🟫🟩🟫🟩🟩, goner, 1, -0.0, 1.0
─ 🟫🟩🟫🟫🟫, tangy, 91, 4.03061, 7.48352
│ └─ 🟨🟩🟫🟫🟫, caput, 13, 2.4997, 2.84615
│ └─ 🟨🟩🟫🟫🟨, batch, 5, 0.721928, 3.4
└─ 🟫🟩🟩🟩🟩, hatch, 4, 0.811278, 2.5
└─ 🟫🟩🟩🟩🟩, latch, 3, 0.918296, 1.66667
│ └─ 🟫🟩🟩🟩🟩, match, 2, 1.0, 1.0
└─ 🟫🟩🟩🟩🟩, watch, 1, -0.0, 1.0
├─ 🟫🟫🟫🟫🟫, mulch, 168, 5.21165, 6.85714
└─ 🟫🟫🟫🟫🟨, whoop, 6, 2.58496, 1.0
└─ 🟫🟨🟨🟫🟫, hobby, 1, -0.0, 1.0
─ 🟨🟫🟫🟨🟨, sheer, 18, 3.28104, 2.11111
└─ 🟩🟫🟫🟩🟩, sober, 4, 1.5, 1.5
└─ 🟩🟫🟫🟩🟩, super, 2, 1.0, 1.0
└─ 🟫🟫🟨🟫🟩, binge, 25, 3.28386, 3.64
└─ 🟫🟩🟩🟫🟩, mince, 2, 1.0, 1.0
```

Although this is not a particularly interesting tree, it serves to illustrate some of the properties.
The first node, called the "root" node, is the first guess in all the games.
The guess is "raise" at index 1535 with pool size 2315, an entropy of 5.88 and an expected pool size of 61.00 after scoring.
The guess is "raise" with a pool size of 2315, an entropy of 5.88 and an expected pool size of 61.00 after scoring.

If the score for "raise" is `🟫🟫🟨🟫🟩`, the next guess will be "binge", with the characteristics shown.
If the score for "raise" is `🟨🟫🟫🟫🟨`, the next guess will be "deter", with the characteristics shown.
If the score is `🟫🟫🟫🟫🟫`, which is the most likely score for the first guess, the next guess is "mulch", and so on.

Note that in the tree the score is associated with the guess that it will produce next, whereas in the summary of the game the score is associated with the guess that produced it.
Expand All @@ -391,41 +391,41 @@ The reason that this tree is not very interesting is that it simply reproduces t

It is more interesting to play a random selection of games

```jl
```julia
julia> print_tree(tree(wordle, Random.seed!(1234321), 12))
missing, raise, 1535, 2315, 5.87791, 61.0009
├─ 🟫🟫🟫🟫🟨, betel, 189, 121, 5.06266, 4.95041
─ 🟫🟩🟫🟫🟨, cello, 349, 9, 2.9477, 1.22222
└─ 🟫🟩🟩🟫🟨, felon, 714, 2, 1.0, 1.0
└─ 🟫🟩🟩🟩🟩, melon, 1220, 1, -0.0, 1.0
├─ 🟨🟩🟩🟫🟫, dairy, 515, 4, 1.5, 1.5
│ └─ 🟫🟩🟩🟩🟩, fairy, 699, 2, 1.0, 1.0
│ └─ 🟫🟩🟩🟩🟩, hairy, 948, 1, -0.0, 1.0
├─ 🟨🟫🟫🟫🟨, deter, 546, 102, 4.37007, 9.23529
│ └─ 🟩🟩🟫🟫🟩, decor, 530, 2, 1.0, 1.0
│ └─ 🟩🟩🟫🟫🟩, demur, 540, 1, -0.0, 1.0
├─ 🟫🟫🟫🟫🟫, mulch, 1275, 168, 5.21165, 6.85714
─ 🟫🟩🟩🟫🟫, bully, 302, 6, 1.79248, 2.0
│ └─ 🟫🟩🟩🟫🟩, pulpy, 1492, 1, -0.0, 1.0
├─ 🟫🟨🟨🟨🟫, cloud, 419, 4, 2.0, 1.0
└─ 🟩🟩🟩🟩🟫, clout, 420, 1, -0.0, 1.0
│ └─ 🟫🟫🟫🟫🟨, whoop, 2262, 6, 2.58496, 1.0
│ └─ 🟫🟨🟨🟫🟫, hobby, 985, 1, -0.0, 1.0
├─ 🟨🟩🟫🟫🟫, party, 1377, 26, 3.12276, 3.84615
│ └─ 🟫🟩🟩🟫🟩, carry, 338, 4, 1.5, 1.5
│ └─ 🟫🟩🟩🟩🟩, harry, 955, 2, 1.0, 1.0
├─ 🟫🟫🟨🟫🟫, pilot, 1413, 107, 4.69342, 6.38318
─ 🟫🟨🟫🟨🟫, comic, 435, 4, 2.0, 1.0
└─ 🟩🟩🟫🟩🟩, conic, 439, 1, -0.0, 1.0
├─ 🟫🟩🟫🟫🟨, width, 2267, 13, 2.93121, 2.07692
└─ 🟫🟩🟫🟩🟫, bitty, 204, 4, 1.5, 1.5
└─ 🟫🟩🟫🟩🟩, fifty, 733, 2, 1.0, 1.0
│ └─ 🟫🟩🟫🟫🟫, windy, 2274, 16, 3.20282, 1.875
└─ 🟫🟩🟫🟫🟩, fizzy, 746, 2, 1.0, 1.0
└─ 🟨🟩🟫🟫🟩, jiffy, 1056, 1, -0.0, 1.0
├─ 🟨🟩🟫🟨🟫, satyr, 1648, 2, 1.0, 1.0
└─ 🟨🟫🟫🟨🟫, short, 1739, 24, 3.60539, 2.25
└─ 🟨🟫🟨🟨🟨, torus, 2085, 1, -0.0, 1.0
missing, raise, 2315, 5.87791, 61.0009
├─ 🟫🟫🟨🟫🟫, pilot, 107, 4.69342, 6.38318
─ 🟫🟩🟫🟫🟨, width, 13, 2.93121, 2.07692
└─ 🟫🟩🟫🟩🟫, bitty, 4, 1.5, 1.5
└─ 🟫🟩🟫🟩🟩, fifty, 2, 1.0, 1.0
├─ 🟫🟩🟫🟫🟫, windy, 16, 3.20282, 1.875
└─ 🟫🟩🟫🟫🟩, fizzy, 2, 1.0, 1.0
└─ 🟨🟩🟫🟫🟩, jiffy, 1, -0.0, 1.0
│ └─ 🟫🟨🟫🟨🟫, comic, 4, 2.0, 1.0
└─ 🟩🟩🟫🟩🟩, conic, 1, -0.0, 1.0
├─ 🟫🟫🟫🟫🟫, mulch, 168, 5.21165, 6.85714
├─ 🟫🟩🟩🟫🟫, bully, 6, 1.79248, 2.0
│ └─ 🟫🟩🟩🟫🟩, pulpy, 1, -0.0, 1.0
─ 🟫🟨🟨🟨🟫, cloud, 4, 2.0, 1.0
│ └─ 🟩🟩🟩🟩🟫, clout, 1, -0.0, 1.0
│ └─ 🟫🟫🟫🟫🟨, whoop, 6, 2.58496, 1.0
└─ 🟫🟨🟨🟫🟫, hobby, 1, -0.0, 1.0
─ 🟫🟫🟫🟫🟨, betel, 121, 5.06266, 4.95041
│ └─ 🟫🟩🟫🟫🟨, cello, 9, 2.9477, 1.22222
└─ 🟫🟩🟩🟫🟨, felon, 2, 1.0, 1.0
└─ 🟫🟩🟩🟩🟩, melon, 1, -0.0, 1.0
├─ 🟨🟩🟩🟫🟫, dairy, 4, 1.5, 1.5
─ 🟫🟩🟩🟩🟩, fairy, 2, 1.0, 1.0
└─ 🟫🟩🟩🟩🟩, hairy, 1, -0.0, 1.0
├─ 🟨🟫🟫🟫🟨, deter, 102, 4.37007, 9.23529
│ └─ 🟩🟩🟫🟫🟩, decor, 2, 1.0, 1.0
│ └─ 🟩🟩🟫🟫🟩, demur, 1, -0.0, 1.0
├─ 🟨🟩🟫🟫🟫, party, 26, 3.12276, 3.84615
│ └─ 🟫🟩🟩🟫🟩, carry, 4, 1.5, 1.5
│ └─ 🟫🟩🟩🟩🟩, harry, 2, 1.0, 1.0
├─ 🟨🟫🟫🟨🟫, short, 24, 3.60539, 2.25
└─ 🟨🟫🟨🟨🟨, torus, 1, -0.0, 1.0
└─ 🟨🟩🟫🟨🟫, satyr, 2, 1.0, 1.0
```

Again, the root is "raise", which is the first guess in any game using the `MaximumEntropy` strategy, and if the first score is `🟫🟫🟫🟫🟫` then the second guess will be "mulch".
Expand Down
1 change: 1 addition & 0 deletions data/Greek/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These files are derived from https://github.com/gvarnavi/wordle-greek/raw/main/src/constants/validGuesses.ts and https://github.com/gvarnavi/wordle-greek/raw/main/src/constants/wordlist.ts
Loading

2 comments on commit 6a62e74

@dmbates
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/56671

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" 6a62e7464fb45c544bf6ce43d826ec59b776f79d
git push origin v0.3.0

Please sign in to comment.