Gameduino One, a little clock,poker,game,light thing

Hy peoples,

I just finished my first project. For me it was a learning by doing thing. But I really like the result. It took me about 15 days for the code. My Gameduino One is a Mega328, a hc595, a variable Resistor, a Button, some resistors , a RTC Clock, Leds and a Box.
It uses a non-standard tone() library for 2 tones on the same speaker, the LiquidCrystal_SR2W by Bill Perry.
The code for the Gameduino is floor(32kb), it uses Progmem, direct register adressing and I think almost every trick to optimize code, so everything fits inside. So what can it do: You can play Poker, a Trucklane Clone, a 1person Pong, make a moodlight or use it as a clock with alarm.

The credits for it so far go to:
pBerry: the LCD Library - man you should somewhere say that the scematics for a hc595 shiftreg. are in the header of LiquidCrystal_SR2W.h.

playing multiple tones on one speaker - the ToneLibrary is from here: Google Code Archive - Long-term storage for Google Code Project Hosting.

Supermariotune was "lended" here: Mario tunes by Dipto Pratyaksa from Play Mario Bros theme song on Arduino and 2 piezo buzzer / speakers in Stereo Harmonies | Linux Circle - Do it yourself (DIY) Internet of Things (IoT) guide for hobbyists and innovators

And the poker checkwin() function was made out of the javacript here: //The Poker checkwin function originally javascripted by : http://www.paulgriffiths.net (Thanks man)

Also the MeteridPanic Game is Trucklane from thedod Simple Arduino car game for a 16x2 LCD display (Hitachi HD44780 or clone) · GitHub only added animations and other Sprites.

I hope I credited all sources.

The sourcecode for the Gameduino Clock isn´t availible for download, because it is a one of kind, and uses code from other peoples. If you like to turn your Arduino into a VideoPoker then download the sourcecode here http://www.xlr8.at/downloads/PokeruinoV100.rar

See it in action: Arduino Game Clock Project with Hitachi LCD 16x2 - YouTube

Thanks to all the help in this forum and the guys who made the arduino project .

Cheers, Andre

Lovely!

I was thinking of some optimizations for the poker code, though.

  • If you store the poker array as 13 sets of 4 cards, rather than 4 sets of 13 cards, then you never need to do modulo 13: a bit shift will suffice to divide by 4. This will save you a bit of time and maybe also some program space.
  • You don't need to check for three-of-a-kind or four-of-a kind directly. Just look for pairs of cards with the same value. For example, A? A? A? counts as 3 such pairs: (A? A?) (A? A?) (A? A?)
    ** If 0 pairs, then possible flush (look at suits), possible straight (look at card values), or possible straight flush
    ** If 1 pair, then possible jacks-or-better (look at card values)
    ** If 2 pairs, then two pair
    ** If 3 pairs, then three-of-a-kind
    ** If 4 pairs, then full house
    ** If 6 pairs, then four-of-a-kind
    Conditions for straight: 0 pairs; difference between highest and lowest card value = 4. Note that aces have to get special treatment (I have yet to work this out, exactly).

Thanks a lot for the input. I will check on that.