Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 125 lines (93 sloc) 3.752 kb
a08ee9a Bryan Fink replace schematic with README
authored
1 Blockgame is a demonstration of using a NerdKit for simple games. It
2 is an implementation of the classic "clear rows of three matching
3 pieces" game.
4
d18948d Bryan Fink add link to informative blog post
authored
5 More information, including a demo, is available at
6 http://blog.beerriot.com/2011/02/14/nerdkit-gaming/
7
a08ee9a Bryan Fink replace schematic with README
authored
8 * Basic Play
9
10 Play begins with a board of random tiles:
11
f39e7f7 Bryan Fink fix rendering of example boards
authored
12 : abcdefg
13 : cabfgde
14 : gbacedf
a08ee9a Bryan Fink replace schematic with README
authored
15
16 The player makes a move by choosing two adjacent tiles to swap, such
17 that a line of three matching tiles are made. For example, swapping
18 the 'a' and 'b' in the second row of the example above creates a line
19 of 'b':
20
f39e7f7 Bryan Fink fix rendering of example boards
authored
21 : abcdefg
22 : cbafgde
23 : gbacedf
a08ee9a Bryan Fink replace schematic with README
authored
24
25 The 'b' tiles are then removed from the board, and new random tiles
26 added to the right side:
27
f39e7f7 Bryan Fink fix rendering of example boards
authored
28 : acdefga
29 : cafgded
30 : gacedfb
a08ee9a Bryan Fink replace schematic with README
authored
31
32 Play continues until it is not possible to make a match with just one
33 swap.
34
35 This version differs from other common versions, in that matches and
36 swaps may "wrap" around any side.
37
38 * Nerdkit Play
39
40 At startup, the player is presented with choices of what size of
41 playing field to use, and how many unique tile types to play with (the
42 "variety").
43
44 The player chooses tiles to swap by clicking left/down/up/right
45 buttons until the cursor is over one of the pieces to be swapped. The
46 player then presses the select button, then moves to the other tile to
47 swap, and presses the select button again. A selected tile is noted
48 by a capital letter (all other tiles are lower-case).
49
50 When no moves remain, a "game over" screen is shown for a few seconds.
51 The user is then returned to the start menu to begin a new game.
52
53 * Nerdkit schematic
54
55 The schematic for the NerdKit while running the game is:
56
57 #+BEGIN_EXAMPLE
58 |---|
59 ^__|1 |_
60 _| |__/ o--| (select)
61 _| A |__/ o--| (right)
62 lcd14_____________| T |__/ o--| (up)
63 lcd13_____________| m |__/ o--| (down)
64 lcd12_____________| e |__/ o--| (left)
65 ^_____________| g |_______|
66 | _________| a |__^ gnd
67 0.1uF = | ____| 1 |__|
68 gnd_|__| |_X__| 6 |_ (14.7Mhz xtal)
69 lcd11_____________| 8 |_
70 lcd6______________| |_
71 lcd4______________| |_
72 _| |_
73 lcd2-^ |---|
74 lcd5--------|
75 lcd1--------|
76 lcd3--vvvv--|
77 1k gnd
78 #+END_EXAMPLE
79
80 For programming, connect the yellow programmer wire to ATmega168 pin 2,
81 and the green programmer wire to pin 3, then tie pin 14 to ground.
82
83 * Nerdkit Building
84
85 To compile and program the NerdKit, connect the programmer, and type
86 'make' at the commandline (the top of Makefile will give you an idea
87 of where the NerdKit libraries should be located).
88
89 To compile without programming, use 'make blockgame.hex'.
8702868 Bryan Fink document new features
authored
90
91 * Extra Features
92
93 ** Scoreboard
94
95 The game features a scoreboard stored in the EEPROM. It's a very
96 simple format: three bytes of initial, two bytes of score, repeat
97 twice more, then add a byte of checksum. Sixteen bytes total.
98 Visually:
99
100 : IIISS
101 : IIISS
102 : IIISS
103 : C
104
105 The two bytes of score are the high byte, then the low byte of a
106 16-bit unsigned integer. The checksum is simply the bitwise XOR of
107 the other 15 bytes.
108
109 ** Sleep
110
111 The game will also put itself to sleep after a period of inactivity
112 (no button presses). The idea is to save power by turning off the
113 display and shutting down most of the MCU. It will automatically wake
114 up and resume where it left off when a button is pressed.
115
116 The two sleep points are: a minute of sitting on the game screen, and
117 4 transitions back and forth between the start menu and the highscore
118 table. (Another new feature is the "screen saver" mode of the start
119 menu, which flips to the highscore table after several seconds.)
120
121 ** Testing
122
123 There are also a couple of tests, with room for more. If you run
124 'make test' or look in the test/ directory, you'll find them.
Something went wrong with that request. Please try again.