This commit is contained in:
benjamyn committed 2023-12-13 12:05:58 +11:00
1 parent 1453d7ea21
commit 1ef0d29c9f
7 files changed
+589 -13

No files matched your search

+15 -12
View File
@@ -159,7 +159,7 @@ int get_string(int x, int y, char chars[140][141], struct HashTable *table)
{
if (x < 0 || x > 140 || y < 0 || y > 141)
{
return;
return -69420;
}
// printf("%c", chars[x][y]);
@@ -168,7 +168,7 @@ int get_string(int x, int y, char chars[140][141], struct HashTable *table)
int num = simple_int_conv(chars[x][y]);
if (num == -69420)
{
return;
return -69420;
}
if (isdigit(num) == 0)
{
@@ -196,18 +196,17 @@ int get_string(int x, int y, char chars[140][141], struct HashTable *table)
// ht_insert(table, x, y, num);
return retnum;
}
return 0;
return -69420;
}
int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *table)
{
int nums[2] = {-1, -1};
int count = 0;
int tmpInt;
tmpInt = get_string(x - 1, y - 1, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -224,7 +223,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x - 1, y, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -241,7 +240,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x - 1, y + 1, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -258,7 +257,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x, y - 1, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -275,7 +274,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x, y + 1, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -292,7 +291,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x + 1, y - 1, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -309,7 +308,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x + 1, y, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -326,7 +325,7 @@ int check_numbers_around(int x, int y, char chars[140][141], struct HashTable *t
tmpInt = get_string(x + 1, y + 1, chars, table);
if (tmpInt != -69420)
{
if ((nums[0] != -1 && nums[1] != -1) && (tmpInt == nums[0] || tmpInt == nums[1]))
if ((nums[0] != -1 && nums[1] != -1) && !(tmpInt != nums[0] || tmpInt != nums[1]))
{
return 0;
}
@@ -359,6 +358,10 @@ int check_symbols(int x, int y, char chars[140][141], struct HashTable *table, i
{
retNum = check_numbers_around(x, y, chars, table);
}
else
{
return total; // This is legit just for debugging ease
}
int newTotal = total + retNum;
}