Skip to content

Commit 2f4a752

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 68eb34c + a4b68e4 commit 2f4a752

File tree

300 files changed

+18232
-140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+18232
-140
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ venv/
3434
.DS_Store
3535
.vs/
3636
**/target/
37-
Cargo.lock
3837
**/*.rs.bk
3938
/target
4039
todo.md
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
2+
3+
Conversion to [MiniScript](https://miniscript.org).
4+
5+
Ways to play:
6+
7+
1. Command-Line MiniScript:
8+
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
9+
10+
```
11+
miniscript aceyducey.ms
12+
```
13+
2. Mini Micro:
14+
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
15+
16+
```
17+
load "aceyducey"
18+
run
19+
```
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
print " "*26 + "Acey Ducey Card Game"
2+
print " "*15 + "Creative Computing Morristown, New Jersey"
3+
print
4+
print
5+
print "Acey-ducey is played in the following manner."
6+
print "The dealer (computer) deals two cards face up."
7+
print "You have an option to bet or not bet depending"
8+
print "on whether or not you feel the card will have"
9+
print "a value between the first two."
10+
print "If you do not want to bet, input a 0."
11+
12+
cards = range(2,10) + ["Jack", "Queen", "King", "Ace"]
13+
14+
while true
15+
money = 100
16+
17+
while true
18+
print "You now have " + money + " dollars."
19+
print
20+
print "Here are your next two cards:"
21+
while true
22+
A = floor(rnd * cards.len)
23+
B = floor(rnd * cards.len)
24+
if B > A then break
25+
end while
26+
print cards[A]
27+
print cards[B]
28+
bet = input("What is your bet? ").val
29+
while bet > money
30+
print "Sorry, my friend, but you bet too much."
31+
print "You have only " + money + " dollars to bet."
32+
bet = input("What is your bet? ").val
33+
end while
34+
if bet == 0 then
35+
print "Chicken!!"
36+
continue
37+
end if
38+
C = floor(rnd * cards.len)
39+
print cards[C]
40+
41+
if C <= A or C >= B then
42+
print "Sorry, you lose."
43+
money -= bet
44+
if money <= 0 then break
45+
else
46+
print "You win!!!"
47+
money += bet
48+
end if
49+
end while
50+
51+
print
52+
print
53+
print "Sorry, friend, but you blew your wad."
54+
print; print
55+
again = input("Try again (yes or no)? ").lower
56+
if again and again[0] == "n" then break
57+
end while
58+
59+
print "O.K., hope you had fun!"
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import std/[random,strutils]
2+
3+
var
4+
bet, cardA, cardB, cardC, stash: int
5+
retry: bool = true
6+
7+
randomize() # Seed the random number generator
8+
9+
proc printGreeting() =
10+
echo spaces(26),"ACEY DUCEY CARD GAME"
11+
echo spaces(15),"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
12+
echo """
13+
14+
ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER
15+
THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP
16+
YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING
17+
ON WHETHER OR NOT YOU FEEL THE CARD WILL HAVE
18+
A VALUE BETWEEN THE FIRST TWO.
19+
IF YOU DO NOT WANT TO BET, INPUT A 0
20+
21+
"""
22+
23+
proc printBalance() =
24+
echo "YOU NOW HAVE ", stash," DOLLARS."
25+
echo ""
26+
27+
proc printCard(aCard: int) =
28+
case aCard:
29+
of 11: echo "=== JACK ==="
30+
of 12: echo "=== QUEEN ==="
31+
of 13: echo "=== KING ==="
32+
of 14: echo "=== ACE ==="
33+
else: echo "=== ", aCard, " ==="
34+
35+
proc drawDealerCards() =
36+
echo "HERE ARE YOUR NEXT TWO CARDS: "
37+
cardA = rand 2..14
38+
cardB = cardA # Copy cardA, so we can test cardB to be different
39+
while cardB == cardA:
40+
cardB = rand 2..14
41+
if cardA > cardB: # Make sure cardA is the smaller card
42+
swap cardA, cardB
43+
echo ""
44+
printCard cardA
45+
echo ""
46+
printCard cardB
47+
echo ""
48+
49+
proc drawPlayerCard() =
50+
cardC = rand 2..14
51+
printCard cardC
52+
echo ""
53+
54+
proc getBet(): int =
55+
result = stash + 1 #ensure we enter the loop
56+
while (result < 0) or (result > stash):
57+
echo "WHAT IS YOUR BET: "
58+
result = readLine(stdin).parseInt()
59+
if result > stash:
60+
echo "SORRY, MY FRIEND, BUT YOU BET TOO MUCH."
61+
echo "YOU HAVE ONLY ", stash, " DOLLARS TO BET."
62+
if result == 0:
63+
echo "CHICKEN!!"
64+
65+
proc tryAgain(): bool =
66+
echo "TRY AGAIN (YES OR NO)"
67+
var answer = readLine(stdin).normalize()
68+
result = (answer == "y") or (answer == "yes")
69+
70+
printGreeting()
71+
while retry:
72+
stash = 100
73+
while stash > 0:
74+
printBalance()
75+
drawDealerCards()
76+
bet = getBet()
77+
echo ""
78+
drawPlayerCard()
79+
if (cardC >= cardA) and (cardC <= cardB):
80+
echo "YOU WIN!!!"
81+
stash += bet
82+
else:
83+
if bet > 0:
84+
echo "SORRY, YOU LOSE"
85+
stash -= bet
86+
echo "SORRY, FRIEND, BUT YOU BLEW YOUR WAD."
87+
echo ""
88+
retry = tryAgain()
89+
echo "O.K., HOPE YOU HAD FUN!"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
2+
3+
Conversion to [MiniScript](https://miniscript.org).
4+
5+
Ways to play:
6+
7+
1. Command-Line MiniScript:
8+
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
9+
10+
```
11+
miniscript amazing.ms
12+
```
13+
Note that because this program imports "listUtil", you will need to have a the standard MiniScript libraries somewhere in your import path.
14+
15+
2. Mini Micro:
16+
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
17+
18+
```
19+
load "amazing"
20+
run
21+
```
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import "listUtil"
2+
print " "*28 + "Amazing Program"
3+
print " "*15 + "Creative Computing Morristown, New Jersey"
4+
print; print; print; print
5+
while true
6+
inp = input("What and your width and length? ")
7+
inp = inp.replace(",", " ")
8+
fields = inp.split
9+
h = fields[0].val; v = fields[-1].val
10+
if h > 1 and v > 1 then break
11+
print "Meaningless dimensions. Try again."
12+
end while
13+
14+
// order: keeps track of the order in which each cell was
15+
// visited as we built the maze. 0 means not explored yet. Indexed in [column][row] order.
16+
// (This is W in the original BASIC program.)
17+
order = list.init2d(h,v, 0)
18+
19+
// walls: keeps track of the walls below and to the right of each cell:
20+
// 0: walls below and to the right
21+
// 1: wall to the right
22+
// 2: wall below
23+
// 3: neither wall
24+
// (This is V in the original BASIC program.)
25+
// Note that a wall to the right can be removed from a
26+
// valid entry by adding 2; a wall below can be removed
27+
// by adding 1.
28+
walls = list.init2d(h,v, 0)
29+
print
30+
print
31+
print
32+
print
33+
34+
// pick an exit at the top of the maze,
35+
// and print the maze top
36+
x = floor(rnd * h)
37+
for i in range(0, h-1)
38+
if i == x then print ". ","" else print ".--",""
39+
end for
40+
print "."
41+
42+
// walk from our starting position (by the exit) around
43+
// the maze, clearing a wall on each step
44+
c = 1 // current step number
45+
order[x][0] = c; c += 1
46+
r = x; s = 0 // [r][s] is our current position in the maze
47+
while true
48+
// collect the set of directions we can move in
49+
dirs = []
50+
if r > 0 and order[r-1][s] == 0 then dirs.push "left"
51+
if s > 0 and order[r][s-1] == 0 then dirs.push "up"
52+
if r+1 < h and order[r+1][s] == 0 then dirs.push "right"
53+
if s+1 < v and order[r][s+1] == 0 then dirs.push "down"
54+
if not dirs then
55+
//print "Uh-oh, I'm stuck at " + r + "," + s
56+
// couldn't find any directions for this cell;
57+
// find the next already-explored cell
58+
while true
59+
r += 1
60+
if r >= h then
61+
r = 0
62+
s += 1
63+
if s >= v then s = 0
64+
end if
65+
if order[r][s] != 0 then break
66+
end while
67+
continue
68+
end if
69+
70+
// pick a random available direction; move there,
71+
// clearing the wall in between and updating order
72+
d = dirs.any
73+
if d == "left" then
74+
walls[r-1][s] += 2
75+
r = r-1
76+
else if d == "up" then
77+
walls[r][s-1] += 1
78+
s = s-1
79+
else if d == "right" then
80+
walls[r][s] += 2
81+
r = r+1
82+
else if d == "down" then
83+
walls[r][s] += 1
84+
s = s+1
85+
end if
86+
87+
//print "At step " + c + ", at " + r + "," + s
88+
order[r][s] = c
89+
c += 1
90+
if c > h*v then break
91+
end while
92+
93+
// pick an exit at the bottom of the maze
94+
x = floor(rnd * h)
95+
walls[x][v-1] += 1
96+
97+
// print the (rest of the) maze
98+
for j in range(0, v-1)
99+
print "I", ""
100+
for i in range(0, h-1)
101+
if walls[i][j] < 2 then print " I", "" else print " ", ""
102+
end for
103+
print
104+
for i in range(0, h-1)
105+
if walls[i][j] % 2 == 0 then print ":--", "" else print ": ", ""
106+
end for
107+
print "."
108+
end for
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html).
2+
3+
Conversion to [MiniScript](https://miniscript.org).
4+
5+
Ways to play:
6+
7+
1. Command-Line MiniScript:
8+
Download for your system from https://miniscript.org/cmdline/, install, and then run the program with a command such as:
9+
10+
```
11+
miniscript animal.ms
12+
```
13+
2. Mini Micro:
14+
Download Mini Micro from https://miniscript.org/MiniMicro/, launch, and then click the top disk slot and chose "Mount Folder..." Select the folder containing the MiniScript program and this README file. Then, at the Mini Micro command prompt, enter:
15+
16+
```
17+
load "animal"
18+
run
19+
```

0 commit comments

Comments
 (0)