mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
Merge pull request #81 from nanochess/main
Ported WAR, WEEKDAY, and WORD to Javascript
This commit is contained in:
9
94 War/javascript/war.html
Normal file
9
94 War/javascript/war.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>WAR</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre id="output" style="font-size: 12pt;"></pre>
|
||||||
|
<script src="war.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
136
94 War/javascript/war.js
Normal file
136
94 War/javascript/war.js
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
// WAR
|
||||||
|
//
|
||||||
|
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
|
||||||
|
//
|
||||||
|
|
||||||
|
function print(str)
|
||||||
|
{
|
||||||
|
document.getElementById("output").appendChild(document.createTextNode(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
function input()
|
||||||
|
{
|
||||||
|
var input_element;
|
||||||
|
var input_str;
|
||||||
|
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
input_element = document.createElement("INPUT");
|
||||||
|
|
||||||
|
print("? ");
|
||||||
|
input_element.setAttribute("type", "text");
|
||||||
|
input_element.setAttribute("length", "50");
|
||||||
|
document.getElementById("output").appendChild(input_element);
|
||||||
|
input_element.focus();
|
||||||
|
input_str = undefined;
|
||||||
|
input_element.addEventListener("keydown", function (event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
input_str = input_element.value;
|
||||||
|
document.getElementById("output").removeChild(input_element);
|
||||||
|
print(input_str);
|
||||||
|
print("\n");
|
||||||
|
resolve(input_str);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function tab(space)
|
||||||
|
{
|
||||||
|
var str = "";
|
||||||
|
while (space-- > 0)
|
||||||
|
str += " ";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
var a = [, "S-2","H-2","C-2","D-2","S-3","H-3","C-3","D-3",
|
||||||
|
"S-4","H-4","C-4","D-4","S-5","H-5","C-5","D-5",
|
||||||
|
"S-6","H-6","C-6","D-6","S-7","H-7","C-7","D-7",
|
||||||
|
"S-8","H-8","C-8","D-8","S-9","H-9","C-9","D-9",
|
||||||
|
"S-10","H-10","C-10","D-10","S-J","H-J","C-J","D-J",
|
||||||
|
"S-Q","H-Q","C-Q","D-Q","S-K","H-K","C-K","D-K",
|
||||||
|
"S-A","H-A","C-A","D-A"];
|
||||||
|
|
||||||
|
var l = [];
|
||||||
|
|
||||||
|
// Main control section
|
||||||
|
async function main()
|
||||||
|
{
|
||||||
|
print(tab(33) + "WAR\n");
|
||||||
|
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("THIS IS THE CARD GAME OF WAR. EACH CARD IS GIVEN BY SUIT-#\n");
|
||||||
|
print("AS S-7 FOR SPADE 7. ");
|
||||||
|
while (1) {
|
||||||
|
print("DO YOU WANT DIRECTIONS");
|
||||||
|
str = await input();
|
||||||
|
if (str == "YES") {
|
||||||
|
print("THE COMPUTER GIVES YOU AND IT A 'CARD'. THE HIGHER CARD\n");
|
||||||
|
print("(NUMERICALLY) WINS. THE GAME ENDS WHEN YOU CHOOSE NOT TO\n");
|
||||||
|
print("CONTINUE OR WHEN YOU HAVE FINISHED THE PACK.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (str == "NO")
|
||||||
|
break;
|
||||||
|
print("YES OR NO, PLEASE. ");
|
||||||
|
}
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
|
||||||
|
a1 = 0;
|
||||||
|
b1 = 0;
|
||||||
|
p = 0;
|
||||||
|
|
||||||
|
// Generate a random deck
|
||||||
|
for (j = 1; j <= 52; j++) {
|
||||||
|
do {
|
||||||
|
l[j] = Math.floor(52 * Math.random()) + 1;
|
||||||
|
for (k = 1; k < j; k++) {
|
||||||
|
if (l[k] == l[j]) // Already in deck?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (j != 1 && k < j) ;
|
||||||
|
}
|
||||||
|
l[j] = 0; // Mark the end of the deck
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
m1 = l[++p]; // Take a card
|
||||||
|
m2 = l[++p]; // Take a card
|
||||||
|
print("\n");
|
||||||
|
print("YOU: " + a[m1] + "\tCOMPUTER: " + a[m2] + "\n");
|
||||||
|
n1 = Math.floor((m1 - 0.5) / 4);
|
||||||
|
n2 = Math.floor((m2 - 0.5) / 4);
|
||||||
|
if (n1 < n2) {
|
||||||
|
a1++;
|
||||||
|
print("THE COMPUTER WINS!!! YOU HAVE " + b1 + " AND THE COMPUTER HAS " + a1 + "\n");
|
||||||
|
} else if (n1 > n2) {
|
||||||
|
b1++;
|
||||||
|
print("YOU WIN. YOU HAVE " + b1 + " AND THE COMPUTER HAS " + a1 + "\n");
|
||||||
|
} else {
|
||||||
|
print("TIE. NO SCORE CHANGE.\n");
|
||||||
|
}
|
||||||
|
if (l[p + 1] == 0) {
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("WE HAVE RUN OUT OF CARDS. FINAL SCORE: YOU: " + b1 + " THE COMPUTER: " + a1 + "\n");
|
||||||
|
print("\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (1) {
|
||||||
|
print("DO YOU WANT TO CONTINUE");
|
||||||
|
str = await input();
|
||||||
|
if (str == "YES")
|
||||||
|
break;
|
||||||
|
if (str == "NO")
|
||||||
|
break;
|
||||||
|
print("YES OR NO, PLEASE. ");
|
||||||
|
}
|
||||||
|
if (str == "NO")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
print("THANKS FOR PLAYING. IT WAS FUN.\n");
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
9
95 Weekday/javascript/weekday.html
Normal file
9
95 Weekday/javascript/weekday.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>WEEKDAY</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre id="output" style="font-size: 12pt;"></pre>
|
||||||
|
<script src="weekday.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
208
95 Weekday/javascript/weekday.js
Normal file
208
95 Weekday/javascript/weekday.js
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
// WEEKDAY
|
||||||
|
//
|
||||||
|
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
|
||||||
|
//
|
||||||
|
|
||||||
|
function print(str)
|
||||||
|
{
|
||||||
|
document.getElementById("output").appendChild(document.createTextNode(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
function input()
|
||||||
|
{
|
||||||
|
var input_element;
|
||||||
|
var input_str;
|
||||||
|
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
input_element = document.createElement("INPUT");
|
||||||
|
|
||||||
|
print("? ");
|
||||||
|
input_element.setAttribute("type", "text");
|
||||||
|
input_element.setAttribute("length", "50");
|
||||||
|
document.getElementById("output").appendChild(input_element);
|
||||||
|
input_element.focus();
|
||||||
|
input_str = undefined;
|
||||||
|
input_element.addEventListener("keydown", function (event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
input_str = input_element.value;
|
||||||
|
document.getElementById("output").removeChild(input_element);
|
||||||
|
print(input_str);
|
||||||
|
print("\n");
|
||||||
|
resolve(input_str);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function tab(space)
|
||||||
|
{
|
||||||
|
var str = "";
|
||||||
|
while (space-- > 0)
|
||||||
|
str += " ";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fna(arg) {
|
||||||
|
return Math.floor(arg / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fnb(arg) {
|
||||||
|
return Math.floor(arg / 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
var t = [, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5];
|
||||||
|
|
||||||
|
var k5;
|
||||||
|
var k6;
|
||||||
|
var k7;
|
||||||
|
|
||||||
|
function time_spent(f, a8)
|
||||||
|
{
|
||||||
|
k1 = Math.floor(f * a8);
|
||||||
|
i5 = Math.floor(k1 / 365);
|
||||||
|
k1 -= i5 * 365;
|
||||||
|
i6 = Math.floor(k1 / 30);
|
||||||
|
i7 = k1 - (i6 * 30);
|
||||||
|
k5 -= i5;
|
||||||
|
k6 -= i6;
|
||||||
|
k7 -= i7;
|
||||||
|
if (k7 < 0) {
|
||||||
|
k7 += 30;
|
||||||
|
k6--;
|
||||||
|
}
|
||||||
|
if (k6 <= 0) {
|
||||||
|
k6 += 12;
|
||||||
|
k5--;
|
||||||
|
}
|
||||||
|
print(i5 + "\t" + i6 + "\t" + i7 + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main control section
|
||||||
|
async function main()
|
||||||
|
{
|
||||||
|
print(tab(32) + "WEEKDAY\n");
|
||||||
|
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("WEEKDAY IS A COMPUTER DEMONSTRATION THAT\n");
|
||||||
|
print("GIVES FACTS ABOUT A DATE OF INTEREST TO YOU.\n");
|
||||||
|
print("\n");
|
||||||
|
print("ENTER TODAY'S DATE IN THE FORM: 3,24,1979 ");
|
||||||
|
str = await input();
|
||||||
|
m1 = parseInt(str);
|
||||||
|
d1 = parseInt(str.substr(str.indexOf(",") + 1));
|
||||||
|
y1 = parseInt(str.substr(str.lastIndexOf(",") + 1));
|
||||||
|
// This program determines the day of the week
|
||||||
|
// for a date after 1582
|
||||||
|
print("ENTER DAY OF BIRTH (OR OTHER DAY OF INTEREST)");
|
||||||
|
str = await input();
|
||||||
|
m = parseInt(str);
|
||||||
|
d = parseInt(str.substr(str.indexOf(",") + 1));
|
||||||
|
y = parseInt(str.substr(str.lastIndexOf(",") + 1));
|
||||||
|
print("\n");
|
||||||
|
i1 = Math.floor((y - 1500) / 100);
|
||||||
|
// Test for date before current calendar.
|
||||||
|
if (y - 1582 < 0) {
|
||||||
|
print("NOT PREPARED TO GIVE DAY OF WEEK PRIOR TO MDLXXXII.\n");
|
||||||
|
} else {
|
||||||
|
a = i1 * 5 + (i1 + 3) / 4;
|
||||||
|
i2 = Math.floor(a - fnb(a) * 7);
|
||||||
|
y2 = Math.floor(y / 100);
|
||||||
|
y3 = Math.floor(y - y2 * 100);
|
||||||
|
a = y3 / 4 + y3 + d + t[m] + i2;
|
||||||
|
b = Math.floor(a - fnb(a) * 7) + 1;
|
||||||
|
if (m <= 2) {
|
||||||
|
if (y3 != 0) {
|
||||||
|
t1 = Math.floor(y - fna(y) * 4);
|
||||||
|
} else {
|
||||||
|
a = i1 - 1;
|
||||||
|
t1 = Math.floor(a - fna(a) * 4);
|
||||||
|
}
|
||||||
|
if (t1 == 0) {
|
||||||
|
if (b == 0)
|
||||||
|
b = 6;
|
||||||
|
b--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (b == 0)
|
||||||
|
b = 7;
|
||||||
|
if ((y1 * 12 + m1) * 31 + d1 < (y * 12 + m) * 31 + d) {
|
||||||
|
print(m + "/" + d + "/" + y + " WILL BE A ");
|
||||||
|
} else if ((y1 * 12 + m1) * 31 + d1 == (y * 12 + m) * 31 + d) {
|
||||||
|
print(m + "/" + d + "/" + y + " IS A ");
|
||||||
|
} else {
|
||||||
|
print(m + "/" + d + "/" + y + " WAS A ");
|
||||||
|
}
|
||||||
|
switch (b) {
|
||||||
|
case 1: print("SUNDAY.\n"); break;
|
||||||
|
case 2: print("MONDAY.\n"); break;
|
||||||
|
case 3: print("TUESDAY.\n"); break;
|
||||||
|
case 4: print("WEDNESDAY.\n"); break;
|
||||||
|
case 5: print("THURSDAY.\n"); break;
|
||||||
|
case 6:
|
||||||
|
if (d == 13) {
|
||||||
|
print("FRIDAY THE THIRTEENTH---BEWARE!\n");
|
||||||
|
} else {
|
||||||
|
print("FRIDAY.\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7: print("SATURDAY.\n"); break;
|
||||||
|
}
|
||||||
|
if ((y1 * 12 + m1) * 31 + d1 != (y * 12 + m) * 31 + d) {
|
||||||
|
i5 = y1 - y;
|
||||||
|
print("\n");
|
||||||
|
i6 = m1 - m;
|
||||||
|
i7 = d1 - d;
|
||||||
|
if (i7 < 0) {
|
||||||
|
i6--;
|
||||||
|
i7 += 30;
|
||||||
|
}
|
||||||
|
if (i6 < 0) {
|
||||||
|
i5--;
|
||||||
|
i6 += 12;
|
||||||
|
}
|
||||||
|
if (i5 >= 0) {
|
||||||
|
if (i7 == 0 && i6 == 0)
|
||||||
|
print("***HAPPY BIRTHDAY***\n");
|
||||||
|
print(" \tYEARS\tMONTHS\tDAYS\n");
|
||||||
|
print(" \t-----\t------\t----\n");
|
||||||
|
print("YOUR AGE (IF BIRTHDATE) \t" + i5 + "\t" + i6 + "\t" + i7 + "\n");
|
||||||
|
a8 = (i5 * 365) + (i6 * 30) + i7 + Math.floor(i6 / 2);
|
||||||
|
k5 = i5;
|
||||||
|
k6 = i6;
|
||||||
|
k7 = i7;
|
||||||
|
// Calculate retirement date.
|
||||||
|
e = y + 65;
|
||||||
|
// Calculate time spent in the following functions.
|
||||||
|
print("YOU HAVE SLEPT \t\t\t");
|
||||||
|
time_spent(0.35, a8);
|
||||||
|
print("YOU HAVE EATEN \t\t\t");
|
||||||
|
time_spent(0.17, a8);
|
||||||
|
if (k5 <= 3) {
|
||||||
|
print("YOU HAVE PLAYED \t\t\t");
|
||||||
|
} else if (k5 <= 9) {
|
||||||
|
print("YOU HAVE PLAYED/STUDIED \t\t");
|
||||||
|
} else {
|
||||||
|
print("YOU HAVE WORKED/PLAYED \t\t");
|
||||||
|
}
|
||||||
|
time_spent(0.23, a8);
|
||||||
|
if (k6 == 12) {
|
||||||
|
k5++;
|
||||||
|
k6 = 0;
|
||||||
|
}
|
||||||
|
print("YOU HAVE RELAXED \t\t" + k5 + "\t" + k6 + "\t" + k7 + "\n");
|
||||||
|
print("\n");
|
||||||
|
print(tab(16) + "*** YOU MAY RETIRE IN " + e + " ***\n");
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
9
96 Word/javascript/word.html
Normal file
9
96 Word/javascript/word.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>WORD</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre id="output" style="font-size: 12pt;"></pre>
|
||||||
|
<script src="word.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
150
96 Word/javascript/word.js
Normal file
150
96 Word/javascript/word.js
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
// WORD
|
||||||
|
//
|
||||||
|
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
|
||||||
|
//
|
||||||
|
|
||||||
|
function print(str)
|
||||||
|
{
|
||||||
|
document.getElementById("output").appendChild(document.createTextNode(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
function input()
|
||||||
|
{
|
||||||
|
var input_element;
|
||||||
|
var input_str;
|
||||||
|
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
input_element = document.createElement("INPUT");
|
||||||
|
|
||||||
|
print("? ");
|
||||||
|
input_element.setAttribute("type", "text");
|
||||||
|
input_element.setAttribute("length", "50");
|
||||||
|
document.getElementById("output").appendChild(input_element);
|
||||||
|
input_element.focus();
|
||||||
|
input_str = undefined;
|
||||||
|
input_element.addEventListener("keydown", function (event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
input_str = input_element.value;
|
||||||
|
document.getElementById("output").removeChild(input_element);
|
||||||
|
print(input_str);
|
||||||
|
print("\n");
|
||||||
|
resolve(input_str);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function tab(space)
|
||||||
|
{
|
||||||
|
var str = "";
|
||||||
|
while (space-- > 0)
|
||||||
|
str += " ";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
var words = ["DINKY", "SMOKE", "WATER", "GLASS", "TRAIN",
|
||||||
|
"MIGHT", "FIRST", "CANDY", "CHAMP", "WOULD",
|
||||||
|
"CLUMP", "DOPEY"];
|
||||||
|
|
||||||
|
var s = [];
|
||||||
|
var a = [];
|
||||||
|
var l = [];
|
||||||
|
var d = [];
|
||||||
|
var p = [];
|
||||||
|
|
||||||
|
// Main control section
|
||||||
|
async function main()
|
||||||
|
{
|
||||||
|
print(tab(33) + "WORD\n");
|
||||||
|
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("I AM THINKING OF A WORD -- YOU GUESS IT. I WILL GIVE YOU\n");
|
||||||
|
print("CLUE TO HELP YO GET IT. GOOD LUCK!!\n");
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
while (1) {
|
||||||
|
print("\n");
|
||||||
|
print("\n");
|
||||||
|
print("YOU ARE STARTING A NEW GAME...\n");
|
||||||
|
n = words.length;
|
||||||
|
ss = words[Math.floor(Math.random() * n)];
|
||||||
|
g = 0;
|
||||||
|
s[0] = ss.length;
|
||||||
|
for (i = 1; i <= ss.length; i++)
|
||||||
|
s[i] = ss.charCodeAt(i - 1);
|
||||||
|
for (i = 1; i <= 5; i++)
|
||||||
|
a[i] = 45;
|
||||||
|
for (j = 1; j <= 5; j++)
|
||||||
|
p[j] = 0;
|
||||||
|
while (1) {
|
||||||
|
print("GUESS A FIVE LETTER WORD");
|
||||||
|
ls = await input();
|
||||||
|
g++;
|
||||||
|
if (ss == ls)
|
||||||
|
break;
|
||||||
|
for (i = 1; i <= 7; i++)
|
||||||
|
p[i] = 0;
|
||||||
|
l[0] = ls.length;
|
||||||
|
for (i = 1; i <= ls.length; i++) {
|
||||||
|
l[i] = ls.charCodeAt(i - 1);
|
||||||
|
}
|
||||||
|
if (l[1] == 63) {
|
||||||
|
print("THE SECRET WORD IS " + ss + "\n");
|
||||||
|
print("\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (l[0] != 5) {
|
||||||
|
print("YOU MUST GUESS A 5 LETTER WORD. START AGAIN.\n");
|
||||||
|
print("\n");
|
||||||
|
g--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
m = 0;
|
||||||
|
q = 1;
|
||||||
|
for (i = 1; i <= 5; i++) {
|
||||||
|
for (j = 1; j <= 5; j++) {
|
||||||
|
if (s[i] == l[j]) {
|
||||||
|
p[q] = l[j];
|
||||||
|
q++;
|
||||||
|
if (i == j)
|
||||||
|
a[j] = l[j];
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a[0] = 5;
|
||||||
|
p[0] = m;
|
||||||
|
as = "";
|
||||||
|
for (i = 1; i <= a[0]; i++)
|
||||||
|
as += String.fromCharCode(a[i]);
|
||||||
|
ps = "";
|
||||||
|
for (i = 1; i <= p[0]; i++)
|
||||||
|
ps += String.fromCharCode(p[i]);
|
||||||
|
print("THERE WERE " + m + " MATCHES AND THE COMMON LETTERS WERE... " + ps + "\n");
|
||||||
|
print("FROM THE EXACT LETTER MATCHES, YOU KNOW............ " + as + "\n");
|
||||||
|
if (as == ss) {
|
||||||
|
ls = as;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (m <= 1) {
|
||||||
|
print("\n");
|
||||||
|
print("IF YOU GIVE UP, TYPE '?' FOR YOUR NEXT GUESS.\n");
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ss == ls) {
|
||||||
|
print("YOU HAVE GUESSED THE WORD. IT TOOK " + g + " GUESSES!\n");
|
||||||
|
print("\n");
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
print("WANT TO PLAY AGAIN");
|
||||||
|
qs = await input();
|
||||||
|
if (qs != "YES")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
150 PRINT "GUESS A FIVE LETTER WORD";
|
150 PRINT "GUESS A FIVE LETTER WORD";
|
||||||
160 INPUT L$
|
160 INPUT L$
|
||||||
170 G=G+1
|
170 G=G+1
|
||||||
172 IF S$=G$ THEN 500
|
172 IF S$=L$ THEN 500
|
||||||
173 FOR I=1 TO 7: P(I)=0: NEXT I
|
173 FOR I=1 TO 7: P(I)=0: NEXT I
|
||||||
175 L(0)=LEN(L$)
|
175 L(0)=LEN(L$)
|
||||||
180 FOR I=1 TO LEN(L$): L(I)=ASC(MID$(L$,I,1)): NEXT I
|
180 FOR I=1 TO LEN(L$): L(I)=ASC(MID$(L$,I,1)): NEXT I
|
||||||
|
|||||||
Reference in New Issue
Block a user