Added ability to set a title for the console

Added seed value to the maze generator
Added a title lock to the console
Added a vconsole lock that locks on any virtual console change
Changed some of the locks used to free up
This commit is contained in:
iDunnoDev
2022-12-18 11:42:58 +00:00
committed by iDunnoDev
parent c65c58a954
commit 662e3795a7
7 changed files with 175 additions and 92 deletions

21
maze.c
View File

@ -18,7 +18,7 @@ uint rngnumber(void)
return (z1 ^ z2 ^ z3 ^ z4) / 2;
}
int rngrange(int start, int end)
int rngrange(int start, int end, int seed)
{
if (end < start)
{
@ -28,27 +28,36 @@ int rngrange(int start, int end)
}
int range = end - start + 1;
return rngnumber() % (range) + start;
return (rngnumber() + seed) % (range) + start;
}
int main(int argc, char *argv[]) {
int lines = 1000;
int seed = getpid();
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-l") == 0) {
if (strcmp(argv[i], "-l") == 0)
{
lines = atoi(argv[i + 1]);
}
else if (strcmp(argv[i], "-s") == 0)
{
seed = atoi(argv[i + 1]);
}
}
cls();
printf(1, "Start Maze\n");
for (int y = 0; y < lines; y++)
{
for (int x = 0; x < 79; x++)
for (int x = 0; x < 80; x++)
{
int rndnum = rngrange(189, 197);
int rndnum = rngrange(188, 197, seed);
switch (rndnum)
{
case 188:
rndnum = 32;
break;
case 189:
rndnum = 179;
break;
@ -59,7 +68,7 @@ int main(int argc, char *argv[]) {
printf(1, "%c", rndnum);
}
printf(1, "\n");
//printf(1, "\n");
sleep(10);
}
printf(1, "Maze Ended\n");