Computer Time is Cheap – Human Time is Expensive

While working on a simple roulette betting game I ran into a roadblock with two ways I could proceed. I asked on reddit and stackoverflow, but in the meantime I realized I should just implement one and get on with my life. Seizing up/writer’s block is a real problem!

Background on Roulette 

While roulette is one of the simplest casino games, there are over a hundred unique bets. The simpler ones are bets on red or black, even or odd, or a specific number (playing it straight). However, There are plenty of weird edge case betting strategies in roulette, which makes bet checking nontrivial. For example, Street bets are a bet on three numbers, but not just any random three — they must be in a grid row. In American Roulette there are

  • 10 simple bets (red, black, etc.)
  • 38 straight up bets (0,00,1,2,3,..,36)
  • around 50 split bets (1 + 2, 4 + 7, 0 + 1, etc.)
  • 12 street bets (1 + 2 + 3, 22 + 23 + 24, etc.)
  • 22 corner bets (1 + 2 + 4 + 5, 8 + 9 + 11 + 12, etc.)
  • 3 column bets (1 + 4 + 7 +.. +34)
  • 6 six-line bets (1 + 2 + 3 + 4 + 5 + 6)

Bet Validity Check

The Simple Route (Hash Table): Create a hash table that contains all possible hash values and check against the table. Human Time Estimate: ~1 hour

The Fancy Route (Linked List of Nodes): Create a doubly-linked list of elements where each element represents a possible outcome (e.g., 0,1,2,3 .. 36) and each is linked to its neighbors. For example the number ‘1’ would be linked to ‘2’, ‘4’, and ‘5’. This gets complicated because you cannot make a split bet on ‘1’ and ‘5’, but you can make a corner bet on ‘1’, ‘2’, ‘4’ and ‘5’.

I’m interested in what the time difference between each would be, so I am going to try both and profile the results. This is a scenario where I can estimate the human time as well. Is it faster to brute force the two hundred or so unique bets into a hash table, or create the data structure?