Fandom

Scratchpad

OpposableThumbs/Clue Algorithm

< OpposableThumbs

215,906pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Clue

This describes the C++ classes ClueGame, ClueHand and ClueUtil which are the core of a clue game program.

See Wikipedias's Cluedo for a description of the board game.

Hand Descriptions

In clue there are 21 cards. Because I can fit 21 bits easily within a 32-bit int, I'll use the bits of an int to store each hand. I'm assuming ints to be 32 bits or larger (well, 21 bits, but that's silly). Since we're trying to identify what cards may exist in other people's hands, or within the Solution envelope, I like the idea of any specific card being represented bit a bit position.

bit: 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Also on Fandom

Random wikia