summaryrefslogtreecommitdiff
path: root/lib/coordinate.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coordinate.c')
-rw-r--r--lib/coordinate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/coordinate.c b/lib/coordinate.c
index f92c22a..26bbca5 100644
--- a/lib/coordinate.c
+++ b/lib/coordinate.c
@@ -4,19 +4,19 @@
#include "coordinate.h"
/*
- * Returns 0 if the coordinate is between a1 and h8.
+ * Returns 1 if the coordinate is between a1 and h8.
*/
int coord_is_valid(char *s) {
if (strnlen(s, 3) != 2)
- return 1;
+ return 0;
char col = tolower(s[0]);
char row = tolower(s[1]);
if (col >= 'a' && col <= 'h' && row >= '1' && row <= '8')
- return 0;
+ return 1;
- return 2;
+ return 0;
}
/*
nihil fit ex nihilo