Added comments and help commands to user apps
This commit is contained in:
23
maze.c
23
maze.c
@ -1,9 +1,11 @@
|
||||
#include "types.h"
|
||||
#include "user.h"
|
||||
|
||||
// User app for generating a simple maze similar to the c64 version using the border ascii characters
|
||||
// This doesnt seem to work on the azure server but left in since i did the work on it...
|
||||
uint rngnumber(void)
|
||||
{
|
||||
// Take from http://stackoverflow.com/questions/1167253/implementation-of-rand
|
||||
// Taken from http://stackoverflow.com/questions/1167253/implementation-of-rand
|
||||
static unsigned int z1 = 12345, z2 = 12345, z3 = 12345, z4 = 12345;
|
||||
unsigned int b;
|
||||
b = ((z1 << 6) ^ z1) >> 13;
|
||||
@ -44,12 +46,24 @@ int main(int argc, char *argv[]) {
|
||||
{
|
||||
seed = atoi(argv[i + 1]);
|
||||
}
|
||||
else if (strcmp(argv[i], "-help") == 0)
|
||||
{
|
||||
printf(1, "Generates X lines of random maze.\n");
|
||||
printf(1, "Options:\n");
|
||||
printf(1, "-l [Number] : Sets number of lines to generate for the maze.\n");
|
||||
printf(1, "-s [Number] : Sets the current seed for the random function.\n");
|
||||
exit();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
cls();
|
||||
greeting();
|
||||
printf(1, "Start Maze\n");
|
||||
|
||||
|
||||
printf(1, "Start Maze (DISABLED)\n");
|
||||
printf(1, "This does not work on the azure servers, but it would generate a random x lines of characters to look like a maze, similar to the old c64 basic program.\n");
|
||||
printf(1, "I could have used the slashes but they look aweful in this font so use the count app instead.\n\n");
|
||||
exit();
|
||||
|
||||
char mazeline[80];
|
||||
for (int y = 0; y < lines; y++)
|
||||
{
|
||||
@ -83,5 +97,6 @@ int main(int argc, char *argv[]) {
|
||||
sleep(10);
|
||||
}
|
||||
printf(1, "Maze Ended\n");
|
||||
|
||||
exit();
|
||||
}
|
Reference in New Issue
Block a user