Skip to content

How it works

The best version of Codenames online is at
- play there and buy the author a coffee!


Here’s how this doc works:

Wordlist

We can get the entire list of 400 words from BoardGameGeeks:
. It lives in the
.

Wordlist Table
1

Colors

Codenames has 4 colors. We use the
and corresponding Hex Values to generate the little Circle Keys.

Color Table
0

Generating a new gameboard

This is where the fun lies. Generating a new game involves the following steps:
Pick a random set of 25 words.
Color them with 8 Blue and 7 Reds. We don’t deal with the additional complexity of flipping reds and blues in every game.
Pick one Black. The rest are beige.
Insert everything into the current game table.

I solved this using an intermediate table. Some interesting tricks:
Coda doesn’t have a shuffle function, so its hard to just shuffle a list of things and take a slice. Instead, I dropped a
Randomizer
column, and used that to sort and then slice. Randomizer can be set to continuously generate randomness, which does the trick BUT requires the use of an intermediate table.
The intermediate table is used to give out colors (which needs stability) followed by an additional shuffle.
Everything is inserted into the game table.
Finally, we need to arrange the cards in a column - a simple
%5 on RowId()
does the trick.

Actions are represented using buttons:
Clear state:
Delete Intermediate Table
Delete Current Game
Add 25 words:
Add New Words
Color them:
Red
Blue
Black
Beige
Create the final table:
Final Table

Intermediate
0

Master table

The net result of all this is the master table.

Current Game Master
2

Fun Coda Tricks

You can create little color circles by using
Rectangle(20,20,”#dd0011”).clipCircle
to get
You can cat images and words using
Concatenate
like this:
Circle with Text
To color actual text, you have to use an internal function
_color
like this:
Circle with Text
All coloring tricks were deprecated by using conditional formatting to show cards fully colored.
RowIds are monotonically increasing and non-random. Praise coda eng 🙌
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.