Post by plus on Jul 22, 2024 14:20:04 GMT
reviewing awlful old Classic code from www.vintage-basic.net/games.html
Here are a few updates for that old stuff that show how much more efficient modern Basic can be!
Output Sample:
It's true that drawing from a full and shuffled deck will give slightly different odds but the difference hardly makes up for the overhead of creating and shuffling a deck of cards. I mean look at all the lines of Code in the original of GOTO crap!
b = b + ...
Here are a few updates for that old stuff that show how much more efficient modern Basic can be!
'Acey Ducey 2024-07-21 version b+ 2024-07-21 trans to JB 2024-07-22
' compare to AceyDucey here www.vintage-basic.net/games.html
' David Ahl's compilation of Basic Games and other stuff
ranking$ = "23456789TJQKA" ' one letter or digit to designate card value T is for Ten, J is for Jack, ...
bank = 100
While bank
r1 = Int(Rnd(0) * 13) + 1: r2 = Int(Rnd(0) * 13) + 1: r3 = Int(Rnd(0) * 13) + 1
If r1 < r2 Then low = r1: high = r2 Else low = r2: high = r1
Print Mid$(ranking$, r1, 1); " "; Mid$(ranking$, r2, 1); " betting that next card will match or be between these cards."
Print "You have "; bank; " to bet."
Input "Enter your bet "; bet
If bet > bank Then bet = bank
If bet = 0 Then bet = 1
Print "Betting "; bet; Chr$(10); Mid$(ranking$, r3, 1)
If r3 >= low And r3 <= high Then bank = bank + bet: Print "You won "; bet: Print
If r3 < low Or r3 > high Then bank = bank - bet: Print "You lost "; bet: Print
Wend
Print "Game Over, no money left to bet."
Output Sample:
K 3 betting that next card will match or be between these cards.
You have 100 to bet.
Enter your bet 100
Betting 100
K
You won 100
T 2 betting that next card will match or be between these cards.
You have 200 to bet.
Enter your bet 150
Betting 150
7
You won 150
6 3 betting that next card will match or be between these cards.
You have 350 to bet.
Enter your bet 0
Betting 1
5
You won 1
J 8 betting that next card will match or be between these cards.
You have 351 to bet.
Enter your bet 0
Betting 1
A
You lost 1
8 T betting that next card will match or be between these cards.
You have 350 to bet.
Enter your bet 0
Betting 1
K
You lost 1
K 6 betting that next card will match or be between these cards.
You have 349 to bet.
Enter your bet 50
Betting 50
7
You won 50
4 2 betting that next card will match or be between these cards.
You have 399 to bet.
Enter your bet
It's true that drawing from a full and shuffled deck will give slightly different odds but the difference hardly makes up for the overhead of creating and shuffling a deck of cards. I mean look at all the lines of Code in the original of GOTO crap!
b = b + ...