QB64.org Forum

Active Forums => Programs => Topic started by: Kiara87 on September 09, 2020, 04:09:15 am

Title: lancio di due dadi
Post by: Kiara87 on September 09, 2020, 04:09:15 am
Hello everyone
I also want to share my projects with you
i promise i am not a programmer

so maybe you understand that my programs will not initially be perfect
place a simple program that rolls two dice

Code: QB64: [Select]
  1. credito = 10
  2. 1 CLS
  3.  
  4. LOCATE 1, 1: PRINT "É"; STRING$(78, 205); "»" 'string$ scrive 78 volte il valore in ascii del 205
  5. LOCATE 2, 1: PRINT "º"; TAB(80); "º" 'tab significa fai un spazio di 80 caratteri una tabbulazione
  6. LOCATE 3, 1: PRINT "È"; STRING$(78, 205); "¼" 'string$ scrive 78 volte il valore in ascii del 205
  7. LOCATE 2, 30: PRINT "il tuo credito"; credito; "gettoni"
  8.  
  9.  
  10. inizio:
  11.  
  12. LOCATE 4, 1
  13. PRINT "hai "; credito; " Crediti"
  14.  
  15.  
  16. INPUT "Quanto vuoi puntare? "; puntata
  17.  
  18. 'tasto$ = INPUT$(1)
  19.  
  20.  
  21.  
  22. IF puntata <= 0 THEN
  23.     LOCATE 6, 11
  24.     PRINT "devi puntare qualcosa per giocare"
  25.     SLEEP 3
  26.     GOTO 1
  27.  
  28. ELSEIF puntata > credito THEN
  29.     LOCATE 21, 11
  30.     PRINT "non possiedi tutto questo credito "; "hai solamente "; credito; " crediti; "
  31.     'coso = 0:coso2 =0
  32.     SLEEP 3
  33.     GOTO 1
  34.  
  35.  
  36. coso = INT(RND * 5) + 1
  37. coso2 = INT(RND * 5) + 1
  38.  
  39. LOCATE 1, 25
  40.  
  41.  
  42.  
  43. LOCATE 22, 25
  44. PRINT "Programma lancio dei dadi...."
  45. LOCATE 8, 11
  46. PRINT "il tuo dado e "; coso
  47. LOCATE 8, 42
  48. PRINT "il dado del avversario e' "; coso2
  49.  
  50.  
  51.  
  52. IF coso = 6 THEN dado: dado6
  53. IF coso = 5 THEN dado: dado5
  54. IF coso = 4 THEN dado: dado4
  55. IF coso = 3 THEN dado: dado3
  56. IF coso = 2 THEN dado: dado2
  57. IF coso = 1 THEN dado: dado1
  58. '----------------------------------
  59. IF coso2 = 6 THEN dadocoso2: cosodado6
  60. IF coso2 = 5 THEN dadocoso2: cosodado5
  61. IF coso2 = 4 THEN dadocoso2: cosodado4
  62. IF coso2 = 3 THEN dadocoso2: cosodado3
  63. IF coso2 = 2 THEN dadocoso2: cosodado2
  64. IF coso2 = 1 THEN dadocoso2: cosodado1
  65.  
  66. IF coso = coso2 THEN
  67.     LOCATE 13, 30
  68.     PRINT "Pareggio"
  69. ELSEIF coso > coso2 THEN
  70.     credito = credito + puntata
  71.     LOCATE 13, 30
  72.     COLOR 10
  73.     PRINT "Hai vinto"
  74.     COLOR 7
  75. ELSEIF coso < coso2 THEN
  76.     credito = credito - puntata
  77.     COLOR 4
  78.     LOCATE 13, 30
  79.     PRINT "Hai perso"
  80.     COLOR 7
  81.     IF credito <= 0 THEN
  82.         LOCATE 13, 30
  83.         COLOR 4
  84.         PRINT "GAME OVER"
  85.         FOR i = 1 TO 20 STEP 2
  86.             BEEP
  87.         NEXT i
  88.         END
  89.     END IF
  90.  
  91.  
  92. GOTO inizio
  93. SUB dado
  94.     LOCATE 10, 10
  95.     PRINT "É"; STRING$(16, 205); "»"
  96.     LOCATE 17, 10
  97.     PRINT "È"; STRING$(16, 205); "¼"
  98.     FOR i = 11 TO 16
  99.         LOCATE i, 10
  100.         PRINT "º"; TAB(27); "º"
  101.     NEXT i
  102. SUB dado1
  103.  
  104.     LOCATE 13, 11
  105.     PRINT "       **"
  106.  
  107. SUB dado2
  108.     LOCATE 11, 11
  109.     PRINT "       **"
  110.     LOCATE 16, 11
  111.     PRINT "       **"
  112. SUB dado3
  113.     LOCATE 11, 11
  114.     PRINT "**"
  115.     LOCATE 13, 11
  116.     PRINT "       **"
  117.     LOCATE 16, 11
  118.     PRINT "              **"
  119.  
  120. SUB dado4
  121.     LOCATE 11, 11
  122.     PRINT "**            **"
  123.     LOCATE 16, 11
  124.     PRINT "**            **"
  125.  
  126.  
  127. SUB dado5
  128.     LOCATE 11, 11
  129.     PRINT "**            **"
  130.     LOCATE 13, 11
  131.     PRINT "       **"
  132.     LOCATE 16, 11
  133.     PRINT "**            **"
  134.  
  135. SUB dado6
  136.     LOCATE 11, 11
  137.     PRINT "**     **     **"
  138.     LOCATE 16, 11
  139.     PRINT "**     **     **"
  140.  
  141.  
  142. '===============================================================
  143. SUB dadocoso2
  144.     LOCATE 10, 40
  145.     PRINT "É"; STRING$(16, 205); "»"
  146.     LOCATE 17, 40
  147.     PRINT "È"; STRING$(16, 205); "¼"
  148.     FOR i = 11 TO 16
  149.         LOCATE i, 40
  150.         PRINT "º"; TAB(57); "º"
  151.     NEXT i
  152.  
  153. SUB cosodado1
  154.  
  155.     LOCATE 13, 42
  156.     PRINT "       **"
  157.  
  158. SUB cosodado2
  159.     LOCATE 11, 42
  160.     PRINT "       **"
  161.     LOCATE 16, 42
  162.     PRINT "       **"
  163. SUB cosodado3
  164.     LOCATE 11, 42
  165.     PRINT "**"
  166.     LOCATE 13, 42
  167.     PRINT "      **"
  168.     LOCATE 16, 42
  169.     PRINT "             **"
  170.  
  171. SUB cosodado4
  172.     LOCATE 11, 42
  173.     PRINT "**           **"
  174.     LOCATE 16, 42
  175.     PRINT "**           **"
  176.  
  177.  
  178. SUB cosodado5
  179.     LOCATE 11, 42
  180.     PRINT "**           **"
  181.     LOCATE 13, 42
  182.     PRINT "       **"
  183.     LOCATE 16, 42
  184.     PRINT "**           **"
  185.  
  186. SUB cosodado6
  187.     LOCATE 11, 42
  188.     PRINT "**     **    **"
  189.     LOCATE 16, 42
  190.     PRINT "**     **    **"
  191.  
  192.  
  193.  
Title: Re: lancio di due dadi
Post by: bplus on September 09, 2020, 08:41:54 am
Oh looks like fun! I will try one.  :)

Code: QB64: [Select]
  1. _TITLE "Dice Game - inspired by Kiara's" ' b+ 2020-09-09
  2. SCREEN _NEWIMAGE(600, 600, 12)
  3. _DELAY .25
  4. DIM SHARED doubles
  5. money = 100
  6.     _FONT 8
  7.     rollDice r1, r2
  8.     IF r1 = r2 THEN
  9.         doubles = doubles + 1
  10.         IF r1 = 1 THEN money = money - 28 ELSE money = money + 6
  11.     ELSEIF r1 + r2 < 7 THEN
  12.         money = money - 1
  13.     ELSEIF r1 + r2 > 7 THEN
  14.         money = money + 1
  15.     END IF
  16.     _FONT 16
  17.     LP 12, 34, "money:" + STR$(money)
  18.     LP 22, 37, STR$(r1 + r2)
  19.     LP 32, 34, "doubles:" + STR$(doubles)
  20.     _DELAY 2
  21.  
  22. SUB rollDice (r1, r2)
  23.     FOR i = 1 TO 10
  24.         CLS
  25.         _FONT 16
  26.         LP 4, 31, "IF r1 = r2 THEN"
  27.         LP 5, 10, "IF r1 = 1 THEN money = money - 28 ELSE money = money + 6"
  28.         LP 7, 17, "ELSEIF r1 + r2 < 7 THEN money = money - 1"
  29.         LP 9, 17, "ELSEIF r1 + r2 > 7 THEN money = money + 1"
  30.         _FONT 8
  31.         r1 = INT(RND * 6) + 1
  32.         r2 = INT(RND * 6) + 1
  33.         ansiiDice 44, 22, r1
  34.         ansiiDice 44, 54, r2
  35.         _LIMIT 10
  36.     NEXT
  37.  
  38. SUB ansiiDice (row, col, n)
  39.     radius = 4
  40.     IF n > 1 THEN
  41.         angle = _PI(2 / n)
  42.         IF n MOD 2 = 0 THEN offset = _PI / 4 ELSE offset = _PI / 2
  43.         IF n = 6 THEN offset = 0
  44.         FOR i = 1 TO n
  45.             r = row + INT(radius * SIN(i * angle - offset) + .5)
  46.             c = col + INT(radius * COS(i * angle - offset) + .5)
  47.             LP r, c, "*"
  48.             'PRINT r, c
  49.         NEXT
  50.     ELSE
  51.         LP row, col, "*"
  52.     END IF
  53.     c1 = col - 9: c2 = col + 9
  54.     r1 = row - 9: r2 = row + 9
  55.     FOR i = c1 TO c2
  56.         LP r1, i, CHR$(196)
  57.         LP r2, i, CHR$(196)
  58.     NEXT
  59.     FOR i = r1 TO r2
  60.         LP i, c1, CHR$(179)
  61.         LP i, c2, CHR$(179)
  62.     NEXT
  63.     LP r1, c1, CHR$(218)
  64.     LP r2, c1, CHR$(192)
  65.     LP r1, c2, CHR$(191)
  66.     LP r2, c2, CHR$(217)
  67.  
  68. SUB LP (r, c, s$)
  69.     LOCATE r, c: PRINT s$
  70.  

EDIT: changed payout scheme

 
Title: Re: lancio di due dadi
Post by: TempodiBasic on September 10, 2020, 06:06:41 pm
@Kiara87
buon inizio, tanta pratica vale molto più di tanta teoria nella programmazione perchè bisogna saper fare e non semplicemente sapere come si fa.
A mio giudizio hai fatto un altro passo verso la programmazione modulare, ma se vuoi progredire in questa direzione devi imparare a trasformare i GOTO e i GOSUB in blocchi di codice, come hai fatto per l'output ASCII dei dadi in questo tuo programma.

Senza trasformarlo è possibile migliorare il suo output
1. è nel lato giocatore è senza apostrofo ( per mimare l'accento ) mentre nel lato l'AI è corretto

2. la testata del gioco scompare e riappare, meglio controllare con precisione il flusso
 REMmando le linee di codice 13,14,15,16 e cambiando il GOTO Inizio con GOTO 1  e alla linea 22 elimina il CLS e usa LOCATE 5,1: PRINT SPACE$(80); per cancellare l'input dell'utente e procedere con il lancio dei dadi.

3. la domanda presenta due ? ? lo puoi risolvere o cancellando ? dal testo specificato con INPUT oppure sostituendo ; ( che pone un ? prima del cursore di input ) con , (che fa seguire direttamente l'input dell'utente)

4. per quanto io adori i colori Blink dello SCREEN 0 alla riga 19 del programma preferirei sostituire COLOR 18 con COLOR 3

confronta il programma che hai postato con questa sua variante.
/
EN
@ Kiara87
good start, a lot of practice is worth much more than a lot of theory in programming because you have to know how to do and not simply know how to do it.
In my judgment you have taken another step towards modular programming, but if you want to progress in this direction you have to learn how to turn GOTOS and GOSUBs into code blocks, as you did for the ASCII output of dice in this program of yours.

Without transforming it it is possible to improve its output
1. è  (e') on the player side is without apostrophe (to mimic the accent) while on the side of the AI it ​​is correct (e' in the place of è)

2. the game head disappears and reappears, better control the flow precisely
 By removing the lines of code 13,14,15,16 and changing the GOTO Inizio with GOTO 1 and at line 22 remove the CLS and use LOCATE 5,1: PRINT SPACE $ (80); to clear user input and proceed with the roll of the dice.

3. the question has two? ? can you fix it or delete it? from the text specified with INPUT or by replacing; (which places a? before the input cursor) with, (which directly follows user input)

4. as much as I love the Blink colors of SCREEN 0 at line 19 of the program I would prefer to replace COLOR 18 with COLOR 3

compare the program you posted with this variant.

Code: QB64: [Select]
  1. credito = 10
  2. 1 CLS
  3.  
  4. LOCATE 1, 1: PRINT "É"; STRING$(78, 205); "»" 'string$ scrive 78 volte il valore in ascii del 205
  5. LOCATE 2, 1: PRINT "º"; TAB(80); "º" 'tab significa fai un spazio di 80 caratteri una tabbulazione
  6. LOCATE 3, 1: PRINT "È"; STRING$(78, 205); "¼" 'string$ scrive 78 volte il valore in ascii del 205
  7. LOCATE 2, 30: PRINT "il tuo credito"; credito; "gettoni"
  8.  
  9.  
  10. '    inizio:
  11.  
  12. 'LOCATE 4, 1
  13. 'PRINT "hai "; credito; " Crediti"
  14.  
  15.  
  16. INPUT "Quanto vuoi puntare? ", puntata
  17. LOCATE 5, 1: PRINT SPACE$(80); 'CLS
  18.  
  19. 'tasto$ = INPUT$(1)
  20.  
  21.  
  22.  
  23. IF puntata <= 0 THEN
  24.     LOCATE 6, 11
  25.     PRINT "devi puntare qualcosa per giocare"
  26.     SLEEP 3
  27.     GOTO 1
  28.  
  29. ELSEIF puntata > credito THEN
  30.     LOCATE 21, 11
  31.     PRINT "non possiedi tutto questo credito "; "hai solamente "; credito; " crediti; "
  32.     'coso = 0:coso2 =0
  33.     SLEEP 3
  34.     GOTO 1
  35.  
  36.  
  37. coso = INT(RND * 5) + 1
  38. coso2 = INT(RND * 5) + 1
  39.  
  40. LOCATE 1, 25
  41.  
  42.  
  43.  
  44. LOCATE 22, 25
  45. PRINT "Programma lancio dei dadi...."
  46. LOCATE 8, 11
  47. PRINT "il tuo dado e "; coso
  48. LOCATE 8, 42
  49. PRINT "il dado del avversario e' "; coso2
  50.  
  51.  
  52.  
  53. IF coso = 6 THEN dado: dado6
  54. IF coso = 5 THEN dado: dado5
  55. IF coso = 4 THEN dado: dado4
  56. IF coso = 3 THEN dado: dado3
  57. IF coso = 2 THEN dado: dado2
  58. IF coso = 1 THEN dado: dado1
  59. '----------------------------------
  60. IF coso2 = 6 THEN dadocoso2: cosodado6
  61. IF coso2 = 5 THEN dadocoso2: cosodado5
  62. IF coso2 = 4 THEN dadocoso2: cosodado4
  63. IF coso2 = 3 THEN dadocoso2: cosodado3
  64. IF coso2 = 2 THEN dadocoso2: cosodado2
  65. IF coso2 = 1 THEN dadocoso2: cosodado1
  66.  
  67. IF coso = coso2 THEN
  68.     LOCATE 13, 30
  69.     PRINT "Pareggio"
  70. ELSEIF coso > coso2 THEN
  71.     credito = credito + puntata
  72.     LOCATE 13, 30
  73.     COLOR 10
  74.     PRINT "Hai vinto"
  75.     COLOR 7
  76. ELSEIF coso < coso2 THEN
  77.     credito = credito - puntata
  78.     COLOR 4
  79.     LOCATE 13, 30
  80.     PRINT "Hai perso"
  81.     COLOR 7
  82.     IF credito <= 0 THEN
  83.         LOCATE 13, 30
  84.         COLOR 4
  85.         PRINT "GAME OVER"
  86.         FOR i = 1 TO 20 STEP 2
  87.             BEEP
  88.         NEXT i
  89.         END
  90.     END IF
  91.  
  92.  
  93. '    GOTO inizio
  94.  
  95. SUB dado
  96.     LOCATE 10, 10
  97.     PRINT "É"; STRING$(16, 205); "»"
  98.     LOCATE 17, 10
  99.     PRINT "È"; STRING$(16, 205); "¼"
  100.     FOR i = 11 TO 16
  101.         LOCATE i, 10
  102.         PRINT "º"; TAB(27); "º"
  103.     NEXT i
  104. SUB dado1
  105.  
  106.     LOCATE 13, 11
  107.     PRINT "       **"
  108.  
  109. SUB dado2
  110.     LOCATE 11, 11
  111.     PRINT "       **"
  112.     LOCATE 16, 11
  113.     PRINT "       **"
  114. SUB dado3
  115.     LOCATE 11, 11
  116.     PRINT "**"
  117.     LOCATE 13, 11
  118.     PRINT "       **"
  119.     LOCATE 16, 11
  120.     PRINT "              **"
  121.  
  122. SUB dado4
  123.     LOCATE 11, 11
  124.     PRINT "**            **"
  125.     LOCATE 16, 11
  126.     PRINT "**            **"
  127.  
  128.  
  129. SUB dado5
  130.     LOCATE 11, 11
  131.     PRINT "**            **"
  132.     LOCATE 13, 11
  133.     PRINT "       **"
  134.     LOCATE 16, 11
  135.     PRINT "**            **"
  136.  
  137. SUB dado6
  138.     LOCATE 11, 11
  139.     PRINT "**     **     **"
  140.     LOCATE 16, 11
  141.     PRINT "**     **     **"
  142.  
  143.  
  144. '===============================================================
  145. SUB dadocoso2
  146.     LOCATE 10, 40
  147.     PRINT "É"; STRING$(16, 205); "»"
  148.     LOCATE 17, 40
  149.     PRINT "È"; STRING$(16, 205); "¼"
  150.     FOR i = 11 TO 16
  151.         LOCATE i, 40
  152.         PRINT "º"; TAB(57); "º"
  153.     NEXT i
  154.  
  155. SUB cosodado1
  156.  
  157.     LOCATE 13, 42
  158.     PRINT "       **"
  159.  
  160. SUB cosodado2
  161.     LOCATE 11, 42
  162.     PRINT "       **"
  163.     LOCATE 16, 42
  164.     PRINT "       **"
  165. SUB cosodado3
  166.     LOCATE 11, 42
  167.     PRINT "**"
  168.     LOCATE 13, 42
  169.     PRINT "      **"
  170.     LOCATE 16, 42
  171.     PRINT "             **"
  172.  
  173. SUB cosodado4
  174.     LOCATE 11, 42
  175.     PRINT "**           **"
  176.     LOCATE 16, 42
  177.     PRINT "**           **"
  178.  
  179.  
  180. SUB cosodado5
  181.     LOCATE 11, 42
  182.     PRINT "**           **"
  183.     LOCATE 13, 42
  184.     PRINT "       **"
  185.     LOCATE 16, 42
  186.     PRINT "**           **"
  187.  
  188. SUB cosodado6
  189.     LOCATE 11, 42
  190.     PRINT "**     **    **"
  191.     LOCATE 16, 42
  192.     PRINT "**     **    **"
  193.  
  194.  
  195.  
  196.  

Good start! Go on translating those GOTO to a DO LOOP cycle for the next step towards modular programming.
Title: Re: lancio di due dadi
Post by: TempodiBasic on September 10, 2020, 06:10:18 pm
@bplus
fine the battle dice  PC vs PC!...
and I can see that you loves geometry, each face of dice has its geometric formula.
Title: Re: lancio di due dadi
Post by: Kiara87 on September 10, 2020, 06:51:28 pm
grazie @TempodiBasic per i consigli
cercherò di migliorare dando esempio dal tuo codice
e confrontarlo cosi vedro i miglioramenti del programma


@bplus  thanks to you too I see that you enjoy editing programs
and it's nice to see the changes
Title: Re: lancio di due dadi
Post by: bplus on September 10, 2020, 06:52:34 pm
@bplus
fine the battle dice  PC vs PC!...
and I can see that you loves geometry, each face of dice has its geometric formula.

Yeah, I can put allot more dots on the dice face with same code!
Title: Re: lancio di due dadi
Post by: bplus on September 10, 2020, 06:57:56 pm
grazie @TempodiBasic per i consigli
cercherò di migliorare dando esempio dal tuo codice
e confrontarlo cosi vedro i miglioramenti del programma


@bplus  thanks to you too I see that you enjoy editing programs
and it's nice to see the changes

Yes I don't understand Italian so I made up my own program after watching yours run.
Title: Re: lancio di due dadi
Post by: Kiara87 on November 20, 2020, 06:44:41 pm
hi in the created argument which is the difference on sub and end sub

where @bplus pointed out that they are similar to each other
I wanted to modify this program with functions to see if the program worked even changing between subs to functions

I tried to change only a sub as it was going and put a function but it goes in error

perhaps functions should not be called with an if condition?

Code: QB64: [Select]
  1. credito = 10
  2. 1 CLS
  3.  
  4. LOCATE 1, 1: PRINT "É"; STRING$(78, 205); "»" 'string$ scrive 78 volte il valore in ascii del 205
  5. LOCATE 2, 1: PRINT "º"; TAB(80); "º" 'tab significa fai un spazio di 80 caratteri una tabbulazione
  6. LOCATE 3, 1: PRINT "È"; STRING$(78, 205); "¼" 'string$ scrive 78 volte il valore in ascii del 205
  7. LOCATE 2, 30: PRINT "il tuo credito"; credito; "gettoni"
  8.  
  9.  
  10. inizio:
  11.  
  12. LOCATE 4, 1
  13. PRINT "hai "; credito; " Crediti"
  14.  
  15.  
  16. INPUT "Quanto vuoi puntare? "; puntata
  17.  
  18. 'tasto$ = INPUT$(1)
  19.  
  20.  
  21.  
  22. IF puntata <= 0 THEN
  23.     LOCATE 6, 11
  24.     PRINT "devi puntare qualcosa per giocare"
  25.     SLEEP 3
  26.     GOTO 1
  27.  
  28. ELSEIF puntata > credito THEN
  29.     LOCATE 21, 11
  30.     PRINT "non possiedi tutto questo credito "; "hai solamente "; credito; " crediti; "
  31.     'coso = 0:coso2 =0
  32.     SLEEP 3
  33.     GOTO 1
  34.  
  35.  
  36. coso = INT(RND * 5) + 1
  37. coso2 = INT(RND * 5) + 1
  38.  
  39. LOCATE 1, 25
  40.  
  41.  
  42.  
  43. LOCATE 22, 25
  44. PRINT "Programma lancio dei dadi...."
  45. LOCATE 8, 11
  46. PRINT "il tuo dado e "; coso
  47. LOCATE 8, 42
  48. PRINT "il dado del avversario e' "; coso2
  49.  
  50.  
  51.  
  52. IF coso = 6 THEN dado: dado6
  53. IF coso = 5 THEN dado: dado5
  54. IF coso = 4 THEN dado: dado4
  55. IF coso = 3 THEN dado: dado3
  56. IF coso = 2 THEN dado:  dado2
  57. IF coso = 1 THEN dado: dado1
  58. '----------------------------------
  59. IF coso2 = 6 THEN dadocoso2: cosodado6
  60. IF coso2 = 5 THEN dadocoso2: cosodado5
  61. IF coso2 = 4 THEN dadocoso2: cosodado4
  62. IF coso2 = 3 THEN dadocoso2: cosodado3
  63. IF coso2 = 2 THEN dadocoso2: cosodado2
  64. IF coso2 = 1 THEN dadocoso2: cosodado1
  65.  
  66. IF coso = coso2 THEN
  67.     LOCATE 13, 30
  68.     PRINT "Pareggio"
  69. ELSEIF coso > coso2 THEN
  70.     credito = credito + puntata
  71.     LOCATE 13, 30
  72.     COLOR 10
  73.     PRINT "Hai vinto"
  74.     COLOR 7
  75. ELSEIF coso < coso2 THEN
  76.     credito = credito - puntata
  77.     COLOR 4
  78.     LOCATE 13, 30
  79.     PRINT "Hai perso"
  80.     COLOR 7
  81.     IF credito <= 0 THEN
  82.         LOCATE 13, 30
  83.         COLOR 4
  84.         PRINT "GAME OVER"
  85.         FOR i = 1 TO 20 STEP 2
  86.             BEEP
  87.         NEXT i
  88.         END
  89.     END IF
  90.  
  91.  
  92. GOTO inizio
  93. SUB dado
  94.     LOCATE 10, 10
  95.     PRINT "É"; STRING$(16, 205); "»"
  96.     LOCATE 17, 10
  97.     PRINT "È"; STRING$(16, 205); "¼"
  98.     FOR i = 11 TO 16
  99.         LOCATE i, 10
  100.         PRINT "º"; TAB(27); "º"
  101.     NEXT i
  102. SUB dado1
  103.  
  104.     LOCATE 13, 11
  105.     PRINT "       **"
  106.  
  107. FUNCTION dado2
  108.     LOCATE 11, 11
  109.     PRINT "       **"
  110.     LOCATE 16, 11
  111.     PRINT "       **"
  112. SUB dado3
  113.     LOCATE 11, 11
  114.     PRINT "**"
  115.     LOCATE 13, 11
  116.     PRINT "       **"
  117.     LOCATE 16, 11
  118.     PRINT "              **"
  119.  
  120. SUB dado4
  121.     LOCATE 11, 11
  122.     PRINT "**            **"
  123.     LOCATE 16, 11
  124.     PRINT "**            **"
  125.  
  126.  
  127. SUB dado5
  128.     LOCATE 11, 11
  129.     PRINT "**            **"
  130.     LOCATE 13, 11
  131.     PRINT "       **"
  132.     LOCATE 16, 11
  133.     PRINT "**            **"
  134.  
  135. SUB dado6
  136.     LOCATE 11, 11
  137.     PRINT "**     **     **"
  138.     LOCATE 16, 11
  139.     PRINT "**     **     **"
  140.  
  141.  
  142. '===============================================================
  143. SUB dadocoso2
  144.     LOCATE 10, 40
  145.     PRINT "É"; STRING$(16, 205); "»"
  146.     LOCATE 17, 40
  147.     PRINT "È"; STRING$(16, 205); "¼"
  148.     FOR i = 11 TO 16
  149.         LOCATE i, 40
  150.         PRINT "º"; TAB(57); "º"
  151.     NEXT i
  152.  
  153. SUB cosodado1
  154.  
  155.     LOCATE 13, 42
  156.     PRINT "       **"
  157.  
  158. SUB cosodado2
  159.     LOCATE 11, 42
  160.     PRINT "       **"
  161.     LOCATE 16, 42
  162.     PRINT "       **"
  163. SUB cosodado3
  164.     LOCATE 11, 42
  165.     PRINT "**"
  166.     LOCATE 13, 42
  167.     PRINT "      **"
  168.     LOCATE 16, 42
  169.     PRINT "             **"
  170.  
  171. SUB cosodado4
  172.     LOCATE 11, 42
  173.     PRINT "**           **"
  174.     LOCATE 16, 42
  175.     PRINT "**           **"
  176.  
  177.  
  178. SUB cosodado5
  179.     LOCATE 11, 42
  180.     PRINT "**           **"
  181.     LOCATE 13, 42
  182.     PRINT "       **"
  183.     LOCATE 16, 42
  184.     PRINT "**           **"
  185.  
  186. SUB cosodado6
  187.     LOCATE 11, 42
  188.     PRINT "**     **    **"
  189.     LOCATE 16, 42
  190.     PRINT "**     **    **"
  191.  
  192.  
  193.  
  194.  
  195.  

Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 07:10:29 pm
And the main difference between a SUB and FUNCTION is that you can use a FUNCTION say MyFunction$ that returns a string say "Hello" so

You can PRINT MyFunction$ and get "Hello"
You can use MyFunction$ in an IF MyFunction$ = "Goodbye" THEN END
You can assign a variable: Greeting$ = MyFunction$
So MyFunction$ works just like any other variable.

None of these things can you do with a SUB, you can only call MySub and it will execute a SUB block of code. A SUB does not return a value you can print, or assign to a variable or compare with IF.

Title: Re: lancio di due dadi
Post by: Kiara87 on November 20, 2020, 07:37:03 pm
And the main difference between a SUB and FUNCTION is that you can use a FUNCTION say MyFunction$ that returns a string say "Hello" so

You can PRINT MyFunction$ and get "Hello"
You can use MyFunction$ in an IF MyFunction$ = "Goodbye" THEN END
You can assign a variable: Greeting$ = MyFunction$
So MyFunction$ works just like any other variable.

None of these things can you do with a SUB, you can only call MySub and it will execute a SUB block of code. A SUB does not return a value you can print, or assign to a variable or compare with IF.



change sub dado for function dado and continue with everyone
so in this program i can't use as a function substituting all subs for functions would it be impossible?
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 07:44:37 pm
Code: QB64: [Select]
  1. FOR i = 1 TO 10
  2.     PRINT nStars$(i)
  3.  
  4.  
  5. FUNCTION nStars$ (n)
  6.     FOR i = 1 TO n
  7.         addStar$ = addStar$ + "* "
  8.     NEXT
  9.     nStars$ = addStar$  ' <<<<<<<<<<<<<<< this assigns the function a string value
  10.  
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 07:51:37 pm
Code: QB64: [Select]
  1. FOR i = 1 TO 10
  2.     printNStars i '<<< can only call a sub like this, no PRINT, IF, X$ =
  3.  
  4.  
  5. SUB printNStars (n) ' <<< no values assigned to SUB name
  6.     FOR i = 1 TO n
  7.         PRINT "* ";
  8.     NEXT
  9.     PRINT
  10.  
Title: Re: lancio di due dadi
Post by: Kiara87 on November 20, 2020, 07:53:37 pm
Code: QB64: [Select]
  1. FOR i = 1 TO 10
  2.     PRINT nStars$(i)
  3.  
  4.  
  5. FUNCTION nStars$ (n)
  6.     FOR i = 1 TO n
  7.         addStar$ = addStar$ + "* "
  8.     NEXT
  9.     nStars$ = addStar$  ' <<<<<<<<<<<<<<< this assigns the function a string value
  10.  

so the subs is used to call blocks of code
instead the functions call the strings to print on the screen and you can only use it to print something on the screen
correct me if I'm wrong ?
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 08:03:29 pm
You can do more with a function than print them to screen, here is one for random number 1 to n:
Code: QB64: [Select]
  1. coso = INT(RND * 5) + 1 ' do you want numbers 1 to 6 ?
  2. coso2 = INT(RND * 5) + 1
  3.  
  4. PRINT "see any 6's in first column?"
  5. FOR i = 1 TO 20
  6.     PRINT INT(RND * 5) + 1, randomNumber1to(6)
  7.  
  8. FUNCTION randomNumber1to (n)
  9.     randomNumber1to = INT(RND * n) + 1
  10.  
  11.  
  12.  
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 08:13:14 pm
Another use of very same function:
Code: QB64: [Select]
  1.     PRINT "Win"; win, "loose"; loose
  2.     IF randomNumber1to(2) = 1 THEN  ' <<<< with (2) returns only 1 or 2
  3.         PRINT "You loose": loose = loose + 1
  4.     ELSE
  5.         PRINT "You win!": win = win + 1
  6.     END IF
  7.     _LIMIT .5 ' <<<<  slow us d o w n
  8. LOOP UNTIL _KEYDOWN(27) ' press escape to quit
  9.  
  10. FUNCTION randomNumber1to (n)
  11.     randomNumber1to = INT(RND * n) + 1
  12.  
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 09:46:15 pm
2 for 1 sale!
Code: QB64: [Select]
  1. 'SUB dado
  2. '    LOCATE 10, 10
  3. '    PRINT "É"; STRING$(16, 205); "»"
  4. '    LOCATE 17, 10
  5. '    PRINT "È"; STRING$(16, 205); "¼"
  6. '    FOR i = 11 TO 16
  7. '        LOCATE i, 10
  8. '        PRINT "º"; TAB(27); "º"
  9. '    NEXT i
  10. 'END SUB
  11.  
  12. 'SUB dadocoso2
  13. '    LOCATE 10, 40
  14. '    PRINT "É"; STRING$(16, 205); "»"
  15. '    LOCATE 17, 40
  16. '    PRINT "È"; STRING$(16, 205); "¼"
  17. '    FOR i = 11 TO 16
  18. '        LOCATE i, 40
  19. '        PRINT "º"; TAB(57); "º"
  20. '    NEXT i
  21. 'END SUB
  22.  
  23. SUB rettangolo (column)
  24.     LOCATE 10, column
  25.     PRINT "É"; STRING$(16, 205); "»";
  26.     LOCATE 17, column
  27.     PRINT "È"; STRING$(16, 205); "¼";
  28.     FOR i = 11 TO 16
  29.         LOCATE i, column
  30.         PRINT "º"; STRING$(16, 32); "º";
  31.     NEXT i
  32.  


Add dice dots:
Code: QB64: [Select]
  1. dado 10, 3
  2. dado 40, 5
  3.  
  4. SUB dado (column, dots)
  5.     LOCATE 10, column
  6.     PRINT "É"; STRING$(15, 205); "»";
  7.     LOCATE 16, column
  8.     PRINT "È"; STRING$(15, 205); "¼";
  9.     FOR i = 11 TO 15
  10.         LOCATE i, column
  11.         PRINT "º"; STRING$(15, 32); "º";
  12.     NEXT i
  13.     SELECT CASE dots
  14.         CASE 1
  15.             LOCATE 13, column + 8: PRINT "*"
  16.         CASE 2
  17.             LOCATE 13, column + 6: PRINT "*   *"
  18.         CASE 3
  19.             LOCATE 12, column + 6: PRINT "*"
  20.             LOCATE 13, column + 8: PRINT "*"
  21.             LOCATE 14, column + 10: PRINT "*"
  22.         CASE 4
  23.             LOCATE 12, column + 6: PRINT "*   *"
  24.             LOCATE 14, column + 6: PRINT "*   *"
  25.         CASE 5
  26.             LOCATE 12, column + 6: PRINT "*   *"
  27.             LOCATE 13, column + 8: PRINT "*"
  28.             LOCATE 14, column + 6: PRINT "*   *"
  29.         CASE 6
  30.             LOCATE 12, column + 6: PRINT "* * *"
  31.             LOCATE 14, column + 6: PRINT "* * *"
  32.     END SELECT
  33.  
  34.  
  35.  
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 10:25:20 pm
Now add our function
Code: QB64: [Select]
  1.  
  2.     dado 2, randomNumber1to(6)
  3.     dado 22, randomNumber1to(6)
  4.     dado 42, randomNumber1to(6)
  5.     dado 62, randomNumber1to(6)
  6.     _LIMIT .5 'slow down to 1 every 2 secs
  7. LOOP UNTIL _KEYDOWN(27) 'escape key press to quit
  8.  
  9. SUB dado (column, dots)
  10.     LOCATE 10, column
  11.     PRINT "É"; STRING$(15, 205); "»";
  12.     LOCATE 16, column
  13.     PRINT "È"; STRING$(15, 205); "¼";
  14.     FOR i = 11 TO 15
  15.         LOCATE i, column
  16.         PRINT "º"; STRING$(15, 32); "º";
  17.     NEXT i
  18.     SELECT CASE dots
  19.         CASE 1
  20.             LOCATE 13, column + 8: PRINT "*"
  21.         CASE 2
  22.             LOCATE 13, column + 6: PRINT "*   *"
  23.         CASE 3
  24.             LOCATE 12, column + 6: PRINT "*"
  25.             LOCATE 13, column + 8: PRINT "*"
  26.             LOCATE 14, column + 10: PRINT "*"
  27.         CASE 4
  28.             LOCATE 12, column + 6: PRINT "*   *"
  29.             LOCATE 14, column + 6: PRINT "*   *"
  30.         CASE 5
  31.             LOCATE 12, column + 6: PRINT "*   *"
  32.             LOCATE 13, column + 8: PRINT "*"
  33.             LOCATE 14, column + 6: PRINT "*   *"
  34.         CASE 6
  35.             LOCATE 12, column + 6: PRINT "* * *"
  36.             LOCATE 14, column + 6: PRINT "* * *"
  37.     END SELECT
  38.  
  39. FUNCTION randomNumber1to (n)
  40.     randomNumber1to = INT(RND * n) + 1
  41.  
  42.  
Title: Re: lancio di due dadi
Post by: bplus on November 20, 2020, 11:01:17 pm
Add an array now to track dice numbers and add another Function to total an array of numbers, so now we roll dice until key press stops and shows dice and total, press another key and roll again, ...

Code: QB64: [Select]
  1. REDIM dice(1 TO 4) 'so we can add them up
  2.     CLS
  3.     WHILE LEN(INKEY$) = 0 ' roll 'em
  4.         FOR d = 1 TO 4
  5.             dice(d) = randomNumber1to(6)
  6.         NEXT
  7.         dado 2, dice(1)
  8.         dado 22, dice(2)
  9.         dado 42, dice(3)
  10.         dado 62, dice(4)
  11.         _LIMIT 20 ' CPU was getting worked up, this saves fan
  12.     WEND
  13.     LOCATE 20, 40: PRINT totalArray(dice())
  14.     SLEEP 'pause and wait for key press
  15.     _KEYCLEAR 'clear keys so start rolling again
  16. LOOP UNTIL _KEYDOWN(27) 'escape key press to quit
  17.  
  18. SUB dado (column, dots)
  19.     LOCATE 10, column
  20.     PRINT "É"; STRING$(15, 205); "»";
  21.     LOCATE 16, column
  22.     PRINT "È"; STRING$(15, 205); "¼";
  23.     FOR i = 11 TO 15
  24.         LOCATE i, column
  25.         PRINT "º"; STRING$(15, 32); "º";
  26.     NEXT i
  27.     SELECT CASE dots
  28.         CASE 1
  29.             LOCATE 13, column + 8: PRINT "*"
  30.         CASE 2
  31.             LOCATE 12, column + 6: PRINT "*"
  32.             LOCATE 14, column + 10: PRINT "*"
  33.         CASE 3
  34.             LOCATE 12, column + 6: PRINT "*"
  35.             LOCATE 13, column + 8: PRINT "*"
  36.             LOCATE 14, column + 10: PRINT "*"
  37.         CASE 4
  38.             LOCATE 12, column + 6: PRINT "*   *"
  39.             LOCATE 14, column + 6: PRINT "*   *"
  40.         CASE 5
  41.             LOCATE 12, column + 6: PRINT "*   *"
  42.             LOCATE 13, column + 8: PRINT "*"
  43.             LOCATE 14, column + 6: PRINT "*   *"
  44.         CASE 6
  45.             LOCATE 12, column + 6: PRINT "* * *"
  46.             LOCATE 14, column + 6: PRINT "* * *"
  47.     END SELECT
  48.  
  49. FUNCTION randomNumber1to (n)
  50.     randomNumber1to = INT(RND * n) + 1
  51.  
  52. FUNCTION totalArray (array())
  53.     FOR i = LBOUND(array) TO UBOUND(array)
  54.         totalArray = totalArray + array(i)
  55.     NEXT
  56.  

EDIT: Fix 2 dots dice face.
Title: Re: lancio di due dadi
Post by: MidnightOwl on November 21, 2020, 09:33:37 am
There is an excellent dice rolling routine in 'mboard.bas' in the samples directory in your qb64 directory. It even simulates rolling dice.
Title: Re: lancio di due dadi
Post by: bplus on November 21, 2020, 11:40:52 am
There is an excellent dice rolling routine in 'mboard.bas' in the samples directory in your qb64 directory. It even simulates rolling dice.

Guess I need full path to mboard.bas, I couldn't find it but no matter, here we are practicing SUBs and FUNCTIONs, I think?

I have excellent game of Pig with dice image rolling but try to find it with search here... :P

One more try with capital Pig, aha!
Boink!
https://www.qb64.org/forum/index.php?topic=712.msg6204#msg6204
Title: Re: lancio di due dadi
Post by: bplus on November 21, 2020, 05:25:30 pm
There is an excellent dice rolling routine in 'mboard.bas' in the samples directory in your qb64 directory. It even simulates rolling dice.

Man get my curiosity going and

Inquiring minds need to know

If anyone wants a listing of Samples here it is:
Code: QB64: [Select]
  1.  

mboard.bas is for Bob's excellent Monopoly Board which is magnificent, can't say that the dice are any more impressive than here though, and they squeak! LOL!
  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: lancio di due dadi
Post by: FellippeHeitor on November 21, 2020, 05:50:02 pm
Love that ASCII board.
Title: Re: lancio di due dadi
Post by: bplus on November 21, 2020, 07:00:41 pm
Well the dado's were embarrassed by Bob's dice ;-))

Code: QB64: [Select]
  1. REDIM dice(1 TO 6) 'so we can add them up
  2.     CLS
  3.     WHILE LEN(INKEY$) = 0 ' roll 'em
  4.         FOR d = 1 TO 6
  5.             dice(d) = randomNumber1to(6)
  6.         NEXT
  7.         dado 3, dice(1)
  8.         dado 16, dice(2)
  9.         dado 29, dice(3)
  10.         dado 42, dice(4)
  11.         dado 55, dice(5)
  12.         dado 68, dice(6)
  13.         _LIMIT 20 ' CPU was getting worked up, this saves fan
  14.     WEND
  15.     LOCATE 20, 40: PRINT totalArray(dice())
  16.     SLEEP 'pause and wait for key press
  17.     _KEYCLEAR 'clear keys so start rolling again
  18. LOOP UNTIL _KEYDOWN(27) 'escape key press to quit
  19.  
  20. SUB dado (column, dots)
  21.     COLOR 15, 12
  22.     LOCATE 11, column
  23.  
  24.     PRINT CHR$(218); STRING$(9, 196); CHR$(191);
  25.     LOCATE 15, column
  26.     PRINT CHR$(192); STRING$(9, 196); CHR$(217);
  27.     FOR i = 12 TO 14
  28.         LOCATE i, column
  29.         PRINT CHR$(179); STRING$(9, 32); CHR$(179);
  30.     NEXT i
  31.     SELECT CASE dots
  32.         CASE 1
  33.             LOCATE 13, column + 5: PRINT "*"
  34.         CASE 2
  35.             LOCATE 12, column + 3: PRINT "*"
  36.             LOCATE 14, column + 7: PRINT "*"
  37.         CASE 3
  38.             LOCATE 12, column + 3: PRINT "*"
  39.             LOCATE 13, column + 5: PRINT "*"
  40.             LOCATE 14, column + 7: PRINT "*"
  41.         CASE 4
  42.             LOCATE 12, column + 3: PRINT "*   *"
  43.             LOCATE 14, column + 3: PRINT "*   *"
  44.         CASE 5
  45.             LOCATE 12, column + 3: PRINT "*   *"
  46.             LOCATE 13, column + 5: PRINT "*"
  47.             LOCATE 14, column + 3: PRINT "*   *"
  48.         CASE 6
  49.             LOCATE 12, column + 3: PRINT "* * *"
  50.             LOCATE 14, column + 3: PRINT "* * *"
  51.     END SELECT
  52.     COLOR 15, 0
  53.  
  54. FUNCTION randomNumber1to (n)
  55.     randomNumber1to = INT(RND * n) + 1
  56.  
  57. FUNCTION totalArray (array())
  58.     FOR i = LBOUND(array) TO UBOUND(array)
  59.         totalArray = totalArray + array(i)
  60.     NEXT
  61.  
  62.  
  63.  

Title: Re: lancio di due dadi
Post by: MidnightOwl on November 21, 2020, 07:46:24 pm
The ideal in programming is to avoid reinventing the wheel ie. reusable code.  The function returns dice total and shows just how complicated a function can be.  It can also be adapted to many uses with little alteration (reused) . Which was why I brought  it up in the  first place. Isn't that why there are code libraries?
Title: Re: lancio di due dadi
Post by: bplus on November 21, 2020, 07:52:43 pm
The ideal in programming is to avoid reinventing the wheel ie. reusable code.  The function returns dice total and shows just how complicated a function can be.  It can also be adapted to many uses with little alteration (reused) . Which was why I brought  it up in the  first place. Isn't that why there are code libraries?

Wait are you saying we should have used this for dice from Monopoly (which is massive! and certainly not meant to be library):
Code: QB64: [Select]
  1. FUNCTION RollDICE% (RRow%, CCol%)
  2.  
  3.     FOR ROLL = 1 TO 24
  4.         Row = RRow% + FIX(RND * 2) - 1
  5.         Col = CCol% + FIX(RND * 2) - 1
  6.         Number1 = FIX(RND * 6) + 1
  7.         Number = Number1
  8.         GOSUB ShowDIE
  9.         GOSUB Sides
  10.         Row = RRow% + FIX(RND * 2) - 1
  11.         Col = CCol% + 7 + FIX(RND * 2) - 1
  12.         Number2 = FIX(RND * 6) + 1
  13.         Number = Number2
  14.         GOSUB ShowDIE
  15.         GOSUB Sides
  16.         PLAY "MBT160L64O6b"
  17.         FOR Slow = 1 TO 6
  18.             WAIT &H3DA, 8
  19.             WAIT &H3DA, 8, 8
  20.         NEXT Slow
  21.     NEXT ROLL
  22.     RollDICE% = Number1 + Number2
  23.     IF Number1 = Number2 THEN Doubles% = TRUE
  24.  
  25.  
  26.     ShowDIE:
  27.     COLOR BackCOLOR%
  28.     FOR x = Col - 2 TO Col + 4
  29.         FOR y = Row - 1 TO Row + 4
  30.             LOCATE y, x
  31.             PRINT CHR$(219)
  32.         NEXT y
  33.     NEXT x
  34.     COLOR 15, 4
  35.     SELECT CASE Number
  36.         CASE 1
  37.             LOCATE Row, Col: GOSUB NoDOTS
  38.             LOCATE Row + 1, Col: GOSUB OneDOT
  39.             LOCATE Row + 2, Col: GOSUB NoDOTS
  40.             LOCATE
  41.         CASE 2
  42.             LOCATE Row, Col: GOSUB Dot
  43.             FOR Reps = 1 TO 2: GOSUB Blank: NEXT Reps
  44.             LOCATE Row + 1, Col: GOSUB NoDOTS
  45.             LOCATE Row + 2, Col
  46.             FOR Reps = 1 TO 2: GOSUB Blank: NEXT Reps
  47.             GOSUB Dot
  48.         CASE 3
  49.             LOCATE Row, Col: GOSUB Dot
  50.             FOR Reps = 1 TO 2: GOSUB Blank: NEXT Reps
  51.             LOCATE Row + 1, Col: GOSUB OneDOT
  52.             LOCATE Row + 2, Col
  53.             FOR Reps = 1 TO 2: GOSUB Blank: NEXT Reps
  54.             GOSUB Dot
  55.         CASE 4
  56.             LOCATE Row, Col: GOSUB TwoDOTS
  57.             LOCATE Row + 1, Col: GOSUB NoDOTS
  58.             LOCATE Row + 2, Col: GOSUB TwoDOTS
  59.         CASE 5
  60.             LOCATE Row, Col: GOSUB TwoDOTS
  61.             LOCATE Row + 1, Col: GOSUB OneDOT
  62.             LOCATE Row + 2, Col: GOSUB TwoDOTS
  63.         CASE 6
  64.             LOCATE Row, Col: GOSUB TwoDOTS
  65.             LOCATE Row + 1, Col: GOSUB TwoDOTS
  66.             LOCATE Row + 2, Col: GOSUB TwoDOTS
  67.     END SELECT
  68.     RETURN
  69.  
  70.     OneDOT:
  71.     GOSUB Blank
  72.     GOSUB Dot
  73.     GOSUB Blank
  74.     RETURN
  75.  
  76.     TwoDOTS:
  77.     GOSUB Dot
  78.     GOSUB Blank
  79.     GOSUB Dot
  80.     RETURN
  81.  
  82.     NoDOTS:
  83.     FOR Reps = 1 TO 3: GOSUB Blank: NEXT Reps
  84.     RETURN
  85.  
  86.     Blank:
  87.     PRINT CHR$(32);
  88.     RETURN
  89.  
  90.     Dot:
  91.     PRINT CHR$(254);
  92.     RETURN
  93.  
  94.     Sides:
  95.     COLOR 4, BackCOLOR%
  96.     LOCATE Row, Col - 1: PRINT CHR$(222)
  97.     LOCATE Row + 1, Col - 1: PRINT CHR$(222)
  98.     LOCATE Row + 2, Col - 1: PRINT CHR$(222)
  99.     LOCATE Row, Col + 3: PRINT CHR$(221)
  100.     LOCATE Row + 1, Col + 3: PRINT CHR$(221)
  101.     LOCATE Row + 2, Col + 3: PRINT CHR$(221)
  102.     RETURN
  103.  
  104.