mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
Merge pull request #642 from JRoussos/main
JAVASCRIPT: Support for both uppercase and lowercase input values
This commit is contained in:
@@ -94,9 +94,9 @@ async function main()
|
|||||||
a[i] = 0;
|
a[i] = 0;
|
||||||
// *** N=NUMBER OF NUMBER
|
// *** N=NUMBER OF NUMBER
|
||||||
n = 9;
|
n = 9;
|
||||||
print("DO YOU WANT THE RULES");
|
print("DO YOU WANT THE RULES? (YES OR NO)");
|
||||||
str = await input();
|
str = await input();
|
||||||
if (str != "NO")
|
if (str.toUpperCase() === "YES" || str.toUpperCase() === "Y")
|
||||||
print_rules();
|
print_rules();
|
||||||
while (1) {
|
while (1) {
|
||||||
// *** Make a random list a(1) to a(n)
|
// *** Make a random list a(1) to a(n)
|
||||||
@@ -123,7 +123,7 @@ async function main()
|
|||||||
break;
|
break;
|
||||||
if (r <= n)
|
if (r <= n)
|
||||||
break;
|
break;
|
||||||
print("OOPS! TOO MANY! I CAN REVERSE AT MOST " + n + "\n");
|
print("OOPS! WRONG! I CAN REVERSE AT MOST " + n + "\n");
|
||||||
}
|
}
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
@@ -147,9 +147,9 @@ async function main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print("\n");
|
print("\n");
|
||||||
print("TRY AGAIN (YES OR NO)");
|
print("TRY AGAIN? (YES OR NO)");
|
||||||
str = await input();
|
str = await input();
|
||||||
if (str != "YES")
|
if (str.toUpperCase() === "NO" || str.toUpperCase() === "N")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
print("\n");
|
print("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user