Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 487
» Latest member: PeterT
» Forum threads: 2,808
» Forum posts: 26,376

Full Statistics

Latest Threads
Fireworks thru the years
Forum: bplus
Last Post: SierraKen
48 minutes ago
» Replies: 6
» Views: 260
Grave Dayz BlockGraphics ...
Forum: Games
Last Post: bplus
1 hour ago
» Replies: 1
» Views: 15
New Years Eve Fireworks!
Forum: Programs
Last Post: bplus
1 hour ago
» Replies: 7
» Views: 79
Hey guys, riddle me this....
Forum: General Discussion
Last Post: Kernelpanic
2 hours ago
» Replies: 7
» Views: 92
QB64pe 4.0 on Mac Trouble...
Forum: Help Me!
Last Post: NakedApe
6 hours ago
» Replies: 11
» Views: 113
QBJS Pocket Billiards
Forum: QBJS, BAM, and Other BASICs
Last Post: vince
11 hours ago
» Replies: 0
» Views: 76
Prime Number Generator
Forum: Programs
Last Post: eoredson
Today, 01:52 AM
» Replies: 8
» Views: 117
Emulating DS4QB2
Forum: QBJS, BAM, and Other BASICs
Last Post: jofers
Yesterday, 10:32 PM
» Replies: 5
» Views: 291
Prime Number Generator
Forum: SierraKen
Last Post: SierraKen
Yesterday, 08:38 PM
» Replies: 0
» Views: 14
QB64PE v4.0 is now live!!
Forum: Announcements
Last Post: NakedApe
Yesterday, 08:19 PM
» Replies: 43
» Views: 1,810

 
  Kill a directory in DOS
Posted by: eoredson - 11-30-2023, 04:16 AM - Forum: Help Me! - Replies (30)

Hi,

I have recently been able to Kill Filename$ but I would like a function to Kill Directory$

I know in Command.com and Cmd.exe the DEL command has /S to delete all subdirectories but Dosbox-X does not..

Or could a batch file do it??

Erik.

Print this item

  What kind of Chart would you use?
Posted by: Dimster - 11-28-2023, 06:35 PM - Forum: Help Me! - Replies (10)

I want to create a chart that visually demonstrates the effects of various activities on a main event. For example if the main event is Forest Fire and the activities are temperature, wind speed, precipitation and density, what kind of chart would you use to display all this information. I've been looking at bar charts, pie charts and a scatter charts but none of them appeal to me. Do you guys use charts and if so would you recommend it?

Print this item

  Call by reference / value
Posted by: Kernelpanic - 11-27-2023, 07:54 PM - Forum: General Discussion - Replies (3)

To once again take chances handing over arguments to procedures (and functions).

A "Shared" is not necessary to access the address of a variable, as "Call by reference" is the standard access for procedures and functions in QuickBasic (QB64). "Shared" is only necessary if one want to make a variable accessible throughout the entire program.

For "AlsWert einzahlung, (zinswert), jahre" (Line 31) only the interest value is passed as a value, since this value should be changed as a copy.

Code: (Select All)

'Uebung zu Call by reference/value - 27. Nov. 2023

Option _Explicit

Declare Sub AlsWert(einzahlung As Double, zinwertn As Double, jahre As Integer)
Declare Sub AlsReferenz(einzahlung As Double, zinwertn As Double, jahre As Integer)

'einzahlung = Deposit -- zinswert = Interest value
Dim As Double einzahlung, zinswert, endkapital, q
Dim As Integer jahre

Locate 2, 2
Input "Jaehrliche Einzahlung    : ", einzahlung
Locate 3, 2
Input "Hoehe der Verzinsubg      : ", zinswert
Locate 4, 2
Input "Einzahlungsdauer in Jahren: ", jahre

'Zinsfaktor berechnen - (Calculate interest factor)
q = (1 + (zinswert / 100))

'Berechnung des Endkapitals nach X Jahren - (Final capital after X years)
endkapital = (einzahlung * q * (((q ^ jahre) - 1) / (q - 1)))

Locate 6, 2
Print Using "Das Endkapital betraegt bei ##.##% Zinsen nach ## Jahren: ##,####.##"; zinswert, jahre, endkapital

Locate 8, 2
Print "Als Wertuebergabe (Call by value)"
Locate 9, 2
AlsWert einzahlung, (zinswert), jahre

Locate 11, 2
'The interest value was not changed (copy)
Print Using "Der Zinswert wurde nicht veraendert (Kopie): ##.##%"; zinswert

Locate 13, 2
Print "Als Referenz (Call by reference)"
Locate 14, 2
AlsReferenz einzahlung, zinswert, jahre

Locate 16, 2
'The interest value was changed because the program has access to the address of the variable.
Print "Der Zinswert wurde veraendert, da das Programm "
Locate 17, 2
Print Using "Zugriff auf die Adresse hat: ##.##%"; zinswert

End 'Hauptprogramm


Sub AlsWert (einzahlung As Double, zinswert As Double, jahre As Integer)

  Dim As Double endkapital, q

  zinswert = 5.7

  'Zinsfaktor berechnen
  q = (1 + (zinswert / 100))

  'Berechnung des Endkapitals nach X Jahren
  endkapital = (einzahlung * q * (((q ^ jahre) - 1) / (q - 1)))

  Print Using "Das Endkapital betraegt bei ##.##% Zinsen nach ## Jahren: ##,####.##"; zinswert, jahre, endkapital
End Sub

Sub AlsReferenz (einzahlung As Double, zinswert As Double, jahre As Integer)

  Dim As Double endkapital, q

  zinswert = 6.75

  'Zinsfaktor berechnen
  q = (1 + (zinswert / 100))

  'Berechnung des Endkapitals nach X Jahren
  endkapital = (einzahlung * q * (((q ^ jahre) - 1) / (q - 1)))

  Print Using "Das Endkapital betraegt bei ##.##% Zinsen nach ## Jahren: ##,####.##"; zinswert, jahre, endkapital
End Sub

[Image: Call-by-reference-Anzeige2023-11-27.jpg]

Print this item

  Monster Spritewalk example
Posted by: James D Jarvis - 11-27-2023, 06:53 PM - Forum: Programs - Replies (4)

Monster spritewalk demo.
experimenting with stacked groups of art elements in the original drawing and revealing them when needed to provide animation.
Probably not the most efficient way to do this speed-wise.
There was originally meant to be an eye animation as well but the way the art program grouped the elements made that bothersome.

If you want to slap the critter into another program I'd like to see it.

Code: (Select All)
'monster spritewalk demo
'by James Jarvis Nov 27, 2023
'walk the monster with the WASD keys
'animagion is made with oveerlapping pieces in the original art shown as needed
'
' graphics are taken form Kenney Assets are free for use
' need QB64 phoenix 3.9 and up.
Screen _NewImage(800, 600, 32)
_Title "Monster Spritewalk Demo  (WASD)"
Dim As Long simg
sx = 0: sy = 0
armstate = 1
antennastate = 2
earstate = 2
legstate = 2
Do
    i$ = "<svg x='0' y='-2'width='64' height='96' >"
    'Arms
    Select Case armstate
        Case 1
            i$ = i$ + "    <path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M16,37.4c-1.3-0.8-2.2-2-2.8-3.5c-0.2-0.8-0.1-1.6,0.2-2.4l0.3-0.7c0.6-1.2,1.5-2,2.8-2.4s2.5-0.3,3.7,0.3c1.2,0.6,2,1.5,2.4,2.8s0.3,2.5-0.3,3.7c-0.3,0.7-0.8,1.2-1.3,1.6c-0.4,0.4-0.9,0.6-1.5,0.8C18.2,38,17.1,37.9,16,37.4 M7.6,56.8L7.6,56.8c1.5-0.7,2.8-0.8,4.1-0.4l0.1,0.1c0.7,0.4,1.1,1,1.4,1.8c0.1,0.3,0.1,0.5,0.2,0.8c-3.2-0.8-5.4-0.2-6.6,1.6l-0.1-0.2c-0.3-0.9-0.2-1.8,0.2-2.7C7,57.5,7.3,57.1,7.6,56.8'/>"
            i$ = i$ + i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M7.6,56.8V56v-0.9l0,0c-0.1-4.3,0.5-8.5,1.8-12.6c0.4-1.3,0.8-2.5,1.4-3.7l1.1-2.3l0.4-0.9l0.2-0.4l0,0l0.7-1.3c0.6,1.6,1.6,2.7,2.8,3.5l-0.5,0.9l-0.1,0.2l-0.1,0.1c-0.6,1.2-1.1,2.4-1.5,3.6c-1.4,4-2.1,8.1-2.1,12.4v0.7v0.4V56l0.1,0.7l-0.1-0.1c-1.3-0.5-2.6-0.4-4,0.3L7.6,56.8 M6.7,60.8c1.2-1.9,3.4-2.4,6.6-1.6h0.2c2.3,0.6,3.7,2,4.3,4.3c0.1,0.6,0.2,1.2,0.3,1.8c0,0.5-0.1,0.9-0.4,1.2c-0.3,0.3-0.7,0.5-1.1,0.6c-0.5,0-0.9-0.1-1.2-0.4s-0.5-0.7-0.6-1.1c-0.1-0.7-0.2-1.3-0.5-1.8c-0.2-0.4-0.5-0.7-0.8-0.9l-0.1,0.3l-0.1,0.3l-0.1,0.4c-0.7,1.9-0.5,3.7,0.5,5.5c0.3,0.5,0.4,1,0.2,1.6c-0.1,0.6-0.5,1-1,1.3s-1,0.4-1.6,0.2s-1-0.5-1.3-1v-0.1c-0.5,0.2-1,0.3-1.5,0.2c-0.6-0.2-1-0.5-1.3-1c-1.2-2.1-1.7-4.1-1.5-6.3c0.1-0.8,0.2-1.6,0.5-2.4l0,0L6.7,60.8'/>"
            i$ = i$ + i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M59.7,56L59.7,56c-1.5-0.6-2.8-0.5-4.1,0.1l-0.1,0.1v-0.7v-0.3v-0.3l-0.1-0.7C55,50,53.9,45.9,52,42.1c-0.6-1.2-1.2-2.3-1.9-3.4L50,38.6l0-0.2l-0.6-0.9c1.2-0.9,2-2.2,2.4-3.8l0.9,1.2l0,0l0.2,0.3l0.5,0.8l1.3,2.2c0.6,1.2,1.2,2.4,1.7,3.6c1.7,3.9,2.7,8,3.1,12.4l0,0l0.1,0.9L59.7,56 M61.1,59.8l0.5,1l0,0c0.4,0.8,0.6,1.6,0.8,2.3c0.4,2.1,0.2,4.2-0.8,6.4c-0.2,0.5-0.6,0.9-1.2,1.1c-0.5,0.2-1,0.2-1.5,0v0.1c-0.2,0.5-0.6,0.9-1.2,1.1c-0.5,0.2-1.1,0.2-1.6-0.1c-0.5-0.2-0.9-0.6-1.1-1.2c-0.2-0.5-0.2-1.1,0.1-1.6c0.8-1.9,0.8-3.7-0.1-5.5l-0.2-0.3l-0.2-0.3l-0.1-0.3c-0.3,0.3-0.5,0.6-0.7,1c-0.2,0.5-0.3,1.1-0.3,1.9c0,0.5-0.1,0.8-0.4,1.2c-0.3,0.3-0.7,0.5-1.2,0.5S51,67,50.7,66.7s-0.5-0.7-0.5-1.2c0-0.6,0-1.3,0.1-1.8c0.4-2.3,1.6-3.9,3.8-4.8l0.2-0.1C57.4,57.8,59.7,58.1,61.1,59.8'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M49.4,37.5c-1.1,0.6-2.2,0.8-3.4,0.5c-0.6-0.1-1.1-0.3-1.6-0.6c-0.6-0.4-1.1-0.8-1.5-1.5c-0.7-1.1-0.9-2.4-0.7-3.7c0.3-1.3,1-2.3,2.1-3s2.3-1,3.7-0.7c1.3,0.3,2.3,1,3,2.1l0.4,0.6c0.4,0.8,0.5,1.6,0.4,2.4C51.4,35.4,50.6,36.6,49.4,37.5 M59.7,56c0.4,0.3,0.7,0.6,0.9,1c0.5,0.8,0.7,1.7,0.5,2.6L61,59.8c-1.4-1.7-3.6-2-6.7-0.9c0-0.3,0-0.5,0.1-0.8c0.2-0.8,0.6-1.4,1.2-1.9l0.1-0.1c1.2-0.6,2.5-0.6,4-0.2V56'/>"
        Case 2
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M49.3,38.4c-1.1,0.5-2.3,0.6-3.5,0.2c-0.6-0.2-1.1-0.4-1.5-0.8c-0.5-0.4-1-1-1.3-1.6c-0.6-1.2-0.7-2.4-0.3-3.7s1.2-2.2,2.4-2.8c1.2-0.6,2.4-0.7,3.7-0.3c1.3,0.4,2.2,1.2,2.8,2.4l0.3,0.7c0.3,0.8,0.3,1.6,0.2,2.4C51.6,36.5,50.6,37.6,49.3,38.4 M57.7,57.8c0.3,0.3,0.6,0.6,0.8,1.1c0.4,0.9,0.5,1.7,0.2,2.7l-0.1,0.2c-1.2-1.9-3.4-2.4-6.6-1.6c0-0.3,0.1-0.5,0.2-0.8c0.2-0.8,0.7-1.4,1.4-1.8l0.1-0.1C55,57,56.3,57.1,57.7,57.8L57.7,57.8'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M57.7,57.8L57.7,57.8c-1.5-0.7-2.8-0.8-4.1-0.4l-0.1,0.1l0.1-0.7v-0.3v-0.4v-0.7c0-4.3-0.7-8.4-2.1-12.4c-0.5-1-1-2.2-1.5-3.4l-0.1-0.1l-0.1-0.2l-0.5-0.9c1.3-0.8,2.2-2,2.8-3.5l0.7,1.3l0,0l0.2,0.4l0.4,0.9l1.1,2.3c0.5,1.2,1,2.5,1.4,3.7c1.3,4.1,1.9,8.3,1.8,12.6l0,0V57L57.7,57.8 M58.6,61.8l0.4,1l0,0c0.3,0.8,0.4,1.6,0.5,2.4c0.2,2.1-0.3,4.2-1.5,6.3c-0.3,0.5-0.7,0.8-1.3,1c-0.5,0.1-1,0.1-1.5-0.2v0.1c-0.3,0.5-0.7,0.8-1.3,1c-0.6,0.1-1.1,0.1-1.6-0.2c-0.5-0.3-0.8-0.7-1-1.3c-0.2-0.6-0.1-1.1,0.2-1.6c1-1.8,1.2-3.6,0.5-5.5l0-0.3l-0.1-0.3l-0.1-0.3c-0.3,0.2-0.6,0.5-0.8,0.9c-0.3,0.5-0.4,1.1-0.5,1.8c0,0.5-0.2,0.8-0.6,1.1c-0.3,0.3-0.7,0.4-1.2,0.4s-0.8-0.2-1.1-0.6s-0.5-0.8-0.4-1.2c0-0.6,0.1-1.3,0.3-1.8c0.6-2.3,2-3.7,4.3-4.3H52C55.2,59.4,57.4,59.9,58.6,61.8'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M5.6,57v-0.8l0.1-0.9l0,0c0.3-4.3,1.4-8.5,3-12.4c0.5-1.2,1.1-2.4,1.7-3.6l1.3-2.2l0.5-0.8l0.2-0.3l0,0l0.9-1.2c0.4,1.6,1.3,2.9,2.4,3.8l-0.6,0.9L15,39.7l-0.1,0.1c-0.7,1.1-1.3,2.3-1.9,3.4C11.2,47,10,51,9.6,55.3L9.5,56v0.3v0.3v0.7l-0.1-0.1c-1.2-0.6-2.5-0.6-4-0.2L5.6,57 M4.3,60.8c1.4-1.7,3.6-2,6.7-0.9l0.2,0.1c2.2,0.8,3.5,2.4,3.8,4.8c0.1,0.6,0.1,1.2,0.1,1.8c0,0.5-0.2,0.8-0.5,1.2c-0.3,0.3-0.7,0.5-1.2,0.4c-0.5,0-0.8-0.2-1.2-0.5c-0.3-0.3-0.5-0.7-0.4-1.2c0-0.7-0.1-1.4-0.3-1.9c-0.2-0.4-0.4-0.7-0.7-1l-0.1,0.3l-0.2,0.3l-0.2,0.3c-0.9,1.8-0.9,3.6-0.1,5.5c0.3,0.5,0.3,1.1,0.1,1.6s-0.6,0.9-1.1,1.2c-0.5,0.2-1,0.3-1.6,0.1s-0.9-0.6-1.2-1.1v-0.1c-0.5,0.2-1,0.2-1.5,0S4,71.1,3.7,70.6c-1-2.2-1.2-4.3-0.8-6.4c0.2-0.8,0.4-1.6,0.8-2.3l0,0L4.3,60.8'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M15.9,38.5c-1.2-0.9-2-2.2-2.4-3.8c-0.1-0.8,0.1-1.6,0.4-2.4l0.4-0.6c0.7-1.1,1.7-1.8,3-2.1c1.3-0.3,2.5,0,3.7,0.7c1.1,0.7,1.8,1.7,2.1,3c0.3,1.3,0.1,2.5-0.7,3.7c-0.4,0.6-0.9,1.1-1.5,1.5c-0.5,0.3-1,0.5-1.6,0.6C18.1,39.3,16.9,39.2,15.9,38.5 M5.6,57L5.6,57c1.5-0.6,2.8-0.5,4.1,0.1l0.1,0.1c0.6,0.5,1,1.1,1.2,1.9c0.1,0.3,0.1,0.5,0.1,0.8c-3.1-1.1-5.4-0.8-6.7,0.9l-0.1-0.2C4,59.7,4.1,58.8,4.6,58C4.9,57.6,5.2,57.3,5.6,57'/>"
        Case 3
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M15.6,38.1c-1.2-0.8-2.1-2.1-2.6-3.7c-0.1-0.8,0-1.6,0.3-2.4l0.3-0.7c0.7-1.2,1.6-1.9,2.9-2.3c1.3-0.3,2.5-0.2,3.7,0.5s1.9,1.6,2.3,2.9s0.2,2.5-0.5,3.7c-0.4,0.6-0.8,1.2-1.4,1.6c-0.5,0.3-1,0.6-1.5,0.7C17.8,38.7,16.6,38.6,15.6,38.1 M6.2,57h0.1c1.4-0.6,2.7-0.6,4-0.1l0.1,0.1c0.6,0.5,1.1,1.1,1.3,1.9c0.1,0.3,0.1,0.5,0.1,0.8c-3.2-0.9-5.4-0.5-6.7,1.3L5,60.7c-0.3-0.9-0.2-1.8,0.3-2.6C5.6,57.6,5.9,57.3,6.2,57'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M6.2,57v-0.8v-0.9l0,0c0.1-4.3,0.9-8.5,2.4-12.5c0.5-1.2,1-2.4,1.5-3.6l1.2-2.3l0.5-0.8l0.2-0.4l0,0l0.8-1.3c0.5,1.6,1.4,2.8,2.6,3.7L15,38.9l-0.1,0.2l-0.1,0.1c-0.6,1.1-1.2,2.3-1.7,3.5c-1.6,3.9-2.6,8-2.7,12.2v0.7V56v0.3V57l-0.1-0.1C9.1,56.4,7.7,56.4,6.2,57L6.2,57M5.1,60.9c1.3-1.8,3.5-2.2,6.7-1.3l0.2,0.1c2.3,0.7,3.6,2.2,4.1,4.6c0.1,0.6,0.2,1.2,0.2,1.8c0,0.5-0.2,0.8-0.5,1.2c-0.3,0.3-0.7,0.5-1.2,0.5s-0.9-0.1-1.2-0.5c-0.3-0.3-0.5-0.7-0.5-1.2c0-0.7-0.1-1.4-0.4-1.9c-0.2-0.4-0.4-0.7-0.8-0.9l-0.1,0.3l-0.1,0.3l-0.2,0.4c-0.8,1.8-0.7,3.7,0.2,5.5c0.3,0.5,0.3,1,0.1,1.6c-0.2,0.5-0.5,1-1,1.2c-0.5,0.3-1,0.3-1.6,0.1c-0.5-0.2-1-0.5-1.2-1v-0.1c-0.5,0.2-1,0.2-1.5,0.1c-0.6-0.2-1-0.5-1.2-1C4,68.6,3.7,66.5,4,64.3c0.1-0.8,0.3-1.6,0.6-2.4l0,0L5.1,60.9'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M58.3,56.9L58.3,56.9c-1.5-0.7-2.8-0.7-4.1-0.2l-0.1,0.1v-0.7v-0.3v-0.4v-0.7c-0.2-4.3-1.1-8.3-2.7-12.2c-0.5-1.2-1.1-2.4-1.7-3.5h-0.1l-0.1-0.2L49,37.9c1.2-0.8,2.1-2.1,2.6-3.7l0.8,1.3l0,0l0.2,0.4l0.5,0.8l1.2,2.3c0.6,1.2,1.1,2.4,1.5,3.6c1.5,4,2.3,8.2,2.4,12.5l0,0V56L58.3,56.9 M59.4,60.8l0.5,1l0,0c0.3,0.8,0.5,1.6,0.6,2.4c0.3,2.1,0,4.2-1.1,6.3c-0.3,0.5-0.7,0.8-1.2,1s-1,0.1-1.5-0.1v0.1c-0.3,0.5-0.7,0.9-1.2,1c-0.5,0.2-1.1,0.1-1.6-0.1c-0.5-0.3-0.9-0.7-1-1.2c-0.2-0.5-0.1-1.1,0.1-1.6c0.9-1.8,1-3.7,0.2-5.5L53,63.8l-0.1-0.3l-0.1-0.3c-0.3,0.3-0.6,0.6-0.8,0.9c-0.2,0.5-0.4,1.1-0.4,1.9c0,0.5-0.2,0.8-0.5,1.2c-0.3,0.3-0.7,0.5-1.2,0.5s-0.8-0.2-1.2-0.5c-0.3-0.3-0.5-0.7-0.5-1.2c0-0.6,0.1-1.3,0.2-1.8c0.5-2.3,1.8-3.8,4.1-4.6l0.2-0.1C55.9,58.6,58.2,59,59.4,60.8'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M49,37.9c-1.1,0.6-2.2,0.7-3.4,0.3c-0.6-0.2-1.1-0.4-1.5-0.7c-0.6-0.4-1-0.9-1.4-1.6c-0.7-1.2-0.8-2.4-0.5-3.7s1.1-2.3,2.3-2.9c1.2-0.7,2.4-0.8,3.7-0.5c1.3,0.4,2.3,1.1,2.9,2.3l0.3,0.7c0.3,0.8,0.4,1.6,0.3,2.4C51.1,35.9,50.2,37.1,49,37.9 M58.3,56.9c0.3,0.3,0.6,0.6,0.9,1c0.5,0.8,0.6,1.7,0.3,2.6l-0.1,0.2c-1.3-1.8-3.5-2.2-6.7-1.3c0-0.3,0-0.5,0.1-0.8c0.2-0.8,0.6-1.4,1.3-1.9l0.1-0.1c1.2-0.5,2.6-0.5,4,0.1L58.3,56.9'/>"
    End Select
    'ears
    Select Case earstate
        Case 1 To 5
            i$ = i$ + "<path fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M24.8,22.9L24.8,22.9l0.1-0.1c0-0.1,0.1-0.1,0-0.2c0-0.1,0-0.1-0.1-0.2c-2.5-1.8-6.2-2.8-11.1-3.1h-0.3l-0.2,0.1l-0.1,0.2V20C18.1,20.4,22,21.3,24.8,22.9'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M16.4,22.4c-0.2,1.5,0.7,2.6,2.7,3.3h0.3l0.3-0.1c1.1-0.5,1.9-1,2.6-1.8c0.1-0.1,0.1-0.1,0.1-0.2s0-0.1-0.1-0.2c-1.2-0.9-2.9-1.4-5.3-1.5h-0.3c-0.1,0-0.1,0-0.2,0.1L16.4,22.4 M13,20.1c5.1,0.3,9,1.2,11.7,2.8c-1.4,1.5-3.1,2.8-5.2,3.8c-0.1,0-0.2,0.1-0.3,0.1c-0.1,0-0.2,0-0.3-0.1c-3.7-1.3-5.6-3.3-5.8-5.7L13,20.1'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M16.4,22.4c-0.2,1.5,0.7,2.6,2.7,3.3h0.3l0.3-0.1c1.1-0.5,1.9-1,2.6-1.8c0.1-0.1,0.1-0.1,0.1-0.2s0-0.1-0.1-0.2c-1.2-0.9-2.9-1.4-5.3-1.5h-0.3c-0.1,0-0.1,0-0.2,0.1L16.4,22.4'/>"
            i$ = i$ + "<path fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M39.6,22.9L39.6,22.9l-0.1-0.1 c0-0.1-0.1-0.1,0-0.2c0-0.1,0-0.1,0.1-0.2c2.5-1.8,6.2-2.8,11.1-3.1H51l0.2,0.1l0.1,0.2V20C46.3,20.4,42.4,21.3,39.6,22.9'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M47.9,22.4l-0.1-0.1c-0.1,0-0.1-0.1-0.2-0.1h-0.3c-2.3,0.1-4.1,0.6-5.3,1.5c-0.1,0-0.1,0.1-0.1,0.2s0,0.1,0.1,0.2c0.7,0.7,1.6,1.3,2.6,1.8l0.3,0.1h0.3C47.2,25,48.1,23.9,47.9,22.4 M51.3,20.1V21c-0.2,2.5-2.2,4.4-5.8,5.7c-0.1,0-0.2,0.1-0.3,0.1s-0.3,0-0.3-0.1c-2.1-1-3.8-2.2-5.2-3.8C42.4,21.3,46.3,20.4,51.3,20.1'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M47.9,22.5c0.2,1.5-0.7,2.6-2.7,3.3h-0.3l-0.3-0.1c-1.1-0.5-1.9-1-2.6-1.8c-0.1-0.1-0.1-0.1-0.1-0.2s0-0.1,0.1-0.2c1.2-0.9,2.9-1.4,5.3-1.5h0.3c0.1,0,0.1,0,0.2,0.1L47.9,22.5'/>"
        Case 6 To 10
            i$ = i$ + "<path fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M25.7,24.7L25.7,24.7l0.1-0.1c0-0.1,0.1-0.1,0.1-0.2c0-0.1,0-0.1,0-0.2c-1.9-2.4-5.2-4.4-9.8-6.1l-0.3-0.1l-0.2,0l-0.2,0.2l-0.1,0.4C19.9,20.5,23.4,22.4,25.7,24.7'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M17.7,21.9c-0.6,1.4-0.1,2.7,1.7,3.9l0.3,0.1l0.3,0c1.2-0.2,2.1-0.4,3-1c0.1-0.1,0.1-0.1,0.2-0.2c0-0.1,0-0.1,0-0.2c-0.9-1.2-2.4-2.2-4.7-2.9l-0.3-0.1c-0.1,0-0.1,0-0.2,0L17.7,21.9 M15.1,18.7c4.8,1.7,8.3,3.7,10.4,6c-1.8,1-3.8,1.8-6.1,2.2c-0.1,0-0.2,0-0.3,0c-0.1,0-0.2-0.1-0.3-0.2c-3.2-2.3-4.5-4.7-4-7.1L15.1,18.7'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M17.7,21.9c-0.6,1.4-0.1,2.7,1.7,3.9l0.3,0.1l0.3,0c1.2-0.2,2.1-0.4,3-1c0.1-0.1,0.1-0.1,0.2-0.2c0-0.1,0-0.1,0-0.2c-0.9-1.2-2.4-2.2-4.7-2.9l-0.3-0.1c-0.1,0-0.1,0-0.2,0L17.7,21.9'/>"
            i$ = i$ + "<path fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M40.3,21.5L40.3,21.5l-0.1-0.1c0-0.1-0.1-0.1,0.1-0.2c0-0.1,0-0.1,0.2-0.2c3-0.8,6.8-0.4,11.5,1.1l0.3,0.1l0.2,0.2l0,0.2L52.3,23C47.4,21.6,43.5,21,40.3,21.5'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M48.2,24l-0.1-0.1c-0.1,0-0.1-0.1-0.2-0.2l-0.3-0.1c-2.2-0.7-4-0.9-5.5-0.5c-0.1,0-0.1,0.1-0.2,0.2c0,0.1,0,0.1,0,0.2c0.4,0.9,1,1.8,1.8,2.6l0.2,0.2l0.3,0.1C46.6,26.2,47.9,25.5,48.2,24 M52.2,23.1L51.9,24c-1.1,2.3-3.6,3.3-7.5,3.2c-0.1,0-0.2,0-0.3,0c-0.1,0-0.3-0.1-0.2-0.2c-1.6-1.7-2.8-3.4-3.5-5.4C43.5,21,47.4,21.6,52.2,23.1'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M48.2,24.2c-0.4,1.5-1.6,2.2-3.7,2.1l-0.3-0.1L44,26c-0.8-0.9-1.4-1.6-1.8-2.6c-0.1-0.1-0.1-0.1,0-0.2c0-0.1,0-0.1,0.2-0.2c1.4-0.4,3.2-0.3,5.5,0.5l0.3,0.1c0.1,0,0.1,0,0.2,0.2L48.2,24.2'/>"
        Case 11 To 15
            i$ = i$ + "<path fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M23.6,21.4L23.6,21.4l0-0.1c0-0.1,0-0.1-0.1-0.2c0-0.1,0-0.1-0.2-0.1c-3-0.5-6.8,0.4-11.3,2.3l-0.3,0.1l-0.1,0.2l0,0.2l0.2,0.4C16.5,22.2,20.3,21.2,23.6,21.4'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M15.9,24.8c0.5,1.4,1.8,2,3.9,1.7l0.3-0.1l0.2-0.2c0.7-0.9,1.2-1.8,1.5-2.8c0-0.1,0-0.1,0-0.2c0-0.1,0-0.1-0.2-0.1c-1.5-0.2-3.2,0.1-5.4,1.1l-0.3,0.1c-0.1,0-0.1,0-0.1,0.2L15.9,24.8 M11.8,24.3c4.7-2.1,8.5-3.1,11.7-2.9c-0.6,2-1.5,3.9-2.9,5.8c-0.1,0-0.1,0.2-0.2,0.2c-0.1,0-0.2,0.1-0.3,0c-3.9,0.5-6.5-0.4-7.8-2.4L11.8,24.3'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M15.9,24.8c0.5,1.4,1.8,2,3.9,1.7l0.3-0.1l0.2-0.2c0.7-0.9,1.2-1.8,1.5-2.8c0-0.1,0-0.1,0-0.2c0-0.1,0-0.1-0.2-0.1c-1.5-0.2-3.2,0.1-5.4,1.1l-0.3,0.1c-0.1,0-0.1,0-0.1,0.2L15.9,24.8'/>"
            i$ = i$ + "<path display='inline' fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M38.4,26L38.4,26l-0.1,0c0-0.1-0.1,0-0.1-0.2c0-0.1,0-0.1,0-0.2c1.4-2.8,4.2-5.4,8.4-7.9l0.3-0.1l0.2,0l0.2,0.1l0.2,0.4C43.2,20.6,40.2,23.3,38.4,26'/>"
            i$ = i$ + "<path display='inline' fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M45.6,21.7l-0.1,0c-0.1,0-0.1,0-0.2,0l-0.3,0.1c-2,1.2-3.4,2.4-4,3.8c-0.1,0,0,0.1,0,0.2c0,0.1,0,0.1,0.2,0.1c0.9,0.3,2,0.4,3.1,0.4l0.3-0.1l0.3-0.1C46.1,24.3,46.4,22.9,45.6,21.7 M47.5,18.1l0.4,0.8c1,2.3,0.1,4.9-2.5,7.7c-0.1,0-0.1,0.2-0.2,0.2c-0.1,0-0.3,0.1-0.3,0.1c-2.3,0.1-4.4-0.2-6.4-0.9C40.2,23.3,43.2,20.6,47.5,18.1'/>"
            i$ = i$ + "<path display='inline' fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M45.6,21.8c0.9,1.2,0.6,2.6-0.9,4.2l-0.3,0.1l-0.3,0.1c-1.2,0.1-2.1,0-3.1-0.4c-0.1,0-0.1,0-0.2-0.1c0-0.1,0-0.1,0-0.2c0.6-1.4,1.9-2.6,4-3.8l0.3-0.1c0.1,0,0.1,0,0.2,0L45.6,21.8'/>"
    End Select

    'i$ = i$ + "<g id='LEGS'>"
    Select Case legstate
        Case 1
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M21.6,55.5c-1.2,0-2.2-0.5-3-1.3L18,53.4c-0.5-0.7-0.7-1.5-0.7-2.4c0-1.2,0.4-2.3,1.3-3.2s1.9-1.3,3.1-1.3c0.7,0,1.4,0.1,2,0.4c0.4,0.2,0.8,0.5,1.2,0.8c0.7,0.7,1.1,1.4,1.2,2.3c0,0.3,0.1,0.6,0.1,0.8c0,1.2-0.4,2.3-1.3,3.1c-0.9,0.9-1.9,1.3-3.2,1.3h-0.1 M19.4,84.4L19,82.9c2.3,0.1,3.7,1.1,4.3,3C22.2,85.1,20.9,84.6,19.4,84.4'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M21.6,55.5c-1.2,0-2.2-0.5-3-1.3L18,53.4c-0.3,0.7-0.5,1.4-0.7,2.1C16,60.6,16.5,74.1,19,82.9c2.3,0.1,3.7,1.1,4.3,3c-1.2-0.8-2.5-1.3-3.9-1.4l-1.3-0.1c-2,0-3.7,0.7-5.1,2.1s-2.1,3-2.1,4.9v0.1c0,0.8,0.7,1.6,2.1,2.2s3.1,0.9,5.1,0.9s3.7-0.3,5.1-0.9s2.1-1.3,2.1-2.2v-0.1c0-0.8-0.2-1.6-0.4-2.4l-0.1-0.3c-4-11.6-5.2-26.6-3.6-32.2L21.6,55.5'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M41.5,55.5h-0.2c-1.2,0-2.3-0.4-3.2-1.3c-0.9-0.9-1.3-1.9-1.3-3.1c0-0.3,0-0.6,0.1-0.8c0.2-0.9,0.6-1.7,1.2-2.3c0.4-0.4,0.8-0.6,1.2-0.8c0.6-0.3,1.3-0.4,2-0.4c1.2,0,2.3,0.4,3.1,1.3c0.9,0.9,1.3,1.9,1.3,3.2c0,0.9-0.2,1.7-0.7,2.4l-0.6,0.8C43.6,55,42.6,55.4,41.5,55.5 M43.7,78c-1.4,0.2-2.7,0.7-3.9,1.4c0.6-1.9,2-2.9,4.3-3L43.7,78'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M41.5,55.5c1.2,0,2.2-0.5,3-1.3l0.6-0.8c0.3,0.7,0.5,1.4,0.7,2.1c1.3,5.1,0.8,12.1-1.7,20.9c-2.3,0.1-3.7,1.1-4.3,3c1.2-0.8,2.5-1.3,3.9-1.4l1.3-0.1c2,0,3.7,0.7,5.1,2.1c1.4,1.4,2.1,3,2.1,4.9V85c0,0.8-0.7,1.6-2.1,2.2c-1.4,0.6-3.1,0.9-5.1,0.9s-3.7-0.3-5.1-0.9c-1.4-0.6-2.1-1.3-2.1-2.2v-0.1c0-0.8,0.2-1.6,0.4-2.4l0.1-0.3c4-11.6,5.2-20.2,3.6-25.8L41.5,55.5'/>"
        Case 2
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M41.9,56h-0.2c-1.2,0-2.3-0.4-3.2-1.3c-0.9-0.9-1.3-1.9-1.3-3.1c0-0.3,0-0.6,0.1-0.8c0.2-0.9,0.6-1.7,1.2-2.3c0.4-0.4,0.8-0.6,1.2-0.8c0.6-0.3,1.3-0.4,2-0.4c1.2,0,2.3,0.4,3.1,1.3c0.9,0.9,1.3,1.9,1.3,3.2c0,0.9-0.2,1.7-0.7,2.4L44.8,55C44,55.5,43.1,55.9,41.9,56 M44.1,84.9c-1.4,0.2-2.7,0.7-3.9,1.4c0.6-1.9,2-2.9,4.3-3L44.1,84.9'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M41.9,56c1.2,0,2.2-0.5,3-1.3l0.6-0.8c0.3,0.7,0.5,1.4,0.7,2.1c1.3,5.1,0.8,18.5-1.7,27.4c-2.3,0.1-3.7,1.1-4.3,3c1.2-0.8,2.5-1.3,3.9-1.4l1.3-0.1c2,0,3.7,0.7,5.1,2.1c1.4,1.4,2.1,3,2.1,4.9V92c0,0.8-0.7,1.6-2.1,2.2C49,94.7,47.3,95,45.3,95s-3.7-0.3-5.1-0.9c-1.4-0.6-2.1-1.3-2.1-2.2v-0.1c0-0.8,0.2-1.6,0.4-2.4l0.1-0.3c4-11.6,5.2-26.6,3.6-32.2L41.9,56'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M22.1,56c-1.2,0-2.2-0.5-3-1.3l-0.6-0.8c-0.5-0.7-0.7-1.5-0.7-2.4c0-1.2,0.4-2.3,1.3-3.2S21,47,22.2,47c0.7,0,1.4,0.1,2,0.4c0.4,0.2,0.8,0.5,1.2,0.8c0.7,0.7,1.1,1.4,1.2,2.3c0,0.3,0.1,0.6,0.1,0.8c0,1.2-0.4,2.3-1.3,3.1c-0.9,0.9-1.9,1.3-3.2,1.3h-0.1 M19.8,78.5L19.4,77c2.3,0.1,3.7,1.1,4.3,3C22.6,79.2,21.3,78.7,19.8,78.5'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M22.1,56c-1.2,0-2.2-0.5-3-1.3l-0.6-0.8c-0.3,0.7-0.5,1.4-0.7,2.1c-1.4,5.2-0.8,12.1,1.6,21c2.3,0.1,3.7,1.1,4.3,3c-1.2-0.8-2.5-1.3-3.9-1.4l-1.3-0.1c-2,0-3.7,0.7-5.1,2.1s-2.1,3-2.1,4.9v0.1c0,0.8,0.7,1.6,2.1,2.2s3.1,0.9,5.1,0.9s3.7-0.3,5.1-0.9s2.1-1.3,2.1-2.2v-0.1c0-0.8-0.2-1.6-0.4-2.4l-0.1-0.3c-4-11.6-5.2-20.2-3.6-25.8L22.1,56'/>"
        Case 3
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M41.9,55.5h-0.2c-1.2,0-2.3-0.4-3.2-1.3c-0.9-0.9-1.3-1.9-1.3-3.1c0-0.3,0-0.6,0.1-0.8c0.2-0.9,0.6-1.7,1.2-2.3c0.4-0.4,0.8-0.6,1.2-0.8c0.6-0.3,1.3-0.4,2-0.4c1.2,0,2.3,0.4,3.1,1.3c0.9,0.9,1.3,1.9,1.3,3.2c0,0.9-0.2,1.7-0.7,2.4l-0.6,0.8C44.1,55,43.1,55.4,41.9,55.5 M44.1,84.4c-1.4,0.2-2.7,0.7-3.9,1.4c0.6-1.9,2-2.9,4.3-3L44.1,84.4'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M41.9,55.5c1.2,0,2.2-0.5,3-1.3l0.6-0.8c0.3,0.7,0.5,1.4,0.7,2.1c1.3,5.1,0.8,18.5-1.7,27.4c-2.3,0.1-3.7,1.1-4.3,3c1.2-0.8,2.5-1.3,3.9-1.4l1.3-0.1c2,0,3.7,0.7,5.1,2.1c1.4,1.4,2.1,3,2.1,4.9v0.1c0,0.8-0.7,1.6-2.1,2.2c-1.4,0.6-3.1,0.9-5.1,0.9s-3.7-0.3-5.1-0.9c-1.4-0.6-2.1-1.3-2.1-2.2v-0.1c0-0.8,0.2-1.6,0.4-2.4l0.1-0.3c4-11.6,5.2-26.6,3.6-32.2L41.9,55.5'/>"
            i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M22.1,55.5c-1.2,0-2.2-0.5-3-1.3l-0.6-0.8c-0.5-0.7-0.7-1.5-0.7-2.4c0-1.2,0.4-2.3,1.3-3.2s1.9-1.3,3.1-1.3c0.7,0,1.4,0.1,2,0.4c0.4,0.2,0.8,0.5,1.2,0.8c0.7,0.7,1.1,1.4,1.2,2.3c0,0.3,0.1,0.6,0.1,0.8c0,1.2-0.4,2.3-1.3,3.1c-0.9,0.9-1.9,1.3-3.2,1.3h-0.1 M19.9,84.4l-0.4-1.5c2.3,0.1,3.7,1.1,4.3,3C22.6,85.1,21.3,84.6,19.9,84.4'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M22.1,55.5c-1.2,0-2.2-0.5-3-1.3l-0.6-0.8c-0.3,0.7-0.5,1.4-0.7,2.1C16.5,60.6,17,74,19.5,82.9c2.3,0.1,3.7,1.1,4.3,3c-1.2-0.8-2.5-1.3-3.9-1.4l-1.3-0.1c-2,0-3.7,0.7-5.1,2.1s-2.1,3-2.1,4.9v0.1c0,0.8,0.7,1.6,2.1,2.2s3.1,0.9,5.1,0.9s3.7-0.3,5.1-0.9s2.1-1.3,2.1-2.2v-0.1c0-0.8-0.2-1.6-0.4-2.4l-0.1-0.3c-4-11.6-5.2-26.6-3.6-32.2L22.1,55.5'/>"
    End Select
    i$ = i$ + "<path fill='#62BE74' stroke='#62BE74' stroke-width='0.25' stroke-miterlimit='10' d='M46.7,38.3c-0.1-2-0.3-4.1-0.7-6.3c-0.7-3.5-2.2-6.3-4.6-8.4c-2.5-2.2-5.5-3.2-9-3.2H32h-0.3c-3.5,0-6.5,1.1-9,3.2c-2.4,2.1-4,4.9-4.6,8.4c-0.4,2.2-0.7,4.3-0.7,6.3v-0.7c0-2.4,0.2-5,0.7-7.7c0.7-3.5,2.2-6.3,4.6-8.4c2.5-2.2,5.5-3.2,9-3.2H32h0.3c3.5,0,6.5,1.1,9,3.2c2.4,2.1,4,4.9,4.6,8.4c0.5,2.7,0.8,5.3,0.7,7.7L46.7,38.3'/>"
    i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M46.7,38.3c-0.1,2.3-0.4,4.4-0.9,6.4c-0.5,1.7-1.1,3.3-2,4.8c-1.3,2.4-3,4.6-5.1,6.5c-1.9,1.7-4,2.6-6.4,2.6H32h-0.3c-2.4,0-4.5-0.9-6.4-2.6c-2.1-1.9-3.8-4.1-5.1-6.5c-0.8-1.5-1.5-3.1-1.9-4.8c-0.6-2-0.9-4.1-0.9-6.4c0.1-2,0.3-4.1,0.7-6.3c0.7-3.5,2.2-6.3,4.6-8.4c2.5-2.2,5.5-3.2,9-3.2H32h0.3c3.5,0,6.5,1.1,9,3.2c2.4,2.1,4,4.9,4.6,8.4C46.4,34.2,46.6,36.3,46.7,38.3'/>"
    'i$ = i$ + "<g id='NOSE'>"  'jeepers this is inefficient... definetely would need a re-edit if used in a lrger progrM
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M35,34.6L35,34.6v0.2v0.1"
    i$ = i$ + "c0,0.1,0,0.3-0.1,0.4v0.1v0.1l0,0c-0.3,0.8-0.8,1.5-1.3,1.9c-0.3,0.2-0.6,0.4-0.9,0.5C32.5,38,32.2,38,32,38s-0.4,0-0.6-0.1"
    i$ = i$ + "c-0.3-0.1-0.6-0.2-0.9-0.5l0,0c-0.6-0.4-1-1.1-1.3-1.9l0,0v-0.1v-0.1C29,35.2,29,35.1,29,34.9v-0.1v-0.1v-0.1"
    i$ = i$ + "c0,0.1,0,0.2,0.1,0.4v0.1v0.1l0,0c0.3,0.8,0.8,1.5,1.3,1.9l0,0c0.3,0.2,0.6,0.4,0.9,0.5c0.2,0.1,0.4,0.1,0.6,0.1"
    i$ = i$ + "c0.2,0,0.4,0,0.6-0.1c0.3-0.1,0.6-0.2,0.9-0.5c0.6-0.4,1-1.1,1.3-1.9l0,0v-0.1V35C35,34.8,35,34.7,35,34.6'/>"
    i$ = i$ + "<path fill='#342A1E' stroke='#342A1E' stroke-width='0.25' stroke-miterlimit='10' d='M35,34.6c0,0.1,0,0.2-0.1,0.3V35v0.1l0,0"
    i$ = i$ + "c-0.3,0.8-0.8,1.5-1.3,1.9c-0.3,0.2-0.6,0.4-0.9,0.5l-0.7,0l-0.6-0.1c-0.3-0.1-0.6-0.2-0.9-0.5l0,0c-0.6-0.4-1-1.1-1.3-1.9l0,0"
    i$ = i$ + "v-0.1v-0.1c0-0.1-0.1-0.3-0.1-0.4c0-0.2,0-0.4,0.1-0.6l0.1-0.1l0.1-0.1C30,33.2,30.9,33,32,33s2,0.2,2.6,0.6l0,0l0.1,0.1l0.1,0.1"
    i$ = i$ + "C35,34.2,35,34.4,35,34.6 M33.5,36.2c0.2-0.2,0.3-0.4,0.3-0.6c0.1-0.2,0-0.3-0.1-0.5S33.4,35,33.2,35s-0.4,0.2-0.6,0.3"
    i$ = i$ + "c-0.2,0.2-0.3,0.4-0.3,0.6c0,0.2,0,0.4,0.1,0.5s0.3,0.1,0.5,0.1C33.2,36.5,33.4,36.4,33.5,36.2 M30.5,36.2"
    i$ = i$ + "c0.2,0.2,0.4,0.3,0.6,0.3c0.2,0.1,0.3,0,0.5-0.1c0.1-0.1,0.1-0.3,0.1-0.5s-0.2-0.4-0.3-0.6C31.2,35.1,31,35,30.8,35"
    i$ = i$ + "s-0.4,0-0.5,0.1s-0.1,0.3-0.1,0.5C30.2,35.9,30.3,36.1,30.5,36.2'/>"
    i$ = i$ + "<path fill='#25201A' stroke='#25201A' stroke-width='0.25' stroke-miterlimit='10' d='M30.5,36.2c-0.2-0.2-0.3-0.4-0.3-0.6"
    i$ = i$ + "c-0.1-0.2,0-0.3,0.1-0.5c0.1-0.1,0.3-0.1,0.5-0.1s0.4,0.2,0.6,0.3c0.2,0.2,0.3,0.4,0.3,0.6c0,0.2,0,0.4-0.1,0.5s-0.3,0.1-0.5,0.1"
    i$ = i$ + "S30.7,36.4,30.5,36.2 M33.5,36.2c-0.2,0.2-0.4,0.3-0.6,0.3c-0.2,0.1-0.3,0-0.5-0.1c-0.1-0.1-0.1-0.3-0.1-0.5s0.2-0.4,0.3-0.6"
    i$ = i$ + "c0.2-0.2,0.4-0.3,0.6-0.3c0.2,0,0.4,0,0.5,0.1s0.1,0.3,0.1,0.5C33.8,35.9,33.7,36.1,33.5,36.2'/>"
    i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M29.1,34c0.1-0.2,0.3-0.4,0.5-0.6"
    i$ = i$ + "c0.6-0.4,1.4-0.7,2.3-0.7c1,0,1.8,0.2,2.3,0.7l0,0c0.2,0.2,0.4,0.4,0.5,0.6l-0.1-0.1l-0.1-0.1l0,0c-0.6-0.4-1.5-0.6-2.6-0.6"
    i$ = i$ + "s-2,0.2-2.6,0.6l-0.1,0.1L29.1,34 M32.7,37.5c-0.2,0.1-0.4,0.1-0.6,0.1c-0.2,0-0.4,0-0.6-0.1l0.6,0.1L32.7,37.5'/>"
    i$ = i$ + "<text transform='matrix(1 0 0 1 3.0571 10)' font-family=''MyriadPro-Regular'' font-size='8px'>Nose</text>"
    'i$ = i$ + "<g id='EYES'>"
    i$ = i$ + "<path fill='#EF4864' stroke='#EF4864' stroke-width='0.25' stroke-miterlimit='10' d='M22.9,29.2c0.1-0.2,0.3-0.5,0.6-0.7c0.1-0.1,0.2-0.2,0.4-0.3c0.2-0.1,0.4-0.2,0.6-0.3c0.6-0.2,1.3-0.3,2-0.3c0.8,0,1.5,0.1,2.1,0.4c0.2,0.1,0.4,0.2,0.5,0.3c0.5,0.3,0.8,0.6,1,1v0.1l0,0v0.1v0.2c-0.1,0.8-0.4,1.6-1,2.2c-0.4,0.4-0.9,0.7-1.5,0.9c-0.3,0.1-0.7,0.1-1,0.1s-0.7,0-1-0.1c-0.6-0.2-1.1-0.5-1.5-0.9c-0.2-0.2-0.3-0.4-0.5-0.6c-0.3-0.5-0.5-1-0.6-1.6v-0.2v-0.1l0,0L22.9,29.2 M27,28.5c-0.1-0.2-0.3-0.3-0.4-0.4h-0.1h-0.1c-0.1,0.1-0.3,0.2-0.4,0.4c-0.3,0.5-0.5,1-0.5,1.6s0.2,1.2,0.5,1.6c0.1,0.2,0.3,0.3,0.4,0.4h0.1h0.1c0.1-0.1,0.3-0.3,0.4-0.4c0.3-0.4,0.5-1,0.5-1.6C27.5,29.5,27.3,29,27,28.5'/>"
    i$ = i$ + "<path fill='#342A1E' stroke='#342A1E' stroke-width='0.25' stroke-miterlimit='10' d='M27,28.5c0.3,0.5,0.5,1,0.5,1.6s-0.2,1.2-0.5,1.6c-0.1,0.2-0.3,0.3-0.4,0.4h-0.1h-0.1c-0.1-0.1-0.3-0.3-0.4-0.4c-0.3-0.4-0.5-1-0.5-1.6s0.2-1.2,0.5-1.6c0.1-0.2,0.3-0.3,0.4-0.4h0.1h0.1C26.7,28.2,26.8,28.4,27,28.5 M25.9,29.6L25.9,29.6L25.9,29.6c0.1,0.2,0.1,0.2,0.2,0.3l0,0l0.2,0.1h0.1h0.1l0,0l0.2-0.1c0.1-0.1,0.2-0.1,0.2-0.2v-0.1l0,0c0-0.3-0.1-0.6-0.3-0.8l-0.2-0.2l0,0h-0.1c-0.1,0-0.1,0-0.1,0L26,28.8C26,29.1,25.9,29.3,25.9,29.6'/>"
    i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M25.9,29.6c0-0.3,0.1-0.6,0.3-0.8l0.2-0.2h0.1c0.1,0,0.1,0,0.1,0l0,0l0.2,0.2c0.2,0.2,0.3,0.5,0.3,0.8l0,0v0.1c0,0.1-0.1,0.1-0.2,0.2L26.6,30l0,0h-0.1h-0.1l-0.2-0.1l0,0C26,29.9,25.9,29.8,25.9,29.6L25.9,29.6L25.9,29.6'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M30,29.7L30,29.7v0.2l0,0V30c0,0.9-0.4,1.8-1,2.4c-0.4,0.4-0.9,0.7-1.5,0.9c-0.3,0.1-0.7,0.1-1,0.1s-0.7,0-1-0.1c-0.6-0.2-1.1-0.5-1.5-0.9"
    i$ = i$ + "c-0.2-0.2-0.3-0.4-0.5-0.6c-0.4-0.5-0.6-1.2-0.6-1.9v-0.1l0,0v-0.2v-0.1c0,0.6,0.2,1.1,0.6,1.6c0.1,0.2,0.3,0.4,0.5,0.6"
    i$ = i$ + "c0.4,0.5,1,0.8,1.5,0.9c0.3,0.1,0.6,0.1,1,0.1s0.7,0,1-0.1c0.6-0.2,1-0.5,1.5-0.9C29.6,31.2,29.9,30.5,30,29.7'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M22.9,29.2c0-0.4,0.2-0.8,0.6-1.1"
    i$ = i$ + "c0.1-0.1,0.3-0.2,0.5-0.4c0.7-0.5,1.5-0.7,2.5-0.7s1.8,0.2,2.5,0.7c0.6,0.4,1,0.9,1,1.5c-0.1-0.4-0.5-0.7-1-1"
    i$ = i$ + "c-0.2-0.1-0.3-0.2-0.5-0.3c-0.6-0.2-1.3-0.4-2.1-0.4c-0.8,0-1.4,0.1-2,0.3c-0.2,0.1-0.4,0.2-0.6,0.3c-0.1,0.1-0.3,0.2-0.4,0.3"
    i$ = i$ + "C23.2,28.7,23,28.9,22.9,29.2'/>"
    i$ = i$ + "<path fill='#EF4864' stroke='#EF4864' stroke-width='0.25' stroke-miterlimit='10' d='M33.8,29.2c0.1-0.2,0.3-0.5,0.6-0.7c0.1-0.1,0.2-0.2,0.4-0.3c0.2-0.1,0.4-0.2,0.6-0.3c0.6-0.2,1.3-0.3,2-0.3c0.8,0,1.5,0.1,2.1,0.4c0.2,0.1,0.4,0.2,0.5,0.3c0.5,0.3,0.8,0.6,1,1v0.1l0,0v0.1v0.2c-0.1,0.8-0.4,1.6-1,2.2c-0.4,0.4-0.9,0.7-1.5,0.9c-0.3,0.1-0.7,0.1-1,0.1s-0.7,0-1-0.1c-0.6-0.2-1.1-0.5-1.5-0.9c-0.2-0.2-0.3-0.4-0.5-0.6c-0.3-0.5-0.5-1-0.6-1.6v-0.2v-0.1l0,0L33.8,29.2 M37.8,28.5c-0.1-0.2-0.3-0.3-0.4-0.4h-0.1h-0.1c-0.1,0.1-0.3,0.2-0.4,0.4c-0.3,0.5-0.5,1-0.5,1.6s0.2,1.2,0.5,1.6c0.1,0.2,0.3,0.3,0.4,0.4h0.1h0.1c0.1-0.1,0.3-0.3,0.4-0.4c0.3-0.4,0.5-1,0.5-1.6C38.3,29.5,38.2,29,37.8,28.5'/>"
    i$ = i$ + "<path fill='#342A1E' stroke='#342A1E' stroke-width='0.25' stroke-miterlimit='10' d='M37.8,28.5c0.3,0.5,0.5,1,0.5,1.6s-0.2,1.2-0.5,1.6c-0.1,0.2-0.3,0.3-0.4,0.4h-0.1h-0.1c-0.1-0.1-0.3-0.3-0.4-0.4c-0.3-0.4-0.5-1-0.5-1.6s0.2-1.2,0.5-1.6c0.1-0.2,0.3-0.3,0.4-0.4h0.1h0.1C37.6,28.2,37.7,28.4,37.8,28.5 M36.7,29.6L36.7,29.6L36.7,29.6c0.1,0.2,0.1,0.2,0.2,0.3l0,0l0.2,0.1h0.1h0.1l0,0l0.2-0.1c0.1-0.1,0.2-0.1,0.2-0.2v-0.1l0,0c0-0.3-0.1-0.6-0.3-0.8l-0.2-0.2l0,0h-0.1c-0.1,0-0.1,0-0.1,0l0,0.2C36.8,29.1,36.7,29.3,36.7,29.6'/>"
    i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M36.7,29.6c0-0.3,0.1-0.6,0.3-0.8l0.2-0.2h0.1c0.1,0,0.1,0,0.1,0l0,0l0.2,0.2c0.2,0.2,0.3,0.5,0.3,0.8l0,0v0.1c0,0.1-0.1,0.1-0.2,0.2L37.4,30l0,0h-0.1h-0.1L37,29.9l0,0C36.9,29.9,36.8,29.8,36.7,29.6L36.7,29.6L36.7,29.6'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M40.9,29.7L40.9,29.7v0.2l0,0V30c0,0.9-0.4,1.8-1,2.4c-0.4,0.4-0.9,0.7-1.5,0.9c-0.3,0.1-0.7,0.1-1,0.1s-0.7,0-1-0.1c-0.6-0.2-1.1-0.5-1.5-0.9c-0.2-0.2-0.3-0.4-0.5-0.6c-0.4-0.5-0.6-1.2-0.6-1.9v-0.1l0,0v-0.2v-0.1c0,0.6,0.2,1.1,0.6,1.6c0.1,0.2,0.3,0.4,0.5,0.6c0.4,0.5,1,0.8,1.5,0.9c0.3,0.1,0.6,0.1,1,0.1s0.7,0,1-0.1c0.6-0.2,1-0.5,1.5-0.9C40.4,31.2,40.8,30.5,40.9,29.7'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M33.8,29.2c0-0.4,0.2-0.8,0.6-1.1c0.1-0.1,0.3-0.2,0.5-0.4c0.7-0.5,1.5-0.7,2.5-0.7s1.8,0.2,2.5,0.7c0.6,0.4,1,0.9,1,1.5c-0.1-0.4-0.5-0.7-1-1c-0.2-0.1-0.3-0.2-0.5-0.3c-0.6-0.2-1.3-0.4-2.1-0.4s-1.4,0.1-2,0.3c-0.2,0.1-0.4,0.2-0.6,0.3c-0.1,0.1-0.3,0.2-0.4,0.3C34.1,28.7,33.9,28.9,33.8,29.2'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M30,29.7L30,29.7v0.2l0,0V30c0,0.9-0.4,1.8-1,2.4c-0.4,0.4-0.9,0.7-1.5,0.9c-0.3,0.1-0.7,0.1-1,0.1s-0.7,0-1-0.1c-0.6-0.2-1.1-0.5-1.5-0.9c-0.2-0.2-0.3-0.4-0.5-0.6c-0.4-0.5-0.6-1.2-0.6-1.9v-0.1l0,0v-0.2v-0.1C23,30.3,29.9,30.5,30,29.7'/>"

    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M22.9,29.2c0-0.4,0.2-0.8,0.6-1.1c0.1-0.1,0.3-0.2,0.5-0.4c0.7-0.5,1.5-0.7,2.5-0.7s1.8,0.2,2.5,0.7c0.6,0.4,1,0.9,1,1.5c-0.1-0.4-2.7-0.5-3.5-0.5C25.8,28.7,23,28.9,22.9,29.2'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M40.9,29.7L40.9,29.7v0.2l0,0V30c0,0.9-0.4,1.8-1,2.4c-0.4,0.4-0.9,0.7-1.5,0.9c-0.3,0.1-0.7,0.1-1,0.1s-0.7,0-1-0.1c-0.6-0.2-1.1-0.5-1.5-0.9c-0.2-0.2-0.3-0.4-0.5-0.6c-0.4-0.5-0.6-1.2-0.6-1.9v-0.1l0,0v-0.2v-0.1C33.8,30.3,40.8,30.5,40.9,29.7'/>"
    i$ = i$ + "<path fill='#29B464' stroke='#29B464' stroke-width='0.25' stroke-miterlimit='10' d='M33.8,29.2c0-0.4,0.2-0.8,0.6-1.1c0.1-0.1,0.3-0.2,0.5-0.4c0.7-0.5,1.5-0.7,2.5-0.7s1.8,0.2,2.5,0.7c0.6,0.4,1,0.9,1,1.5c-0.1-0.4-2.7-0.5-3.5-0.5S33.9,28.9,33.8,29.2'/>"
    i$ = i$ + "<path fill='#342A1E' stroke='#342A1E' stroke-width='0.25' stroke-miterlimit='10' d='M41.1,25.1c0,0.1,0,0.1-0.1,0.2c-0.4,0.4-0.6,0.7-0.7,1.1c0,0.1-0.1,0.2-0.2,0.2c-0.1,0.1-0.2,0.1-0.3,0.1c-2.4,0-4.4,0.2-5.8,0.8h-0.3c-0.1,0-0.2,0-0.3-0.1c-0.1,0-0.1-0.1-0.2-0.1l-0.5-0.7l-0.1-0.1v-0.1c0-0.1,0-0.1,0.1-0.2c0.5-0.6,1.4-1.1,2.7-1.6c0.1,0,0.2-0.1,0.3,0c0.1,0,0.2,0.1,0.3,0.1c0.1,0.1,0.1,0.1,0.1,0.2V25c0.4-0.2,1-0.4,1.6-0.5c0.1,0,0.2,0,0.3,0s0.2,0.1,0.3,0.1c0.1,0.1,0.1,0.1,0.1,0.2V25c0.6-0.2,1.3-0.3,2.1-0.3c0.1,0,0.3,0,0.4,0.1C41,24.9,41.1,24.9,41.1,25.1L41.1,25.1'/>"
    i$ = i$ + "<path fill='#342A1E' stroke='#342A1E' stroke-width='0.25' stroke-miterlimit='10' d='M22.7,25.1c0,0.1,0,0.1,0.1,0.2c0.4,0.4,0.6,0.7,0.7,1.1c0,0.1,0.1,0.2,0.2,0.2c0.1,0.1,0.2,0.1,0.3,0.1c2.4,0,4.4,0.2,5.8,0.8h0.3c0.1,0,0.2,0,0.3-0.1c0.1,0,0.1-0.1,0.2-0.1l0.5-0.7l0.1-0.1v-0.1c0-0.1,0-0.1-0.1-0.2c-0.5-0.6-1.4-1.1-2.7-1.6c-0.1,0-0.2-0.1-0.3,0c-0.1,0-0.2,0.1-0.3,0.1c-0.1,0.1-0.1,0.1-0.1,0.2V25c-0.4-0.2-1-0.4-1.6-0.5c-0.1,0-0.2,0-0.3,0c-0.1,0-0.2,0.1-0.3,0.1c-0.1,0.1-0.1,0.1-0.1,0.2V25c-0.6-0.2-1.3-0.3-2.1-0.3c-0.1,0-0.3,0-0.4,0.1S22.7,24.9,22.7,25.1L22.7,25.1'/>"

    'i$ = i$ + "<g id='Antenna'>"
    Select Case antennastate
        Case 1
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M38.8,12.5l-0.3-0.3c-0.2-0.2-0.3-0.4-0.4-0.6c-0.1-0.3-0.2-0.5-0.2-0.8c0-0.5,0.2-1,0.6-1.4c0.4-0.4,0.8-0.6,1.4-0.6s1,0.2,1.4,0.6c0.4,0.4,0.6,0.9,0.6,1.4s-0.2,1-0.6,1.4c-0.4,0.4-0.8,0.6-1.4,0.6C39.5,12.8,39.1,12.7,38.8,12.5 M35.6,18l-0.2,1.1c0,0.1,0,0.3,0.1,0.4s0.2,0.2,0.4,0.2c0.1,0,0.3,0,0.4-0.1c0.1-0.1,0.2-0.2,0.2-0.4c0-0.3,0.1-0.7,0.2-1l0.1,0.1c0.2,0.3,0.4,0.6,0.4,0.9c0,0.4-0.1,0.7-0.4,0.9c-0.2,0.3-0.5,0.4-0.9,0.4s-0.6-0.1-0.9-0.4c-0.2-0.3-0.4-0.6-0.4-0.9c0-0.4,0.1-0.7,0.4-0.9C35.1,18.2,35.3,18.1,35.6,18'/>"
            i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M35.6,18c0.5-2.5,1.3-4.7,2.5-6.4c0.1,0.2,0.2,0.4,0.4,0.6l0.3,0.3c-1,1.6-1.8,3.5-2.2,5.8c-0.1,0.3-0.1,0.6-0.2,1c0,0.1-0.1,0.3-0.2,0.4c-0.1,0.1-0.3,0.1-0.4,0.1c-0.2,0-0.3-0.1-0.4-0.2c-0.1-0.1-0.1-0.3-0.1-0.4L35.6,18'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M25,12.5c-0.3,0.2-0.7,0.3-1,0.3c-0.5,0-1-0.2-1.4-0.6c-0.4-0.4-0.6-0.9-0.6-1.4s0.2-1,0.6-1.4s0.8-0.6,1.4-0.6s1,0.2,1.4,0.6c0.4,0.4,0.6,0.9,0.6,1.4c0,0.3-0.1,0.5-0.2,0.8c-0.1,0.2-0.2,0.4-0.4,0.6L25,12.5 M28.2,18c0.3,0,0.5,0.2,0.7,0.3c0.2,0.3,0.4,0.6,0.4,0.9c0,0.4-0.1,0.7-0.4,0.9c-0.2,0.3-0.5,0.4-0.9,0.4s-0.6-0.1-0.9-0.4c-0.2-0.3-0.4-0.6-0.4-0.9c0-0.4,0.1-0.7,0.4-0.9l0.1-0.1c0.1,0.3,0.1,0.6,0.2,1c0,0.1,0.1,0.3,0.2,0.4s0.3,0.1,0.4,0.1c0.2,0,0.3-0.1,0.4-0.2s0.1-0.3,0.1-0.4L28.2,18'/>"
            i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M28.2,18c-0.5-2.5-1.3-4.7-2.5-6.4c-0.1,0.2-0.2,0.4-0.4,0.6L25,12.5c1,1.6,1.8,3.5,2.2,5.8c0.1,0.3,0.1,0.6,0.2,1c0,0.1,0.1,0.3,0.2,0.4s0.3,0.1,0.4,0.1c0.2,0,0.3-0.1,0.4-0.2s0.1-0.3,0.1-0.4L28.2,18'/>"
        Case 2
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M39.7,13.4l-0.3-0.3c-0.2-0.2-0.3-0.4-0.4-0.6c-0.1-0.3-0.2-0.5-0.2-0.8c0-0.5,0.2-1,0.6-1.4c0.4-0.4,0.8-0.6,1.4-0.6c0.5,0,1,0.2,1.4,0.6c0.4,0.4,0.6,0.9,0.6,1.4s-0.2,1-0.6,1.4c-0.4,0.4-0.8,0.6-1.4,0.6C40.4,13.7,40,13.6,39.7,13.4 M35.6,18l-0.2,1.1c0,0.1,0,0.3,0.1,0.4s0.2,0.2,0.4,0.2c0.1,0,0.3,0,0.4-0.1c0.1-0.1,0.2-0.2,0.2-0.4c0-0.3,0.1-0.7,0.2-1l0.1,0.1c0.2,0.3,0.4,0.6,0.4,0.9c0,0.4-0.1,0.7-0.4,0.9c-0.2,0.3-0.5,0.4-0.9,0.4s-0.6-0.1-0.9-0.4c-0.2-0.3-0.4-0.6-0.4-0.9c0-0.4,0.1-0.7,0.4-0.9C35.1,18.2,35.3,18.1,35.6,18'/>"
            i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M35.6,18c0.4-4.3,2.2-3.8,3.4-5.5c0.1,0.2,0.2,0.4,0.4,0.6l0.3,0.3c-1,1.6-2.8,1.2-3.1,4.9c-0.1,0.3-0.1,0.6-0.2,1c0,0.1-0.1,0.3-0.2,0.4c-0.1,0.1-0.3,0.1-0.4,0.1c-0.2,0-0.3-0.1-0.4-0.2c-0.1-0.1-0.1-0.3-0.1-0.4L35.6,18'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M25,12.5c-0.3,0.2-0.7,0.3-1,0.3c-0.5,0-1-0.2-1.4-0.6c-0.4-0.4-0.6-0.9-0.6-1.4s0.2-1,0.6-1.4s0.8-0.6,1.4-0.6s1,0.2,1.4,0.6c0.4,0.4,0.6,0.9,0.6,1.4c0,0.3-0.1,0.5-0.2,0.8c-0.1,0.2-0.2,0.4-0.4,0.6L25,12.5 M28.2,18c0.3,0,0.5,0.2,0.7,0.3c0.2,0.3,0.4,0.6,0.4,0.9c0,0.4-0.1,0.7-0.4,0.9c-0.2,0.3-0.5,0.4-0.9,0.4s-0.6-0.1-0.9-0.4c-0.2-0.3-0.4-0.6-0.4-0.9c0-0.4,0.1-0.7,0.4-0.9l0.1-0.1c0.1,0.3,0.1,0.6,0.2,1c0,0.1,0.1,0.3,0.2,0.4s0.3,0.1,0.4,0.1c0.2,0,0.3-0.1,0.4-0.2s0.1-0.3,0.1-0.4L28.2,18'/>"
            i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M28.2,18c-0.5-2.5-1.3-4.7-2.5-6.4c-0.1,0.2-0.2,0.4-0.4,0.6L25,12.5c1,1.6,1.8,3.5,2.2,5.8c0.1,0.3,0.1,0.6,0.2,1c0,0.1,0.1,0.3,0.2,0.4s0.3,0.1,0.4,0.1c0.2,0,0.3-0.1,0.4-0.2s0.1-0.3,0.1-0.4L28.2,18'/>"
        Case 3
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M38.8,12.5l-0.3-0.3c-0.2-0.2-0.3-0.4-0.4-0.6c-0.1-0.3-0.2-0.5-0.2-0.8c0-0.5,0.2-1,0.6-1.4c0.4-0.4,0.8-0.6,1.4-0.6s1,0.2,1.4,0.6c0.4,0.4,0.6,0.9,0.6,1.4s-0.2,1-0.6,1.4c-0.4,0.4-0.8,0.6-1.4,0.6C39.5,12.8,39.1,12.7,38.8,12.5 M35.6,18l-0.2,1.1c0,0.1,0,0.3,0.1,0.4s0.2,0.2,0.4,0.2c0.1,0,0.3,0,0.4-0.1c0.1-0.1,0.2-0.2,0.2-0.4c0-0.3,0.1-0.7,0.2-1l0.1,0.1c0.2,0.3,0.4,0.6,0.4,0.9c0,0.4-0.1,0.7-0.4,0.9c-0.2,0.3-0.5,0.4-0.9,0.4s-0.6-0.1-0.9-0.4c-0.2-0.3-0.4-0.6-0.4-0.9c0-0.4,0.1-0.7,0.4-0.9C35.1,18.1,35.3,18,35.6,18'/>"
            i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M35.6,18c0.5-2.5,1.3-4.7,2.5-6.4c0.1,0.2,0.2,0.4,0.4,0.6l0.3,0.3c-1,1.6-1.8,3.5-2.2,5.8c-0.1,0.3-0.1,0.6-0.2,1c0,0.1-0.1,0.3-0.2,0.4c-0.1,0.1-0.3,0.1-0.4,0.1c-0.2,0-0.3-0.1-0.4-0.2c-0.1-0.1-0.1-0.3-0.1-0.4L35.6,18'/>"
            i$ = i$ + "<path fill='#4FBA6F' stroke='#4FBA6F' stroke-width='0.25' stroke-miterlimit='10' d='M23,13.7c-0.2,0.3-0.5,0.5-0.9,0.6c-0.5,0.2-1,0.1-1.5-0.2s-0.8-0.6-1-1.2c-0.2-0.5-0.1-1,0.1-1.5c0.3-0.5,0.6-0.8,1.1-1s1-0.1,1.5,0.1c0.5,0.3,0.8,0.7,1,1.2c0.1,0.3,0.1,0.5,0.1,0.8c0,0.2-0.1,0.5-0.2,0.7L23,13.7 M27.7,18c0.3,0,0.5,0,0.7,0.1c0.3,0.2,0.5,0.4,0.6,0.8c0.1,0.3,0.1,0.7-0.1,1s-0.4,0.5-0.7,0.6c-0.3,0.1-0.7,0.1-1-0.1s-0.5-0.4-0.6-0.8c-0.1-0.3-0.1-0.7,0.1-1v-0.1c0.2,0.3,0.3,0.6,0.4,0.9c0.1,0.1,0.2,0.2,0.3,0.3c0.1,0.1,0.3,0,0.4,0c0.1-0.1,0.2-0.2,0.3-0.3c0.1-0.1,0-0.3,0-0.4L27.7,18'/>"
            i$ = i$ + "<path fill='#504030' stroke='#504030' stroke-width='0.25' stroke-miterlimit='10' d='M27.7,18c-1.2-2.3-2.6-4.1-4.3-5.3c0,0.2-0.1,0.5-0.2,0.7L23,13.7c1.5,1.2,2.7,2.8,3.8,4.9c0.2,0.3,0.3,0.6,0.4,0.9c0.1,0.1,0.2,0.2,0.3,0.3c0.1,0.1,0.3,0,0.4,0c0.1-0.1,0.2-0.2,0.3-0.3c0.1-0.1,0-0.3,0-0.4L27.7,18'/>"
    End Select
    'i$ = i$ + "<g id='Mouth'>"
    i$ = i$ + "<path fill='#FFF9AE' stroke='#FFF9AE' stroke-width='0.25' stroke-miterlimit='10' d='M35.9,39.4l1.6-1.9c0.1-0.1,0.2-0.1,0.3-0.1l0.4,0.1c0.1,0.1,0.2,0.2,0.2,0.3l0.1,3c-0.3-0.2-0.7-0.5-1.1-0.7C36.9,39.8,36.4,39.6,35.9,39.4M28.2,39.4c-0.5,0.2-1,0.4-1.5,0.6l0,0c-0.4,0.2-0.8,0.4-1.1,0.7l0.1-3c0-0.1,0.1-0.2,0.2-0.3l0.4-0.1c0.1,0,0.3,0.1,0.3,0.1L28.2,39.4'/>"
    i$ = i$ + "<path fill='#342A1E' stroke='#342A1E' stroke-width='0.25' stroke-miterlimit='10' d='M35.9,39.4c0.5,0.2,1,0.4,1.5,0.6c0.4,0.2,0.8,0.4,1.1,0.7l0.5,0.4c0.2,0.2,0.3,0.4,0.3,0.7s-0.1,0.5-0.3,0.7s-0.5,0.3-0.7,0.3c-0.3,0-0.5-0.1-0.7-0.3c-0.3-0.3-0.6-0.5-1.1-0.8l0,0c-1.2-0.6-2.7-0.9-4.4-0.9s-3.2,0.3-4.4,0.9c-0.4,0.2-0.8,0.5-1,0.7s-0.5,0.3-0.7,0.3c-0.3,0-0.5-0.1-0.7-0.3S25,42,25,41.7s0.1-0.5,0.3-0.7l0.5-0.4c0.3-0.2,0.7-0.5,1.1-0.7l0,0c0.5-0.3,1-0.5,1.5-0.6c1.1-0.4,2.4-0.5,3.9-0.5C33.5,38.8,34.7,39,35.9,39.4'/>"
    i$ = i$ + "</svg>"
    simg = _LoadImage(i$, 32, "HQ2XA memory")

    Cls
    _PutImage (sx, sy), simg
    _Display
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""

    Select Case kk$
        Case "W", "w"
            sy = sy - 4
            earstate = earstate + 1
            legstate = legstate + 1
        Case "A", "a"
            sx = sx - 4
            earstate = earstate + 1
            legstate = legstate + 1
        Case "D", "d"
            sx = sx + 4
            earstate = earstate - 1
            legstate = legstate + 1
        Case "S", "s": sy = sy + 4
            earstate = earstate - 1
            legstate = legstate + 1
    End Select
    armstate = armstate + 1
    If armstate = 4 Then armstate = 1
    antennastate = antennastate + 1
    If antennastate = 4 Then antennastate = 1
    er = Int(1 + Rnd * 50)
    Select Case er
        Case 1
            earstate = earstate + 1
        Case 50
            earstate = earstate - 1
    End Select
    If earstate > 15 Then earstate = 1
    If earstate < 1 Then earstate = 11
    If legstate = 4 Then legstate = 1
    If sx < 0 Then sx = 0
    If sx >= _Width - 128 Then sx = _Width - 128
    If sy < -16 Then sy = -16
    If sy >= _Height - 192 Then sy = _Height - 192
Loop Until kk$ = Chr$(27)

Print this item

  Book List to Folders
Posted by: SMcNeill - 11-27-2023, 10:22 AM - Forum: SMcNeill - Replies (5)

Code: (Select All)
$CONSOLE:ONLY
WIDTH 150, 50

'get file lists
SHELL "dir /b z:\ > z:\temp.txt"
_DELAY 2
CHDIR "z:\"

'create directory and place file in them
OPEN "temp.txt" FOR BINARY AS #1
DO
LINE INPUT #1, filename$
IF filename$ = "temp.txt" THEN _CONTINUE
PRINT filename$; " =>";
IF _FILEEXISTS(filename$) THEN
period = _INSTRREV(filename$, ".")
IF period THEN
file_no_ext$ = LEFT$(filename$, period - 1)
ELSE
file_no_ext$ = filename$
END IF
ELSE
PRINT "File not found. Check paths for error."
_CONTINUE
END IF
dash = INSTR(file_no_ext$, " -")
IF dash THEN file_no_ext$ = LEFT$(file_no_ext$, dash - 1)
IF _DIREXISTS(file_no_ext$) = 0 THEN MKDIR file_no_ext$
NAME filename$ AS file_no_ext$ + "\" + filename$
PRINT file_no_ext$ + "\" + filename$
LOOP UNTIL EOF(1)

SYSTEM

As is, I doubt this program will ever be of use to anyone except myself, but I thought I'd share it, in case anyone else ever has a need such as this one.

What this does is solve a massive disk organizational issue for me. As you guys might know, I'm a massive digital packrat. I collect everything -- and lots of everything. (Currently around 80TB of disk storage at my house, and before another year passes, I'll probably end up adding another drive to the mix!)

One thing I've very particular about collecting is e-books. I just love them. Can't get enough of them. Even if it's a book I won't read (such as romance), if I can grab a copy of it in digital form, then I'm going to snatch it and add it to my collection. Since I'm so particular about collecting these books, I want all my books to be able to fit into a nice directory structure so I can navigate and find what I need easily and quickly.

Unfortunately, when you download torrents of books, they're often just in file lists and not in any sort of directory structure. /blah!

This little program, as short as it is, fixes that issue!

BEFORE:
   


AFTER:
   

Others may find something like this useful, so I thought I'd share it so they could refer to this if they ever need to. As it is, unless you have a drive Z: (it's my RAM Drive for quick and dirty temp stuff, such as this, so I won't mess up the originals until I know it all is working 100% right.), this isn't going to do much for you except error out.

The books here are formatted with <Author Name> - <Series> - <Book Name> <.extension>. I use this to strip down to just <Author Name>, then make a directory with that name (if it doesn't already exist), and then move the book into that directory, where they're all together and easy to find and reference in the future.

Simple, and yet *THIS* is probably the best type of example of what I could ever say programming is for. Automate a task that might take days/weeks to be done manually, and let the machine do it in moments!

LONG LIVE QB64PE! Big Grin

Print this item

  Speedreading books.
Posted by: justsomeguy - 11-27-2023, 06:19 AM - Forum: Programs - Replies (23)

This is a program to view text files using one word at a time in rapid succession. Instead of the traditional way of reading a page of text, this displays one word at a time in rapid succession.  The speed is adjustable and is adaptive to the length of the word.  Your place is automatically saved when you exit the application or even when you switch text files. You can change the font, the font size, and font color from the pause menu.

It also supports inline Unicode characters.

[Image: screenshot1.png]

[Image: screenshot2.png]



Attached Files
.zip   reader.zip (Size: 633.76 KB / Downloads: 78)
Print this item

Star QBJS in VSCode
Posted by: grymmjack - 11-26-2023, 01:33 AM - Forum: QBJS, BAM, and Other BASICs - No Replies

Hi,

I've finally created the video on QBJS and how it works in Visual Studio Code.



It's More Fun to Compute YouTube Playlist:
https://youtube.com/playlist?list=PLLIsn...nFULr0D0YT

Grab the VSCode profile for QBJS here:
https://github.com/grymmjack/vscode-prof.../main/QBJS

Grab the VSCode QBJS Project Template here:
https://github.com/grymmjack/qbjs-vscode-template

Learn more about VSCode and QB64 here:
https://www.youtube.com/watch?v=6kn-N_-e...p=gAQBiAQB

Thanks for watching!

Print this item

  Read a text and attribute it to a variable
Posted by: krovit - 11-24-2023, 08:34 AM - Forum: Help Me! - Replies (11)

Code: (Select All)

x=freefile
open "c:\test.bas" for input as #x
line input #x, j$
close
? j$


Good morning or good evening or even good afternoon...

The answer to my question will certainly be simple 'Cause I'm slipping away Something obvious, but at the moment I can't figure out where the error is. Sometimes I get lost in a glass of water...

How can I turn j$ - into a string such that it can give me the result of p$ ?

Thank you!

Code: (Select All)

p$ = "QB64 Phoenix "+CHR$(138)+" (is) beatiful"
? p$



Attached Files
.bas   test.bas (Size: 42 bytes / Downloads: 37)
Print this item

  Simple Rummy-based game
Posted by: PhilOfPerth - 11-24-2023, 04:15 AM - Forum: Programs - Replies (3)

This is a simple game based on the Rummy card game.
It may appeal to those who just want to relax and play an uncomplicated game. 
I may have gone a bit overboard with comments, which were mostly for my own benefit while writing.  Big Grin

Code: (Select All)
wwidth = 1120: wheight = 800: mode = 32: size = 24 '                                    choose window 32 rows, 80 columns, full _RGB colours
Screen _NewImage(wwidth, wheight, mode)

Common Shared cpl, names$(), np, plr, scores(), hands(), discard, discard$, nexttile, ok$, bad$, fin$, setpos, pickup$, set(), settype$, allsame, runhigh, runlow, tiles(), wild()
ok$ = "o3l64ceg": bad$ = "o2l16gec": fin$ = "t120o3l16msc,e,g,o4msc,e,g,o5msc,e,gp64o3l1mlc,e,g,o4c,e,g,o5c,e,g" '            game sounds

SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", size, "monospace"): _Font f& '   use Monospace font
lhs = (_DesktopWidth - wwidth) / 2: top = (_DesktopHeight - wheight) / 2 '              find top and left of window
_ScreenMove lhs, top '                                                                  centre the window
cpl = _Width / _PrintWidth("X") '                                                       find characters per line (columns)

Randomize Timer
Dim tiles(101, 2), names$(4), scores(4), hands(4, 11)

PrepTiles:
For a = 0 To 11 '                                                                       first 96 tiles letter numbers are 1 to 8 for A-H (adding 64 gives 65 to 72)
    For b = 1 To 8
        tiles(a * 8 + b, 1) = b
    Next
Next
For a = 1 To 96 '                                                                        second parameter sets colours as 1, 2 or 3 for tile groups
    If a < 33 Then tiles(a, 2) = 1 '                                                     first 32 are red
    If a > 32 Then tiles(a, 2) = 2 '                                                     next 32 are green
    If a > 64 Then tiles(a, 2) = 3 '                                                     next 32 are magenta
Next
For a = 97 To 100: tiles(a, 1) = -22: tiles(a, 2) = 4: Next
tiles(101, 1) = -19: tiles(101, 2) = 4 '                                                 adding 64 to -19 gives 45;  chr$(45) is white - sign for vacant hand-positions

Play ok$

Intro

Scoring

GetNames '                                                                               get player names and number of players, and randomize first player

Shuffle:
For a = 1 To 99 '                                                                        shuffle 100 tiles, leave 101 as is
    swop = Int(Rnd * 100) + 1
    Swap tiles(a, 1), tiles(swop, 1): Swap tiles(a, 2), tiles(swop, 2)
Next

AssignTiles '                                                                            deal hands and Discard, NextTile is set to next tile after Discard (i.e. 42 with 4 players)

NewGame:
Cls
centre "New Round!", 2: Sleep 1: Cls
GetPlayer:
plr = plr + 1: If plr > np Then plr = 1
yellow: Locate 3, 1: white
For a = 1 To np
    Print Tab(2); names$(a); Tab(10); scores(a)
Next

ShowHand '                                                                              show current player's hand (position 11 is vacant), and Discard below

ChoosePickUp '                                                                          player can pick Discard or from Stack

LayDown '                                                                               player can lay down a set, or hold for further improvement

LayDownDone '                                                                           finished laying down a set

CalcPoints:
FindPoints

Sleep 1: WIPE "062728": GoTo GetPlayer ' next player's turn

Finish ' all Stack tiles used - finish game


' ---------------------------- subs below ------------------------------

Sub GetNames
    np = 0
    GetPlayerNames:
    yellow
    GetAName:
    _KeyClear
    Cls
    Locate 15, 18
    Print "Name of Player"; np + 1; "(or <Enter> for no more)";: Input nm$ '                nm$ is temp name for player, np is number of players"
    If nm$ = "" Then GoTo FinalName '                                                   if no name, jump to FinalName line
    nm$ = UCase$(nm$) '                                                                 capitalise name
    If nm$ < "A" Then WIPE "15": Play bad$: GoTo GetAName '                             if invalid name, try again
    np = np + 1: names$(np) = nm$
    If np = 4 Then GoTo FinalName Else Play ok$: GoTo GetAName '                                                     max of 4 players

    FinalName:
    Play ok$: Play ok$
    If np < 2 Then
        red: centre "We need 2 to 4 players", 16: yellow: Play bad$: Sleep 1: WIPE "1516": GoTo GetPlayerNames ' ensure at least 2 players
    End If
    plr = Int(Rnd * np) + 1 '                                                            randomize first player
    Play ok$
    Cls
End Sub

Sub AssignTiles
    For a = 1 To np '                                                                    deal 10 tiles to each player
        For b = 1 To 10
            nexttile = nexttile + 1
            hands(a, b) = nexttile
        Next
        hands(a, 11) = 101 '                                                             set each player's 11th tile to tile 101 (white -)
    Next
    nexttile = nexttile + 1
    discard = nexttile '                                                                 next tile will be the Discard
    nexttile = nexttile + 1 '                                                            move NextTile on past Discard tile
End Sub

Sub ShowHand
    yellow: centre msg$, 9
    msg$ = names$(plr) + " playing"
    centre msg$, 10
    centre "Your Hand", 12
    ' Print: Print Tab(24);
    centre "1  2  3  4  5  6  7  8  9 10 11", 14
    Locate 15, 25

    For a = 1 To 11
        Select Case tiles(hands(plr, a), 2) '                                           second parameter of tiles() sets colour of the tile
            Case Is = 1
                red
            Case Is = 2
                green
            Case Is = 3
                magenta
            Case Is = 4
                white
        End Select

        Print Chr$(tiles(hands(plr, a), 1) + 64); "  ";
    Next
    white: PSet (310, 300): Draw "r480d70l480u70": yellow
    ShowDiscard:
    Locate 18, 35: Print " Discard"
    discard$ = Chr$(tiles(discard, 1) + 64)
    Select Case tiles(discard, 2)
        Case Is = 1
            red
        Case Is = 2
            green
        Case Is = 3
            magenta
        Case Is = 4
            white
    End Select
    Print Tab(39); Chr$(tiles(discard, 1) + 64) '                                            show Discard tile in its colour
    msg$ = "Remaining Stack tiles:" + Str$(101 - nexttile)
    WIPE "30": yellow: centre msg$, 30
End Sub

Sub ChoosePickUp
    WIPE "01"
    _KeyClear
    PickupChoice:
    yellow: centre "Will you pick from Stack or Discard (S or D) ?", 21
    WhereFrom:
    pickup$ = InKey$
    If pickup$ = "" Then GoTo PickupChoice
    If pickup$ = Chr$(13) Then pickup$ = "D"
    pickup$ = UCase$(pickup$)
    If pickup$ <> "S" And pickup$ <> "D" Then Play bad$: GoTo WhereFrom
    WIPE "21"
    Locate 15, 55
    If pickup$ = "D" Then '                                                               if player picks Discard...
        hands(plr, 11) = discard '                                                            transfer Discard to player's 11th tile position (don't change NextTile)
        Select Case tiles(hands(plr, 11), 2) '                                            get its colour
            Case Is = 1
                red
            Case Is = 2
                green
            Case Is = 3
                magenta
            Case Is = 4
                white
        End Select
        Print Chr$(tiles(hands(plr, 11), 1) + 64) '                                        display new 11th tile

    ElseIf pickup$ = "S" Then '                                                            or if player picks from Stack...
        hands(plr, 11) = nexttile: nexttile = nexttile + 1 '                               transfer NextTile to player's 11th tile position, and increment NextTile
        Locate 15, 55
        Select Case tiles(hands(plr, 11), 2) '                                             get its colour
            Case Is = 1
                red
            Case Is = 2
                green
            Case Is = 3
                magenta
            Case Is = 4
                white
        End Select
        Print Chr$(tiles(hands(plr, 11), 1) + 64) '                                       display new 11th tile
    End If
    Play ok$
    WIPE "181930": yellow: Locate 30, 28: Print "Remaining Stack tiles:"; 101 - nexttile
    Sleep 1
End Sub

Sub LayDown '                                                                             setpos is the position of this tile in the set
    StartSet:
    ReDim set(11) '                                                                       set() will hold position in player's hand of each laid-down tile
    setpos = 1: _KeyClear
    GetaSetTile:
    yellow
    num$ = "" '                                                                           this will be the position in the player's hand
    WIPE "22"
    Locate 20, 12
    yellow: centre "Enter a tile number to lay down for a set (Enter to finish)", 20
    Locate 22, 40: Input num$
    If num$ = "" Then Play ok$: Exit Sub '                                                if player pressed Enter, they have no more to lay down
    num = Val(num$)
    If num < 1 Or num > 11 Then '                                                         validate number of the tile
        Play bad$: WIPE "27": red: centre "Invalid tile-number!", 27
        Sleep 1: WIPE "27": yellow
        GoTo GetaSetTile '                                                               if not 1 to 11, try again
    End If

    CheckLayDown:
    Select Case setpos
        Case Is = 1 '                                                                     first pick for the set
            If tiles(hands(plr, num), 1) = -22 Then
                Play bad$: red: centre "First can't be Wild!", 27
                Sleep 1: WIPE "27": GoTo GetaSetTile
            End If
            set(1) = num '                                                                num has been validated so accept this tile as first of set
            runlow = tiles(hands(plr, num), 1): runhigh = tiles(hands(plr, num), 1) '     first num is always lowest and highest of a run
            GoTo LaydownAccepted '                                                        process the accepted lay-down tile

        Case Is = 2 '                                                                     second pick of set; is already validated and we have already accepted first as set(1)
            If tiles(hands(plr, num), 1) = -22 Then
                Play bad$: red: centre "You must have a set before adding Wilds!", 27 '   must be at least 2 selected before Wildcard
                Sleep 1: WIPE "27": GoTo GetaSetTile
            End If
            If num = set(1) Then
                Play bad$: red: centre "Tile already picked!", 27 '                       if this is the same tile as the first, reject it and get another
                Sleep 1: WIPE "27": GoTo GetaSetTile
            End If
            CheckForSetType:
            If tiles(hands(plr, set(1)), 1) = tiles(hands(plr, num), 1) Then '             if the letters on set(1) and set(2) are the same, they're a Match
                settype$ = "Matches"
                centre "The Set Type is Matches", 18
            ElseIf Abs(tiles(hands(plr, set(1)), 1) - tiles(hands(plr, num), 1)) = 1 Then
                settype$ = "Run" '                                                         if letters on set(1) and set(2) are consecutive (1 up or 1 down), they're a Run
                centre "The Set Type is Run", 18
            Else
                Play bad$: red: centre "These two tiles can't start a Run or Matches set!", 17
                Sleep 1: WIPE "17": yellow: GoTo GetaSetTile '                                     if not same letter as first (for a match), or one higher than highest or one lower than lowest (for a run), it can't form a set
            End If
            Play ok$: yellow
            If runhigh < tiles(hands(plr, num), 1) Then
                runhigh = tiles(hands(plr, num), 1) '                                      if letter on set(1)1 is lower than letter on set(2), set runhigh to this letter
            Else
                runlow = tiles(hands(plr, num), 1) '                                       if not, set runlow to this letter
            End If
            set(2) = num '                                                                 accept it as set(2)
            GoTo LaydownAccepted
        Case Is >= 3 '                                                                     for third pick and on
            If tiles(hands(plr, num), 1) = -22 Then
                Play ok$: Play ok$: Print Tab(15); "WILD!": Sleep 1: Locate 23, 15: Print Space$(5)
                GoTo LaydownAccepted
            End If
            DupTileCheck:
            dup = 0
            For a = 1 To 11
                If num = set(a) Then dup = 1 '                                              if the tile number is already in the set, it's a duplicated pick
            Next
            If dup = 1 Then
                Play bad$: red: centre "Tile already picked!", 17
                Sleep 1: WIPE "17": GoTo GetaSetTile
            End If
            If settype$ = "Matches" Then '                                                   if a Matches set has been started...
                If tiles(hands(plr, set(1)), 1) = tiles(hands(plr, num), 1) Then '           check this laydown's letter against first of set
                    GoTo LaydownAccepted '                                                   if it is the same letter, accept it for the Matches set
                Else
                    Play bad$: red: centre "This tile is not part of your set!", 17 '        otherwise, reject it for Matches and get another
                    Sleep 1: WIPE "17": GoTo GetaSetTile
                End If
            Else '                                                                           but if a Run set has started...
                dup = 0
                For a = 1 To setpos
                    If tiles(hands(plr, num), 1) = tiles(hands(plr, set(a)), 1) Then
                        dup = 1
                    End If
                Next
                If dup = 1 Then
                    Play bad$: red: centre "Letter already picked!", 17 '                     if it duplicates a Run set letter, reject for Run set and get another
                    Sleep 1: WIPE "17": GoTo GetaSetTile
                End If
                If tiles(hands(plr, num), 1) - runhigh = 1 Then '                             if this letter is one letter higher than the highest in the run
                    runhigh = tiles(hands(plr, num), 1)
                    GoTo LaydownAccepted '                                                    change runhigh to this letter and accept it
                ElseIf runlow - tiles(hands(plr, num), 1) = 1 Then '                          if this letter is one letter lower than the lowest in the run...
                    runlow = tiles(hands(plr, num), 1) '
                    GoTo LaydownAccepted '                                                     change runlow to this letter and accept it
                Else '                                                                         but if not exactly one higher or exactly one lower
                    Play bad$: red: centre "This tile is not part of your Run!", 17 '          reject it and get another
                    Sleep 1: WIPE "17": yellow: GoTo GetaSetTile
                End If
            End If
    End Select

    LaydownAccepted:
    set(setpos) = num '                                                                        accept it into the set
    white: Locate 15, 22 + num * 3: Print "-" '                                                replace this tile in Hand with a - symbol
    Locate 25, 23 + setpos * 5: Print set(setpos) '                                            show the laid-down tile's hand position number
    Select Case tiles(hands(plr, num), 2) '                                                    get its colour
        Case Is = 1
            red
        Case Is = 2
            green
        Case Is = 3
            magenta
        Case Is = 4
            white
    End Select
    Locate 23, 24 + setpos * 5
    Print Chr$(tiles(hands(plr, num), 1) + 64): yellow '                                        display the picked tile in its colour
    setpos = setpos + 1
    CalcPoints
    GoTo GetaSetTile
End Sub

Sub CalcPoints
    tempv = 0: tileval = 0
    If settype$ = "Matches" Then '                                                               calculate base score for Matches set
        For a = 1 To setpos - 1
            tileval = tileval + 10
            tempv = tempv + tileval
        Next
    ElseIf settype$ = "Run" Then '                                                               calculate base score for Run set
        For a = 1 To setpos - 1
            tileval = tileval + 5
            tempv = tempv + tileval
        Next
    Else
        Exit Sub
    End If
    CheckForSameColour:
    WIPE "27"
    allsame = 1
    firsttnum = hands(plr, set(1))
    For a = 1 To setpos - 1
        If tiles(hands(plr, (set(a))), 2) <> tiles(hands(plr, (set(1))), 2) And tiles(hands(plr, (set(a))), 2) <> 4 Then
            allsame = 0
        End If
    Next
    If allsame = 1 Then '                                                                          if they are all the same colour
        tempv = tempv * 2 '                                                                        double the points value
    End If
    WIPE "02": centre "Points:", 2: Locate 2, 44: Print tempv
End Sub


Sub LayDownDone
    yellow: Locate 30, 28: Print "Remaining Stack tiles:"; 101 - nexttile
    setpos = setpos - 1 '                                                                          cancel last (unused) pick
    GetThrow:
    yellow
    WIPE "2022"
    centre "Which tile will you throw back", 20
    Locate 20, 57
    Input throw$
    throw = Val(throw$)
    Locate 27, 1
    If throw < 1 Or throw > 11 Then
        Play bad$: red: centre "You must throw back 1 tile!", 17
        Sleep 1: WIPE "17": GoTo GetThrow
    End If
    For a = 1 To setpos
        If throw = set(a) Then
            Play bad$: red: centre "You can't throw out a Laid-down tile!", 17
            Sleep 1: WIPE "17": GoTo GetThrow '                                                     can't discard part of set, so get another throw"
        End If
    Next
    discard = hands(plr, throw)
    throw = hands(plr, 11)

    yellow: Locate 30, 28: Print "Remaining Stack tiles:"; 101 - nexttile
    WIPE "1820"
End Sub

Sub FindPoints
    points = 0: tileval = 0: Locate 31, 24
    If settype$ = "Matches" Then '                                                                   calculate score for Matches set
        For a = 1 To setpos
            tileval = tileval + 10
            points = points + tileval
        Next
    Else '                                                                                           calculate score for Run set
        For a = 1 To setpos
            tileval = tileval + 5
            points = points + tileval
        Next
    End If
    CheckForSameColour:
    WIPE "27"
    allsame = 1
    firsttnum = hands(plr, set(1))
    For a = 1 To setpos
        If tiles(hands(plr, (set(a))), 2) <> tiles(hands(plr, (set(1))), 2) And tiles(hands(plr, (set(a))), 2) <> 4 Then
            allsame = 0
        End If
    Next
    If allsame = 1 Then '                                                                             if they are all the same colour
        points = points * 2 '                                                                         double the points value
        Locate 27, 20
        Print settype$; ", all the same colour -"; points; "points"
    Else
        Locate 27, 23
        Print settype$; ", mixed colours -"; points; "points"
    End If
    For a = 1 To setpos '                                                                              refill all picks from stack
        hands(plr, set(a)) = nexttile
        nexttile = nexttile + 1
        If nexttile >= 100 Then Exit For '                                                             if last tile drawn from stack, move on to get their throwback
    Next
    If setpos < 3 Then
        WIPE "27": points = 0:: red: centre "Minimum set size not reached - no score!", 27: yellow
    End If
    Sleep 1
    scores(plr) = scores(plr) + points
    hands(plr, 11) = 101
    If nexttile > 100 Then Finish '                                                                    if last Stock tile has been used, finish
    WIPE "23252729"
End Sub

Sub Finish
    Play fin$
    Cls
    yellow: centre "Finished!", 10: Print
    Locate 12, 1
    For a = 1 To np
        Print Tab(30); names$(a); Tab(45); scores(a)
    Next
    FindWinner:
    winr = 1: best = scores(1) '                                                                         assume winner is player 1
    For a = 2 To np
        If scores(a) > best Then best = scores(a): winr = a '                                            if this player's score is higher, make this player the winner
    Next
    Locate 14, 30: Print "Congratulations, "; names$(winr)
    Sleep: System
End Sub

Sub white:
    Color _RGB(255, 255, 255)
End Sub

Sub red:
    Color _RGB(255, 0, 0)
End Sub

Sub green
    Color _RGB(0, 255, 0)
End Sub

Sub yellow
    Color _RGB(255, 255, 0)
End Sub

Sub magenta
    Color _RGB(255, 55, 255)
End Sub

Sub WIPE (ln$) '                                                                                        call with string of 2-digit line numbers only  eg "0122"  for lines 1 and 22
    For a = 1 To Len(ln$) - 1 Step 2
        wl = Val(Mid$(ln$, a, 2))
        Locate wl, 1: Print Space$(73)
    Next
End Sub

Sub centre (txt$, linenum)
    ctr = Int(cpl / 2 - Len(txt$) / 2) + 1 '                                                            ctr is column number for start of centred text
    Locate linenum, ctr
    Print txt$
End Sub

Sub Intro
    yellow: centre "Rummage", 2
    centre " A simple strategy game based on the card game Rummy", 3
    centre "for 2 to 4 players", 4
    Print
    Print Tab(18);
    For a = 1 To 100
        Select Case tiles(a, 2)
            Case Is = 1
                red
            Case Is = 2
                green
            Case Is = 3
                magenta
            Case Is = 4
                white
        End Select
        Print Chr$(tiles(a, 1) + 64); " ";
        If a Mod 24 = 0 Then Print: Print Tab(18);
    Next
    white
    Locate 12, 1
    Print "     Rummage uses 100 tiles, the first 96 of which hold a letter"
    Print "     from A to H, with 4 of each letter, in each of 3 colours, as"
    Print "     shown above. The next four are ";: yellow: Print "Wildcards";: white: Print "."
    Print "     All 100 are shuffled, and the players are each dealt 10 tiles."
    Print "     The next tile becomes the first ";: yellow: Print "Discard";: white: Print ", and the remainder"
    Print "     form the ";: yellow: Print "Stack";: white: Print ".": Print
    Print "     Players then take turns to:"
    Print "          1. Pick up a tile, either the Discard";: white: Print " or from the Stack.";
    Print "          2. Lay down a set and score points, if they wish"
    Print "             (but they may choose to wait to form a better set)."
    Print "          3. Throw back one tile, which then becomes the Discard."
    Print "     Their hand is re-filled from the Stack and the next player plays.": Print
    Print "     When the last tile is taken from the Stack by a player (either by"
    Print "     pick-up or re-fill of their hand) the game ends. That player can"
    Print "     complete their turn and this is included in their final score."
    yellow: centre "Press a key", 29
    Sleep: Cls
End Sub

Sub Scoring
    centre "Points are scored as follows:", 2: Print
    Print "     Matches";: white
    Print " (minimum of 3 tiles with the same letter, e.g. ";
    red: Print "E";: green: Print "E";: magenta: Print "E";: green: Print "E";: white: Print ") will score"
    Print "     10 points for first tile, 20 for second, 30 for third etc. So this set"
    Print "     scores 10+20+30+40 = 100 points.": Print: yellow
    Print "     Runs";: white: Print " (minimum of 3 tiles with consecutive letters, e.g. ";
    magenta: Print "B";: green: Print "C";: magenta: Print "D";: magenta: Print "E";: white: Print ") will score"
    Print "     5 points for first tile, 10 for second, 15 for third etc. So this set"
    Print "     scores 5+10+15+20 = 50 points.": Print: yellow
    Print "     Sets with only 2 tiles";: white: Print " are accepted, but score no points.": Print: yellow
    Print "     Single-Colour sets";: white: Print " score double. So ";: magenta: Print "CCCC";: white: Print " scores";
    Print " (10+20+30+40)*2 = 200,"
    Print "     and ";: magenta: Print "CDEF";: white: Print " scores (5+10+15+20)*2 = 100.": Print: yellow
    Print "     Wildcards";: white
    Print " are displayed as a white star, and can be added to any set"
    Print "     before laying it down, adding one tile to the length of that set."
    Print "     They may only be added after 2 or more tiles have already been chosen"
    Print "     for the set. The type of set (Run or Matches) is not afffected, and"
    Print "     Wildcards take the colour of the previous tile of the set, which means"
    Print "     that Single-Colour sets can include Wildcards. Multiple Wildcards may"
    Print "     be used in a set.": Print
    Print "     Sets may be kept in the hand while the player builds to form a better"
    Print "     set, but they have no value until laid down, and once a Set has been"
    Print "     laid down, it can't be changed or added to.": Print
    Print "     The number of Stack tiles remaining is always displayed, allowing players"
    Print "     to lay down any sets they still hold when the game end is near."
    yellow: centre "Press a key", 31
    Sleep: Play ok$: Cls
End Sub

Print this item

  Dice Poker Board Game
Posted by: Donald Foster - 11-24-2023, 01:59 AM - Forum: Donald Foster - Replies (1)

[Image: Dice-Poker-Screenshot.png]


.pdf   Dice Poker Board Game Rules.pdf (Size: 1.26 MB / Downloads: 78)
.pdf   Dice Poker Description.pdf (Size: 124.56 KB / Downloads: 62)
.pdf   Dice Poker Print ' n Play.pdf (Size: 385.29 KB / Downloads: 65)

Hello Everyone,
This is my take on the 2 - 3 player Dice Poker Board Game.

Code: (Select All)
_TITLE "Dice Poker - Programmed by Donald L. Foster Jr. - 2023"

RANDOMIZE TIMER: _MOUSESHOW "LINK"

SCREEN _NEWIMAGE(1305, 739, 256)

_PALETTECOLOR 1, _RGB32(177, 83, 0) '   Background Color
_PALETTECOLOR 2, _RGB32(205, 161, 67) ' Board Color
_PALETTECOLOR 3, _RGB32(176, 82, 0) '   Word Color
_PALETTECOLOR 5, _RGB32(120, 0, 0) '    Dice Color
_PALETTECOLOR 6, _RGB32(0, 44, 127) '   Player 1 Blue Piece Outer Color
_PALETTECOLOR 7, _RGB32(0, 64, 147) '   Player 1 Blue Piece Inner Color
_PALETTECOLOR 8, _RGB32(166, 78, 0) '   Player 2 Orange Piece Outer Color
_PALETTECOLOR 9, _RGB32(249, 100, 0) '  Player 2 Orange Piece Inner Color
_PALETTECOLOR 10, _RGB32(78, 0, 83) '   Player 3 Purple Piece Outer Color
_PALETTECOLOR 11, _RGB32(161, 0, 166) ' Player 3 Purple Piece Inner Color

DIM AS _UNSIGNED INTEGER V, X, Y, Z
DIM SHARED AS _UNSIGNED _BYTE Player, Players, FiveOfKind, Straight, FullHouse, Lucky7, Lucky11, Roll, CanPlay, StraightCount, FullHouseCount, StraightBouncer, FullHouseBouncer
DIM SHARED AS _UNSIGNED _BYTE PiecesPlayed, Dice, Die(5), Dice(5), Chosen(5), BoardSpace(9, 9), BoardRotation(9, 9), BoardPlayer(9, 9), BoardRun(9, 9), Playable(9, 9)
DIM SHARED AS _UNSIGNED INTEGER BoardX(9, 9), BoardY(9, 9), DiceX(5)

Player = 1: PiecesPlayed = 0

DATA 37,1,18,1,33,1,32,1,2,1,30,1,27,1,23,1,37,2: ' Row 1 Spaces
DATA 6,1,36,2,22,1,26,1,29,1,31,1,17,1,36,2,4,1: '  Row 2 Spaces
DATA 16,1,8,1,36,2,28,1,13,1,25,1,36,2,12,1,21,1: ' Row 3 Spaces
DATA 10,1,7,1,15,1,36,2,24,1,36,2,20,1,9,1,11,1: '  Row 4 Spaces
DATA 34,1,19,1,35,1,14,1,38,1,14,1,35,2,19,1,34,2: ' Row 5 Spaces
DATA 11,2,9,2,20,2,36,1,24,2,36,1,15,1,7,2,10,2: '  Row 6 Spaces
DATA 21,2,12,2,36,1,25,2,13,1,28,2,36,1,8,2,16,1: ' Row 7 Spaces
DATA 5,1,36,1,17,1,31,2,29,2,26,2,22,2,36,1,3,1: '  Row 8 Speces
DATA 37,3,23,2,27,2,30,2,1,1,32,2,33,2,18,1,37,4: ' Row 9 Spaces
FOR Z = 1 TO 5: DiceX(Z) = 799 + X: X = X + 108: NEXT
FOR Z = 1 TO 9: FOR Y = 1 TO 9: READ BoardSpace(Z, Y), BoardRotation(Z, Y): NEXT: NEXT

fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"

CLS , 1

' Draw Board
LINE (10, 10)-(729, 729), 0, BF
X = 53
FOR Z = 1 TO 9
   V = 53
   FOR Y = 1 TO 9
      LINE (V - 37, X - 37)-(V + 37, X + 37), 2, BF
      DrawBoardSpace V, X, BoardSpace(Z, Y), BoardRotation(Z, Y)
      BoardX(Z, Y) = V: BoardY(Z, Y) = X
      V = V + 79
   NEXT
   X = X + 79
NEXT

' Draw Game Title
COLOR 3, 1: font& = _LOADFONT(fontpath$, 60): _FONT font&: _PRINTSTRING (800, 200), "DICE POKER"

X = 0
FOR Z = 200 TO 265
   V = 0
   FOR Y = 800 TO 1140
      IF POINT(Y, Z) = 3 THEN PSET (840 + V, 5 + X), 2
      V = V + 1
   NEXT
   X = X + 1
NEXT

X = 0
FOR Z = 200 TO 265
   V = 0
   FOR Y = 800 TO 1140
      IF POINT(Y, Z) = 3 THEN PSET (850 + V, 15 + X), 0
      V = V + 1
   NEXT
   X = X + 1
NEXT

LINE (800, 200)-(1400, 288), 1, BF

' How Many Players?
COLOR 15, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (817, 200), " How Many Players? (2 or 3)"

Players: A$ = INKEY$: IF A$ = "" GOTO Players
IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
IF VAL(A$) < 2 OR VAL(A$) > 3 GOTO Players ELSE Players = VAL(A$)

LINE (817, 200)-(1220, 235), 1, BF

StartGame: Roll = 1: FOR Z = 1 TO 5: Die(Z) = 0: Dice(Z) = 0: Chosen(Z) = 0: NEXT

' Draw Player Indicator
DrawPiece 1029, 160, Player
font& = _LOADFONT(fontpath$, 20): _FONT font&
_PRINTSTRING (990, 215), "Player: " + STR$(Player)

DisPlayDice:
font& = _LOADFONT(fontpath$, 28): _FONT font&
FOR Y = 635 TO 705 STEP 35: _PRINTSTRING (780, Y), STRING$(300, 32): NEXT

COLOR 0, 1: font& = _LOADFONT(fontpath$, 30): _FONT font&: _PRINTSTRING (970, 445), "Roll: " + STR$(Roll)

' Clear Space for Roll Button
LINE (888, 525)-(1138, 575), 1, BF

' Display Roll Dice Button
IF Roll < 3 THEN
   CIRCLE (913, 550), 25, 0, 1.5, 4.75: CIRCLE (1113, 550), 25, 0, 4.7, 1.7: LINE (913, 525)-(1113, 525), 0: LINE (913, 575)-(1113, 575), 0: PAINT (913, 550), 2, 0
   COLOR 0, 2: font& = _LOADFONT(fontpath$, 24): _FONT font&: _PRINTSTRING (925, 539), "R O L L   D I C E"
END IF

' Roll and Display Dice
X = 0
FOR Y = 1 TO 12
   FOR Z = 1 TO 5:
      DrawCursor DiceX(Z), 350, 2, 1
      IF Chosen(Z) = 0 THEN Dice(Z) = INT(RND * 6) + 1: DrawDice DiceX(Z), 350, 2, Dice(Z)
   NEXT
   _DELAY .10
NEXT

ArrangeDice: CheckDicePatterns: CountPatterns: X = 0

FOR Z = 1 TO 9
   FOR Y = 1 TO 9

      Playable(Z, Y) = 0: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 2

      ' Check Remove Opponent's Piece
      IF BoardSpace(Z, Y) <> 38 AND ((StraightBouncer = 1 AND Straight = 1) OR (FullHouseBouncer = 1 AND FullHouse = 1)) THEN
         IF BoardPlayer(Z, Y) > 0 AND BoardPlayer(Z, Y) <> Player AND BoardRun(Z, Y) = 0 THEN X = 1: Playable(Z, Y) = 2: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0
      END IF

      EndLoop:

   NEXT
NEXT

' Standard Move
CheckBoardPatterns

' Display End Turn Button
IF Roll = 3 AND CanPlay = 0 THEN
   CIRCLE (913, 550), 25, 0, 1.5, 4.75: CIRCLE (1113, 550), 25, 0, 4.7, 1.7: LINE (913, 525)-(1113, 525), 0: LINE (913, 575)-(1113, 575), 0: PAINT (913, 550), 2, 0
   COLOR 0, 2: font& = _LOADFONT(fontpath$, 24): _FONT font&: _PRINTSTRING (925, 539), "E N D   T U R N"
END IF

COLOR 0, 1: font& = _LOADFONT(fontpath$, 28): _FONT font&

IF (FullHouseBouncer = 1 AND FullHouse = 1) OR (StraightBouncer = 1 AND Straight = 1) THEN X = 1 ELSE X = 0

IF X = 1 AND Roll < 3 THEN _PRINTSTRING (780, 635), "Choose Dice to Keep and Roll Again  "

IF CanPlay = 0 AND X = 0 AND Roll = 3 THEN _PRINTSTRING (780, 670), "     There are No Playable Spaces       "
IF CanPlay = 1 AND X = 0 AND Roll < 3 THEN _PRINTSTRING (780, 670), "Choose Dice to Keep and Roll Again  "
IF CanPlay = 1 AND X = 1 THEN _PRINTSTRING (780, 670), "Choose Opponent's Piece to Remove  "

IF CanPlay = 0 AND X = 1 THEN _PRINTSTRING (780, 705), "Choose Opponent's Piece to Remove  "
IF CanPlay = 0 AND X = 0 AND Roll < 3 THEN _PRINTSTRING (780, 705), "Choose Dice to Keep and Roll Again  "
IF CanPlay = 0 AND X = 0 AND Roll = 3 THEN _PRINTSTRING (780, 705), "      Click END TURN to Continue     "
IF CanPlay = 1 AND FiveOfKind = 0 THEN _PRINTSTRING (780, 705), " Choose a Space to Place Your Piece "
IF CanPlay = 1 AND FiveOfKind = 1 THEN _PRINTSTRING (780, 705), "Place Your Piece On Any Open Space "

GetInput:
DO WHILE _MOUSEINPUT

   ' Choose Dice to Keep
   FOR Z = 1 TO 5
      IF _MOUSEX > DiceX(Z) - 51 AND _MOUSEX < DiceX(Z) + 51 AND _MOUSEY > 309 AND _MOUSEY < 391 AND _MOUSEBUTTON(1) = -1 AND Roll < 3 THEN
         GOSUB ReleaseButton: IF Chosen(Z) = 0 THEN Chosen(Z) = 1: DrawCursor DiceX(Z), 350, 2, 0 ELSE Chosen(Z) = 0: DrawCursor DiceX(Z), 350, 2, 1
      END IF
   NEXT

   ' Choose Roll Dice Button
   IF _MOUSEX > 900 AND _MOUSEX < 1126 AND _MOUSEY > 525 AND _MOUSEY < 575 AND _MOUSEBUTTON(1) = -1 THEN
      GOSUB ReleaseButton: IF Roll < 3 THEN Roll = Roll + 1: GOTO DisPlayDice ELSE IF Roll = 3 AND CanPlay = 0 GOTO EndTurn
   END IF

   ' Choose Board Position
   FOR Z = 1 TO 9
      FOR Y = 1 TO 9
         IF _MOUSEX > BoardX(Z, Y) - 51 AND _MOUSEX < BoardX(Z, Y) + 51 AND _MOUSEY > BoardY(Z, Y) - 51 AND _MOUSEY < BoardY(Z, Y) + 51 AND _MOUSEBUTTON(1) = -1 THEN
            GOSUB ReleaseButton: IF Playable(Z, Y) = 1 THEN BoardPlayer(Z, Y) = Player: DrawPiece BoardX(Z, Y), BoardY(Z, Y), Player: GOTO EndTurn
            IF Playable(Z, Y) = 2 THEN
               BoardPlayer(Z, Y) = 0: LINE (BoardX(Z, Y) - 37, BoardY(Z, Y) - 37)-(BoardX(Z, Y) + 37, BoardY(Z, Y) + 37), 2, BF
               DrawBoardSpace BoardX(Z, Y), BoardY(Z, Y), BoardSpace(Z, Y), BoardRotation(Z, Y): GOTO EndTurn
            END IF
         ELSE
         END IF
      NEXT
   NEXT

LOOP
A$ = INKEY$: IF A$ <> "" THEN IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
GOTO GetInput

EndTurn:

' Remove All Board Cursors
FOR Z = 1 TO 9: FOR Y = 1 TO 9: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 2: NEXT: NEXT

' Check for Winner
IF CheckWinner(Player) > 0 THEN DisplayWinner Player

' Get Next Player
IF Player = Players THEN Player = 1 ELSE Player = Player + 1

GOTO StartGame

ReleaseButton:
DO WHILE _MOUSEINPUT
   IF _MOUSEBUTTON(1) = 0 THEN RETURN
LOOP
GOTO ReleaseButton

SUB DrawBoardSpace (X1, X2, Space, Rotation)

   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"

   SELECT CASE Space

      CASE 1 ' 1 Pair 1's
         DrawDice X1 - 16, X2, 1, 1: DrawDice X1 + 16, X2, 1, 1

      CASE 2 ' 1 Pair 2's
         DrawDice X1 - 16, X2, 1, 2: DrawDice X1 + 16, X2, 1, 2

      CASE 3 ' 1 Pair 3's
         DrawDice X1 - 16, X2, 1, 3: DrawDice X1 + 16, X2, 1, 3

      CASE 4 ' 1 Pair 4's
         DrawDice X1 - 16, X2, 1, 4: DrawDice X1 + 16, X2, 1, 4

      CASE 5 ' 1 Pair 5's
         DrawDice X1 - 16, X2, 1, 5: DrawDice X1 + 16, X2, 1, 5

      CASE 6 ' 1 Pair 6's
         DrawDice X1 - 16, X2, 1, 6: DrawDice X1 + 16, X2, 1, 6

      CASE 7 ' Three of a Kind 1's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1, X2 + 16, 1, 1
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1: DrawDice X1, X2 - 16, 1, 1

      CASE 8 ' Three of a Kind 2's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1, X2 + 16, 1, 2
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2: DrawDice X1, X2 - 16, 1, 2

      CASE 9 ' Three of a Kind 3's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1, X2 + 16, 1, 3
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3: DrawDice X1, X2 - 16, 1, 3

      CASE 10 ' Three of a Kind 4's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1, X2 + 16, 1, 4
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4: DrawDice X1, X2 - 16, 1, 4

      CASE 11 ' Three of a Kind 5's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1, X2 + 16, 1, 5
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5: DrawDice X1, X2 - 16, 1, 5

      CASE 12 ' Three of a Kind 6's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1, X2 + 16, 1, 6
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6: DrawDice X1, X2 - 16, 1, 6

      CASE 13 ' Four of a Kind 1's
         DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1

      CASE 14 ' Four of a Kind 2's
         DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2

      CASE 15 ' Four of a Kind 3's
         DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3

      CASE 16 ' Four of a Kind 4's
         DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4

      CASE 17 ' Four of a Kind 5's
         DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5

      CASE 18 ' Four of a Kind 6's
         DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6

      CASE 19 ' 1 Pair 1's - 1 Pair 2's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2

      CASE 20 ' 1 Pair 1's - 1 Pair 3's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3

      CASE 21 ' 1 Pair 1's - 1 Pair 4's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4

      CASE 22 ' 1 Pair 1's - 1 Pair 5's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5

      CASE 23 ' 1 Pair 1's - 1 Pair 6's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 1: DrawDice X1 + 16, X2 + 16, 1, 1
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 1: DrawDice X1 + 16, X2 - 16, 1, 1: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6

      CASE 24 ' 1 Pair 2's - 1 Pair 3's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3

      CASE 25 ' 1 Pair 2's - 1 Pair 4's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4

      CASE 26 ' 1 Pair 2's - 1 Pair 5's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5

      CASE 27 ' 1 Pair 2's - 1 Pair 6's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 2: DrawDice X1 + 16, X2 + 16, 1, 2
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 2: DrawDice X1 + 16, X2 - 16, 1, 2: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6

      CASE 28 ' 1 Pair 3's - 1 Pair 4's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4

      CASE 29 ' 1 Pair 3's - 1 Pair 5's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5

      CASE 30 ' 1 Pair 3's - 1 Pair 6's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 3: DrawDice X1 + 16, X2 + 16, 1, 3
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 3: DrawDice X1 + 16, X2 - 16, 1, 3: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6

      CASE 31 ' 1 Pair 4's - 1 Pair 5's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5

      CASE 32 ' 1 Pair 4's - 1 Pair 6's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 4: DrawDice X1 + 16, X2 + 16, 1, 4
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 4: DrawDice X1 + 16, X2 - 16, 1, 4: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6

      CASE 33 ' 1 Pair 5's - 1 Pair 6's
         IF Rotation = 1 THEN DrawDice X1 - 16, X2 - 16, 1, 6: DrawDice X1 + 16, X2 - 16, 1, 6: DrawDice X1 - 16, X2 + 16, 1, 5: DrawDice X1 + 16, X2 + 16, 1, 5
         IF Rotation = 2 THEN DrawDice X1 - 16, X2 - 16, 1, 5: DrawDice X1 + 16, X2 - 16, 1, 5: DrawDice X1 - 16, X2 + 16, 1, 6: DrawDice X1 + 16, X2 + 16, 1, 6

      CASE 34 ' Lucky 7

         COLOR 3, 1: font& = _LOADFONT(fontpath$, 20): _FONT font&: _PRINTSTRING (1230, 14), "LUCKY"
         COLOR 3, 1: font& = _LOADFONT(fontpath$, 50): _FONT font&: _PRINTSTRING (1247, 32), "7"

         X = X1 - 30: W = X1 + 30
         FOR Z = 14 TO 74
            V = X2 + 30: U = X2 - 30
            FOR Y = 1230 TO 1290
               IF POINT(Y, Z) = 3 THEN
                  IF Z < 35 THEN T = 0 ELSE T = 4
                  IF Rotation = 1 THEN IF T = 4 THEN CIRCLE (X, V), 1, 4: PAINT (X, V), 4 ELSE PSET (X, V), T
                  IF Rotation = 2 THEN IF T = 4 THEN CIRCLE (W, U), 1, 4: PAINT (W, U), 4 ELSE PSET (W, U), T
               END IF
               V = V - 1: U = U + 1
            NEXT
            X = X + 1: W = W - 1
         NEXT

         LINE (1230, 14)-(1290, 74), 1, BF

      CASE 35 ' Lucky 11

         COLOR 3, 1: font& = _LOADFONT(fontpath$, 20): _FONT font&: _PRINTSTRING (1230, 14), "LUCKY"
         COLOR 3, 1: font& = _LOADFONT(fontpath$, 50): _FONT font&: _PRINTSTRING (1232, 32), "11"

         X = X1 - 30: W = X1 + 30
         FOR Z = 14 TO 74
            V = X2 + 30: U = X2 - 30
            FOR Y = 1230 TO 1290
               IF POINT(Y, Z) = 3 THEN
                  IF Z < 35 THEN T = 0 ELSE T = 4
                  IF Rotation = 1 THEN IF T = 4 THEN CIRCLE (X, V), 1, 4: PAINT (X, V), 4 ELSE PSET (X, V), 0
                  IF Rotation = 2 THEN IF T = 4 THEN CIRCLE (W, U), 1, 4: PAINT (W, U), 4 ELSE PSET (W, U), 0
               END IF
               V = V - 1: U = U + 1
            NEXT
            X = X + 1: W = W - 1
         NEXT

         LINE (1230, 14)-(1290, 74), 1, BF

      CASE 36 ' Full House

         IF Rotation = 1 THEN PSET (X1, X2), 2: DRAW "C0TA0BU30TA30L32TA0R55TA150R32TA0BD5P0,0R9U5R5D10U5BL2P0,0BD46L36D8R49U8L14BD2P0,0"
         IF Rotation = 2 THEN PSET (X1, X2), 2: DRAW "C0TA0BD30TA30R32TA0L55TA150L30TA0BU5P0,0L9D5L5U10D5BR2P0,0BU46R38U8L49D8R14BU2P0,0"

         COLOR 3, 1: font& = _LOADFONT(fontpath$, 16): _FONT font&: _PRINTSTRING (1244, 33), "FULL"
         COLOR 3, 1: font& = _LOADFONT(fontpath$, 16): _FONT font&: _PRINTSTRING (1234, 48), "HOUSE"

         X = 0
         FOR Z = 14 TO 74
            V = 0
            FOR Y = 1230 TO 1290
               IF POINT(Y, Z) = 3 THEN
                  IF Rotation = 1 THEN PSET (X1 - 30 + V, X2 - 30 + X), 4
                  IF Rotation = 2 THEN PSET (X1 + 30 - V, X2 + 30 - X), 4
               END IF
               V = V + 1
            NEXT
            X = X + 1
         NEXT

         LINE (1230, 14)-(1290, 74), 1, BF

      CASE 37 ' Straight

         COLOR 3, 1: font& = _LOADFONT(fontpath$, 11): _FONT font&: _PRINTSTRING (1220, 10), "STRAIGHT"

         U = 0
         FOR Z = 10 TO 30
            V = 0
            FOR Y = 1220 TO 1295
               IF POINT(Y, Z) = 3 THEN
                  IF Rotation = 1 THEN CIRCLE (X1 + 21 - V + U, X2 + 30 - V - U), 1, 4: PAINT (X1 + 21 - V + U, X2 + 30 - V - U), 4
                  IF Rotation = 2 THEN CIRCLE (X1 + 31 - V - U, X2 - 21 + V - U), 1, 4: PAINT (X1 + 31 - V - U, X2 - 21 + V - U), 4
                  IF Rotation = 3 THEN CIRCLE (X1 - 31 + V + U, X2 + 21 - V + U), 1, 4: PAINT (X1 - 31 + V + U, X2 + 21 - V + U), 4
                  IF Rotation = 4 THEN CIRCLE (X1 - 21 + V - U, X2 - 31 + V + U), 1, 4: PAINT (X1 - 21 + V - U, X2 - 31 + V + U), 4
               END IF
               V = V + 1
            NEXT
            U = U + 1
         NEXT

         LINE (1220, 10)-(1295, 30), 1, BF

      CASE 38 ' Free Space

         COLOR 0, 2: font& = _LOADFONT(fontpath$, 13): _FONT font&: _PRINTSTRING (X1 - 14, X2 - 34), "FREE"
         COLOR 0, 2: font& = _LOADFONT(fontpath$, 13): _FONT font&: _PRINTSTRING (X1 - 18, X2 + 24), "SPACE"

         PSET (X1, X2), 2: DRAW "C0TA0BU9BR3TA15U11TA165U11TA45BL9TA15L11TA165L11TA45BD9TA15D11TA165D11TA45BR9TA15R11TA165R11"
         DRAW "TA0BL1BU1TA60R11TA30L11TA0BL8TA60U11TA30D11TA0BD8TA60L11TA30R11TA0BR8TA60D11TA30U11": PAINT (X1, X2), 4, 0

   END SELECT

END SUB

SUB DrawCursor (X1 AS INTEGER, X2 AS INTEGER, CursorSize AS _BYTE, CursorColor AS _BYTE)

   IF CursorSize = 1 THEN PSET (X1 - 34, X2 - 34), CursorColor: DRAW "TA0R68D68L68U68H1R70D70L70U70H1R72D72L72U72H1R74D74L74U74"

   IF CursorSize = 2 THEN PSET (X1 - 48, X2 - 48), CursorColor: DRAW "TA0R97D97L97U97H1R99D99L99U99H1R101D101L101U101"

END SUB

SUB DrawPiece (X1, X2, Player)

   IF Player = 1 THEN CIRCLE (X1, X2), 32, 6: PAINT (X1, X2), 7, 6
   IF Player = 2 THEN CIRCLE (X1, X2), 32, 8: PAINT (X1, X2), 9, 8
   IF Player = 3 THEN CIRCLE (X1, X2), 32, 10: PAINT (X1, X2), 11, 10

END SUB

SUB DrawDice (X1, X2, DiceSize, Die)

   IF DiceSize = 1 THEN
      LINE (X1 - 14, X2 - 10)-(X1 - 14, X2 + 10), 0: LINE (X1 + 14, X2 - 10)-(X1 + 14, X2 + 10), 0
      LINE (X1 - 10, X2 - 14)-(X1 + 10, X2 - 14), 0: LINE (X1 - 10, X2 + 14)-(X1 + 10, X2 + 14), 0
      CIRCLE (X1 - 10, X2 - 10), 4, 0, 1.5, 3.0: CIRCLE (X1 + 10, X2 - 10), 4, 0, 0, 1.7: CIRCLE (X1 - 10, X2 + 10), 4, 0, 3.0, 4.9: CIRCLE (X1 + 10, X2 + 10), 4, 0, 4.5, 0
      PAINT (X1, X2), 15, 0
      IF Die = 1 OR Die = 3 OR Die = 5 THEN CIRCLE (X1, X2), 2, 0: PAINT (X1, X2), 0
      IF Die > 1 THEN CIRCLE (X1 + 7, X2 - 7), 2, 0: PAINT (X1 + 7, X2 - 7), 0: CIRCLE (X1 - 7, X2 + 7), 2, 0: PAINT (X1 - 7, X2 + 7), 0
      IF Die > 3 THEN CIRCLE (X1 - 7, X2 - 7), 2, 0: PAINT (X1 - 7, X2 - 7), 0: CIRCLE (X1 + 7, X2 + 7), 2, 0: PAINT (X1 + 7, X2 + 7), 0
      IF Die = 6 THEN CIRCLE (X1 - 7, X2), 2, 0: PAINT (X1 - 7, X2), 0: CIRCLE (X1 + 7, X2), 2, 0: PAINT (X1 + 7, X2), 0
   ELSE
      LINE (X1 - 40, X2 - 40)-(X1 + 40, X2 + 40), 1, BF
      LINE (X1 - 28, X2 - 40)-(X1 + 28, X2 - 40), 0: LINE (X1 - 28, X2 + 40)-(X1 + 28, X2 + 40), 0
      LINE (X1 - 40, X2 - 28)-(X1 - 40, X2 + 28), 0: LINE (X1 + 40, X2 - 28)-(X1 + 40, X2 + 28), 0
      CIRCLE (X1 - 28, X2 - 28), 12, 0, 1.5, 3.0: CIRCLE (X1 + 28, X2 - 28), 12, 0, 0, 1.7: CIRCLE (X1 - 28, X2 + 28), 12, 0, 3.2, 4.9: CIRCLE (X1 + 28, X2 + 28), 12, 0, 4.5, 0
      PAINT (X1, X2), 15, 0: 'CIRCLE (X1, X2), 36, 4: PAINT (X1, X2), 4
      IF Die = 1 OR Die = 3 OR Die = 5 THEN CIRCLE (X1, X2), 6, 0: PAINT (X1, X2), 0
      IF Die > 1 THEN CIRCLE (X1 + 21, X2 - 21), 6, 0: PAINT (X1 + 21, X2 - 21), 0: CIRCLE (X1 - 21, X2 + 21), 6, 0: PAINT (X1 - 21, X2 + 21), 0
      IF Die > 3 THEN CIRCLE (X1 - 21, X2 - 21), 6, 0: PAINT (X1 - 21, X2 - 21), 0: CIRCLE (X1 + 21, X2 + 21), 6, 0: PAINT (X1 + 21, X2 + 21), 0
      IF Die = 6 THEN CIRCLE (X1 - 21, X2), 6, 0: PAINT (X1 - 21, X2), 0: CIRCLE (X1 + 21, X2), 6, 0: PAINT (X1 + 21, X2), 0
   END IF

END SUB

SUB ArrangeDice

   DIM AS _BYTE Arranged(5)

   Position = 1: Arranged(1) = 0: Arranged(2) = 0: Arranged(3) = 0: Arranged(4) = 0: Arranged(5) = 0

   FOR Z = 1 TO 6
      FOR Y = 1 TO 5
         IF Dice(Y) = Z AND Arranged(Y) = 0 THEN Die(Position) = Z: Arranged(Y) = 1: Position = Position + 1
      NEXT
   NEXT

END SUB

SUB CheckDicePatterns

   FiveOfKind = 0: Straight = 0: FullHouse = 0: Lucky11 = 0: Lucky7 = 0

   ' Five of a Kind
   IF Die(1) = Die(2) AND Die(2) = Die(3) AND Die(3) = Die(4) AND Die(4) = Die(5) THEN FiveOfKind = 1

   ' Straight
   IF Die(1) = 1 AND Die(2) = 2 AND Die(3) = 3 AND Die(4) = 4 AND Die(5) = 5 THEN Straight = 1
   IF Die(1) = 2 AND Die(2) = 3 AND Die(3) = 4 AND Die(4) = 5 AND Die(5) = 6 THEN Straight = 1

   ' Full House
   IF Die(1) = Die(2) AND Die(2) <> Die(3) AND Die(3) = Die(4) AND Die(4) = Die(5) THEN FullHouse = 1
   IF Die(1) = Die(2) AND Die(2) = Die(3) AND Die(3) <> Die(4) AND Die(4) = Die(5) THEN FullHouse = 1

   ' Lucky 11
   IF Die(1) + Die(2) + Die(3) + Die(4) + Die(5) = 11 THEN Lucky11 = 1

   ' Lucky 7
   IF Die(1) + Die(2) + Die(3) + Die(4) + Die(5) = 7 THEN Lucky7 = 1

END SUB

SUB CountPatterns

   StraightCount = 0: FullHouseCount = 0: StraightBouncer = 0: FullHouseBouncer = 0

   FOR Z = 1 TO 9
      FOR Y = 1 TO 9

         ' Count Filled FullHouses
         IF BoardSpace(Z, Y) = 36 AND BoardPlayer(Z, Y) > 0 THEN FullHouseCount = FullHouseCount + 1

         ' Count Filled Straights
         IF BoardSpace(Z, Y) = 37 AND BoardPlayer(Z, Y) > 0 THEN StraightCount = StraightCount + 1

      NEXT
   NEXT

   IF FullHouseCount = 12 THEN FullHouseBouncer = 1

   IF StraightCount = 4 THEN StraightBouncer = 1

END SUB

SUB CheckBoardPatterns

   Ones = 0: Twos = 0: Threes = 0: Fours = 0: Fives = 0: Sixes = 0: CanPlay = 0

   ' Count Hom Many Ones, Twos, Threes, Fours, Fives and Sixes
   FOR Z = 1 TO 5
      IF Die(Z) = 1 THEN Ones = Ones + 1
      IF Die(Z) = 2 THEN Twos = Twos + 1
      IF Die(Z) = 3 THEN Threes = Threes + 1
      IF Die(Z) = 4 THEN Fours = Fours + 1
      IF Die(Z) = 5 THEN Fives = Fives + 1
      IF Die(Z) = 6 THEN Sixes = Sixes + 1
   NEXT

   FOR Z = 1 TO 9
      FOR Y = 1 TO 9

         IF BoardPlayer(Z, Y) = 0 AND BoardSpace(Z, Y) <> 38 AND FiveOfKind = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

         IF BoardPlayer(Z, Y) = 0 THEN

            SELECT CASE BoardSpace(Z, Y)

               CASE 1 ' 1 Pair 1's
                  IF Ones > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 2 ' 1 Pair 2's
                  IF Twos > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 3 ' 1 Pair 3's
                  IF Threes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 4 ' 1 Pair 4's
                  IF Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 5 ' 1 Pair 5's
                  IF Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 6 ' 1 Pair 6's
                  IF Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 7 ' Three of a Kind 1's
                  IF Ones > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 8 ' Three of a Kind 2's
                  IF Twos > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 9 ' Three of a Kind 3's
                  IF Threes > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 10 ' Three of a Kind 4's
                  IF Fours > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 11 ' Three of a Kind 5's
                  IF Fives > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 12 ' Three of a Kind 6's
                  IF Sixes > 2 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 13 ' Four of a Kind 1's
                  IF Ones > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 14 ' Four of a Kind 2's
                  IF Twos > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 15 ' Four of a Kind 3's
                  IF Threes > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 16 ' Four of a Kind 4's
                  IF Fours > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 17 ' Four of a Kind 5's
                  IF Fives > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 18 ' Four of a Kind 6's
                  IF Sixes > 3 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 19 ' 1 Pair 1's - 1 Pair 2's
                  IF Ones > 1 AND Twos > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 20 ' 1 Pair 1's - 1 Pair 3's
                  IF Ones > 1 AND Threes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 21 ' 1 Pair 1's - 1 Pair 4's
                  IF Ones > 1 AND Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 22 ' 1 Pair 1's - 1 Pair 5's
                  IF Ones > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 23 ' 1 Pair 1's - 1 Pair 6's
                  IF Ones > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 24 ' 1 Pair 2's - 1 Pair 3's
                  IF Twos > 1 AND Threes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 25 ' 1 Pair 2's - 1 Pair 4's
                  IF Twos > 1 AND Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 26 ' 1 Pair 2's - 1 Pair 5's
                  IF Twos > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 27 ' 1 Pair 2's - 1 Pair 6's
                  IF Twos > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 28 ' 1 Pair 3's - 1 Pair 4's
                  IF Threes > 1 AND Fours > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 29 ' 1 Pair 3's - 1 Pair 5's
                  IF Threes > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 30 ' 1 Pair 3's - 1 Pair 6's
                  IF Threes > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 31 ' 1 Pair 4's - 1 Pair 5's
                  IF Fours > 1 AND Fives > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 32 ' 1 Pair 4's - 1 Pair 6's
                  IF Fours > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 33 ' 1 Pair 5's - 1 Pair 6's
                  IF Fives > 1 AND Sixes > 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 34 ' Lucky 7
                  IF Lucky7 = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 35 ' Lucky 11
                  IF Lucky11 = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 36 ' Full House
                  IF FullHouse = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 37 ' Straight
                  IF Straight = 1 THEN Playable(Z, Y) = 1: DrawCursor BoardX(Z, Y), BoardY(Z, Y), 1, 0: CanPlay = 1

               CASE 38 ' Free Space

            END SELECT

         END IF

      NEXT
   NEXT

END SUB

FUNCTION CheckWinner (Player)

   DIM X(9): X1 = 0: X2 = 0: X3 = 0: X4 = 0: X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0

   ' Check for Duel Vertical Patterns
   FOR Z = 1 TO 9
      IF BoardPlayer(1, Z) = Player AND BoardPlayer(2, Z) = Player AND BoardPlayer(3, Z) = Player AND BoardPlayer(4, Z) = Player AND (BoardPlayer(5, Z) = Player OR BoardSpace(5, Z) = 38) AND BoardPlayer(6, Z) = Player AND BoardPlayer(7, Z) = Player AND BoardPlayer(8, Z) = Player AND BoardPlayer(9, Z) = Player THEN
         X1 = 2
         BoardRun(1, Z) = 1: CIRCLE (BoardX(1, Z), BoardY(1, Z)), 10, 15: PAINT (BoardX(1, Z), BoardY(1, Z)), 15
         BoardRun(2, Z) = 1: CIRCLE (BoardX(2, Z), BoardY(2, Z)), 10, 15: PAINT (BoardX(2, Z), BoardY(2, Z)), 15
         BoardRun(3, Z) = 1: CIRCLE (BoardX(3, Z), BoardY(3, Z)), 10, 15: PAINT (BoardX(3, Z), BoardY(3, Z)), 15
         BoardRun(4, Z) = 1: CIRCLE (BoardX(4, Z), BoardY(4, Z)), 10, 15: PAINT (BoardX(4, Z), BoardY(4, Z)), 15
         IF Z <> 5 THEN BoardRun(5, Z) = 1: CIRCLE (BoardX(4, Z), BoardY(5, Z)), 10, 15: PAINT (BoardX(5, Z), BoardY(5, Z)), 15
         BoardRun(6, Z) = 1: CIRCLE (BoardX(6, Z), BoardY(6, Z)), 10, 15: PAINT (BoardX(6, Z), BoardY(6, Z)), 15
         BoardRun(7, Z) = 1: CIRCLE (BoardX(7, Z), BoardY(7, Z)), 10, 15: PAINT (BoardX(7, Z), BoardY(7, Z)), 15
         BoardRun(8, Z) = 1: CIRCLE (BoardX(8, Z), BoardY(8, Z)), 10, 15: PAINT (BoardX(8, Z), BoardY(8, Z)), 15
         BoardRun(9, Z) = 1: CIRCLE (BoardX(9, Z), BoardY(9, Z)), 10, 15: PAINT (BoardX(9, Z), BoardY(9, Z)), 15
      END IF
   NEXT

   ' Check for Single Vertical Patterns
   IF X1 = 0 THEN
      FOR Z = 1 TO 9
         FOR Y = 1 TO 5
            IF (BoardPlayer(Y, Z) = Player OR BoardSpace(Y, Z) = 38) AND (BoardPlayer(Y + 1, Z) = Player OR BoardSpace(Y + 1, Z) = 38) AND (BoardPlayer(Y + 2, Z) = Player OR BoardSpace(Y + 2, Z) = 38) AND (BoardPlayer(Y + 3, Z) = Player OR BoardSpace(Y + 3, Z) = 38) AND (BoardPlayer(Y + 4, Z) = Player OR BoardSpace(Y + 4, Z) = 38) THEN
               X(Z) = 1
               IF Z = 5 AND Y = 5 GOTO EndLoop11 ELSE BoardRun(Y, Z) = 1: CIRCLE (BoardX(Y, Z), BoardY(Y, Z)), 10, 15: PAINT (BoardX(Y, Z), BoardY(Y, Z)), 15
               EndLoop11: IF Z = 5 AND Y + 1 = 5 GOTO EndLoop12 ELSE BoardRun(Y + 1, Z) = 1: CIRCLE (BoardX(Y + 1, Z), BoardY(Y + 1, Z)), 10, 15: PAINT (BoardX(Y + 1, Z), BoardY(Y + 1, Z)), 15
               EndLoop12: IF Z = 5 AND Y + 2 = 5 GOTO EndLoop13 ELSE BoardRun(Y + 2, Z) = 1: CIRCLE (BoardX(Y + 2, Z), BoardY(Y + 2, Z)), 10, 15: PAINT (BoardX(Y + 2, Z), BoardY(Y + 2, Z)), 15
               EndLoop13: IF Z = 5 AND Y + 3 = 5 GOTO EndLoop14 ELSE BoardRun(Y + 3, Z) = 1: CIRCLE (BoardX(Y + 3, Z), BoardY(Y + 3, Z)), 10, 15: PAINT (BoardX(Y + 3, Z), BoardY(Y + 3, Z)), 15
               EndLoop14: IF Z = 5 AND Y + 4 = 5 GOTO EndLoop15 ELSE BoardRun(Y + 4, Z) = 1: CIRCLE (BoardX(Y + 4, Z), BoardY(Y + 4, Z)), 10, 15: PAINT (BoardX(Y + 4, Z), BoardY(Y + 4, Z)), 15
               EndLoop15:
            END IF
         NEXT
      NEXT
      X1 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)
   END IF

   X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0

   ' Check for Duel Horizontal Patterns
   FOR Z = 1 TO 9
      IF BoardPlayer(Z, 1) = Player AND BoardPlayer(Z, 2) = Player AND BoardPlayer(Z, 3) = Player AND BoardPlayer(Z, 4) = Player AND (BoardPlayer(Z, 5) = Player OR BoardSpace(Z, 5) = 38) AND BoardPlayer(Z, 6) = Player AND BoardPlayer(Z, 7) = Player AND BoardPlayer(Z, 8) = Player AND BoardPlayer(Z, 9) = Player THEN
         X2 = 2
         BoardRun(Z, 1) = 1: CIRCLE (BoardX(Z, 1), BoardY(Z, 1)), 10, 15: PAINT (BoardX(Z, 1), BoardY(Z, 1)), 15
         BoardRun(Z, 2) = 1: CIRCLE (BoardX(Z, 2), BoardY(Z, 2)), 10, 15: PAINT (BoardX(Z, 2), BoardY(Z, 2)), 15
         BoardRun(Z, 3) = 1: CIRCLE (BoardX(Z, 3), BoardY(Z, 3)), 10, 15: PAINT (BoardX(Z, 3), BoardY(Z, 3)), 15
         BoardRun(Z, 4) = 1: CIRCLE (BoardX(Z, 4), BoardY(Z, 4)), 10, 15: PAINT (BoardX(Z, 4), BoardY(Z, 4)), 15
         IF Z <> 5 THEN BoardRun(Z, 5) = 1: CIRCLE (BoardX(Z, 5), BoardY(Z, 5)), 10, 15: PAINT (BoardX(Z, 5), BoardY(Z, 5)), 15
         BoardRun(Z, 6) = 1: CIRCLE (BoardX(Z, 6), BoardY(Z, 6)), 10, 15: PAINT (BoardX(Z, 6), BoardY(Z, 6)), 15
         BoardRun(Z, 7) = 1: CIRCLE (BoardX(Z, 7), BoardY(Z, 7)), 10, 15: PAINT (BoardX(Z, 7), BoardY(Z, 7)), 15
         BoardRun(Z, 8) = 1: CIRCLE (BoardX(Z, 8), BoardY(Z, 8)), 10, 15: PAINT (BoardX(Z, 8), BoardY(Z, 8)), 15
         BoardRun(Z, 9) = 1: CIRCLE (BoardX(Z, 9), BoardY(Z, 9)), 10, 15: PAINT (BoardX(Z, 9), BoardY(Z, 9)), 15
      END IF
   NEXT

   ' Check for Single Horizontal Patterns
   IF X2 = 0 THEN
      FOR Z = 1 TO 9
         FOR Y = 1 TO 5
            IF (BoardPlayer(Z, Y) = Player OR BoardSpace(Z, Y) = 38) AND (BoardPlayer(Z, Y + 1) = Player OR BoardSpace(Z, Y + 1) = 38) AND (BoardPlayer(Z, Y + 2) = Player OR BoardSpace(Z, Y + 2) = 38) AND (BoardPlayer(Z, Y + 3) = Player OR BoardSpace(Z, Y + 3) = 38) AND (BoardPlayer(Z, Y + 4) = Player OR BoardSpace(Z, Y + 4) = 38) THEN
               X(Z) = 1
               IF Z = 5 AND Y = 5 GOTO EndLoop21 ELSE BoardRun(Z, Y) = 1: CIRCLE (BoardX(Z, Y), BoardY(Z, Y)), 10, 15: PAINT (BoardX(Z, Y), BoardY(Z, Y)), 15
               EndLoop21: IF Z = 5 AND Y + 1 = 5 GOTO EndLoop22 ELSE BoardRun(Z, Y + 1) = 1: CIRCLE (BoardX(Z, Y + 1), BoardY(Z, Y + 1)), 10, 15: PAINT (BoardX(Z, Y + 1), BoardY(Z, Y + 1)), 15
               EndLoop22: IF Z = 5 AND Y + 2 = 5 GOTO EndLoop23 ELSE BoardRun(Z, Y + 2) = 1: CIRCLE (BoardX(Z, Y + 2), BoardY(Z, Y + 2)), 10, 15: PAINT (BoardX(Z, Y + 2), BoardY(Z, Y + 2)), 15
               EndLoop23: IF Z = 5 AND Y + 3 = 5 GOTO EndLoop24 ELSE BoardRun(Z, Y + 3) = 1: CIRCLE (BoardX(Z, Y + 3), BoardY(Z, Y + 3)), 10, 15: PAINT (BoardX(Z, Y + 3), BoardY(Z, Y + 3)), 15
               EndLoop24: IF Z = 5 AND Y + 4 = 5 GOTO EndLoop25 ELSE BoardRun(Z, Y + 4) = 1: CIRCLE (BoardX(Z, Y + 4), BoardY(Z, Y + 4)), 10, 15: PAINT (BoardX(Z, Y + 4), BoardY(Z, Y + 4)), 15
               EndLoop25:
            END IF
         NEXT
      NEXT
      X2 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)
   END IF

   X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0

   ' Check for Duel Diagonal 1 Pattern
   IF BoardPlayer(1, 1) = Player AND BoardPlayer(2, 2) = Player AND BoardPlayer(3, 3) = Player AND BoardPlayer(4, 4) = Player AND BoardPlayer(6, 6) = Player AND BoardPlayer(7, 7) = Player AND BoardPlayer(8, 8) = Player AND BoardPlayer(9, 9) = Player THEN
      X3 = 2
      BoardRun(1, 1) = 1: CIRCLE (BoardX(1, 1), BoardY(1, 1)), 10, 15: PAINT (BoardX(1, 1), BoardY(1, 1)), 15
      BoardRun(2, 2) = 1: CIRCLE (BoardX(2, 2), BoardY(2, 2)), 10, 15: PAINT (BoardX(2, 2), BoardY(2, 2)), 15
      BoardRun(3, 3) = 1: CIRCLE (BoardX(3, 3), BoardY(3, 3)), 10, 15: PAINT (BoardX(3, 3), BoardY(3, 3)), 15
      BoardRun(4, 4) = 1: CIRCLE (BoardX(4, 4), BoardY(4, 4)), 10, 15: PAINT (BoardX(4, 4), BoardY(4, 4)), 15
      BoardRun(6, 6) = 1: CIRCLE (BoardX(6, 6), BoardY(6, 6)), 10, 15: PAINT (BoardX(6, 6), BoardY(6, 6)), 15
      BoardRun(7, 7) = 1: CIRCLE (BoardX(7, 7), BoardY(7, 7)), 10, 15: PAINT (BoardX(7, 7), BoardY(7, 7)), 15
      BoardRun(8, 8) = 1: CIRCLE (BoardX(8, 8), BoardY(8, 8)), 10, 15: PAINT (BoardX(8, 8), BoardY(8, 8)), 15
      BoardRun(9, 9) = 1: CIRCLE (BoardX(9, 9), BoardY(9, 9)), 10, 15: PAINT (BoardX(9, 9), BoardY(9, 9)), 15
   END IF

   ' Check for Single Diagonal 1 Patterns
   IF X3 = 0 THEN

      IF BoardPlayer(1, 5) = Player AND BoardPlayer(2, 6) = Player AND BoardPlayer(3, 7) = Player AND BoardPlayer(4, 8) = Player AND BoardPlayer(5, 9) = Player THEN
         X(1) = 1
         BoardRun(1, 5) = 1: CIRCLE (BoardX(1, 5), BoardY(1, 5)), 10, 15: PAINT (BoardX(1, 5), BoardY(1, 5)), 15
         BoardRun(2, 6) = 1: CIRCLE (BoardX(2, 6), BoardY(2, 6)), 10, 15: PAINT (BoardX(2, 6), BoardY(2, 6)), 15
         BoardRun(3, 7) = 1: CIRCLE (BoardX(3, 7), BoardY(3, 7)), 10, 15: PAINT (BoardX(3, 7), BoardY(3, 7)), 15
         BoardRun(4, 8) = 1: CIRCLE (BoardX(4, 8), BoardY(4, 8)), 10, 15: PAINT (BoardX(4, 8), BoardY(4, 8)), 15
         BoardRun(5, 9) = 1: CIRCLE (BoardX(5, 9), BoardY(5, 9)), 10, 15: PAINT (BoardX(5, 9), BoardY(5, 9)), 15
      END IF

      FOR Z = 0 TO 1
         IF BoardPlayer(1 + Z, 4 + Z) = Player AND BoardPlayer(2 + Z, 5 + Z) = Player AND BoardPlayer(3 + Z, 6 + Z) = Player AND BoardPlayer(4 + Z, 7 + Z) = Player AND BoardPlayer(5 + Z, 8 + Z) = Player THEN
            X(2) = 1
            BoardRun(Z + 1, Z + 4) = 1: CIRCLE (BoardX(Z + 1, Z + 4), BoardY(Z + 1, Z + 4)), 10, 15: PAINT (BoardX(Z + 1, Z + 4), BoardY(Z + 1, Z + 4)), 15
            BoardRun(Z + 2, Z + 5) = 1: CIRCLE (BoardX(Z + 2, Z + 5), BoardY(Z + 2, Z + 5)), 10, 15: PAINT (BoardX(Z + 2, Z + 5), BoardY(Z + 2, Z + 5)), 15
            BoardRun(Z + 3, Z + 6) = 1: CIRCLE (BoardX(Z + 3, Z + 6), BoardY(Z + 3, Z + 6)), 10, 15: PAINT (BoardX(Z + 3, Z + 6), BoardY(Z + 3, Z + 6)), 15
            BoardRun(Z + 4, Z + 7) = 1: CIRCLE (BoardX(Z + 4, Z + 7), BoardY(Z + 4, Z + 7)), 10, 15: PAINT (BoardX(Z + 4, Z + 7), BoardY(Z + 4, Z + 7)), 15
            BoardRun(Z + 5, Z + 8) = 1: CIRCLE (BoardX(Z + 5, Z + 8), BoardY(Z + 5, Z + 8)), 10, 15: PAINT (BoardX(Z + 5, Z + 8), BoardY(Z + 5, Z + 8)), 15
         END IF
      NEXT

      FOR Z = 0 TO 2
         IF BoardPlayer(1 + Z, 3 + Z) = Player AND BoardPlayer(2 + Z, 4 + Z) = Player AND BoardPlayer(3 + Z, 5 + Z) = Player AND BoardPlayer(4 + Z, 6 + Z) = Player AND BoardPlayer(5 + Z, 7 + Z) = Player THEN
            X(3) = 1
            BoardRun(Z + 1, Z + 3) = 1: CIRCLE (BoardX(Z + 1, Z + 3), BoardY(Z + 1, Z + 3)), 10, 15: PAINT (BoardX(Z + 1, Z + 3), BoardY(Z + 1, Z + 3)), 15
            BoardRun(Z + 2, Z + 4) = 1: CIRCLE (BoardX(Z + 2, Z + 4), BoardY(Z + 2, Z + 4)), 10, 15: PAINT (BoardX(Z + 2, Z + 4), BoardY(Z + 2, Z + 4)), 15
            BoardRun(Z + 3, Z + 5) = 1: CIRCLE (BoardX(Z + 3, Z + 5), BoardY(Z + 3, Z + 5)), 10, 15: PAINT (BoardX(Z + 3, Z + 5), BoardY(Z + 3, Z + 5)), 15
            BoardRun(Z + 4, Z + 6) = 1: CIRCLE (BoardX(Z + 4, Z + 6), BoardY(Z + 4, Z + 6)), 10, 15: PAINT (BoardX(Z + 4, Z + 6), BoardY(Z + 4, Z + 6)), 15
            BoardRun(Z + 5, Z + 7) = 1: CIRCLE (BoardX(Z + 5, Z + 7), BoardY(Z + 5, Z + 7)), 10, 15: PAINT (BoardX(Z + 5, Z + 7), BoardY(Z + 5, Z + 7)), 15
         END IF
      NEXT

      FOR Z = 0 TO 3
         IF BoardPlayer(1 + Z, 2 + Z) = Player AND BoardPlayer(2 + Z, 3 + Z) = Player AND BoardPlayer(3 + Z, 4 + Z) = Player AND BoardPlayer(4 + Z, 5 + Z) = Player AND BoardPlayer(5 + Z, 6 + Z) = Player THEN
            X(4) = 1
            BoardRun(Z + 1, Z + 2) = 1: CIRCLE (BoardX(Z + 1, Z + 2), BoardY(Z + 1, Z + 2)), 10, 15: PAINT (BoardX(Z + 1, Z + 2), BoardY(Z + 1, Z + 2)), 15
            BoardRun(Z + 2, Z + 3) = 1: CIRCLE (BoardX(Z + 2, Z + 3), BoardY(Z + 2, Z + 3)), 10, 15: PAINT (BoardX(Z + 2, Z + 3), BoardY(Z + 2, Z + 3)), 15
            BoardRun(Z + 3, Z + 4) = 1: CIRCLE (BoardX(Z + 3, Z + 4), BoardY(Z + 3, Z + 4)), 10, 15: PAINT (BoardX(Z + 3, Z + 4), BoardY(Z + 3, Z + 4)), 15
            BoardRun(Z + 4, Z + 5) = 1: CIRCLE (BoardX(Z + 4, Z + 5), BoardY(Z + 4, Z + 5)), 10, 15: PAINT (BoardX(Z + 4, Z + 5), BoardY(Z + 4, Z + 5)), 15
            BoardRun(Z + 5, Z + 6) = 1: CIRCLE (BoardX(Z + 5, Z + 6), BoardY(Z + 5, Z + 6)), 10, 15: PAINT (BoardX(Z + 5, Z + 6), BoardY(Z + 5, Z + 6)), 15
         END IF
      NEXT

      FOR Z = 1 TO 5
         IF (BoardPlayer(Z, Z) = Player OR BoardSpace(Z, Z) = 38) AND (BoardPlayer(Z + 1, Z + 1) = Player OR BoardSpace(Z + 1, Z + 1) = 38) AND (BoardPlayer(Z + 2, Z + 2) = Player OR BoardSpace(Z + 2, Z + 2) = 38) AND (BoardPlayer(Z + 3, Z + 3) = Player OR BoardSpace(Z + 3, Z + 3) = 38) AND (BoardPlayer(Z + 4, Z + 4) = Player OR BoardSpace(Z + 4, Z + 4) = 38) THEN
            X(5) = 1
            IF BoardSpace(Z, Z) <> 38 THEN BoardRun(Z, Z) = 1: CIRCLE (BoardX(Z, Z), BoardY(Z, Z)), 10, 15: PAINT (BoardX(Z, Z), BoardY(Z, Z)), 15
            IF BoardSpace(Z + 1, Z + 1) <> 38 THEN BoardRun(Z + 1, Z + 1) = 1: CIRCLE (BoardX(Z + 1, Z + 1), BoardY(Z + 1, Z + 1)), 10, 15: PAINT (BoardX(Z + 1, Z + 1), BoardY(Z + 1, Z + 1)), 15
            IF BoardSpace(Z + 2, Z + 2) <> 38 THEN BoardRun(Z + 2, Z + 2) = 1: CIRCLE (BoardX(Z + 2, Z + 2), BoardY(Z + 2, Z + 2)), 10, 15: PAINT (BoardX(Z + 2, Z + 2), BoardY(Z + 2, Z + 2)), 15
            IF BoardSpace(Z + 3, Z + 3) <> 38 THEN BoardRun(Z + 3, Z + 3) = 1: CIRCLE (BoardX(Z + 3, Z + 3), BoardY(Z + 3, Z + 3)), 10, 15: PAINT (BoardX(Z + 3, Z + 3), BoardY(Z + 3, Z + 3)), 15
            IF BoardSpace(Z + 4, Z + 4) <> 38 THEN BoardRun(Z + 4, Z + 4) = 1: CIRCLE (BoardX(Z + 4, Z + 4), BoardY(Z + 4, Z + 4)), 10, 15: PAINT (BoardX(Z + 4, Z + 4), BoardY(Z + 4, Z + 4)), 15
         END IF
      NEXT

      FOR Z = 0 TO 3
         IF BoardPlayer(2 + Z, 1 + Z) = Player AND BoardPlayer(3 + Z, 2 + Z) = Player AND BoardPlayer(4 + Z, 3 + Z) = Player AND BoardPlayer(5 + Z, 4 + Z) = Player AND BoardPlayer(6 + Z, 5 + Z) = Player THEN
            X(6) = 1
            BoardRun(Z + 2, Z + 1) = 1: CIRCLE (BoardX(Z + 2, Z + 1), BoardY(Z + 2, Z + 1)), 10, 15: PAINT (BoardX(Z + 2, Z + 1), BoardY(Z + 2, Z + 1)), 15
            BoardRun(Z + 3, Z + 2) = 1: CIRCLE (BoardX(Z + 3, Z + 2), BoardY(Z + 3, Z + 2)), 10, 15: PAINT (BoardX(Z + 3, Z + 2), BoardY(Z + 3, Z + 2)), 15
            BoardRun(Z + 4, Z + 3) = 1: CIRCLE (BoardX(Z + 4, Z + 3), BoardY(Z + 4, Z + 3)), 10, 15: PAINT (BoardX(Z + 4, Z + 3), BoardY(Z + 4, Z + 3)), 15
            BoardRun(Z + 5, Z + 4) = 1: CIRCLE (BoardX(Z + 5, Z + 4), BoardY(Z + 5, Z + 4)), 10, 15: PAINT (BoardX(Z + 5, Z + 4), BoardY(Z + 5, Z + 4)), 15
            BoardRun(Z + 6, Z + 5) = 1: CIRCLE (BoardX(Z + 6, Z + 5), BoardY(Z + 6, Z + 5)), 10, 15: PAINT (BoardX(Z + 6, Z + 5), BoardY(Z + 6, Z + 5)), 15
         END IF
      NEXT

      FOR Z = 0 TO 2
         IF BoardPlayer(3 + Z, 1 + Z) = Player AND BoardPlayer(4 + Z, 2 + Z) = Player AND BoardPlayer(5 + Z, 3 + Z) = Player AND BoardPlayer(6 + Z, 4 + Z) = Player AND BoardPlayer(7 + Z, 5 + Z) = Player THEN
            X(7) = 1
            BoardRun(Z + 3, Z + 1) = 1: CIRCLE (BoardX(Z + 3, Z + 1), BoardY(Z + 3, Z + 1)), 10, 15: PAINT (BoardX(Z + 3, Z + 1), BoardY(Z + 3, Z + 1)), 15
            BoardRun(Z + 4, Z + 2) = 1: CIRCLE (BoardX(Z + 4, Z + 2), BoardY(Z + 4, Z + 2)), 10, 15: PAINT (BoardX(Z + 4, Z + 2), BoardY(Z + 4, Z + 2)), 15
            BoardRun(Z + 5, Z + 3) = 1: CIRCLE (BoardX(Z + 5, Z + 3), BoardY(Z + 5, Z + 3)), 10, 15: PAINT (BoardX(Z + 5, Z + 3), BoardY(Z + 5, Z + 3)), 15
            BoardRun(Z + 6, Z + 4) = 1: CIRCLE (BoardX(Z + 6, Z + 4), BoardY(Z + 6, Z + 4)), 10, 15: PAINT (BoardX(Z + 6, Z + 4), BoardY(Z + 6, Z + 4)), 15
            BoardRun(Z + 7, Z + 5) = 1: CIRCLE (BoardX(Z + 7, Z + 5), BoardY(Z + 7, Z + 5)), 10, 15: PAINT (BoardX(Z + 7, Z + 5), BoardY(Z + 7, Z + 5)), 15
         END IF
      NEXT

      FOR Z = 0 TO 1
         IF BoardPlayer(4 + Z, 1 + Z) = Player AND BoardPlayer(5 + Z, 2 + Z) = Player AND BoardPlayer(6 + Z, 3 + Z) = Player AND BoardPlayer(7 + Z, 4 + Z) = Player AND BoardPlayer(8 + Z, 5 + Z) = Player THEN
            X(8) = 1
            BoardRun(Z + 4, Z + 1) = 1: CIRCLE (BoardX(Z + 4, Z + 1), BoardY(Z + 4, Z + 1)), 10, 15: PAINT (BoardX(Z + 4, Z + 1), BoardY(Z + 4, Z + 1)), 15
            BoardRun(Z + 5, Z + 2) = 1: CIRCLE (BoardX(Z + 5, Z + 2), BoardY(Z + 5, Z + 2)), 10, 15: PAINT (BoardX(Z + 5, Z + 2), BoardY(Z + 5, Z + 2)), 15
            BoardRun(Z + 6, Z + 3) = 1: CIRCLE (BoardX(Z + 6, Z + 3), BoardY(Z + 6, Z + 3)), 10, 15: PAINT (BoardX(Z + 6, Z + 3), BoardY(Z + 6, Z + 3)), 15
            BoardRun(Z + 7, Z + 4) = 1: CIRCLE (BoardX(Z + 7, Z + 4), BoardY(Z + 7, Z + 4)), 10, 15: PAINT (BoardX(Z + 7, Z + 4), BoardY(Z + 7, Z + 4)), 15
            BoardRun(Z + 8, Z + 5) = 1: CIRCLE (BoardX(Z + 8, Z + 5), BoardY(Z + 8, Z + 5)), 10, 15: PAINT (BoardX(Z + 8, Z + 5), BoardY(Z + 8, Z + 5)), 15
         END IF
      NEXT

      IF BoardPlayer(5, 1) = Player AND BoardPlayer(6, 2) = Player AND BoardPlayer(7, 3) = Player AND BoardPlayer(8, 4) = Player AND BoardPlayer(9, 5) = Player THEN
         X(9) = 1
         BoardRun(5, 1) = 1: CIRCLE (BoardX(5, 1), BoardY(5, 1)), 10, 15: PAINT (BoardX(5, 1), BoardY(5, 1)), 15
         BoardRun(6, 2) = 1: CIRCLE (BoardX(6, 2), BoardY(6, 2)), 10, 15: PAINT (BoardX(6, 2), BoardY(6, 2)), 15
         BoardRun(7, 3) = 1: CIRCLE (BoardX(7, 3), BoardY(7, 3)), 10, 15: PAINT (BoardX(7, 3), BoardY(7, 3)), 15
         BoardRun(8, 4) = 1: CIRCLE (BoardX(8, 4), BoardY(8, 4)), 10, 15: PAINT (BoardX(8, 4), BoardY(8, 4)), 15
         BoardRun(9, 5) = 1: CIRCLE (BoardX(9, 5), BoardY(9, 5)), 10, 15: PAINT (BoardX(9, 5), BoardY(9, 5)), 15
      END IF

      X3 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)

   END IF

   X(1) = 0: X(2) = 0: X(3) = 0: X(4) = 0: X(5) = 0: X(6) = 0: X(7) = 0: X(8) = 0: X(9) = 0

   ' Check for Duel Diagonal 2 Pattern
   IF BoardPlayer(1, 9) = Player AND BoardPlayer(2, 8) = Player AND BoardPlayer(3, 7) = Player AND BoardPlayer(4, 6) = Player AND BoardPlayer(6, 4) = Player AND BoardPlayer(7, 3) = Player AND BoardPlayer(8, 2) = Player AND BoardPlayer(9, 1) = Player THEN
      X4 = 2
      BoardRun(1, 9) = 1: CIRCLE (BoardX(1, 9), BoardY(1, 9)), 10, 15: PAINT (BoardX(1, 9), BoardY(1, 9)), 15
      BoardRun(2, 8) = 1: CIRCLE (BoardX(2, 8), BoardY(2, 8)), 10, 15: PAINT (BoardX(2, 8), BoardY(2, 8)), 15
      BoardRun(3, 7) = 1: CIRCLE (BoardX(3, 7), BoardY(3, 7)), 10, 15: PAINT (BoardX(3, 7), BoardY(3, 7)), 15
      BoardRun(4, 6) = 1: CIRCLE (BoardX(4, 6), BoardY(4, 6)), 10, 15: PAINT (BoardX(4, 6), BoardY(4, 6)), 15
      BoardRun(6, 4) = 1: CIRCLE (BoardX(6, 4), BoardY(6, 4)), 10, 15: PAINT (BoardX(6, 4), BoardY(6, 4)), 15
      BoardRun(7, 3) = 1: CIRCLE (BoardX(7, 3), BoardY(7, 3)), 10, 15: PAINT (BoardX(7, 3), BoardY(7, 3)), 15
      BoardRun(8, 2) = 1: CIRCLE (BoardX(8, 2), BoardY(8, 2)), 10, 15: PAINT (BoardX(8, 2), BoardY(8, 2)), 15
      BoardRun(9, 1) = 1: CIRCLE (BoardX(9, 1), BoardY(9, 1)), 10, 15: PAINT (BoardX(9, 1), BoardY(9, 1)), 15
   END IF

   ' Check for Single Diagonal 2 Patterns
   IF X4 = 0 THEN

      IF BoardPlayer(1, 5) = Player AND BoardPlayer(2, 4) = Player AND BoardPlayer(3, 3) = Player AND BoardPlayer(4, 2) = Player AND BoardPlayer(5, 1) = Player THEN
         X(1) = 1
         BoardRun(1, 5) = 1: CIRCLE (BoardX(1, 5), BoardY(1, 5)), 10, 15: PAINT (BoardX(1, 5), BoardY(1, 5)), 15
         BoardRun(2, 4) = 1: CIRCLE (BoardX(2, 4), BoardY(2, 4)), 10, 15: PAINT (BoardX(2, 4), BoardY(2, 4)), 15
         BoardRun(3, 3) = 1: CIRCLE (BoardX(3, 3), BoardY(3, 3)), 10, 15: PAINT (BoardX(3, 3), BoardY(3, 3)), 15
         BoardRun(4, 2) = 1: CIRCLE (BoardX(4, 2), BoardY(4, 2)), 10, 15: PAINT (BoardX(4, 2), BoardY(4, 2)), 15
         BoardRun(5, 1) = 1: CIRCLE (BoardX(5, 1), BoardY(5, 1)), 10, 15: PAINT (BoardX(5, 1), BoardY(5, 1)), 15
      END IF

      FOR Z = 0 TO 1
         IF BoardPlayer(0 + Z, 7 - Z) = Player AND BoardPlayer(1 + Z, 6 - Z) = Player AND BoardPlayer(2 + Z, 5 - Z) = Player AND BoardPlayer(3 + Z, 4 - Z) = Player AND BoardPlayer(4 + Z, 3 - Z) = Player THEN
            X(2) = 1
            BoardRun(0 + Z, 7 - Z) = 1: CIRCLE (BoardX(0 + Z, 7 - Z), BoardY(0 + Z, 7 - Z)), 10, 15: PAINT (BoardX(0 + Z, 7 - Z), BoardY(0 + Z, 7 - Z)), 15
            BoardRun(1 + Z, 6 - Z) = 1: CIRCLE (BoardX(1 + Z, 6 - Z), BoardY(1 + Z, 6 - Z)), 10, 15: PAINT (BoardX(1 + Z, 6 - Z), BoardY(1 + Z, 6 - Z)), 15
            BoardRun(2 + Z, 5 - Z) = 1: CIRCLE (BoardX(2 + Z, 5 - Z), BoardY(2 + Z, 5 - Z)), 10, 15: PAINT (BoardX(2 + Z, 5 - Z), BoardY(2 + Z, 5 - Z)), 15
            BoardRun(3 + Z, 4 - Z) = 1: CIRCLE (BoardX(3 + Z, 4 - Z), BoardY(3 + Z, 4 - Z)), 10, 15: PAINT (BoardX(3 + Z, 4 - Z), BoardY(3 + Z, 4 - Z)), 15
            BoardRun(4 + Z, 3 - Z) = 1: CIRCLE (BoardX(4 + Z, 3 - Z), BoardY(4 + Z, 3 - Z)), 10, 15: PAINT (BoardX(4 + Z, 3 - Z), BoardY(4 + Z, 3 - Z)), 15
         END IF
      NEXT

      FOR Z = 0 TO 2
         IF BoardPlayer(0 + Z, 8 - Z) = Player AND BoardPlayer(1 + Z, 7 - Z) = Player AND BoardPlayer(2 + Z, 6 - Z) = Player AND BoardPlayer(3 + Z, 5 - Z) = Player AND BoardPlayer(4 + Z, 4 - Z) = Player THEN
            X(3) = 1
            BoardRun(0 + Z, 8 - Z) = 1: CIRCLE (BoardX(0 + Z, 8 - Z), BoardY(0 + Z, 8 - Z)), 10, 15: PAINT (BoardX(0 + Z, 8 - Z), BoardY(0 + Z, 8 - Z)), 15
            BoardRun(1 + Z, 7 - Z) = 1: CIRCLE (BoardX(1 + Z, 7 - Z), BoardY(1 + Z, 7 - Z)), 10, 15: PAINT (BoardX(1 + Z, 7 - Z), BoardY(1 + Z, 7 - Z)), 15
            BoardRun(2 + Z, 6 - Z) = 1: CIRCLE (BoardX(2 + Z, 6 - Z), BoardY(2 + Z, 6 - Z)), 10, 15: PAINT (BoardX(2 + Z, 6 - Z), BoardY(2 + Z, 6 - Z)), 15
            BoardRun(3 + Z, 5 - Z) = 1: CIRCLE (BoardX(3 + Z, 5 - Z), BoardY(3 + Z, 5 - Z)), 10, 15: PAINT (BoardX(3 + Z, 5 - Z), BoardY(3 + Z, 5 - Z)), 15
            BoardRun(4 + Z, 4 - Z) = 1: CIRCLE (BoardX(4 + Z, 4 - Z), BoardY(4 + Z, 4 - Z)), 10, 15: PAINT (BoardX(4 + Z, 4 - Z), BoardY(4 + Z, 4 - Z)), 15
         END IF
      NEXT

      FOR Z = 0 TO 3
         IF BoardPlayer(0 + Z, 9 - Z) = Player AND BoardPlayer(1 + Z, 8 - Z) = Player AND BoardPlayer(2 + Z, 7 - Z) = Player AND BoardPlayer(3 + Z, 6 - Z) = Player AND BoardPlayer(4 + Z, 5 - Z) = Player THEN
            X(4) = 1
            BoardRun(0 + Z, 9 - Z) = 1: CIRCLE (BoardX(0 + Z, 9 - Z), BoardY(0 + Z, 9 - Z)), 10, 15: PAINT (BoardX(0 + Z, 9 - Z), BoardY(0 + Z, 9 - Z)), 15
            BoardRun(1 + Z, 8 - Z) = 1: CIRCLE (BoardX(1 + Z, 8 - Z), BoardY(1 + Z, 8 - Z)), 10, 15: PAINT (BoardX(1 + Z, 8 - Z), BoardY(1 + Z, 8 - Z)), 15
            BoardRun(2 + Z, 7 - Z) = 1: CIRCLE (BoardX(2 + Z, 7 - Z), BoardY(2 + Z, 7 - Z)), 10, 15: PAINT (BoardX(2 + Z, 7 - Z), BoardY(2 + Z, 7 - Z)), 15
            BoardRun(3 + Z, 6 - Z) = 1: CIRCLE (BoardX(3 + Z, 6 - Z), BoardY(3 + Z, 6 - Z)), 10, 15: PAINT (BoardX(3 + Z, 6 - Z), BoardY(3 + Z, 6 - Z)), 15
            BoardRun(4 + Z, 5 - Z) = 1: CIRCLE (BoardX(4 + Z, 5 - Z), BoardY(4 + Z, 5 - Z)), 10, 15: PAINT (BoardX(4 + Z, 5 - Z), BoardY(4 + Z, 5 - Z)), 15
         END IF
      NEXT

      FOR Z = 1 TO 5
         IF (BoardPlayer(Z, 10 - Z) = Player OR BoardSpace(Z, 10 - Z) = 38) AND (BoardPlayer(1 + Z, 9 - Z) = Player OR BoardSpace(1 + Z, 9 - Z) = 38) AND (BoardPlayer(2 + Z, 8 - Z) = Player OR BoardSpace(2 + Z, 8 - Z) = 38) AND (BoardPlayer(3 + Z, 7 - Z) = Player OR BoardSpace(3 + Z, 7 - Z) = 38) AND (BoardPlayer(4 + Z, 6 - Z) = Player OR BoardSpace(4 + Z, 6 - Z) = 38) THEN
            X(5) = 1
            IF BoardSpace(Z, 10 - Z) <> 38 THEN BoardRun(Z, 10 - Z) = 1: CIRCLE (BoardX(Z, 10 - Z), BoardY(Z, 10 - Z)), 10, 15: PAINT (BoardX(Z, 10 - Z), BoardY(Z, 10 - Z)), 15
            IF BoardSpace(1 + Z, 9 - Z) <> 38 THEN BoardRun(1 + Z, 9 - Z) = 1: CIRCLE (BoardX(1 + Z, 9 - Z), BoardY(1 + Z, 9 - Z)), 10, 15: PAINT (BoardX(1 + Z, 9 - Z), BoardY(1 + Z, 9 - Z)), 15
            IF BoardSpace(2 + Z, 8 - Z) <> 38 THEN BoardRun(2 + Z, 8 - Z) = 1: CIRCLE (BoardX(2 + Z, 8 - Z), BoardY(2 + Z, 8 - Z)), 10, 15: PAINT (BoardX(2 + Z, 8 - Z), BoardY(2 + Z, 8 - Z)), 15
            IF BoardSpace(3 + Z, 7 - Z) <> 38 THEN BoardRun(3 + Z, 7 - Z) = 1: CIRCLE (BoardX(3 + Z, 7 - Z), BoardY(3 + Z, 7 - Z)), 10, 15: PAINT (BoardX(3 + Z, 7 - Z), BoardY(3 + Z, 7 - Z)), 15
            IF BoardSpace(4 + Z, 6 - Z) <> 38 THEN BoardRun(4 + Z, 6 - Z) = 1: CIRCLE (BoardX(4 + Z, 6 - Z), BoardY(4 + Z, 6 - Z)), 10, 15: PAINT (BoardX(4 + Z, 6 - Z), BoardY(4 + Z, 6 - Z)), 15
         END IF
      NEXT

      FOR Z = 0 TO 3
         IF BoardPlayer(2 + Z, 9 - Z) = Player AND BoardPlayer(3 + Z, 8 - Z) = Player AND BoardPlayer(4 + Z, 7 - Z) = Player AND BoardPlayer(5 + Z, 6 - Z) = Player AND BoardPlayer(6 + Z, 5 - Z) = Player THEN
            X(6) = 1
            BoardRun(2 + Z, 9 - Z) = 1: CIRCLE (BoardX(2 + Z, 9 - Z), BoardY(2 + Z, 9 - Z)), 10, 15: PAINT (BoardX(2 + Z, 9 - Z), BoardY(2 + Z, 9 - Z)), 15
            BoardRun(3 + Z, 8 - Z) = 1: CIRCLE (BoardX(3 + Z, 8 - Z), BoardY(3 + Z, 8 - Z)), 10, 15: PAINT (BoardX(3 + Z, 8 - Z), BoardY(3 + Z, 8 - Z)), 15
            BoardRun(4 + Z, 7 - Z) = 1: CIRCLE (BoardX(4 + Z, 7 - Z), BoardY(4 + Z, 7 - Z)), 10, 15: PAINT (BoardX(4 + Z, 7 - Z), BoardY(4 + Z, 7 - Z)), 15
            BoardRun(5 + Z, 6 - Z) = 1: CIRCLE (BoardX(5 + Z, 6 - Z), BoardY(5 + Z, 6 - Z)), 10, 15: PAINT (BoardX(5 + Z, 6 - Z), BoardY(5 + Z, 6 - Z)), 15
            BoardRun(6 + Z, 5 - Z) = 1: CIRCLE (BoardX(6 + Z, 5 - Z), BoardY(6 + Z, 5 - Z)), 10, 15: PAINT (BoardX(6 + Z, 5 - Z), BoardY(6 + Z, 5 - Z)), 15
         END IF
      NEXT

      FOR Z = 0 TO 2
         IF BoardPlayer(3 + Z, 9 - Z) = Player AND BoardPlayer(4 + Z, 8 - Z) = Player AND BoardPlayer(5 + Z, 7 - Z) = Player AND BoardPlayer(5 + Z, 6 - Z) = Player AND BoardPlayer(7 + Z, 5 - Z) = Player THEN
            X(7) = 1
            BoardRun(3 + Z, 9 - Z) = 1: CIRCLE (BoardX(3 + Z, 9 - Z), BoardY(3 + Z, 9 - Z)), 10, 15: PAINT (BoardX(3 + Z, 9 - Z), BoardY(3 + Z, 9 - Z)), 15
            BoardRun(4 + Z, 8 - Z) = 1: CIRCLE (BoardX(4 + Z, 8 - Z), BoardY(4 + Z, 8 - Z)), 10, 15: PAINT (BoardX(4 + Z, 8 - Z), BoardY(4 + Z, 8 - Z)), 15
            BoardRun(5 + Z, 7 - Z) = 1: CIRCLE (BoardX(5 + Z, 7 - Z), BoardY(5 + Z, 7 - Z)), 10, 15: PAINT (BoardX(5 + Z, 7 - Z), BoardY(5 + Z, 7 - Z)), 15
            BoardRun(6 + Z, 6 - Z) = 1: CIRCLE (BoardX(6 + Z, 6 - Z), BoardY(6 + Z, 6 - Z)), 10, 15: PAINT (BoardX(6 + Z, 6 - Z), BoardY(6 + Z, 6 - Z)), 15
            BoardRun(7 + Z, 5 - Z) = 1: CIRCLE (BoardX(7 + Z, 5 - Z), BoardY(7 + Z, 5 - Z)), 10, 15: PAINT (BoardX(7 + Z, 5 - Z), BoardY(7 + Z, 5 - Z)), 15
         END IF
      NEXT

      FOR Z = 0 TO 1
         IF BoardPlayer(4 + Z, 9 - Z) = Player AND BoardPlayer(5 + Z, 8 - Z) = Player AND BoardPlayer(6 + Z, 7 - Z) = Player AND BoardPlayer(7 + Z, 6 - Z) = Player AND BoardPlayer(8 + Z, 5 - Z) = Player THEN
            X(8) = 1
            BoardRun(4 + Z, 9 - Z) = 1: CIRCLE (BoardX(4 + Z, 9 - Z), BoardY(4 + Z, 9 - Z)), 10, 15: PAINT (BoardX(4 + Z, 9 - Z), BoardY(4 + Z, 9 - Z)), 15
            BoardRun(5 + Z, 8 - Z) = 1: CIRCLE (BoardX(5 + Z, 8 - Z), BoardY(5 + Z, 8 - Z)), 10, 15: PAINT (BoardX(5 + Z, 8 - Z), BoardY(5 + Z, 8 - Z)), 15
            BoardRun(6 + Z, 7 - Z) = 1: CIRCLE (BoardX(5 + Z, 7 - Z), BoardY(6 + Z, 7 - Z)), 10, 15: PAINT (BoardX(6 + Z, 7 - Z), BoardY(6 + Z, 7 - Z)), 15
            BoardRun(7 + Z, 6 - Z) = 1: CIRCLE (BoardX(7 + Z, 6 - Z), BoardY(7 + Z, 6 - Z)), 10, 15: PAINT (BoardX(7 + Z, 6 - Z), BoardY(7 + Z, 6 - Z)), 15
            BoardRun(8 + Z, 5 - Z) = 1: CIRCLE (BoardX(8 + Z, 5 - Z), BoardY(8 + Z, 5 - Z)), 10, 15: PAINT (BoardX(8 + Z, 5 - Z), BoardY(8 + Z, 5 - Z)), 15
         END IF
      NEXT

      IF BoardPlayer(5, 9) = Player AND BoardPlayer(6, 8) = Player AND BoardPlayer(7, 7) = Player AND BoardPlayer(8, 6) = Player AND BoardPlayer(9, 5) = Player THEN
         X(9) = 1
         BoardRun(5, 9) = 1: CIRCLE (BoardX(5, 9), BoardY(5, 9)), 10, 15: PAINT (BoardX(5, 9), BoardY(5, 9)), 15
         BoardRun(6, 8) = 1: CIRCLE (BoardX(6, 8), BoardY(6, 8)), 10, 15: PAINT (BoardX(6, 8), BoardY(6, 8)), 15
         BoardRun(7, 7) = 1: CIRCLE (BoardX(7, 7), BoardY(7, 7)), 10, 15: PAINT (BoardX(7, 7), BoardY(7, 7)), 15
         BoardRun(8, 6) = 1: CIRCLE (BoardX(8, 6), BoardY(8, 6)), 10, 15: PAINT (BoardX(8, 6), BoardY(8, 6)), 15
         BoardRun(9, 5) = 1: CIRCLE (BoardX(9, 5), BoardY(9, 5)), 10, 15: PAINT (BoardX(9, 5), BoardY(9, 5)), 15
      END IF

      X4 = X(1) + X(2) + X(3) + X(4) + X(5) + X(6) + X(7) + X(8) + X(9)

   END IF

   IF X1 + X2 + X3 + X4 > 1 THEN CheckWinner = Player ELSE CheckWinner = 0

END FUNCTION

SUB DisplayWinner (Player)

   LINE (DiceX(1) - 55, 295)-(DiceX(5) + 55, 595), 1, BF

   fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\Segoeuib.ttf"
   COLOR 15, 1: font& = _LOADFONT(fontpath$, 28): _FONT font&:

   _PRINTSTRING (780, 670), "          Player " + STR$(Player) + " is the Winner!           "

   _PRINTSTRING (780, 705), "      Play Another Game? (Y or N)        "

   YorN: A$ = UCASE$(INKEY$): IF A$ = "" GOTO YorN
   IF ASC(A$) = 27 AND FullScreen = 0 THEN FullScreen = -1: _FULLSCREEN _SQUAREPIXELS , _SMOOTH ELSE IF ASC(A$) = 27 THEN FullScreen = 0: _FULLSCREEN _OFF
   IF A$ = "Y" THEN RUN
   IF A$ = "N" THEN SYSTEM
   GOTO YorN

END SUB

Print this item