Recent Posts

Pages: [1] 2 3 ... 10
1
QB64 Discussion / Re: help my
« Last post by Kiara87 on Today at 09:48:30 AM »

I was trying to finish the program but I find myself with many difficulties I try not to give up but I see programming difficult
maybe I need a master as good as you
only that I don't understand English
I think my problem is to understand the programming logic I mean how can a programmer think
how to compose all the instructions to create the program

I won't give up
2
Programs / Re: Blackjack
« Last post by FellippeHeitor on Today at 08:12:42 AM »
Hey it's not one of those CHR$(0) at the end of the string things is it?
No, it isn't.
3
Try using Dav's IDE  http://www.qbasicnews.com/dav/projects.php#DAVSIDE.  It includes a print function.
4
Blackjack

Author: @bplus @johnno56
Source: qb64.org Forum
URL: https://www.qb64.org/forum/index.php?topic=1406.0
Version: BJ v2020-07-08
Tags: [Graphics], [2D], [Audio]

Description:
Interactive graphical game of Blackjack.  Place bets, Hit, Stay or Double-Down.


5
Programs / Re: Blackjack
« Last post by codeguy on Today at 03:16:08 AM »
I would choose Knuth Shuffle for shuffling cards or for any randomization of order.
Code: QB64: [Select]
  1. TYPE card
  2.     cardVAL AS _UNSIGNED _BYTE
  3.     CARDsuit AS STRING * 7
  4. DIM NSUITSMIN AS _UNSIGNED INTEGER: NSUITSMIN = 1
  5. DIM NSUITSMAX AS _UNSIGNED INTEGER: NSUITSMAX = 4
  6. DIM NCARDSMIN AS _UNSIGNED INTEGER: NCARDSMIN = 1
  7. DIM NCARDSMAX AS _UNSIGNED INTEGER: NCARDSMAX = 13
  8. REDIM Deck(1 TO (NSUITSMAX - NSUITSMIN + 1) * (NCARDSMAX - NCARDSMIN + 1)) AS card
  9.  
  10. FOR S = NSUITSMIN TO NSUITSMAX
  11.     READ SUIT
  12.     FOR T = NCARDSMIN TO NCARDSMAX
  13.         Deck(X).CARDsuit = SUIT
  14.         Deck(X).cardVAL = T
  15.         X = X + 1
  16.     NEXT
  17. DATA DIAMOND,SPADE,HEART,CLUB
  18. KnuthShuffle Deck(), LBOUND(DECK), UBOUND(DECK)
  19. SUB KnuthShuffle (a() AS card, start AS _INTEGER64, finish AS _INTEGER64)
  20.     DIM KNUTHSHUFFLE_AX AS _INTEGER64
  21.     DIM KNUTHSHUFFLE_BX AS _INTEGER64
  22.     KNUTHSHUFFLE_BX = start
  23.     DO
  24.         KNUTHSHUFFLE_AX = KNUTHSHUFFLE_BX
  25.         KNUTHSHUFFLE_BX = KNUTHSHUFFLE_AX + 1
  26.         SWAP a(KNUTHSHUFFLE_AX), a(KNUTHSHUFFLE_BX + INT(RND * (finish - KNUTHSHUFFLE_BX)))
  27.     LOOP UNTIL KNUTHSHUFFLE_AX > finish - 1
  28.  
6
QB64 Discussion / Re: Collatz Conjecture
« Last post by bplus on Today at 02:30:17 AM »
Code: QB64: [Select]
  1. ' 2020-07-09 Write up  from reply I left at QB64 forum yesterday
  2. ' ref: https://www.qb64.org/forum/index.php?topic=2789.msg120521#msg120521
  3. ' here is essence  (((N + 1) / 2) * 3) - 1 = (3*N + 1) / 2   is New Rule for Odd
  4. ' here is new limit (32766 / 3) * 2
  5.  
  6. _TITLE "Collatz Array Program revist 2020-07-09"
  7. CONST topLimit = (32766 / 3) * 2 'just integers today
  8. REDIM cSeq$(0)
  9.     PRINT "The highest number Interger Type can handle is"; topLimit; ","
  10.     PRINT "If our test number wanders up there we must cut the run short."
  11.     PRINT "Go ahead try 20,000 it is over 1/3 of Integer Type Limit!"
  12.     INPUT "(0 quits) Enter a number to try New Collatz Sequencer "; n
  13.     IF n = 0 THEN EXIT DO
  14.     done = 0: odd = 0: even = 0: l = 1
  15.     WHILE n <> 1 OR done
  16.         s$ = STR$(l) + ":" + STR$(n)
  17.         IF n MOD 2 THEN 'odd
  18.             IF n < topLimit THEN s$ = s$ + " odd": l = l + 1 ELSE s$ = s$ + " hit limit, end of run.": done = 1
  19.             n = (((n + 1) / 2) * 3) - 1: odd = odd + 1
  20.         ELSE
  21.             s$ = s$ + " even": l = l + 1
  22.             n = n \ 2: even = even + 1
  23.         END IF
  24.         sAppend cSeq$(), s$
  25.     WEND
  26.     IF done = 0 THEN
  27.         s$ = STR$(l) + ":" + STR$(n)
  28.         sAppend cSeq$(), s$
  29.         even = even + 1
  30.     END IF
  31.     s$ = STR$(odd) + " times the odd rule was applied.": sAppend cSeq$(), s$
  32.     s$ = STR$(even) + " times the even  rule was applied.": sAppend cSeq$(), s$
  33.     s$ = STR$(odd + even) + " steps were taken to create this sequence.": sAppend cSeq$(), s$
  34.     display cSeq$()
  35.     REDIM cSeq$(0)
  36.     CLS
  37. PRINT: PRINT "0 tells me to say, goodbye!"
  38.  
  39. SUB sAppend (arr() AS STRING, addItem$)
  40.     REDIM _PRESERVE arr(LBOUND(arr) TO UBOUND(arr) + 1) AS STRING
  41.     arr(UBOUND(arr)) = addItem$
  42.  
  43. SUB display (arr() AS STRING)
  44.     lb = LBOUND(arr): ub = UBOUND(arr)
  45.     IF ub - lb + 1 < 21 THEN top = ub ELSE top = lb + 19
  46.     CLS: PRINT "press any key to quit scroller..."
  47.     LOCATE 3, 1
  48.     FOR i = lb TO top
  49.         PRINT arr(i)
  50.     NEXT
  51.     DO
  52.         IF ub - lb + 1 > 20 THEN
  53.             DO WHILE _MOUSEINPUT
  54.                 IF row >= lb THEN row = row + _MOUSEWHEEL ELSE row = lb 'prevent under scrolling
  55.                 IF row > ub - 19 THEN row = ub - 19 'prevent over scrolling
  56.                 IF prevrow <> row THEN 'look for a change in row value
  57.                     IF row >= lb AND row <= ub - 19 THEN
  58.                         CLS: PRINT "press any key to quit scroller..."
  59.                         LOCATE 3, 1
  60.                         FOR n = row TO row + 19
  61.                             PRINT arr(n)
  62.                         NEXT
  63.                     END IF
  64.                 END IF
  65.                 prevrow = row 'store previous row value
  66.             LOOP
  67.         END IF
  68.     LOOP UNTIL INKEY$ > ""
  69.  
  70.  
  71.  

So what? I just made the Odd Rule Odder! ;-))
7
Programs / Re: Blackjack
« Last post by bplus on Today at 01:12:22 AM »
The bug with variable width strings in UDTs on macOS is already under investigation: https://github.com/QB64Team/qb64/issues/64

Hey it's not one of those CHR$(0) at the end of the string things is it?
8
Programs / Re: Blackjack
« Last post by bplus on Today at 12:25:58 AM »
Here is another little update to the Multi-AI Tester #3, I moved all the AI's to the bottom of the subs area and added a bunch of simple ones to test different Stay numbers side by side, I suppose it'd take a very, very long run to actually distinguish the different Stay strategies and just plain luck of the cards.

I named the Stay 16 limit after George because he spoke of it sorta, and I named Stay 18 after Steve2 because he might have been meaning to Stay one more card over what the Dealer has to stay at, preliminary tests suggest they are all better than Stay 12 (so you can never be busted). B3 is Stay 16 plus Double Down only at 11.

Code: QB64: [Select]
  1. ' No suits shown for cards A is Ace, J, Q, K are Jack, Queen, King, X is for 10
  2. '2020-07-05 fix hit (it wasn't broken), delete line chose$ = inkey$ before loop
  3. ' force dealer to hit on 16 stay 17
  4. ' ties are push
  5. ' bring in double down option
  6. ' fix dealer has Blackjack should tell also fix exposing 2nd card
  7. ' work this towards converting to multiple AI players, so players stats are all located in PlayerType
  8. ' 2020-07-06 Installed AI and mods for it
  9. ' 2020-07-06 new Compact Tester with 2nd AI
  10. ' 2020-07-06 start Blackjack Multi AI Tester off of Compact Tester
  11. '            add in allot of code worked out in Blackjack with Bots 2019-06-07
  12. '            Yes, major overhaul of last year bot code which was/is neat!
  13. '            Thanks Johnno and Steve for some interesting AI ideas to try!
  14. ' 2020-07-07 for Blackjack Multi AI Tester #2, I hope to do something kind of interesting with displaying players
  15. '            Yes Mouse over a player you want to check on but try and stay out of way of updating.
  16. ' 2020-07-08 No overlapping players, sucks, get rid of timer stuff, removed.
  17. '            Screen Size depends on how many players go against Dealer from 1 to 6 maximum.
  18. '            1 row of players with screen width < 1024, Dealer at top.
  19. '            Added more items to Player type  to display status solely from it's array contents.
  20. '            Also forbid player to double down if es chips can't cover loss.
  21. '            Display round number in Title Bar
  22. ' 2020-07-08 added some basic stay strategies
  23. '=================================================================================================================
  24. ' Blackjack Multi-Tester Notes: (removed from screening at start)
  25.  
  26. '                              *** Blackjack Multi AI Tester #3 ***
  27. '
  28. '                     Each AI bot starts with 100 chips and bets 2 each round.
  29. '                                Dealer must hit on 16 or less.
  30. '                                 Blackjack pays 1.5 X the bet.
  31. '                       Double down option available when you get 2 cards.
  32. '                         It Doubles the bet and you get one more card.
  33. '
  34. '====================================================================================================================
  35.  
  36. DEFINT A-Z
  37.  
  38. CONST nPlayers = 7 '            2 to 7 only! Dealer counts as the last player Screen size is adjusted to this!
  39. CONST rank$ = "A23456789XJQK" ' for building deck and figuring Totals
  40. CONST bH = 12, bW = 20 '        box height and box width in rows and columns
  41. CONST bc = &HFF008822, fc = &HFFCCCCFF ' screen back and fore colors , no printing though
  42.  
  43. TYPE PlayerType
  44.     ID AS STRING '        name of bot including dealer bot
  45.     Col AS INTEGER '      left corner column
  46.     Row AS INTEGER '      top row
  47.     FC AS _UNSIGNED LONG 'player colors are assigned in init FC are alternating Black and White
  48.     BC AS _UNSIGNED LONG 'random light and dark opposite print FC
  49.     Hand AS STRING '      cards are 1 char strings 10 is X
  50.     Ace AS INTEGER '      flag has ace for totalling hand
  51.     Bust AS INTEGER '     flag for final reckoning
  52.     BJ AS INTEGER '       flag for final reckoning
  53.     Total AS INTEGER '    card total of hand
  54.     Chips AS _INTEGER64 ' players status
  55.     SetBet AS _INTEGER64 'regular bet amount
  56.     Bet AS _INTEGER64 '   players bet each round
  57.     Tell AS STRING '      Hit, Stay Double or Win Push Loss Amt goal to put everything in PlayerType that showPlayer needs for display
  58.  
  59. DIM SHARED xmax, deck$(1 TO 52), p(1 TO nPlayers) AS PlayerType, deckIndex, round, allOut, player, blockDealer
  60.  
  61. DIM i, chose$
  62. initGame
  63. 'FOR i = 1 TO nPlayers
  64. '    showPlayer i
  65. 'NEXT
  66. 'SLEEP
  67. 'END
  68. DO 'start a round
  69.     startRound 'clears screen too and shuffles deck
  70.  
  71.     FOR i = 1 TO 2
  72.         FOR player = 1 TO nPlayers 'each Player is dealt 2 cards
  73.             IF player <> nPlayers THEN
  74.                 IF p(player).Chips > 0 THEN
  75.                     allOut = 0 'signal everyone is out of chips is false
  76.                     PlayerAddCard player
  77.                 END IF
  78.             ELSE
  79.                 IF allOut THEN
  80.                     EXIT DO
  81.                 ELSE
  82.                     PlayerAddCard player
  83.                 END IF
  84.             END IF
  85.         NEXT
  86.     NEXT
  87.  
  88.     IF p(nPlayers).BJ = 0 THEN 'dealer does not have BJ
  89.         FOR player = 1 TO nPlayers - 1
  90.             showPlayer player
  91.             WHILE p(player).Total < 21
  92.                 SELECT CASE player ' this has to be coded for exactly all nPlayers - 1
  93.                     CASE 1: chose$ = Johnno$(player)
  94.                     CASE 2: chose$ = Steve$(player)
  95.                     CASE 3: chose$ = stay16$(player)
  96.                     CASE 4: chose$ = stay17$(player)
  97.                     CASE 5: chose$ = stay18$(player)
  98.                     CASE 6: chose$ = bplusAI3$(player) 'no more than 6 bots
  99.                 END SELECT
  100.                 IF chose$ = "h" THEN p(player).Tell = "Hit"
  101.                 IF chose$ = "d" THEN p(player).Tell = "Double Down"
  102.                 IF chose$ <> "h" AND chose$ <> "d" THEN p(player).Tell = "Stay"
  103.                 showPlayer player
  104.                 _DELAY 2
  105.                 IF chose$ = "h" THEN
  106.                     PlayerAddCard player
  107.                 ELSEIF chose$ = "d" AND LEN(p(player).Hand) = 2 THEN
  108.                     p(player).Bet = 2 * p(player).Bet
  109.                     PlayerAddCard player
  110.                     EXIT WHILE
  111.                 ELSE 'stayed
  112.                     EXIT WHILE
  113.                 END IF
  114.             WEND
  115.         NEXT
  116.     END IF
  117.  
  118.     blockDealer = 0
  119.     showPlayer nPlayers
  120.     WHILE p(nPlayers).Total < 17
  121.         p(nPlayers).Tell = "Dealer takes a card."
  122.         showPlayer nPlayers
  123.         PlayerAddCard nPlayers
  124.     WEND
  125.     p(nPlayers).Tell = "Reckoning"
  126.     showPlayer nPlayers
  127.  
  128.     '    final Reckoning
  129.     FOR player = 1 TO nPlayers - 1
  130.         showPlayer player
  131.         IF p(player).BJ AND p(nPlayers).BJ THEN
  132.             p(player).Tell = "Push"
  133.         ELSEIF p(player).Total > 21 OR (p(player).Total < p(nPlayers).Total AND p(nPlayers).Total < 22) THEN
  134.             p(player).Tell = "Lost" + STR$(p(player).Bet)
  135.             p(player).Chips = p(player).Chips - p(player).Bet
  136.             p(nPlayers).Chips = p(nPlayers).Chips + p(player).Bet
  137.         ELSEIF p(player).Total = p(nPlayers).Total AND p(player).BJ = 0 THEN
  138.             p(player).Tell = "Push"
  139.         ELSE
  140.             IF p(player).BJ THEN
  141.                 p(player).Tell = "Win!" + STR$(p(player).Bet + .5 * p(player).Bet)
  142.                 p(player).Chips = p(player).Chips + p(player).Bet + .5 * p(player).Bet
  143.                 p(nPlayers).Chips = p(nPlayers).Chips - p(player).Bet - .5 * p(player).Bet
  144.             ELSE
  145.                 p(player).Tell = "Win!" + STR$(p(player).Bet)
  146.                 p(player).Chips = p(player).Chips + p(player).Bet
  147.                 p(nPlayers).Chips = p(nPlayers).Chips - p(player).Bet
  148.             END IF
  149.         END IF
  150.         showPlayer player
  151.         _DELAY 1 'an extra delay
  152.         IF p(player).Chips = 0 THEN
  153.             p(player).Tell = "Out of chips!":
  154.             showPlayer player
  155.             _DELAY 2 ' an extra delay
  156.         END IF
  157.     NEXT
  158. LOOP UNTIL allOut
  159.  
  160. SUB startRound
  161.     DIM i
  162.     COLOR fc, bc: CLS
  163.     round = round + 1: allOut = -1
  164.     FOR i = 1 TO nPlayers
  165.         p(i).Hand = ""
  166.         p(i).Ace = 0
  167.         p(i).Total = 0
  168.         p(i).BJ = 0
  169.         p(i).Bust = 0
  170.         p(i).Tell = ""
  171.         'because of double down option I have to reset bet during play and set it back at each new round
  172.         'make sure we aren't betting more than our chips count at least to start
  173.         IF p(i).Chips < p(i).SetBet THEN p(i).Bet = p(i).Chips ELSE p(i).Bet = p(i).SetBet
  174.     NEXT
  175.     FOR i = 52 TO 2 STEP -1 'shuffle
  176.         SWAP deck$(INT(RND * i) + 1), deck$(i)
  177.     NEXT
  178.     'deck$(5) = "A": deck$(10) = "J"  'check immediate show of Blackjack for dealer
  179.     deckIndex = 0: blockDealer = -1
  180.     _TITLE "BJ AI Tester Round:" + STR$(round)
  181.  
  182. SUB PlayerAddCard (rec) 'updates player's hand and total
  183.     DIM i AS INTEGER, cv AS INTEGER
  184.     deckIndex = deckIndex + 1
  185.     p(rec).Hand = p(rec).Hand + deck$(deckIndex)
  186.     IF deck$(deckIndex) = "A" THEN p(rec).Ace = -1
  187.     p(rec).Total = 0
  188.     FOR i = 1 TO LEN(p(rec).Hand)
  189.         IF INSTR(rank$, MID$(p(rec).Hand, i, 1)) > 10 THEN cv = 10 ELSE cv = INSTR(rank$, MID$(p(rec).Hand, i, 1))
  190.         p(rec).Total = p(rec).Total + cv
  191.     NEXT
  192.     IF p(rec).Total < 12 AND p(rec).Ace THEN p(rec).Total = p(rec).Total + 10
  193.     IF LEN(p(rec).Hand) = 2 AND p(rec).Total = 21 THEN p(rec).BJ = -1
  194.     IF p(rec).Total > 21 THEN p(rec).Bust = -1
  195.     showPlayer rec 'when ever add card show update
  196.  
  197. SUB showPlayer (nPlayer) '
  198.     DIM i AS INTEGER, S$
  199.     COLOR p(nPlayer).FC, p(nPlayer).BC
  200.     FOR i = 0 TO bH - 1 'clear our block
  201.         LOCATE p(nPlayer).Row + i, p(nPlayer).Col: PRINT SPACE$(bW);
  202.     NEXT
  203.     cp nPlayer, 1, p(nPlayer).ID
  204.     cp nPlayer, 3, "Chips:" + STR$(p(nPlayer).Chips)
  205.     IF nPlayer <> nPlayers THEN cp nPlayer, 4, "Bet:" + STR$(p(nPlayer).Bet)
  206.     FOR i = 1 TO LEN(p(nPlayer).Hand)
  207.         S$ = S$ + MID$(p(nPlayer).Hand, i, 1) + " "
  208.     NEXT
  209.     IF nPlayer = nPlayers AND LEN(p(nPlayer).Hand) = 2 AND p(nPlayer).Total <> 21 AND blockDealer THEN
  210.         S$ = LEFT$(S$, 2) + "?"
  211.         cp nPlayer, 6, S$
  212.         cp nPlayer, 7, "Total: ??"
  213.     ELSE
  214.         cp nPlayer, 6, S$
  215.         cp nPlayer, 7, "Total:" + STR$(p(nPlayer).Total)
  216.     END IF
  217.     IF p(nPlayer).Bust THEN cp nPlayer, 8, "Busted"
  218.     IF p(nPlayer).BJ THEN cp nPlayer, 8, "Blackjack"
  219.     cp nPlayer, 10, p(nPlayer).Tell ' last action of player or dealer or final win lost push
  220.     _DELAY 1 'when ever showPlayer  need a delay to read
  221.  
  222. SUB initGame 'the stuff that never changes
  223.     DIM i
  224.     ' 1+13*2 rows = 27*16 = 432 ymax
  225.     xmax = ((nPlayers - 1) * 21 + 1) * 8
  226.     SCREEN _NEWIMAGE(xmax, 432, 32)
  227.     _DELAY .25
  228.  
  229.     'dealer on top row then max 2 rows of 5 players
  230.     FOR i = 1 TO nPlayers
  231.         IF i <> nPlayers THEN
  232.             SELECT CASE i 'vvvvvvvvvvvvvvvvvvvvvvvvvvvv plug in ai names here
  233.                 CASE 1: p(i).ID = "Johnno"
  234.                 CASE 2: p(i).ID = "Steve Stay 12"
  235.                 CASE 3: p(i).ID = "George Stay 16"
  236.                 CASE 4: p(i).ID = "Dealer Stay 17"
  237.                 CASE 5: p(i).ID = "Steve2 Stay 18"
  238.                 CASE 6: p(i).ID = "b3 stay16 dd11"
  239.             END SELECT
  240.             p(i).Col = 2 + (i - 1) * 21
  241.             p(i).Row = 15
  242.             p(i).Chips = 100
  243.             p(i).SetBet = 2
  244.             IF i MOD 2 THEN
  245.                 p(i).BC = _RGB32(RND * 128, RND * 60, RND * 128)
  246.             ELSE
  247.                 p(i).BC = _RGB32(RND * 128 + 127, 255 - RND * 95, RND * 128 + 127)
  248.             END IF
  249.             IF i MOD 2 THEN p(i).FC = &HFFFFFFFF ELSE p(i).FC = &HFF000000
  250.         ELSE
  251.             p(i).ID = "Dealer"
  252.             p(i).Col = (xmax \ 8 - 20) \ 2 + 1
  253.             p(i).Row = 2
  254.             p(i).Chips = -100 * (nPlayers - 1)
  255.             p(i).BC = &HFF000000
  256.             p(i).FC = &HFFFFFFFF
  257.         END IF
  258.     NEXT
  259.     FOR i = 1 TO 52 'get deck ready
  260.         deck$(i) = MID$(rank$ + rank$ + rank$ + rank$, i, 1)
  261.     NEXT
  262.  
  263.     COLOR fc, bc: CLS
  264.  
  265. SUB cp (nPlayer, row, s AS STRING) 'center print a string on the given row
  266.     IF nPlayer THEN
  267.         COLOR p(nPlayer).FC, p(nPlayer).BC
  268.         LOCATE p(nPlayer).Row + row, p(nPlayer).Col + (bW - LEN(s)) / 2: PRINT s;
  269.     ELSE
  270.         COLOR fc, bc
  271.         PRINT s, row, (xmax \ 8 - LEN(s)) / 2 + 1
  272.         LOCATE row, (xmax \ 8 - LEN(s)) / 2 + 1: PRINT s;
  273.     END IF
  274.  
  275. ' ======================================= AI storage Area #51
  276.  
  277. FUNCTION bplusAI$ (pn) ' first try
  278.     SELECT CASE p(pn).Total
  279.         CASE IS < 10: bplusAI$ = "h" 'no caps!
  280.         CASE 10, 11
  281.             IF LEN(p(pn).Hand) = 2 THEN bplusAI$ = "d" ELSE bplusAI$ = "h"
  282.         CASE IS < 15
  283.             IF RND < .5 THEN bplusAI$ = "h" ELSE bplusAI$ = "whatever"
  284.         CASE ELSE: bplusAI$ = "Show me the money!"
  285.     END SELECT
  286.  
  287. FUNCTION bplusAI2$ (pN) 'after trying first want to try this make it more likely to hit on 12 than 13, 14...
  288.     SELECT CASE p(pN).Total
  289.         CASE IS < 10: bplusAI2$ = "h" 'no caps!
  290.         CASE 10, 11 'double down unless dealer showing an Ace which is like insurance for dealer
  291.             IF LEN(p(pN).Hand) = 2 AND LEFT$(p(nPlayers).Hand, 1) <> "A" THEN bplusAI2$ = "d" ELSE bplusAI2$ = "h"
  292.         CASE 12: IF RND < .75 THEN bplusAI2$ = "h" ELSE bplusAI2$ = "whatever"
  293.         CASE 13: IF RND < .5 THEN bplusAI2$ = "h" ELSE bplusAI2$ = "whatever"
  294.         CASE 14: IF RND < .25 THEN bplusAI2$ = "h" ELSE bplusAI2$ = "whatever"
  295.         CASE ELSE: bplusAI2$ = "Show me the money!"
  296.     END SELECT
  297.  
  298. FUNCTION bplusAI3$ (pn) ' first try modified to stay 16 plus dd on 11 only
  299.     SELECT CASE p(pn).Total
  300.         CASE 11
  301.             IF LEN(p(pn).Hand) = 2 THEN bplusAI3$ = "d" ELSE bplusAI3$ = "h"
  302.         CASE IS < 16: bplusAI3$ = "h"
  303.     END SELECT
  304.  
  305. FUNCTION Johnno$ (pN)
  306.     IF p(pN).Total = 10 OR p(pN).Total = 11 AND LEN(p(pN).Hand) = 2 THEN
  307.         Johnno$ = "d"
  308.     ELSEIF p(pN).Total = 10 OR p(pN).Total = 11 AND LEN(p(pN).Hand) <> 2 THEN
  309.         Johnno$ = "h"
  310.     ELSEIF 12 <= p(pN).Total AND p(pN).Total <= 15 THEN
  311.         SELECT CASE LEFT$(p(nPlayers).Hand, 1)
  312.             CASE "A", "K", "Q", "J", "X", "9": Johnno$ = "h"
  313.             CASE "7", "8": IF RND < .5 THEN Johnno$ = "h"
  314.             CASE ELSE: Johnno$ = "Hope to Bust em"
  315.         END SELECT
  316.     ELSEIF p(pN).Total < 12 THEN
  317.         Johnno$ = "h"
  318.     ELSE
  319.         Johnno$ = "Stay"
  320.     END IF
  321.  
  322. FUNCTION Steve$ (pN) 'how simple is this! never bust make dealer work for it
  323.     IF p(pN).Total < 12 THEN Steve$ = "h"
  324.  
  325. FUNCTION stay16$ (pN) ' calling this George because he seems to agree, might want to do more about what Dealer is showing
  326.     IF p(pN).Total < 16 THEN stay16$ = "h"
  327. FUNCTION stay17$ (pN)
  328.     IF p(pN).Total < 17 THEN stay17$ = "h"
  329. FUNCTION stay18$ (pN) 'this might have been what Steve was talking about so calling it Steve2
  330.     IF p(pN).Total < 18 THEN stay18$ = "h"
  331.  
  332.  
  333.  
9
Programs / Re: Blackjack
« Last post by bplus on Today at 12:00:22 AM »
@Qwerkey

As promised the Blackjack Game, BJ v2020-07-08 updated with more or better comments:
(Nothing has been changed in the code, for those who have already downloaded the July 4th version.)

10
Programs / Re: Blackjack
« Last post by FellippeHeitor on Yesterday at 11:33:33 PM »
The bug with variable width strings in UDTs on macOS is already under investigation: https://github.com/QB64Team/qb64/issues/64
Pages: [1] 2 3 ... 10