summaryrefslogtreecommitdiff
path: root/apps/plugins/sliding_puzzle.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-07-21 11:03:14 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-07-21 11:03:14 +0000
commite1d5ebd53fcf58a1e57a96205e6b5dd88b0caf9e (patch)
tree5f394121b57bf4c7757a5454a2339dc93f504093 /apps/plugins/sliding_puzzle.c
parent754426e11f82eca75bbca302674d4cc92cdf53be (diff)
minor edits to conform to rockbox standards
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3858 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/sliding_puzzle.c')
-rw-r--r--apps/plugins/sliding_puzzle.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index 73b1ae3b08..790e4ac501 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -5,7 +5,7 @@
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
- * $Id: puzzle.c,v 1.1 2003/01/19 00:19:56
+ * $Id$
*
* Copyright (C) 2002 Vicentini Martin
*
@@ -128,7 +128,8 @@ static unsigned char picture[20][32] = {
};
/* draws a spot at the coordinates (x,y), range of p is 1-20 */
-static void draw_spot(int p, int x, int y) {
+static void draw_spot(int p, int x, int y)
+{
if (pic || p==20) {
ptr = picture[p-1];
rb->lcd_bitmap (ptr, x, y, 16, 8, true);
@@ -143,7 +144,8 @@ static void draw_spot(int p, int x, int y) {
}
/* check if the puzzle is solved */
-static bool puzzle_finished(void) {
+static bool puzzle_finished(void)
+{
int i;
for (i=0; i<20; i++)
if (spots[i] != (i+1))
@@ -152,7 +154,8 @@ static bool puzzle_finished(void) {
}
/* move a piece in any direction */
-static void move_spot(int x, int y) {
+static void move_spot(int x, int y)
+{
int i;
spots[hole] = spots[hole-x-5*y];
hole -= (x+5*y);
@@ -169,7 +172,8 @@ static void move_spot(int x, int y) {
}
/* initializes the puzzle */
-static void puzzle_init(void) {
+static void puzzle_init(void)
+{
int i, r, temp, tsp[20];
moves = 0;
rb->lcd_clear_display();
@@ -178,7 +182,7 @@ static void puzzle_init(void) {
rb->snprintf(s, sizeof(s), "%d", moves);
rb->lcd_putsxy(85, 20, s);
- // shuffle spots
+ /* shuffle spots */
for (i=19; i>=0; i--) {
r = (*rb->current_tick % (i+1));
@@ -190,7 +194,7 @@ static void puzzle_init(void) {
hole = i;
}
- // test if the puzzle is solvable
+ /* test if the puzzle is solvable */
for (i=0; i<20; i++)
tsp[i] = spots[i];
r=0;
@@ -205,7 +209,7 @@ static void puzzle_init(void) {
}
}
- // if the random puzzle isn't solvable just change two spots
+ /* if the random puzzle isn't solvable just change two spots */
if (r%2 == 1) {
if (spots[0]!=20 && spots[1]!=20) {
temp = spots[0];
@@ -218,14 +222,15 @@ static void puzzle_init(void) {
}
}
- // draw spots to the lcd
+ /* draw spots to the lcd */
for (i=0; i<20; i++)
draw_spot(spots[i], (i%5)*16, (i/5)*16);
rb->lcd_update();
}
/* the main game loop */
-static int puzzle_loop(void) {
+static int puzzle_loop(void)
+{
int i;
puzzle_init();
while(true) {