mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-18 15:56:46 -08:00
Removed spaces from top-level directory names.
Spaces tend to cause annoyances in a Unix-style shell environment. This change fixes that.
This commit is contained in:
7
30_Cube/README.md
Normal file
7
30_Cube/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
### Cube
|
||||
|
||||
As published in Basic Computer Games (1978)
|
||||
https://www.atariarchives.org/basicgames/showpage.php?page=53
|
||||
|
||||
Downloaded from Vintage Basic at
|
||||
http://www.vintage-basic.net/games.html
|
||||
3
30_Cube/csharp/README.md
Normal file
3
30_Cube/csharp/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Microsoft C#](https://docs.microsoft.com/en-us/dotnet/csharp/)
|
||||
161
30_Cube/cube.bas
Normal file
161
30_Cube/cube.bas
Normal file
@@ -0,0 +1,161 @@
|
||||
10 PRINT TAB(34);"CUBE"
|
||||
20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
|
||||
30 PRINT : PRINT : PRINT
|
||||
100 PRINT "DO YOU WANT TO SEE THE INSTRUCTIONS? (YES--1,NO--0)"
|
||||
110 INPUT B7
|
||||
120 IF B7=0 THEN 370
|
||||
130 PRINT"THIS IS A GAME IN WHICH YOU WILL BE PLAYING AGAINST THE"
|
||||
140 PRINT"RANDOM DECISION OF THE COMPUTER. THE FIELD OF PLAY IS A"
|
||||
150 PRINT"CUBE OF SIDE 3. ANY OF THE 27 LOCATIONS CAN BE DESIGNATED"
|
||||
160 PRINT"BY INPUTING THREE NUMBERS SUCH AS 2,3,1. AT THE START,"
|
||||
170 PRINT"YOU ARE AUTOMATICALLY AT LOCATION 1,1,1. THE OBJECT OF"
|
||||
180 PRINT"THE GAME IS TO GET TO LOCATION 3,3,3. ONE MINOR DETAIL:"
|
||||
190 PRINT"THE COMPUTER WILL PICK, AT RANDOM, 5 LOCATIONS AT WHICH"
|
||||
200 PRINT"IT WILL PLANT LAND MINES. IF YOU HIT ONE OF THESE LOCATIONS"
|
||||
210 PRINT"YOU LOSE. ONE OTHER DETAIL: YOU MAY MOVE ONLY ONE SPACE "
|
||||
220 PRINT"IN ONE DIRECTION EACH MOVE. FOR EXAMPLE: FROM 1,1,2 YOU"
|
||||
230 PRINT"MAY MOVE TO 2,1,2 OR 1,1,3. YOU MAY NOT CHANGE"
|
||||
240 PRINT"TWO OF THE NUMBERS ON THE SAME MOVE. IF YOU MAKE AN ILLEGAL"
|
||||
250 PRINT"MOVE, YOU LOSE AND THE COMPUTER TAKES THE MONEY YOU MAY"
|
||||
260 PRINT"HAVE BET ON THAT ROUND."
|
||||
270 PRINT
|
||||
280 PRINT
|
||||
290 PRINT"ALL YES OR NO QUESTIONS WILL BE ANSWERED BY A 1 FOR YES"
|
||||
300 PRINT"OR A 0 (ZERO) FOR NO."
|
||||
310 PRINT
|
||||
320 PRINT"WHEN STATING THE AMOUNT OF A WAGER, PRINT ONLY THE NUMBER"
|
||||
330 PRINT"OF DOLLARS (EXAMPLE: 250) YOU ARE AUTOMATICALLY STARTED WITH"
|
||||
340 PRINT"500 DOLLARS IN YOUR ACCOUNT."
|
||||
350 PRINT
|
||||
360 PRINT "GOOD LUCK!"
|
||||
370 LET A1=500
|
||||
380 LET A=INT(3*(RND(X)))
|
||||
390 IF A<>0 THEN 410
|
||||
400 LET A=3
|
||||
410 LET B=INT(3*(RND(X)))
|
||||
420 IF B<>0 THEN 440
|
||||
430 LET B=2
|
||||
440 LET C=INT(3*(RND(X)))
|
||||
450 IF C<>0 THEN 470
|
||||
460 LET C=3
|
||||
470 LET D=INT(3*(RND(X)))
|
||||
480 IF D<>0 THEN 500
|
||||
490 LET D=1
|
||||
500 LET E=INT(3*(RND(X)))
|
||||
510 IF E<>0 THEN 530
|
||||
520 LET E=3
|
||||
530 LET F=INT(3*(RND(X)))
|
||||
540 IF F<>0 THEN 560
|
||||
550 LET F=3
|
||||
560 LET G=INT(3*(RND(X)))
|
||||
570 IF G<>0 THEN 590
|
||||
580 LET G=3
|
||||
590 LET H=INT(3*(RND(X)))
|
||||
600 IF H<>0 THEN 620
|
||||
610 LET H=3
|
||||
620 LET I=INT(3*(RND(X)))
|
||||
630 IF I<>0 THEN 650
|
||||
640 LET I=2
|
||||
650 LET J=INT(3*(RND(X)))
|
||||
660 IF J<>0 THEN 680
|
||||
670 LET J=3
|
||||
680 LET K=INT(3*(RND(X)))
|
||||
690 IF K<>0 THEN 710
|
||||
700 LET K=2
|
||||
710 LET L=INT(3*(RND(X)))
|
||||
720 IF L<>0 THEN 740
|
||||
730 LET L=3
|
||||
740 LET M=INT(3*(RND(X)))
|
||||
750 IF M<>0 THEN 770
|
||||
760 LET M=3
|
||||
770 LET N=INT(3*(RND(X)))
|
||||
780 IF N<>0 THEN 800
|
||||
790 LET N=1
|
||||
800 LET O=INT (3*(RND(X)))
|
||||
810 IF O <>0 THEN 830
|
||||
820 LET O=3
|
||||
830 PRINT "WANT TO MAKE A WAGER?"
|
||||
840 INPUT Z
|
||||
850 IF Z=0 THEN 880
|
||||
860 PRINT "HOW MUCH ";
|
||||
870 INPUT Z1
|
||||
876 IF A1<Z1 THEN 1522
|
||||
880 LET W=1
|
||||
890 LET X=1
|
||||
900 LET Y=1
|
||||
910 PRINT
|
||||
920 PRINT "IT'S YOUR MOVE: ";
|
||||
930 INPUT P,Q,R
|
||||
940 IF P>W+1 THEN 1030
|
||||
950 IF P=W+1 THEN 1000
|
||||
960 IF Q>X+1 THEN 1030
|
||||
970 IF Q=(X+1) THEN 1010
|
||||
980 IF R >(Y+1) THEN 1030
|
||||
990 GOTO 1050
|
||||
1000 IF Q>= X+1 THEN 1030
|
||||
1010 IF R>=Y+1 THEN 1030
|
||||
1020 GOTO 1050
|
||||
1030 PRINT:PRINT "ILLEGAL MOVE. YOU LOSE."
|
||||
1040 GOTO 1440
|
||||
1050 LET W=P
|
||||
1060 LET X=Q
|
||||
1070 LET Y=R
|
||||
1080 IF P=3 THEN 1100
|
||||
1090 GOTO 1130
|
||||
1100 IF Q=3 THEN 1120
|
||||
1110 GOTO 1130
|
||||
1120 IF R=3 THEN 1530
|
||||
1130 IF P=A THEN 1150
|
||||
1140 GOTO 1180
|
||||
1150 IF Q=B THEN 1170
|
||||
1160 GOTO 1180
|
||||
1170 IF R=C THEN 1400
|
||||
1180 IF P=D THEN 1200
|
||||
1190 GOTO 1230
|
||||
1200 IF Q=E THEN 1220
|
||||
1210 GOTO 1230
|
||||
1220 IF R=F THEN 1400
|
||||
1230 IF P=G THEN 1250
|
||||
1240 GOTO 1280
|
||||
1250 IF Q=H THEN 1270
|
||||
1260 GOTO 1280
|
||||
1270 IF R=I THEN 1400
|
||||
1280 IF P=J THEN 1300
|
||||
1290 GOTO 1330
|
||||
1300 IF Q=K THEN 1320
|
||||
1310 GOTO 1330
|
||||
1320 IF R=L THEN 1400
|
||||
1330 IF P=M THEN 1350
|
||||
1340 GOTO 1380
|
||||
1350 IF Q=N THEN 1370
|
||||
1360 GOTO 1380
|
||||
1370 IF R=O THEN 1400
|
||||
1380 PRINT "NEXT MOVE: ";
|
||||
1390 GOTO 930
|
||||
1400 PRINT"******BANG******"
|
||||
1410 PRINT "YOU LOSE!"
|
||||
1420 PRINT
|
||||
1430 PRINT
|
||||
1440 IF Z=0 THEN 1580
|
||||
1450 PRINT
|
||||
1460 LET Z2=A1-Z1
|
||||
1470 IF Z2>0 THEN 1500
|
||||
1480 PRINT "YOU BUST."
|
||||
1490 GOTO 1610
|
||||
1500 PRINT " YOU NOW HAVE"; Z2; "DOLLARS."
|
||||
1510 LET A1=Z2
|
||||
1520 GOTO 1580
|
||||
1522 PRINT"TRIED TO FOOL ME; BET AGAIN";
|
||||
1525 GOTO 870
|
||||
1530 PRINT"CONGRATULATIONS!"
|
||||
1540 IF Z=0 THEN 1580
|
||||
1550 LET Z2=A1+Z1
|
||||
1560 PRINT "YOU NOW HAVE"; Z2;"DOLLARS."
|
||||
1570 LET A1=Z2
|
||||
1580 PRINT"DO YOU WANT TO TRY AGAIN ";
|
||||
1590 INPUT S
|
||||
1600 IF S=1 THEN 380
|
||||
1610 PRINT "TOUGH LUCK!"
|
||||
1620 PRINT
|
||||
1630 PRINT "GOODBYE."
|
||||
1640 END
|
||||
3
30_Cube/java/README.md
Normal file
3
30_Cube/java/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Oracle Java](https://openjdk.java.net/)
|
||||
3
30_Cube/javascript/README.md
Normal file
3
30_Cube/javascript/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Shells)
|
||||
9
30_Cube/javascript/cube.html
Normal file
9
30_Cube/javascript/cube.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>CUBE</title>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="output" style="font-size: 12pt;"></pre>
|
||||
<script src="cube.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
207
30_Cube/javascript/cube.js
Normal file
207
30_Cube/javascript/cube.js
Normal file
@@ -0,0 +1,207 @@
|
||||
// CUBE
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Main program
|
||||
async function main()
|
||||
{
|
||||
print(tab(33) + "CUBE\n");
|
||||
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
print("DO YOU WANT TO SEE THE INSTRUCTIONS? (YES--1,NO--0)");
|
||||
b7 = parseInt(await input());
|
||||
if (b7 != 0) {
|
||||
print("THIS IS A GAME IN WHICH YOU WILL BE PLAYING AGAINST THE\n");
|
||||
print("RANDOM DECISION OF THE COMPUTER. THE FIELD OF PLAY IS A\n");
|
||||
print("CUBE OF SIDE 3. ANY OF THE 27 LOCATIONS CAN BE DESIGNATED\n");
|
||||
print("BY INPUTING THREE NUMBERS SUCH AS 2,3,1. AT THE START,\n");
|
||||
print("YOU ARE AUTOMATICALLY AT LOCATION 1,1,1. THE OBJECT OF\n");
|
||||
print("THE GAME IS TO GET TO LOCATION 3,3,3. ONE MINOR DETAIL:\n");
|
||||
print("THE COMPUTER WILL PICK, AT RANDOM, 5 LOCATIONS AT WHICH\n");
|
||||
print("IT WILL PLANT LAND MINES. IF YOU HIT ONE OF THESE LOCATIONS\n");
|
||||
print("YOU LOSE. ONE OTHER DETAIL: YOU MAY MOVE ONLY ONE SPACE \n");
|
||||
print("IN ONE DIRECTION EACH MOVE. FOR EXAMPLE: FROM 1,1,2 YOU\n");
|
||||
print("MAY MOVE TO 2,1,2 OR 1,1,3. YOU MAY NOT CHANGE\n");
|
||||
print("TWO OF THE NUMBERS ON THE SAME MOVE. IF YOU MAKE AN ILLEGAL\n");
|
||||
print("MOVE, YOU LOSE AND THE COMPUTER TAKES THE MONEY YOU MAY\n");
|
||||
print("HAVE BET ON THAT ROUND.\n");
|
||||
print("\n");
|
||||
print("\n");
|
||||
print("ALL YES OR NO QUESTIONS WILL BE ANSWERED BY A 1 FOR YES\n");
|
||||
print("OR A 0 (ZERO) FOR NO.\n");
|
||||
print("\n");
|
||||
print("WHEN STATING THE AMOUNT OF A WAGER, PRINT ONLY THE NUMBER\n");
|
||||
print("OF DOLLARS (EXAMPLE: 250) YOU ARE AUTOMATICALLY STARTED WITH\n");
|
||||
print("500 DOLLARS IN YOUR ACCOUNT.\n");
|
||||
print("\n");
|
||||
print("GOOD LUCK!\n");
|
||||
}
|
||||
a1 = 500;
|
||||
while (1) {
|
||||
a = Math.floor(3 * Math.random());
|
||||
if (a == 0)
|
||||
a = 3;
|
||||
b = Math.floor(3 * Math.random());
|
||||
if (b == 0)
|
||||
b = 2;
|
||||
c = Math.floor(3 * Math.random());
|
||||
if (c == 0)
|
||||
c = 3;
|
||||
d = Math.floor(3 * Math.random());
|
||||
if (d == 0)
|
||||
d = 1;
|
||||
e = Math.floor(3 * Math.random());
|
||||
if (e == 0)
|
||||
e = 3;
|
||||
f = Math.floor(3 * Math.random());
|
||||
if (f == 0)
|
||||
f = 3;
|
||||
g = Math.floor(3 * Math.random());
|
||||
if (g == 0)
|
||||
g = 3;
|
||||
h = Math.floor(3 * Math.random());
|
||||
if (h == 0)
|
||||
h = 3;
|
||||
i = Math.floor(3 * Math.random());
|
||||
if (i == 0)
|
||||
i = 2;
|
||||
j = Math.floor(3 * Math.random());
|
||||
if (j == 0)
|
||||
j = 3;
|
||||
k = Math.floor(3 * Math.random());
|
||||
if (k == 0)
|
||||
k = 2;
|
||||
l = Math.floor(3 * Math.random());
|
||||
if (l == 0)
|
||||
l = 3;
|
||||
m = Math.floor(3 * Math.random());
|
||||
if (m == 0)
|
||||
m = 3;
|
||||
n = Math.floor(3 * Math.random());
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
o = Math.floor(3 * Math.random());
|
||||
if (o == 0)
|
||||
o = 3;
|
||||
print("WANT TO MAKE A WAGER?");
|
||||
z = parseInt(await input());
|
||||
if (z != 0) {
|
||||
print("HOW MUCH ");
|
||||
while (1) {
|
||||
z1 = parseInt(await input());
|
||||
if (a1 < z1) {
|
||||
print("TRIED TO FOOL ME; BET AGAIN");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
w = 1;
|
||||
x = 1;
|
||||
y = 1;
|
||||
print("\n");
|
||||
print("IT'S YOUR MOVE: ");
|
||||
while (1) {
|
||||
str = await input();
|
||||
p = parseInt(str);
|
||||
q = parseInt(str.substr(str.indexOf(",") + 1));
|
||||
r = parseInt(str.substr(str.lastIndexOf(",") + 1));
|
||||
if (p > w + 1 || q > x + 1 || r > y + 1 || (p == w + 1 && (q >= x + 1 || r >= y + 1)) || (q == x + 1 && r >= y + 1)) {
|
||||
print("\n");
|
||||
print("ILLEGAL MOVE, YOU LOSE.\n");
|
||||
break;
|
||||
}
|
||||
w = p;
|
||||
x = q;
|
||||
y = r;
|
||||
if (p == 3 && q == 3 && r == 3) {
|
||||
won = true;
|
||||
break;
|
||||
}
|
||||
if (p == a && q == b && r == c
|
||||
|| p == d && q == e && r == f
|
||||
|| p == g && q == h && r == i
|
||||
|| p == j && q == k && r == l
|
||||
|| p == m && q == n && r == o) {
|
||||
print("******BANG******");
|
||||
print("YOU LOSE!");
|
||||
print("\n");
|
||||
print("\n");
|
||||
won = false;
|
||||
break;
|
||||
}
|
||||
print("NEXT MOVE: ");
|
||||
}
|
||||
if (won) {
|
||||
print("CONGRATULATIONS!\n");
|
||||
if (z != 0) {
|
||||
z2 = a1 + z1;
|
||||
print("YOU NOW HAVE " + z2 + " DOLLARS.\n");
|
||||
a1 = z2;
|
||||
}
|
||||
} else {
|
||||
if (z != 0) {
|
||||
print("\n");
|
||||
z2 = a1 - z1;
|
||||
if (z2 <= 0) {
|
||||
print("YOU BUST.\n");
|
||||
break;
|
||||
} else {
|
||||
print(" YOU NOW HAVE " + z2 + " DOLLARS.\n");
|
||||
a1 = z2;
|
||||
}
|
||||
}
|
||||
}
|
||||
print("DO YOU WANT TO TRY AGAIN ");
|
||||
s = parseInt(await input());
|
||||
if (s != 1)
|
||||
break;
|
||||
}
|
||||
print("TOUGH LUCK!\n");
|
||||
print("\n");
|
||||
print("GOODBYE.\n");
|
||||
}
|
||||
|
||||
main();
|
||||
3
30_Cube/pascal/README.md
Normal file
3
30_Cube/pascal/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))
|
||||
3
30_Cube/perl/README.md
Normal file
3
30_Cube/perl/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Perl](https://www.perl.org/)
|
||||
3
30_Cube/python/README.md
Normal file
3
30_Cube/python/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Python](https://www.python.org/about/)
|
||||
114
30_Cube/python/cube.py
Executable file
114
30_Cube/python/cube.py
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python3
|
||||
# CUBE
|
||||
#
|
||||
# Converted from BASIC to Python by Trevor Hobson
|
||||
|
||||
import random
|
||||
|
||||
|
||||
def mine_position():
|
||||
mine = []
|
||||
for _ in range(3):
|
||||
mine.append(random.randint(1, 3))
|
||||
return mine
|
||||
|
||||
|
||||
def play_game():
|
||||
"""Play one round of the game"""
|
||||
|
||||
money = 500
|
||||
print("\nYou have", money, "dollars.")
|
||||
while True:
|
||||
mines = []
|
||||
for _ in range(5):
|
||||
mine = []
|
||||
while True:
|
||||
mine = mine_position()
|
||||
if not(mine in mines or mine == [1, 1, 1] or mine == [3, 3, 3]):
|
||||
break
|
||||
mines.append(mine)
|
||||
wager = -1
|
||||
while wager == -1:
|
||||
try:
|
||||
wager = int(input("\nHow much do you want to wager? "))
|
||||
if not 0 <= wager <= money:
|
||||
wager = -1
|
||||
print("Tried to fool me; bet again")
|
||||
except ValueError:
|
||||
print("Please enter a number.")
|
||||
prompt = "\nIt's your move: "
|
||||
position = [1, 1, 1]
|
||||
while True:
|
||||
move = [-1, -1, -1]
|
||||
while move == [-1, -1, -1]:
|
||||
try:
|
||||
coordinates = [int(item)
|
||||
for item in input(prompt).split(",")]
|
||||
if len(coordinates) == 3:
|
||||
move = coordinates
|
||||
else:
|
||||
raise ValueError
|
||||
except (ValueError, IndexError):
|
||||
print("Please enter valid coordinates.")
|
||||
if (abs(move[0]-position[0]) + abs(move[1]-position[1]) + abs(move[2]-position[2])) > 1:
|
||||
print("\nIllegal move. You lose")
|
||||
money = money - wager
|
||||
break
|
||||
elif not move[0] in [1, 2, 3] or not move[1] in [1, 2, 3] or not move[2] in [1, 2, 3]:
|
||||
print("\nIllegal move. You lose")
|
||||
money = money - wager
|
||||
break
|
||||
elif move == [3, 3, 3]:
|
||||
print("\nCongratulations!")
|
||||
money = money + wager
|
||||
break
|
||||
elif move in mines:
|
||||
print("\n******BANG******")
|
||||
print("You lose!")
|
||||
money = money - wager
|
||||
break
|
||||
else:
|
||||
position = move
|
||||
prompt = "\nNext move: "
|
||||
if money > 0:
|
||||
print("\nYou now have", money, "dollars.")
|
||||
if not input("Do you want to try again ").lower().startswith("y"):
|
||||
break
|
||||
else:
|
||||
print("\nYou bust.")
|
||||
print("\nTough luck")
|
||||
print("\nGoodbye.")
|
||||
|
||||
|
||||
def main():
|
||||
print(" " * 34 + "CUBE")
|
||||
print(" " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n")
|
||||
if input("Do you want to see the instructions ").lower().startswith("y"):
|
||||
print("\nThis is a game in which you will be playing against the")
|
||||
print("random decisions of the computer. The field of play is a")
|
||||
print("cube of side 3. Any of the 27 locations can be designated")
|
||||
print("by inputing three numbers such as 2,3,1. At the start,")
|
||||
print("you are automatically at location 1,1,1. The object of")
|
||||
print("the game is to get to location 3,3,3. One minor detail:")
|
||||
print("the computer will pick, at random, 5 locations at which")
|
||||
print("it will plant land mines. If you hit one of these locations")
|
||||
print("you lose. One other detail: You may move only one space")
|
||||
print("in one direction each move. For example: From 1,1,2 you")
|
||||
print("may move to 2,1,2 or 1,1,3. You may not change")
|
||||
print("two of the numbers on the same move. If you make an illegal")
|
||||
print("move, you lose and the computer takes the money you may")
|
||||
print("have bet on that round.\n")
|
||||
print("When stating the amount of a wager, print only the number")
|
||||
print("of dollars (example: 250) you are automatically started with")
|
||||
print("500 dollars in your account.\n")
|
||||
print("Good luck!")
|
||||
|
||||
keep_playing = True
|
||||
while keep_playing:
|
||||
play_game()
|
||||
keep_playing = input(
|
||||
"\nPlay again? (yes or no) ").lower().startswith("y")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
3
30_Cube/ruby/README.md
Normal file
3
30_Cube/ruby/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Ruby](https://www.ruby-lang.org/en/)
|
||||
3
30_Cube/vbnet/README.md
Normal file
3
30_Cube/vbnet/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Original BASIC source [downloaded from Vintage Basic](http://www.vintage-basic.net/games.html)
|
||||
|
||||
Conversion to [Visual Basic .NET](https://en.wikipedia.org/wiki/Visual_Basic_.NET)
|
||||
Reference in New Issue
Block a user