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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 483
» Latest member: aplus
» Forum threads: 2,795
» Forum posts: 26,338

Full Statistics

Latest Threads
GNU C++ Compiler error
Forum: Help Me!
Last Post: eoredson
1 hour ago
» Replies: 15
» Views: 185
What do you guys like to ...
Forum: General Discussion
Last Post: bplus
5 hours ago
» Replies: 10
» Views: 111
Mean user base makes Stev...
Forum: General Discussion
Last Post: Pete
Yesterday, 06:39 PM
» Replies: 8
» Views: 218
Fast QB64 base64 encoder ...
Forum: a740g
Last Post: a740g
Yesterday, 04:43 AM
» Replies: 3
» Views: 455
_IIF limits two question...
Forum: General Discussion
Last Post: bplus
Yesterday, 02:56 AM
» Replies: 6
» Views: 116
DeflatePro
Forum: a740g
Last Post: a740g
Yesterday, 02:11 AM
» Replies: 2
» Views: 69
New QBJS Samples Site
Forum: QBJS, BAM, and Other BASICs
Last Post: dbox
12-20-2024, 06:16 PM
» Replies: 25
» Views: 902
Raspberry OS
Forum: Help Me!
Last Post: Jack
12-20-2024, 05:42 PM
» Replies: 7
» Views: 157
InForm-PE
Forum: a740g
Last Post: Kernelpanic
12-20-2024, 05:22 PM
» Replies: 80
» Views: 6,187
Merry Christmas Globes!
Forum: Programs
Last Post: SierraKen
12-20-2024, 03:46 AM
» Replies: 10
» Views: 149

 
  Program Containing All Inkey$ function codes and all other codes
Posted by: TDarcos - 04-27-2024, 02:43 AM - Forum: Utilities - Replies (4)

You're probably aware that the 12 function keys can generate 48 functions (FKey, Shift FKey, Ctrl FKey, Alt Fkey). You might be aware that there are 12 more function keys by using ALT and any of 0-9 , - , and -. You're probably not aware of some functions, like ALT-Pg Down , Shift Pg Down, beyond the usual Pg Down and Ctrl Pg Down. But did you know about ALT-Comma, and Alt-Open Brace (Actually it's available as ALT-[ and as ALT-{.)

I have created a file containing the definition for essentially every key combination recognized by Inkey$ a set of named constants. It's intended to go by most used to least used:

  • All F-Keys
  • ALT numbers
  • ALT punctuation
  • Regular upper case (Capitals)
  • Regular lower case
  • Digits
  • Punctuation
  • Control Characters

I was trying to find a file containing definitions for all key combinations that generate a 2-character Inkey$ string, and not finding one, made one myself. The program at the end will display key combinations, which is how I generated the results, as the reference in the Wiki (which I pasted in as comments at the beginning) does not show all of them.

I've attached the program so it may be downloaded.

This is what it looks like:
Code: (Select All)

'                                ASCII Keyboard Codes
'
'  Esc  F1  F2  F3  F4  F5  F6  F7  F8  F9  F10  F11  F12  Sys ScL Pause
'  27 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68  +133 +134  -  -    -
'  `~  1!  2@  3#  4$  5%  6^  7&  8*  9(  0) -_ =+ BkSp  Ins Hme PUp  NumL  /  *    -
'  126 33  64  35  36  37  94  38  42  40  41 95 43  8    +82 +71 +73    -    47  42  45
'  96 49  50  51  52  53  54  55  56  57  48 45 61
'  Tab Q  W  E  R  T  Y  U  I  O  P  [{  ]}  \|  Del End PDn  7Hme 8/?  9PU  +
'  9  81  87  69  82  84  89  85  73  79  80 123 125 124  +83 +79 +81  +71  +72  +73  43
'    113 119 101 114 116 121 117 105 111 112  91  93  92                55  56  57
'  CapL  A  S  D  F  G  H  J  K  L  ;:  '" Enter                4/?-  5  6/-?
'    -  65  83  68  70  71  72  74  75  76  58  34  13                  +75  +76  +77  E
'        97 115 100 102 103 104 106 107 108  59  39                      52  53  54  n
'  Shift  Z  X  C  V  B  N  M  ,<  .>  /?    Shift      ?        1End 2/?  3PD  t
'    *    90  88  67  86  66  78  77  60  62  63      *        +72      +79  +80  +81  e
'        122 120  99 118  98 110 109  44  46  47                          49  50  51  r
'  Ctrl Win Alt      Spacebar          Alt Win Menu Ctrl  ?-  ?  -?  0Ins    .Del
'  *    -  *          32              *  -  -    *    +75 +80 +77  +82      +83  13
'                                                                        48        46
'
'    Italics = LCase/NumLock On  * = 2 byte combo only,  + = 2 Byte: CHR$(0) + CHR$(code)
'



' Alt #
Const KeyAlt0 = Chr$(0) + Chr$(129)
Const KeyAlt1 = Chr$(0) + Chr$(120)
Const KeyAlt2 = Chr$(0) + Chr$(121)
Const KeyAlt3 = Chr$(0) + Chr$(122)
Const KeyAlt4 = Chr$(0) + Chr$(123)
Const KeyAlt5 = Chr$(0) + Chr$(124)
Const KeyAlt6 = Chr$(0) + Chr$(125)
Const KeyAlt7 = Chr$(0) + Chr$(126)
Const KeyAlt8 = Chr$(0) + Chr$(127)
Const KeyAlt9 = Chr$(0) + Chr$(128)
Const KeyAltMinus = Chr$(0) + Chr$(130)
Const KeyAltPlus = Chr$(0) + Chr$(131)

' Alt + Letter
Const KeyAltA = Chr$(0) + Chr$(30)
Const KeyAltB = Chr$(0) + Chr$(48)
Const KeyAltC = Chr$(0) + Chr$(46)
Const KeyAltD = Chr$(0) + Chr$(32)
Const KeyAltE = Chr$(0) + Chr$(18)
Const KeyAltF = Chr$(0) + Chr$(33)
Const KeyAltG = Chr$(0) + Chr$(34)
Const KeyAltH = Chr$(0) + Chr$(35)
Const KeyAltI = Chr$(0) + Chr$(23)
Const KeyAltJ = Chr$(0) + Chr$(36)
Const KeyAltK = Chr$(0) + Chr$(37)
Const KeyAltL = Chr$(0) + Chr$(38)
Const KeyAltM = Chr$(0) + Chr$(50)
Const KeyAltN = Chr$(0) + Chr$(49)
Const KeyAltO = Chr$(0) + Chr$(24)
Const KeyAltP = Chr$(0) + Chr$(25)
Const KeyAltQ = Chr$(0) + Chr$(16)
Const KeyAltR = Chr$(0) + Chr$(19)
Const KeyAltS = Chr$(0) + Chr$(31)
Const KeyAltT = Chr$(0) + Chr$(20)
Const KeyAltU = Chr$(0) + Chr$(22)
Const KeyAltV = Chr$(0) + Chr$(47)
Const KeyAltW = Chr$(0) + Chr$(17)
Const KeyAltX = Chr$(0) + Chr$(45)
Const KeyAltY = Chr$(0) + Chr$(21)
Const KeyAltZ = Chr$(0) + Chr$(44)

' Function Keys
Const KeyF1 = Chr$(0) + Chr$(59)
Const KeyF2 = Chr$(0) + Chr$(60)
Const KeyF3 = Chr$(0) + Chr$(61)
Const KeyF4 = Chr$(0) + Chr$(62)
Const KeyF5 = Chr$(0) + Chr$(63)
Const KeyF6 = Chr$(0) + Chr$(64)
Const KeyF7 = Chr$(0) + Chr$(65)
Const KeyF8 = Chr$(0) + Chr$(66)
Const KeyF9 = Chr$(0) + Chr$(67)
Const KeyF10 = Chr$(0) + Chr$(68)
Const KeyF11 = Chr$(0) + Chr$(133)
Const KeyF12 = Chr$(0) + Chr$(134)

' Function Keys - Alt
Const KeyAltF1 = Chr$(0) + Chr$(104)
Const KeyAltF2 = Chr$(0) + Chr$(105)
Const KeyAltF3 = Chr$(0) + Chr$(106)
Const KeyAltF4 = Chr$(0) + Chr$(107) ' Closes Program
Const KeyAltF5 = Chr$(0) + Chr$(108)
Const KeyAltF6 = Chr$(0) + Chr$(109)
Const KeyAltF7 = Chr$(0) + Chr$(110)
Const KeyAltF8 = Chr$(0) + Chr$(111)
Const KeyAltF9 = Chr$(0) + Chr$(112)
Const KeyAltF10 = Chr$(0) + Chr$(113)
Const KeyAltF11 = Chr$(0) + Chr$(139)
Const KeyAltF12 = Chr$(0) + Chr$(140)

' Function Keys - Ctrl
Const KeyCtrlF1 = Chr$(0) + Chr$(94)
Const KeyCtrlF2 = Chr$(0) + Chr$(95)
Const KeyCtrlF3 = Chr$(0) + Chr$(96)
Const KeyCtrlF4 = Chr$(0) + Chr$(97)
Const KeyCtrlF5 = Chr$(0) + Chr$(98)
Const KeyCtrlF6 = Chr$(0) + Chr$(99)
Const KeyCtrlF7 = Chr$(0) + Chr$(100)
Const KeyCtrlF8 = Chr$(0) + Chr$(101)
Const KeyCtrlF9 = Chr$(0) + Chr$(102)
Const KeyCtrlF10 = Chr$(0) + Chr$(103)
Const KeyCtrlF11 = Chr$(0) + Chr$(137)
Const KeyCtrlF12 = Chr$(0) + Chr$(138)

' Function Keys - Shift
Const KeyShiftF1 = Chr$(0) + Chr$(84)
Const KeyShiftF2 = Chr$(0) + Chr$(85)
Const KeyShiftF3 = Chr$(0) + Chr$(86)
Const KeyShiftF4 = Chr$(0) + Chr$(87)
Const KeyShiftF5 = Chr$(0) + Chr$(88)
Const KeyShiftF6 = Chr$(0) + Chr$(89)
Const KeyShiftF7 = Chr$(0) + Chr$(90)
Const KeyShiftF8 = Chr$(0) + Chr$(91)
Const KeyShiftF9 = Chr$(0) + Chr$(92)
Const KeyShiftF10 = Chr$(0) + Chr$(93)
Const KeyShiftF11 = Chr$(0) + Chr$(133)
Const KeyShiftF12 = Chr$(0) + Chr$(134)


' Cursor keys -
Const KeyDel = Chr$(0) + Chr$(83)
Const KeyDown = Chr$(0) + Chr$(80)
Const KeyEnd = Chr$(0) + Chr$(79)
Const KeyIns = Chr$(0) + Chr$(82)
Const KeyLeft = Chr$(0) + Chr$(75)
Const KeyPgDown = Chr$(0) + Chr$(81)
Const KeyPgUp = Chr$(0) + Chr$(73)
Const KeyRight = Chr$(0) + Chr$(77)
Const KeyUp = Chr$(0) + Chr$(72)

' Cursor keys - Alt
Const KeyAltDel = Chr$(0) + Chr$(163)
Const KeyAltDown = Chr$(0) + Chr$(160)
Const KeyAltEnd = Chr$(0) + Chr$(159)
Const KeyAltIns = Chr$(0) + Chr$(162)
Const KeyAltLeft = Chr$(0) + Chr$(157)
Const KeyAltPgDown = Chr$(0) + Chr$(161)
Const KeyAltPgUp = Chr$(0) + Chr$(153)
Const KeyAltRight = Chr$(0) + Chr$(155)
Const KeyAltUp = Chr$(0) + Chr$(152)

' Cursor keys - Ctrl
Const KeyCtrlDel = Chr$(0) + Chr$(147)
Const KeyCtrlDown = Chr$(0) + Chr$(145)
Const KeyCtrlEnd = Chr$(0) + Chr$(117)
Const KeyCtrlIns = Chr$(0) + Chr$(146)
Const KeyCtrlLeft = Chr$(0) + Chr$(115)
Const KeyCtrlPgDown = Chr$(0) + Chr$(118)
Const KeyCtrlPgUp = Chr$(0) + Chr$(132)
Const KeyCtrlRight = Chr$(0) + Chr$(116)
Const KeyCtrlUp = Chr$(0) + Chr$(141)

' Cursor keys - Shift
Const KeyShiftDel = Chr$(0) + Chr$(83)
Const KeyShiftDown = Chr$(0) + Chr$(80)
Const KeyShiftEnd = Chr$(0) + Chr$(79)
Const KeyShiftIns = Chr$(0) + Chr$(82)
Const KeyShiftLeft = Chr$(0) + Chr$(75)
Const KeyShiftPgDown = Chr$(0) + Chr$(81)
Const KeyShiftPgUp = Chr$(0) + Chr$(73)
Const KeyShiftRight = Chr$(0) + Chr$(77)
Const KeyShiftUp = Chr$(0) + Chr$(72)

'Other
Const KeyAltComma = Chr$(0) + Chr$(51)
Const KeyAltPeriod = Chr$(0) + Chr$(52)
Const KeyAltSlash = Chr$(0) + Chr$(53)
Const KeyAltSemiColon = Chr$(0) + Chr$(39)
Const KeyAltQuote = Chr$(0) + Chr$(40)
Const KeyAltOpenBracket = Chr$(0) + Chr$(26) '  [
Const KeyAltCloseBracket = Chr$(0) + Chr$(27) ' ]
Const KeyAltBackSlash = Chr$(0) + Chr$(43) '    \
Const KeyAltNumericPlus = Chr$(0) + Chr$(131) ' + on the number pad
Const KeyAltBackspace = Chr$(0) + Chr$(14)
Const KeyAltTilde = Chr$(0) + Chr$(41)

Const KeyCtrlBackspace = Chr$(0) + Chr$(147)

' Capital Letters
Const KeyCapitalA = "A"
Const KeyCapitalB = "B"
Const KeyCapitalC = "C"
Const KeyCapitalD = "D"
Const KeyCapitalE = "E"
Const KeyCapitalF = "F"
Const KeyCapitalG = "G"
Const KeyCapitalH = "H"
Const KeyCapitalI = "I"
Const KeyCapitalJ = "J"
Const KeyCapitalK = "K"
Const KeyCapitalL = "L"
Const KeyCapitalM = "M"
Const KeyCapitalN = "N"
Const KeyCapitalO = "O"
Const KeyCapitalP = "P"
Const KeyCapitalQ = "Q"
Const KeyCapitalR = "R"
Const KeyCapitalS = "S"
Const KeyCapitalT = "T"
Const KeyCapitalU = "U"
Const KeyCapitalV = "V"
Const KeyCapitalW = "W"
Const KeyCapitalX = "X"
Const KeyCapitalY = "Y"
Const KeyCapitalZ = "Z"

' Lower Case
Const KeyLowerCaseA = "a"
Const KeyLowerCaseB = "b"
Const KeyLowerCaseC = "c"
Const KeyLowerCaseD = "d"
Const KeyLowerCaseE = "e"
Const KeyLowerCaseF = "f"
Const KeyLowerCaseG = "g"
Const KeyLowerCaseH = "h"
Const KeyLowerCaseI = "i"
Const KeyLowerCaseJ = "j"
Const KeyLowerCaseK = "k"
Const KeyLowerCaseL = "l"
Const KeyLowerCaseM = "m"
Const KeyLowerCaseN = "n"
Const KeyLowerCaseO = "o"
Const KeyLowerCaseP = "p"
Const KeyLowerCaseQ = "q"
Const KeyLowerCaseR = "r"
Const KeyLowerCaseS = "s"
Const KeyLowerCaseT = "t"
Const KeyLowerCaseU = "u"
Const KeyLowerCaseV = "v"
Const KeyLowerCaseW = "w"
Const KeyLowerCaseX = "x"
Const KeyLowerCaseY = "y"
Const KeyLowerCaseZ = "z"

' Digits
Const KeyDigit0 = "0"
Const KeyDigit1 = "1"
Const KeyDigit2 = "2"
Const KeyDigit3 = "3"
Const KeyDigit4 = "4"
Const KeyDigit5 = "5"
Const KeyDigit6 = "6"
Const KeyDigit7 = "7"
Const KeyDigit8 = "8"
Const KeyDigit9 = "9"

' Punctuation
Const Dquote = Chr$(34) ' "
Const Squote = "''" '    '

Const KeyAmpersand = "&"
Const KeyAsterisk = "*"
Const KeyAt = "@"
Const KeyBackslash = "\"
Const KeyCaret = "^"
Const KeyCloseBracket = "]"
Const KeyCloseCurl = "}"
Const KeyCloseParen = ")"
Const KeyColon = ":"
Const KeyComma = ","
Const KeyDollar = "$"
Const KeyEqual = "="
Const KeyExclamation = "!"
Const KeyGreaterThan = ">"
Const KeyLessThan = "<"
Const KeyMinus = "-"
Const KeyOpenBracket = "["
Const KeyOpenCurl = "{"
Const KeyOpenParen = "("
Const KeyPercent = "%"
Const KeyPeriod = "."
Const KeyPipe = "|"
Const KeyPlus = "+"
Const KeyPound = "#"
Const KeyQuestion = "?"
Const KeySemiColon = ";"
Const KeyTick = "`"
Const KeyTilde = "~"
Const KeyUnderscore = "_"

' Control Codes
Const KeyCtrlA = Chr$(1)
Const KeyCtrlB = Chr$(2)
Const KeyCtrlC = Chr$(3)
Const KeyCtrlD = Chr$(4)
Const KeyCtrlE = Chr$(5)
Const KeyCtrlF = Chr$(6)
Const KeyCtrlG = Chr$(7)
Const KeyCtrlH = Chr$(8)
Const KeyCtrlI = Chr$(9)
Const KeyCtrlJ = Chr$(10)
Const KeyCtrlK = Chr$(11)
Const KeyCtrlL = Chr$(12)
Const KeyCtrlM = Chr$(13)
Const KeyCtrlN = Chr$(14)
Const KeyCtrlO = Chr$(15)
Const KeyCtrlP = Chr$(16)
Const KeyCtrlQ = Chr$(17)
Const KeyCtrlR = Chr$(18)
Const KeyCtrlS = Chr$(19)
Const KeyCtrlT = Chr$(20)
Const KeyCtrlU = Chr$(21)
Const KeyCtrlV = Chr$(22)
Const KeyCtrlW = Chr$(23)
Const KeyCtrlX = Chr$(24)
Const KeyCtrlY = Chr$(25)
Const KeyCtrlZ = Chr$(26)
Const KeyEscape = Chr$(27)
Const KeyFS = Chr$(28) ' File Separator
Const KeyGS = Chr$(29) ' Group Separator
Const KeyRS = Chr$(30) ' Record Separator
Const KeyUS = Chr$(31) ' Unit Separator
Const KeySpace = " "





Do
    R$ = InKey$
    If R$ <> "" Then
        Print Asc(R$, 1);
        If Len(R$) = 2 Then Print Asc(R$, 2)
    End If
Loop









Attached Files
.bas   KeyCodes.bas (Size: 10.3 KB / Downloads: 45)
Print this item

  GnomeSort
Posted by: James D Jarvis - 04-26-2024, 07:52 PM - Forum: Utilities - Replies (8)

Rosetta code didn't have a QB64 version of a Gnome Sort so I made one.

Code: (Select All)
'GnomeSort.bas
'a sorting algorithm that will sort a one dimensional array of any size from lowest to greatest value
'https://en.wikipedia.org/wiki/Gnome_sort
'initialize two different one dimensional arrays to demonstrate the subroutine
Randomize Timer
Dim A(1 To 6)
Dim B(-5 To 5)
For I = LBound(A) To UBound(A)
    A(I) = (Rnd(1) * 100)
Next I
For I = LBound(B) To UBound(B)
    B(I) = Int(Rnd(1) * 100) + 1
Next I

'display the arrays before and after the gnomesort
Print "unsorted array: ";: printarray A(): Print
gnomesort A()
Print "  sorted array: ";: printarray A(): Print

Print "unsorted array: ";: printarray B(): Print
gnomesort B()
Print "  sorted array: ";: printarray B(): Print
End

Sub printarray (array())
    'print all the elements in a 1 dimensional array  of any range
    For I = LBound(array) To UBound(array)
        Print array(I);
    Next I
End Sub

Sub gnomesort (array())
    'sort a one dimensional array of any size using gnomesort
    'https://en.wikipedia.org/wiki/Gnome_sort
    I = LBound(array) + 1 'find the lowest element in the array and add 1 for the sorting routine
    J = I + 1
    While I <= UBound(array)
        If array(I - 1) <= array(I) Then
            I = J
            J = J + 1
        Else If array(I - 1) > array(I) Then
                Swap array(I - 1), array(I)
                I = I - 1
                If I = LBound(array) Then
                    I = J
                    J = J + 1
                End If
            End If
        End If
    Wend
End Sub

Print this item

  String Addition (Optimization)
Posted by: SMcNeill - 04-26-2024, 12:48 AM - Forum: Learning Resources and Archives - Replies (10)

Code: (Select All)
Const limit = 200000
Dim Shared NumStr(limit) As String

MakeNumsStrings
t# = Timer(0.001)
o$ = AddStrings 'time how long it takes to add those strings together
t1# = Timer(0.001)
o1$ = MidStrings(Len(o$)) 'and time how long it takes to just mid$ those strings, if you know the size
t2# = Timer(0.001)

Print "Results:"
Print "First 50: "; Left$(o$, 50)
Print "First 50: "; Left$(o1$, 50)
Print "Last  50: "; Right$(o$, 50)
Print "Last  50: "; Right$(o$, 50)
Print
Print
Print Using "It took ###.### seconds to AddStrings"; t1# - t#
Print Using "It took ###.### seconds to MidStrings"; t2# - t1#

Sub MakeNumsStrings
    For i = 1 To limit
        NumStr(i) = _Trim$(Str$(i))
    Next
End Sub

Function AddStrings$
    For i = 1 To limit
        temp$ = temp$ + NumStr(i)
    Next
    AddStrings = temp$
End Function

Function MidStrings$ (size)
    temp$ = Space$(size)
    p = 1 'position in full string
    For i = 1 To limit
        Mid$(temp$, p) = NumStr(i)
        p = p + Len(NumStr(i))
    Next
    MidStrings = temp$
End Function

I think the code above helps showcase one of QB64's and QB64PE's greatest flaws -- the time it takes to do anything substantial with strings!

The above simply makes a list of strings, by using the numbers from 1 to whatever LIMIT we set, and then it adds those strings all into one massive string.   Basicially "1" + "2" + "3" +... = "123..." -- a simple process, but all that is needed to showcase how slow this process can become.  Wink

In the above, I've made use of two different methods for speed comparison, for folks.  

The first method is what we see a lot in our programs:  temp$ = temp$ + num$.  It simply adds the strings together over and over until it's finished.

The second method is much more efficient:  mid%(temp$, p) = num$.  This has to pre-allocate the proper size of the string, create the string, and then it simply uses mid$ to swap out the proper portion of that string with num$ as it goes along.

I won't post my times on this, as I'd prefer for folks to run this code at least once themselves and see what the difference in speed might be on their own system, with whatever compiler flags/optimizations they might be using.  Let's just say that I'm certain folks should be able to see a noticeable difference here.

NOTE:  And one important thing to note here -- the larger the strings involved, the greater the difference becomes.  The difference here isn't a static, "it takes 0.1 seconds to perform X additions to the string".  Change that limit and you can see for yourself.  A limit of 100000 takes X seconds.  A limit of 110000 takes 2 * x seconds.  A limit of 120000 takes 4 * x seconds.  Exponential time increases as string length increases!!  (Though not quite as bad as the * 2 modifier I just tossed out as an example to the left there.  Big Grin )


Take away from all this??

If you're going to be doing a lot of string addition, you'd probably be better served by running it through two loops, instead of just adding the strings together in one.

Loop 1:   Count the total size of the string
FOR i = 1 TO limit
    totalSize = totalSize + len(num$(i))
NEXT

Allocate the output string first:   
temp$ = SPACE$(totalSize)

Loop 2: Mid$ the string together instead of adding it
p = 1
FOR i = 1 TO limit
    mid$(temp$, p) = num(i)
    p = p + len(num(i))
NEXT


It's thinking outside the box, and it's not the way that most folks tend to do things, but I'd think the above showcases WHY this might be an important concept to keep under your hat, if you're ever doing any serious string work in your projects.

(And feel free to post your own times below.  I'd love to see how large a difference such a simple approach makes for most people on their own systems.  I just don't want to spoil the surprise by posting my own times here, and you guys might not want to read below this post until you run the code for yourself once, just for the "pop factor" of the figures. Big Grin )

Print this item

  AI does a good job of analyzing code
Posted by: SpriggsySpriggs - 04-25-2024, 03:26 PM - Forum: General Discussion - Replies (6)

I asked Perplexity AI what it thought my pipecom code did by asking it to read that page of the forum.

My prompt was

Quote:Analyze the code in the code block and give a best guess as to what it is used for

The response:
Quote:The code you provided appears to be an implementation of a pipe command in QB64, a BASIC programming language. The purpose of this code is to allow executing external commands and capturing their output and error streams[1].

Here's a breakdown of what the code does:

1. It defines a function called `pipecom` that takes a command string, an output string variable, and an error string variable as parameters.

2. The function creates two pipes using `CreatePipe` - one for standard output and one for standard error. It also sets up the necessary security attributes and startup information for the child process.

3. It then creates a child process using `CreateProcess` or `CreateProcessW` (depending on whether UNICODE is defined) to execute the specified command.

4. The function reads the output from the child process's standard output and error pipes using `ReadFile` and stores them in the provided output and error string variables.

5. Finally, it waits for the child process to exit, retrieves its exit code, and returns it.

There is also a helper function called `pipecom_lite` that simplifies the usage of `pipecom` by returning either the standard output or standard error stream as a string, depending on which one is not empty.

This code allows running external commands and capturing their output and error streams within a QB64 program, which can be useful for tasks such as executing system commands, parsing command output, or handling errors from external processes.

Citations:
[1] https://qb64phoenix.com/forum/showthread...20has%20co

Here is the link to the actual AI thread

Print this item

  Another Mouse Issue?
Posted by: NakedApe - 04-25-2024, 12:54 AM - Forum: Help Me! - Replies (17)

I'm working on a game, see, and I don't want the player to be able to hold down the fire-button indefinitely (that's cheating!). So I tried setting up a timer that kills the left mouse button after a second and a half. All is cool if the mouse is stationary, but the minute you move the mouse the button resets itself - without the user letting the button up - not cool. Is this a Mac mouse issue, a QB64PE mouse issue or a dumb NakedApe issue?
Is there a better way to do this?     Huh  

Thanks in advance for any insights, Ted

DIM AS _BYTE leftClick, started
DIM startTime AS LONG
SCREEN _NEWIMAGE(800, 600, 32)

DO
    WHILE _MOUSEINPUT
        leftClick = _MOUSEBUTTON(1) '
        mouseX = _MOUSEX
        mouseY = _MOUSEY
    WEND

    IF leftClick THEN

        IF NOT started THEN startTime = TIMER: started = -1

        IF TIMER - startTime > 1.5 THEN '    no holding the button down forever!
            leftClick = 0 '                              kill left click
            started = 0 '                                reset timer
            SOUND 1000, .7 '                         pip
        END IF

        _PRINTSTRING (380, 280), "Button Down"
        _PRINTSTRING (380, 320), STR$(TIMER - startTime)
    END IF

    IF NOT leftClick THEN '                            if buttonUP then reset timer and erase
        CLS
        started = 0
    END IF

LOOP UNTIL _KEYDOWN(27)
SYSTEM

Print this item

  Alphabetical sort of characters within a string.
Posted by: Circlotron - 04-24-2024, 12:25 PM - Forum: Help Me! - Replies (60)

I want to alphabetically sort the characters of a single word string. The only way i can think of so far is to get each character individually and make each one a single character variable, check the ASC value and bubble sort them with a SWAP function. Is there a better way?

Print this item

  How to reorder string variable x factorial different ways?
Posted by: Circlotron - 04-24-2024, 11:14 AM - Forum: Help Me! - Replies (13)

Say I have a string variable abcd$. The letters in the variable can be arranged 4 factorial or 4x3x2x1 different ways. How can I produce every combination? Find Len(abcd$) then a for/next loop Len factorial times, but what inside the loop? I'm at a loss here. Huh

Print this item

  Using shell to delete a file
Posted by: PhilOfPerth - 04-24-2024, 06:43 AM - Forum: Help Me! - Replies (7)

I need to delete a file from within a programme), and I'm trying to use shell, as in:
Shell "rm C:\qb64pe\myfile"
but I can't get it to work. I've read through the Wiki notes but can't find anything that makes it work. Where am I going wrong?

Print this item

  aquascape screen saver ver1.1
Posted by: kn0ne - 04-23-2024, 10:20 PM - Forum: Programs - No Replies

Hello, I'm a Newbie here and just started using QB64 PE. I first posted this under utilities because I did not see the programs listing, ha! So I figured that this really is a program and not a utility I would post it here as well.
  
This is my first QB64 PE project. It started out with just me learning how to use lines and circles in QB64 PE and it kind of got out of control. I find the aquascape is relaxing, but I'm biased.

I mostly program with the unrelated Batari BASIC language, and I dabble with 6502 ASM on the Atari tip.
I find QB64 PE very enjoyable to program with! and am looking forward to learning more!

Let me know what you think...

[Image: Screenshot-2024-04-22-004525.png]


Code: (Select All)
Option _Explicit

Screen _NewImage(1900, 1080, 32)
_FullScreen
_MouseHide

Dim Shared f&
Dim Shared fdt&
Dim Shared fkn&
fkn& = _LoadFont("aqua_mat\fonts\Ac437_Kaypro2K_G.ttf", 34)
f& = _LoadFont("aqua_mat\fonts\Ac437_Kaypro2K_G.ttf", 24)
fdt& = _LoadFont("aqua_mat\fonts\Ac437_Kaypro2K_G.ttf", 18)



Option _Explicit

'--const&variables--
Const CYAN = _RGB32(0, 255, 255)
Const LIGHTCYAN = _RGB32(0, 123, 252)
Const PURPLE = _RGB32(56, 0, 177)
Const BRIGHTPURPLE = _RGB32(205, 0, 238)
Const YELLOW = _RGB32(255, 255, 0)
Const LIGHTYELLOW = _RGB32(255, 255, 139)
Const DARKYELLOW = _RGB32(216, 216, 83)
Const BRIGHTRED = _RGB32(255, 0, 0)
Const RED = _RGB32(177, 0, 0)
Const DARKRED = _RGB32(144, 0, 0)
Const ORANGE = _RGB32(255, 72, 67)
Const BRIGHTGREEN = _RGB32(0, 255, 0)
Const DARKGREEN = _RGB32(0, 61, 0)
Const GREEN = _RGB32(0, 122, 0)
Const BLUE = _RGB32(0, 0, 255)
Const LIGHTBLUE = _RGB32(0, 83, 255)
Const WHITE = _RGB32(255, 255, 255)
Const GRAY = _RGB32(127, 127, 127)
Const LIGHTGRAY = _RGB32(0, 200, 0)
Const DARKGRAY = _RGB32(0, 100, 0)
Const BLACK = _RGB32(0, 0, 0)



Const num_fish = 35
Const num_fisha = 15
Const num_fishb = 35
Const num_fishba = 28
Const num_fish2 = 20
Const num_fish3 = 25
Const num_fish4 = 20
Const num_fish5 = 25
Const num_fish6 = 10

Const num_snail_1 = 68
Const num_snail_2 = 68

Const num_bubbles = 20
Const num_bubbles2 = 20
Const num_bubbles3 = 20

Const num_hooks = 1

Const num_plants = 500

Dim Shared sv As Integer

Dim Shared f As Integer
f = 0

Dim Shared randf As Integer
Dim Shared randf2 As Integer
Dim Shared randf3 As Integer
Dim Shared randf4 As Integer
Dim Shared randf5 As Integer

Randomize Timer

randf = Int((Rnd * 4) + 1)
randf2 = Int((Rnd * 4) + 1)
randf3 = Int((Rnd * 4) + 1)
randf4 = Int((Rnd * 4) + 1)
randf5 = Int((Rnd * 4) + 1)

Dim Shared time_limit As Integer
time_limit = (Int(Rnd * 600)) + 300

Type fish_type
    x As Integer
    y As Integer
    r As Integer
    color As Long
    move_right As Integer
    move_up As Integer
    height As Integer
    width As Integer
End Type

Type snail_type
    x As Integer
    y As Integer
    move_right As Integer
    move_up As Integer
End Type

Type bubble_type
    x As Integer
    y As Integer
    move_right As Integer
    move_up As Long
End Type

Type plant_type
    x As Integer
    y As Integer
    c As Long
End Type

Type hook_type
    x As Integer
    y As Integer
    move_right As Integer
    move_up As Integer
End Type

Type window_type
    height As Integer
    width As Integer
End Type

Dim Shared fish(num_fish) As fish_type 'creates the fish"array" with the size set to "num_fish"
Dim Shared fisha(num_fisha) As fish_type
Dim Shared fishb(num_fishb) As fish_type
Dim Shared fishba(num_fishba) As fish_type
Dim Shared fish2(num_fish2) As fish_type
Dim Shared fish3(num_fish3) As fish_type
Dim Shared fish4(num_fish4) As fish_type
Dim Shared fish5(num_fish5) As fish_type
Dim Shared fish6(num_fish6) As fish_type


Dim Shared plant(num_plants) As plant_type
Dim Shared plant2(num_plants) As plant_type

Dim Shared snail_1(num_snail_1) As snail_type
Dim Shared snail_2(num_snail_2) As snail_type

Dim Shared bub(num_bubbles) As bubble_type
Dim Shared bub2(num_bubbles2) As bubble_type
Dim Shared bub3(num_bubbles3) As bubble_type

Dim Shared hook(num_hooks) As hook_type
Dim Shared hook2(num_hooks) As hook_type
Dim Shared hook3(num_hooks) As hook_type
Dim Shared hook4(num_hooks) As hook_type
Dim Shared hook5(num_hooks) As hook_type

Dim mmx%
Dim mmy%

Dim Shared current_date$
current_date$ = Date$

Dim Shared h% ' hours
Dim Shared m% ' minutes
Dim Shared s% ' seconds
Dim Shared tm$ ' current time% value
Dim Shared x% 'circle x pos
Dim Shared y% 'circle y pos

Dim clock_timer%
Dim Shared clock_right As Integer
Dim Shared clock_up As Integer

Dim Shared current_hr As Integer
current_hr = Val(Left$(tm$, 12))

Dim Shared current_hr
current_hr = Val(Left$(tm$, 2))

Dim Shared my_timer2 As Integer
Dim Shared my_timer3 As Integer

Randomize Timer

Dim Shared dy As Integer
dy = (Rnd * 940) + 940
Dim Shared dx As Integer
dx = (Rnd * 1899)

Dim Shared sn As Integer


clock_right = 1
clock_up = 1


x% = Int(Rnd * 1900)
y% = Int(Rnd * 1080)

Dim b&
Dim Shared lb&
Dim Shared t~&

b& = _SndOpen("aqua_mat\sounds\fishtank_bubbles.mp3")
lb& = _SndOpen("aqua_mat\sounds\large_bubble.mp3")
'--main_loop--


fish_setup
Randomize Timer



Dim bnum420&
Dim Shared bgp420$
bnum420& = _Round(Rnd * 50)
bgp420$ = RTrim$(LTrim$(Str$(bnum420&)))
If bgp420$ = "0" Then
    bgp420$ = "1"
End If
If bnum420& > 50 Then
    bgp420$ = "40"
End If

Dim Shared alert420&
alert420& = _LoadImage("aqua_mat\images\420\420_" + bgp420$ + ".jpg", 32)
Dim Shared day_pic&
Dim Shared night_pic&

Dim bgdp$
Dim bdnum As Long
bdnum = _Round(Rnd * 80)
bgdp$ = RTrim$(LTrim$(Str$(bdnum)))

If bgdp$ = "0" Then
    bgdp$ = "59"
End If
If bdnum > 80 Then
    bgdp$ = "79"
End If

Dim bgnp$
Dim bnnum As Long
bnnum = _Round(Rnd * 81)
bgnp$ = RTrim$(LTrim$(Str$(bnnum)))
If bgnp$ = "0" Then
    bgnp$ = "3"
End If
If bnnum > 81 Then
    bgnp$ = "81"
End If
'bgnp$ = "47"


Dim Shared st_pat_pic&
Dim Shared july_4th_pic&
Dim Shared halloween_pic&
Dim Shared de_los_meurtos_pic&
Dim Shared xmas_pic&
Dim Shared new_year_pic&

Dim bgspd$
Dim bgspd&
Dim bgj4$
Dim bgj4&
Dim bghw$
Dim bghw&
Dim bgdlm$
Dim bgdlm&
Dim bgxms$
Dim bgxms&
Dim bgny$
Dim bgny&


Dim Shared p1x As Integer
Dim Shared p2x As Integer
Dim Shared p3x As Integer

Dim Shared p1y As Integer
Dim Shared p2y As Integer
Dim Shared p3y As Integer

p1x = (Rnd * 1080)
p2x = (Rnd * 1080)
p3x = (Rnd * 1080)
p1y = (Rnd * 1080) + 500
p2y = (Rnd * 1080) + 400
p3y = (Rnd * 1080) + 600


'' st pat day ''
bgspd& = _Round(Rnd * 11)
bgspd$ = RTrim$(LTrim$(Str$(bgspd&)))
If bgspd$ = "0" Then
    bgspd$ = "3"
End If
If bgspd& > 11 Then
    bgspd$ = "11"
End If

'' 4th of July ''
bgj4& = _Round(Rnd * 10)
bgj4$ = RTrim$(LTrim$(Str$(bgj4&)))
If bgj4$ = "0" Then
    bgj4$ = "3"
End If
If bgj4& > 10 Then
    bgj4$ = "10"
End If

'' halloween ''
bghw& = _Round(Rnd * 13)
bghw$ = RTrim$(LTrim$(Str$(bghw&)))
If bghw$ = "0" Then
    bghw$ = "3"
End If
If bghw& > 13 Then
    bghw$ = "13"
End If

'' dia de los meuertos ''
bgdlm& = _Round(Rnd * 11)
bgdlm$ = RTrim$(LTrim$(Str$(bgdlm&)))
If bgdlm$ = "0" Then
    bgdlm$ = "3"
End If
If bgdlm& > 11 Then
    bgdlm$ = "11"
End If

'' xmas ''
bgxms& = _Round(Rnd * 6)
bgxms$ = RTrim$(LTrim$(Str$(bgxms&)))
If bgxms$ = "0" Then
    bgxms$ = "1"
End If
If bgxms& > 6 Then
    bgxms$ = "4"
End If

'' new year ''
bgny& = _Round(Rnd * 11)
bgny$ = RTrim$(LTrim$(Str$(bgny&)))
If bgny$ = "0" Then
    bgny$ = "3"
End If
If bgny& > 11 Then
    bgny$ = "11"
End If

st_pat_pic& = _LoadImage("aqua_mat\images\holiday\st_pat\st_pat_" + bgspd$ + ".jpg", 32)
july_4th_pic& = _LoadImage("aqua_mat\images\holiday\fourth_of_july\fourth_of_july_" + bgj4$ + ".jpg", 32)
halloween_pic& = _LoadImage("aqua_mat\images\holiday\halloween\halloween_" + bgj4$ + ".jpg", 32)
de_los_meurtos_pic& = _LoadImage("aqua_mat\images\holiday\dia_de_los_muertos\dia_de_los_muertos_" + bgdlm$ + ".jpg", 32)
xmas_pic& = _LoadImage("aqua_mat\images\holiday\xmas\xmas_" + bgxms$ + ".jpg", 32)
new_year_pic& = _LoadImage("aqua_mat\images\holiday\new_year\new_year_" + bgny$ + ".jpg", 32)


day_pic& = _LoadImage("aqua_mat\images\fish\day\aqua_day_" + bgdp$ + ".jpg", 32)
night_pic& = _LoadImage("aqua_mat\images\fish\night\aqua_night_" + bgnp$ + ".jpg", 32)

Color _RGB32(6, 233, 17)
Dim text$
If f& > 0 Then _Font f&
text$ = "generating aquascape... "
_PrintString (950, 540), text$
'draw_plant
dy = (Rnd * 1050) + 940

background_draw

_Delay 5

Do: _Limit 60
    'Cls
    current_hr = Val(Left$(tm$, 2))
    If current_hr = 16 And m% >= 20 And m% <= 40 Then
        _PutImage , alert420&
    Else
        holiday_check
    End If
    tm$ = Time$
    s% = Val(Right$(tm$, 2))
    m% = Val(Mid$(tm$, 4, 2))
    h% = Val(Left$(tm$, 2))
    clock_timer% = clock_timer% + 1
    draw_plant
    If clock_timer% < 102 Then convert_to_12hr
    If clock_timer% = 204 Then clock_timer% = 0
    If current_hr >= 6 And current_hr < 17 Then
        clock_color_day
    Else
        clock_color_night
    End If
    fish_AI
    fish_draw
    snail_move
    snail_move_2
    fish_move
    foreground
    move_hook
    background_draw
    move_clock
    _Display
    _SndVol b&, 0.01
    If b& > 0 Then _SndLoop b&
    sound_large_bubbles
    Do While _MouseInput
        mmx% = mmx% + _MouseMovementX
        mmy% = mmy% + _MouseMovementY
    Loop
Loop Until InKey$ > "" Or mmx% <> 0 Or mmy% <> 0

_MouseShow
_SndClose b&
_SndClose lb&
System

'-sub_routines--


Sub sound_large_bubbles
    t~& = t~& + 1
    If t~& = 3000 Then
        t~& = 1
    End If

    Select Case t~&
        Case 1 To 35
            _SndVol lb&, 0.02
            _SndLoop lb&
        Case 1420 To 1460
            _SndVol lb&, 0.01
            _SndLoop lb&
        Case 2400 To 2440
            _SndVol lb&, 0.02
            _SndLoop lb&
        Case Else
            _SndVol lb&, 0
    End Select
End Sub

Sub fish_draw
    Dim i As Integer
    Dim k As Integer
    Dim l As Integer

    Dim n As Integer
    ''snail attempt, lets see...
    Dim sn As Integer

    For sn = 19 To 21
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .25, _RGB32(68 - sn, 0, 0), , , .7
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .7
        Paint (snail_2(sn).x, snail_2(sn).y - sn * .1), _RGB32(198, 178, 8), _RGB32(172 - sn, 22, 22)
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .5, _RGB32(125 - sn, 0, 0), , , .7
        Paint (snail_2(sn).x, snail_2(sn).y - sn * .1), _RGB32(244 + sn, 168 - sn, 0), _RGB32(125 - sn, 0, 0)
    Next sn

    For sn = 22 To 24
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .25, _RGB32(68 - sn, 0, 0), , , .6
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .6
        Paint (snail_2(sn).x, snail_2(sn).y - sn * .1), _RGB32(0, 147, 147), _RGB32(172 - sn, 22, 22)
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .5, _RGB32(125 - sn, 0, 0), , , .6
        Paint (snail_2(sn).x, snail_2(sn).y - sn * .1), BLACK, _RGB32(125 - sn, 0, 0)

        Circle (snail_2(sn).x, snail_2(sn).y), sn * .2, BLACK, , , .6
    Next sn

    For sn = 25 To 27
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .25, _RGB32(68 - sn, 0, 0), , , .8
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .8
        Paint (snail_2(sn).x, snail_2(sn).y - sn * .1), ORANGE, _RGB32(172 - sn, 22, 22)
        Circle (snail_2(sn).x, snail_2(sn).y), sn * .5, _RGB32(125 - sn, 0, 0), , , .8
        Paint (snail_2(sn).x, snail_2(sn).y - sn * .1), RED, _RGB32(125 - sn, 0, 0)

        Circle (snail_2(sn).x, snail_2(sn).y), sn * .2, BLACK, , , .8
        Paint (snail_2(sn).x, snail_2(sn).y), PURPLE, BLACK
    Next sn

    For sn = 60 To 62
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .25, _RGB32(68 - sn, 0, 0), , , .9
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .9

        Circle (snail_1(sn).x, snail_1(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .7
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .87
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .85, _RGB32(172 - sn, 22, 22), , , .4



        Paint (snail_1(sn).x, snail_1(sn).y - sn * .5), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)
        Paint (snail_1(sn).x, snail_1(sn).y - sn * .6), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)
        Paint (snail_1(sn).x, snail_1(sn).y - sn * .7), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)


        Paint (snail_1(sn).x, snail_1(sn).y + sn * .7), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)
        Paint (snail_1(sn).x, snail_1(sn).y + sn * .4), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)
        Paint (snail_1(sn).x, snail_1(sn).y + sn * .3), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)
        Paint (snail_1(sn).x, snail_1(sn).y + sn * .2), _RGB32(55, 17, 0), _RGB32(172 - sn, 22, 22)

        Circle (snail_1(sn).x, snail_1(sn).y), sn * .5, _RGB32(125 - sn, 0, 0), , , .9

        Circle (snail_1(sn).x, snail_1(sn).y), sn * .4, _RGB32(125 - sn, 0, 0), , , .5
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .3, _RGB32(125 - sn, 0, 0), , , .4
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .2, _RGB32(125 - sn, 0, 0), , , .3

        Paint (snail_1(sn).x, snail_1(sn).y - sn * .1), PURPLE, _RGB32(125 - sn, 0, 0)
        Paint (snail_1(sn).x, snail_1(sn).y - sn * .3), _RGB32(33, 17, 0), _RGB32(125 - sn, 0, 0)

    Next sn

    For sn = 63 To 65
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .74, _RGB32(68 - sn, 0, 0), , , .9
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .98, _RGB32(172 - sn, 22, 22), , , .7

        Paint (snail_1(sn).x, snail_1(sn).y - sn * .1), _RGB32(111, 67, 0), _RGB32(172 - sn, 22, 22)
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .5, _RGB32(125 - sn, 0, 0), , , .9
        Paint (snail_1(sn).x, snail_1(sn).y - sn * .1), _RGB32(166, 133, 0), _RGB32(125 - sn, 0, 0)

        Circle (snail_1(sn).x, snail_1(sn).y), sn * .1, BLACK, , , .2
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .2, BLACK, , , .4
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .3, BLACK, , , 1
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .4, BLACK, , , 1
        'Circle (snail_1(sn).x, snail_1(sn).y), sn * .5, BLACK, , , .8
        'Circle (snail_1(sn).x, snail_1(sn).y), sn * .6, BLACK, , , .8
    Next sn

    For sn = 66 To num_snail_1
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .50, _RGB32(68 - sn, 0, 0), , , .9
        Circle (snail_1(sn).x, snail_1(sn).y), sn * 1.3, _RGB32(172 - sn, 22, 22), , , .9
        Paint (snail_1(sn).x, snail_1(sn).y - sn * .1), _RGB32(68 - sn, 6, 8), _RGB32(172 - sn, 22, 22)

        Circle (snail_1(sn).x, snail_1(sn).y), sn * .5, _RGB32(125 - sn, 0, 0), , , .8
        Circle (snail_1(sn).x, snail_1(sn).y), sn * .4, _RGB32(125 - sn, 0, 0), , , 1

        Paint (snail_1(sn).x, snail_1(sn).y - sn * .1), DARKRED, _RGB32(125 - sn, 0, 0)

        Circle (snail_1(sn).x, snail_1(sn).y), sn * 1.1, ORANGE, , , .9
        Circle (snail_1(sn).x, snail_1(sn).y), sn * 1.1, ORANGE, , , .7
        Circle (snail_1(sn).x, snail_1(sn).y), sn * 1.1, ORANGE, , , .5
        Circle (snail_1(sn).x, snail_1(sn).y), sn * 1.1, ORANGE, , , .3
    Next sn

    For i = 1 To num_fish Step 1
        Circle (fish(i).x, fish(i).y), i + 48, YELLOW, 2, 4
        Circle (fish(i).x, fish(i).y), i + 16, BRIGHTPURPLE, 4, 2
        Circle (fish(i).x, fish(i).y), i + 16, YELLOW, 4, 2
        Circle (fish(i).x, fish(i).y), i + 8, YELLOW, 4, 2
        Circle (fish(i).x, fish(i).y), i + 4, YELLOW, 4, 2
        Circle (fish(i).x, fish(i).y), i + 2, YELLOW, 4, 2
        Circle (fish(i).x, fish(i).y), i + 32, YELLOW, 2, 4
        Circle (fish(i).x, fish(i).y), i + 30, DARKYELLOW, 2, 4
        Circle (fish(i).x, fish(i).y), i + 28, YELLOW, 2, 4
        Circle (fish(i).x, fish(i).y), i + 26, DARKYELLOW, 2, 4
        Circle (fish(i).x, fish(i).y), i + 40, CYAN, 2, 4
        Circle (fish(i).x, fish(i).y), i + 34, CYAN, 2, 4
        Circle (fish(i).x, fish(i).y), i + 28, BRIGHTPURPLE, 2, 4

        Circle (fish(i).x, fish(i).y), i + 40, YELLOW, 4, 2
        Circle (fish(i).x, fish(i).y), i + 36, DARKYELLOW, 4, 2
        Circle (fish(i).x, fish(i).y), i + 32, YELLOW, 4, 2

        Circle (fish(i).x, fish(i).y), i + 28, BRIGHTPURPLE, 4, 2
        Circle (fish(i).x, fish(i).y), i + 24, CYAN, 4, 2
        Circle (fish(i).x, fish(i).y), i + 20, BRIGHTPURPLE, 4, 2

        Circle (fish(i).x + 5, fish(i).y - 40), i * .6, YELLOW, 4, 1, .5
        Circle (fish(i).x + 5, fish(i).y - 40), i * .4, YELLOW, 4, 1, .5
        Circle (fish(i).x + 5, fish(i).y - 40), 4, BLACK
        Circle (fish(i).x + 5, fish(i).y - 40), 3, BLACK
        Circle (fish(i).x + 5, fish(i).y - 40), 2, BLACK

        Line (fish(i).x - 100, fish(i).y - 20)-(fish(i).x, fish(i).y - 20), DARKYELLOW
        Line (fish(i).x - 90, fish(i).y - 15)-(fish(i).x - 5, fish(i).y - 15), YELLOW
        Line (fish(i).x - 80, fish(i).y - 10)-(fish(i).x - 10, fish(i).y - 10), CYAN
        Line (fish(i).x - 70, fish(i).y - 5)-(fish(i).x - 15, fish(i).y - 5), YELLOW
        Line (fish(i).x - 50, fish(i).y - 2)-(fish(i).x - 20, fish(i).y - 2), CYAN

        Line (fish(i).x - 40, fish(i).y + 2)-(fish(i).x - 20, fish(i).y + 2), CYAN
        Line (fish(i).x - 50, fish(i).y + 5)-(fish(i).x - 15, fish(i).y + 5), YELLOW
        Line (fish(i).x - 60, fish(i).y + 10)-(fish(i).x - 10, fish(i).y + 10), CYAN
        Line (fish(i).x - 70, fish(i).y + 15)-(fish(i).x - 5, fish(i).y + 15), YELLOW
        Line (fish(i).x - 80, fish(i).y + 20)-(fish(i).x, fish(i).y + 20), DARKYELLOW

        Circle (fish(i).x + 35, fish(i).y), i + 8, YELLOW, 4, 2, .5
        Circle (fish(i).x + 45, fish(i).y), i + 2, YELLOW, 4, 2, .5
        Circle (fish(i).x - 145, fish(i).y), i + 52, YELLOW, -4, -2
        Circle (fish(i).x - 166, fish(i).y), i + 50, DARKYELLOW, -4, -2
        Circle (fish(i).x - 165, fish(i).y), i + 40, CYAN, -4, -2
        Circle (fish(i).x - 166, fish(i).y), i + 39, CYAN, -4, -2
        Circle (fish(i).x - 165, fish(i).y), i + 30, DARKYELLOW, -4, -2
        Circle (fish(i).x - 166, fish(i).y), i + 38, YELLOW, -4, -2
        Circle (fish(i).x - 165, fish(i).y), i + 26, YELLOW, -4, -2
    Next i

    Dim i2 As Integer
    For i2 = 1 To num_fisha Step 1
        Circle (fisha(i2).x, fisha(i2).y), i2 + 48, BRIGHTRED, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 16, BRIGHTPURPLE, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 16, BRIGHTRED, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 8, BRIGHTRED, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 4, BRIGHTRED, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 2, BRIGHTRED, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 32, BRIGHTRED, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 30, DARKYELLOW, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 28, BRIGHTRED, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 26, DARKYELLOW, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 40, CYAN, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 34, CYAN, 2, 4
        Circle (fisha(i2).x, fisha(i2).y), i2 + 28, BRIGHTPURPLE, 2, 4

        Circle (fisha(i2).x, fisha(i2).y), i2 + 40, BRIGHTRED, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 36, DARKYELLOW, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 32, BRIGHTRED, 4, 2

        Circle (fisha(i2).x, fisha(i2).y), i2 + 28, BRIGHTPURPLE, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 24, CYAN, 4, 2
        Circle (fisha(i2).x, fisha(i2).y), i2 + 20, BRIGHTPURPLE, 4, 2

        Circle (fisha(i2).x + 5, fisha(i2).y - 40), i2 * .6, BRIGHTRED, 4, 1, .5
        Circle (fisha(i2).x + 5, fisha(i2).y - 40), i2 * .4, BRIGHTRED, 4, 1, .5
        Circle (fisha(i2).x + 5, fisha(i2).y - 40), 4, BLACK
        Circle (fisha(i2).x + 5, fisha(i2).y - 40), 3, BLACK
        Circle (fisha(i2).x + 5, fisha(i2).y - 40), 2, BLACK

        Line (fisha(i2).x - 100, fisha(i2).y - 20)-(fisha(i2).x, fisha(i2).y - 20), DARKYELLOW
        Line (fisha(i2).x - 90, fisha(i2).y - 15)-(fisha(i2).x - 5, fisha(i2).y - 15), BRIGHTRED
        Line (fisha(i2).x - 80, fisha(i2).y - 10)-(fisha(i2).x - 10, fisha(i2).y - 10), CYAN
        Line (fisha(i2).x - 70, fisha(i2).y - 5)-(fisha(i2).x - 15, fisha(i2).y - 5), BRIGHTRED
        Line (fisha(i2).x - 50, fisha(i2).y - 2)-(fisha(i2).x - 20, fisha(i2).y - 2), CYAN

        Line (fisha(i2).x - 40, fisha(i2).y + 2)-(fisha(i2).x - 20, fisha(i2).y + 2), CYAN
        Line (fisha(i2).x - 50, fisha(i2).y + 5)-(fisha(i2).x - 15, fisha(i2).y + 5), BRIGHTRED
        Line (fisha(i2).x - 60, fisha(i2).y + 10)-(fisha(i2).x - 10, fisha(i2).y + 10), CYAN
        Line (fisha(i2).x - 70, fisha(i2).y + 15)-(fisha(i2).x - 5, fisha(i2).y + 15), BRIGHTRED
        Line (fisha(i2).x - 80, fisha(i2).y + 20)-(fisha(i2).x, fisha(i2).y + 20), DARKYELLOW

        Circle (fisha(i2).x + 35, fisha(i2).y), i2 + 8, BRIGHTRED, 4, 2, .5
        Circle (fisha(i2).x + 45, fisha(i2).y), i2 + 2, BRIGHTRED, 4, 2, .5
        Circle (fisha(i2).x - 145, fisha(i2).y), i2 + 52, BRIGHTRED, -4, -2
        Circle (fisha(i2).x - 166, fisha(i2).y), i2 + 50, DARKYELLOW, -4, -2
        Circle (fisha(i2).x - 165, fisha(i2).y), i2 + 40, CYAN, -4, -2
        Circle (fisha(i2).x - 166, fisha(i2).y), i2 + 39, CYAN, -4, -2
        Circle (fisha(i2).x - 165, fisha(i2).y), i2 + 30, DARKYELLOW, -4, -2
        Circle (fisha(i2).x - 166, fisha(i2).y), i2 + 38, BRIGHTRED, -4, -2
        Circle (fisha(i2).x - 165, fisha(i2).y), i2 + 26, BRIGHTRED, -4, -2
    Next i2

    Dim z As Integer
    For z = 1 To num_fishb Step 1
        Circle (fishb(z).x, fishb(z).y), z + 24, BRIGHTRED, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 23, BRIGHTPURPLE, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 22, YELLOW, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 21, BRIGHTPURPLE, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 20, YELLOW, 2, 4

        Circle (fishb(z).x, fishb(z).y), 8, YELLOW, 4, 2
        Circle (fishb(z).x - 10, fishb(z).y - 3), 8, YELLOW, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 16, BRIGHTPURPLE, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 14, BRIGHTRED, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 12, BRIGHTPURPLE, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 10, BRIGHTRED, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 8, BRIGHTPURPLE, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 6, BRIGHTPURPLE, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 4, YELLOW, 2, 4
        Circle (fishb(z).x, fishb(z).y), z + 2, YELLOW, 2, 4

        Circle (fishb(z).x, fishb(z).y), z + 30, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 29, BRIGHTRED, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 28, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 27, BRIGHTRED, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 26, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 25, BRIGHTRED, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 24, BRIGHTRED, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 23, YELLOW, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 20, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 16, YELLOW, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 12, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 7, YELLOW, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 3, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 1, YELLOW, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 12, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 10, BRIGHTRED, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 8, BRIGHTPURPLE, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 6, BRIGHTRED, 4, 2
        Circle (fishb(z).x, fishb(z).y), z + 4, BRIGHTPURPLE, 4, 2

        Circle (fishb(z).x - 15, fishb(z).y - 18), 4, BRIGHTPURPLE
        Circle (fishb(z).x - 15, fishb(z).y - 18), 3, BRIGHTPURPLE
        Circle (fishb(z).x - 15, fishb(z).y - 18), 1, BRIGHTRED
        Circle (fishb(z).x - 35, fishb(z).y), z + 3, DARKRED, 2, 4, .1
        Circle (fishb(z).x - 35, fishb(z).y), z + 2, DARKRED, 2, 4, .5
        Circle (fishb(z).x - 35, fishb(z).y), z + 1, DARKRED, 2, 4, .1
        Circle (fishb(z).x - 31, fishb(z).y), z, BRIGHTRED, 4, 2
        Circle (fishb(z).x + 65, fishb(z).y), z + 26, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 25, BRIGHTRED, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 24, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 23, YELLOW, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 22, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 21, YELLOW, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 20, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 17, BRIGHTRED, -4, -2 ' ==========================
        Circle (fishb(z).x + 65, fishb(z).y), z + 19, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 15, BRIGHTRED, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 13, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 12, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 11, BRIGHTRED, -4, -2 ' =======================
        Circle (fishb(z).x + 65, fishb(z).y), z + 10, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 9, YELLOW, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 8, BRIGHTPURPLE, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 7, YELLOW, -4, -2
        Circle (fishb(z).x + 65, fishb(z).y), z + 6, BRIGHTPURPLE, -4, -2

        Line (fishb(z).x, fishb(z).y)-(fishb(z).x - 10, fishb(z).y), BRIGHTRED
        Line (fishb(z).x, fishb(z).y - 20)-(fishb(z).x - 20, fishb(z).y - 20), BRIGHTRED
        Line (fishb(z).x - 20, fishb(z).y - 23)-(fishb(z).x + 20, fishb(z).y - (z + 26)), BRIGHTRED
        Line (fishb(z).x - 18, fishb(z).y - 23)-(fishb(z).x + 20, fishb(z).y - (z + 31)), BRIGHTRED
        Line (fishb(z).x - 16, fishb(z).y - 23)-(fishb(z).x + 20, fishb(z).y - (z + 36)), BRIGHTRED
        Line (fishb(z).x - 14, fishb(z).y - 23)-(fishb(z).x + 20, fishb(z).y - (z + 41)), BRIGHTRED
        Line (fishb(z).x - 12, fishb(z).y - 23)-(fishb(z).x + 20, fishb(z).y - (z + 46)), BRIGHTRED
        Line (fishb(z).x - 10, fishb(z).y - 23)-(fishb(z).x + 20, fishb(z).y - (z + 11)), BRIGHTRED

        Circle (fishb(z).x + 5, fishb(z).y - 30), z * .4, WHITE, 4, 1, .5
        Circle (fishb(z).x + 5, fishb(z).y - 30), z * .2, WHITE, 4, 1, .5
        Circle (fishb(z).x + 5, fishb(z).y - 30), 4, BLACK
        Circle (fishb(z).x + 5, fishb(z).y - 30), 3, BLACK
        Circle (fishb(z).x + 5, fishb(z).y - 30), 2, BLACK
    Next z
    Dim z2 As Integer

    For z2 = 1 To num_fishba Step 1
        Circle (fishba(z2).x, fishba(z2).y), z2 + 24, BLUE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 23, PURPLE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 22, WHITE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 21, PURPLE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 20, WHITE, 2, 4

        Circle (fishba(z2).x, fishba(z2).y), 8, WHITE, 4, 2
        Circle (fishba(z2).x - 10, fishba(z2).y - 3), 8, WHITE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 16, PURPLE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 14, BLUE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 12, PURPLE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 10, BLUE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 8, PURPLE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 6, PURPLE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 4, WHITE, 2, 4
        Circle (fishba(z2).x, fishba(z2).y), z2 + 2, WHITE, 2, 4

        Circle (fishba(z2).x, fishba(z2).y), z2 + 30, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 29, BLUE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 28, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 27, BLUE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 26, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 25, BLUE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 24, BLUE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 23, WHITE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 20, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 16, WHITE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 12, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 7, WHITE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 3, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 1, WHITE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 12, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 10, BLUE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 8, PURPLE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 6, BLUE, 4, 2
        Circle (fishba(z2).x, fishba(z2).y), z2 + 4, PURPLE, 4, 2

        Circle (fishba(z2).x - 15, fishba(z2).y - 18), 4, PURPLE
        Circle (fishba(z2).x - 15, fishba(z2).y - 18), 3, PURPLE
        Circle (fishba(z2).x - 15, fishba(z2).y - 18), 1, BLUE
        Circle (fishba(z2).x - 35, fishba(z2).y), z2 + 3, DARKRED, 2, 4, .1
        Circle (fishba(z2).x - 35, fishba(z2).y), z2 + 2, DARKRED, 2, 4, .5
        Circle (fishba(z2).x - 35, fishba(z2).y), z2 + 1, DARKRED, 2, 4, .1
        Circle (fishba(z2).x - 31, fishba(z2).y), z2, BLUE, 4, 2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 26, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 25, BLUE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 24, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 23, WHITE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 22, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 21, WHITE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 20, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 17, BLUE, -4, -2 ' ==========================
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 19, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 15, BLUE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 13, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 12, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 11, BLUE, -4, -2 ' =======================
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 10, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 9, WHITE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 8, PURPLE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 7, WHITE, -4, -2
        Circle (fishba(z2).x + 65, fishba(z2).y), z2 + 6, PURPLE, -4, -2

        Line (fishba(z2).x, fishba(z2).y)-(fishba(z2).x - 10, fishba(z2).y), BLUE
        Line (fishba(z2).x, fishba(z2).y - 20)-(fishba(z2).x - 20, fishba(z2).y - 20), BLUE
        Line (fishba(z2).x - 20, fishba(z2).y - 23)-(fishba(z2).x + 20, fishba(z2).y - (z2 + 26)), BLUE
        Line (fishba(z2).x - 18, fishba(z2).y - 23)-(fishba(z2).x + 20, fishba(z2).y - (z2 + 31)), BLUE
        Line (fishba(z2).x - 16, fishba(z2).y - 23)-(fishba(z2).x + 20, fishba(z2).y - (z2 + 36)), BLUE
        Line (fishba(z2).x - 14, fishba(z2).y - 23)-(fishba(z2).x + 20, fishba(z2).y - (z2 + 41)), BLUE
        Line (fishba(z2).x - 12, fishba(z2).y - 23)-(fishba(z2).x + 20, fishba(z2).y - (z2 + 46)), BLUE
        Line (fishba(z2).x - 10, fishba(z2).y - 23)-(fishba(z2).x + 20, fishba(z2).y - (z2 + 11)), BLUE

        Circle (fishba(z2).x + 5, fishba(z2).y - 30), z2 * .4, WHITE, 4, 1, .5
        Circle (fishba(z2).x + 5, fishba(z2).y - 30), z2 * .2, WHITE, 4, 1, .5
        Circle (fishba(z2).x + 5, fishba(z2).y - 30), 4, BLACK
        Circle (fishba(z2).x + 5, fishba(z2).y - 30), 3, BLACK
        Circle (fishba(z2).x + 5, fishba(z2).y - 30), 2, BLACK
    Next z2

    For k = 1 To num_fish2 Step 1
        Circle (fish2(k).x, fish2(k).y), k * 3, DARKRED, , , .3
        Circle (fish2(k).x, fish2(k).y), k * 3, BRIGHTGREEN, , , .2
        Circle (fish2(k).x, fish2(k).y), k * 3, DARKRED, , , .1
        Circle (fish2(k).x, fish2(k).y), k * 1, DARKRED, , , .3
        Circle (fish2(k).x, fish2(k).y), k * 1.5, BRIGHTGREEN, , , .2
        Circle (fish2(k).x, fish2(k).y), k * 2, DARKRED, , , .1

        Line (fish2(k).x - (k * 1), fish2(k).y - k + 1.5)-(fish2(k).x + (k * 1), fish2(k).y - k + 1.5), DARKRED
        Line -(fish2(k).x, fish2(k).y - k * 1.5), DARKRED
        Line -(fish2(k).x - (k * 1), fish2(k).y - k + 1.5), DARKRED
        Paint (fish2(k).x, fish2(k).y - k + .2), DARKRED, DARKRED
    Next k

    Dim y As Integer
    For y = 1 To num_fish6 Step 1
        Circle (fish6(y).x, fish6(y).y), y * 3 + 5, DARKYELLOW, , , .3
        Circle (fish6(y).x, fish6(y).y), y * 3, CYAN, , , .2
        Circle (fish6(y).x, fish6(y).y), y * 3 + 5, DARKYELLOW, , , .1
    Next y

    For l = 1 To num_fish3 Step 1
        Circle (fish3(l).x + 10, fish3(l).y), l + 20, YELLOW, , , .3
        Circle (fish3(l).x + 12, fish3(l).y), l + 20, YELLOW, , , .3
        Circle (fish3(l).x + 10, fish3(l).y), l + 20, BRIGHTRED, , , .2
        Circle (fish3(l).x + 10, fish3(l).y), l + 20, YELLOW, , , .1
    Next l

    For n = 1 To num_fish5 Step 1
        Circle (fish5(n).x, fish5(n).y), n + 10, BRIGHTRED, , , .3
        Circle (fish5(n).x, fish5(n).y), n + 8, BRIGHTPURPLE, , , .2
        Circle (fish5(n).x, fish5(n).y), n + 5, BRIGHTRED, , , .1
    Next n

End Sub


Sub draw_plant
    Dim pn As Integer

    Line (1700, 1080)-(1717, 824), DARKGREEN
    Line -(1719, 1080), DARKGREEN
    Line -(1700, 1080), DARKGREEN
    Paint (1705, 1078), GREEN, DARKGREEN


    Line (1500, 1080)-(1517, 789), DARKGREEN
    Line -(1519, 1080), DARKGREEN
    Line -(1500, 1080), DARKGREEN
    Paint (1505, 1078), GREEN, DARKGREEN

    Line (1600, 1080)-(1617, 789), GREEN
    Line -(1619, 1080), GREEN
    Line -(1600, 1080), GREEN
    Paint (1605, 1078), DARKGREEN, GREEN
    Paint (1612, 925), DARKGREEN, GREEN
    Paint (1612, 910), DARKGREEN, GREEN
    'Line (1612, 925)-(1604, 1), BRIGHTRED

    Line (1615, 1080)-(1628, 678), GREEN
    Line -(1636, 1080), GREEN
    Line -(1615, 1080), GREEN
    Paint (1620, 1078), DARKGREEN, GREEN
    Paint (1625, 910), DARKGREEN, GREEN
    Paint (1625, 900), DARKGREEN, GREEN
    Paint (1625, 890), DARKGREEN, GREEN
    'Line (1625, 910)-(1617, 1), BRIGHTRED

    Line (170, 1080)-(187, 824), DARKGREEN
    Line -(189, 1080), DARKGREEN
    Line -(170, 1080), DARKGREEN
    Paint (175, 1078), GREEN, DARKGREEN

    Line (150, 1080)-(177, 789), GREEN
    Line -(180, 1080), GREEN
    Line -(150, 1080), GREEN
    Paint (155, 1078), DARKGREEN, GREEN

    Line (280, 1080)-(297, 678), DARKGREEN
    Line -(303, 1080), DARKGREEN
    Line -(280, 1080), DARKGREEN
    Paint (285, 1078), GREEN, DARKGREEN

    Line (1750, 1080)-(600, 765), GREEN
    Line -(1625, 1080), GREEN
    Line -(1750, 1080), GREEN
    Paint (950, 872), DARKGREEN, GREEN
    Paint (1590, 1065), DARKGREEN, GREEN
    Paint (1650, 1063), DARKGREEN, GREEN
End Sub

Sub foreground
    Line (400, 1080)-(200, 879), GREEN
    Line -(420, 1080), GREEN
    Line -(400, 1080), GREEN
    Paint (410, 1078), _RGB32(111, 145, 5), GREEN

    Line (657, 1080)-(456, 678), GREEN
    Line -(698, 1080), GREEN
    Line -(657, 1080), GREEN
    Paint (660, 1078), _RGB32(0, 45, 5), GREEN


    Line (1400, 1080)-(1200, 759), GREEN
    Line -(1420, 1080), GREEN
    Line -(1400, 1080), GREEN
    Paint (1410, 1078), BRIGHTGREEN, GREEN
    Paint (1300, 910), BRIGHTGREEN, GREEN

    Line (1700, 1080)-(1500, 759), GREEN
    Line -(1790, 1080), GREEN
    Line -(1700, 1080), GREEN
    Paint (1710, 1078), _RGB32(150, 150, 0), GREEN
    Paint (1600, 875), _RGB32(150, 150, 0), GREEN
    Paint (1638, 945), _RGB32(150, 150, 0), GREEN
    Paint (1740, 1245), _RGB32(150, 150, 0), GREEN
    Paint (1738, 1242), _RGB32(150, 150, 0), GREEN
    Paint (1742, 1248), _RGB32(150, 150, 0), GREEN
    Paint (1742, 1078), _RGB32(150, 150, 0), GREEN
    Paint (1744, 1075), _RGB32(150, 150, 0), GREEN
    'Line (1744, 1075)-(1742, 1), BRIGHTRED



End Sub
Sub background_draw
    Dim i As Integer
    Dim x As Integer

    For x = -500 To 500 Step 1
        dy = (Rnd * 950) + 950
        dx = (Rnd * 1899)

        Line Step(1 + x, 1080)-(dx + 50, dy), BRIGHTGREEN
        Line Step(940 + x, 1070)-(dx + 250, dy), DARKGREEN
        Line Step(120 + x, 1075)-(dx + 500, dy), YELLOW

        Line Step(1 + x, 1080)-(dx + 750, dy), BRIGHTGREEN
        Line Step(33 + x, 1072)-(dx + 950, dy), GREEN
        Line Step(120 + x, 1078)-(dx + 1150, dy), YELLOW

        Line Step(1 + x, 1080)-(dx + 50, dy), DARKGREEN
        Line Step(940 + x, 1065)-(dx + 250, dy), BRIGHTGREEN
        Line Step(120 + x, 1068)-(dx + 500, dy), YELLOW

        'Line Step(1 + x, 1080)-(dx + 750, dy), BRIGHTGREEN
        'Line Step(33 + x, 1062)-(dx + 950, dy), GREEN
        'Line Step(120 + x, 1073)-(dx + 1150, dy), YELLOW

    Next x

    '--plant--

    Dim pn As Integer
    'For pn = 1 To num_plants
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 50, (Rnd * 1080) + 1000), BRIGHTGREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 25, (Rnd * 1080) + 950), GREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 550, (Rnd * 1080) + 935), BRIGHTGREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 150, (Rnd * 1080) + 905), GREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 1250, (Rnd * 1080) + 1023), BRIGHTGREEN

    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 75, (Rnd * 1080) + 1200), BRIGHTGREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 15, (Rnd * 1080) + 1019), GREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 575, (Rnd * 1080) + 935), BRIGHTGREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 175, (Rnd * 1080) + 955), GREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 1275, (Rnd * 1080) + 1010), BRIGHTGREEN

    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 99, (Rnd * 1080) + 1177), BRIGHTGREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 20, (Rnd * 1080) + 1077), GREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 777, (Rnd * 1080) + 876), BRIGHTGREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 135, (Rnd * 1080) + 985), GREEN
    '    Line Step(Rnd * 1899, 1080)-((Rnd * 1080) + 1456, (Rnd * 1080) + 999), BRIGHTGREEN
    'Next pn

    'Dim x As Integer
    'For x = 1 To 1900 Step Rnd * 50 + 25
    '    Line Step(100, 1080)-(x + 5, 900), BRIGHTGREEN
    '    Line Step(100, 1080)-(x + 115, 900), GREEN
    'Next x
    'For x = 1 To 5000 Step 150
    '    Line Step(100, 1080)-(x + 5, 900), BRIGHTGREEN
    '    Line Step(100, 1080)-(x + 115, 900), GREEN
    'Next x
    'For x = 1 To 5000 Step 500
    '    Line Step(100, 1080)-(x + 5, 900), BRIGHTGREEN
    '    Line Step(100, 1080)-(x + 115, 900), GREEN
    'Next x






    '--bubbles--
    Randomize Timer
    For i = 1 To num_bubbles Step 1
        Circle (bub(i).x, bub(i).y), i, CYAN
        Circle (bub(i).x, bub(i).y), i, WHITE, 1, -4, .5
    Next i
    For i = 1 To num_bubbles2 Step 1
        Circle (bub2(i).x, bub2(i).y), i, CYAN
        Circle (bub2(i).x, bub2(i).y), i, WHITE, 1, -4, .5
    Next i
    For i = 1 To num_bubbles3 Step 1
        Circle (bub3(i).x, bub3(i).y), i, CYAN
        Circle (bub3(i).x, bub3(i).y), i, WHITE, 1, -4, .5
    Next i


    Dim m As Integer
    For m = 1 To num_hooks
        If hook(1).move_right = 1 Then
            Line (hook(m).x, -1)-(hook(m).x, hook(m).y), WHITE
            Circle (hook(m).x - 20, hook(m).y), 20, GREEN, , , .3
            Circle (hook(m).x - 20, hook(m).y), 19, _RGB32(0, Rnd * 256, Rnd * 256), , , .2
            Circle (hook(m).x - 20, hook(m).y), 16, GREEN, , , .1
            Circle (hook(m).x - 20, hook(m).y), 14, GREEN, , , .3
            Circle (hook(m).x - 20, hook(m).y), 12, _RGB32(0, Rnd * 256, Rnd * 256), , , .2
            Circle (hook(m).x - 20, hook(m).y), 10, GREEN, , , .1
            Circle (hook(m).x - 20, hook(m).y), 8, GREEN, , , .3
            Circle (hook(m).x - 20, hook(m).y), 6, _RGB32(0, Rnd * 256, Rnd * 256), , , .2
            Circle (hook(m).x - 20, hook(m).y), 4, GREEN, , , .1
        End If
        If hook(1).move_right = 0 Then
            Line (hook(m).x, -1)-(hook(m).x, hook(m).y), WHITE
            Circle (hook(m).x + 20, hook(m).y), 20, GREEN, , , .3
            Circle (hook(m).x + 20, hook(m).y), 18, _RGB32(0, Rnd * 256, Rnd * 256), , , .2
            Circle (hook(m).x + 20, hook(m).y), 18, GREEN, , , .1
            Circle (hook(m).x + 20, hook(m).y), 14, GREEN, , , .3
            Circle (hook(m).x + 20, hook(m).y), 12, _RGB32(0, Rnd * 256, Rnd * 256), , , .2
            Circle (hook(m).x + 20, hook(m).y), 10, GREEN, , , .1
            Circle (hook(m).x + 20, hook(m).y), 8, GREEN, , , .3
            Circle (hook(m).x + 20, hook(m).y), 6, _RGB32(0, Rnd * 256, Rnd * 256), , , .2
            Circle (hook(m).x + 20, hook(m).y), 4, GREEN, , , .1
        End If
    Next m

    Dim o As Integer

    For o = 1 To num_hooks
        Line (hook2(o).x, -1)-(hook2(o).x, hook2(o).y), WHITE
        Circle (hook2(o).x, hook2(o).y), 5, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 4, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 3, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 2, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 1, BRIGHTRED

        Circle (hook2(o).x, hook2(o).y), 6, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 7, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 8, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 9, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 10, BRIGHTRED

        Circle (hook2(o).x, hook2(o).y), 11, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 12, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 13, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 14, BRIGHTRED
        Circle (hook2(o).x, hook2(o).y), 15, BRIGHTRED
    Next o



    Dim n As Integer
    For n = 1 To num_hooks
        Line (hook3(n).x + 10, -2)-(hook3(n).x, hook3(n).y), WHITE
        Line -(hook3(n).x + 50, hook3(n).y), _RGB32(155, 100, 0)
        Line -(hook3(n).x + 16, hook3(n).y - 50), _RGB32(155, 100, 0)
        Line -(hook3(n).x, hook3(n).y + 4), _RGB32(155, 100, 0)
        Paint (hook3(n).x + 4, hook3(n).y - 4), _RGB32(211, 161, 0), _RGB32(155, 100, 0)
    Next n



    For o = 1 To num_hooks
        Line (hook4(o).x, -1)-(hook4(o).x, hook4(o).y), GRAY, B , 132
        Circle (hook4(o).x, hook4(o).y), 3.5, DARKRED
        Circle (hook4(o).x, hook4(o).y), 3, DARKRED
        Circle (hook4(o).x, hook4(o).y), 2.5, DARKRED
        Circle (hook4(o).x, hook4(o).y), 2, DARKRED
        Circle (hook4(o).x, hook4(o).y), 1.5, DARKRED
        Circle (hook4(o).x, hook4(o).y), 1, DARKRED
    Next o

    For n = 1 To 1
        Line (hook5(n).x + 5, -1)-(hook5(n).x, hook5(n).y), GRAY, , 132
        Line -(hook5(n).x + 12, hook5(n).y), YELLOW
        Line -(hook5(n).x + 4, hook5(n).y - 8), YELLOW
        Line -(hook5(n).x, hook5(n).y - 1), YELLOW
        Paint (hook5(n).x + 4, hook5(n).y - 1.5), DARKYELLOW, YELLOW
    Next n
End Sub

Sub fish_setup
    Dim r As Integer
    Dim s As Integer

    Randomize Timer

    snail_2(17).x = Int(Rnd * 540) + 250
    snail_2(17).move_up = 3
    snail_2(17).move_right = Int((Rnd * 2) + 1)

    If snail_2(17).move_right = 1 Then
        snail_2(17).y = 1051
    End If
    If snail_2(17).move_right = 2 Then
        snail_2(17).y = 1052
    End If
    If snail_2(17).move_right > 2 Then
        snail_2(17).move_right = 1
        snail_2(17).y = 1052
    End If


    snail_2(18).x = Int(Rnd * 800) + 654
    snail_2(18).move_up = 3
    snail_2(18).move_right = Int((Rnd * 2) + 1)

    If snail_2(18).move_right = 1 Then
        snail_2(18).y = 1051
    End If
    If snail_2(18).move_right = 2 Then
        snail_2(18).y = 1052
    End If
    If snail_2(18).move_right > 2 Then
        snail_2(18).move_right = 2
        snail_2(18).y = 1052
    End If

    snail_2(19).x = (Rnd * 450) + 450
    snail_2(19).move_up = 3
    snail_2(19).move_right = Int((Rnd * 2) + 1)
    If snail_2(19).move_right = 1 Then
        snail_2(19).y = 1051
    End If

    If snail_2(19).move_right = 2 Then
        snail_2(19).y = 1052
    End If
    If snail_2(19).move_right > 2 Then
        snail_2(19).move_right = 1
        snail_2(19).y = 1052
    End If

    snail_2(20).x = (Rnd * 720) + 720
    snail_2(20).move_up = 3
    snail_2(20).move_right = Int(Rnd * 400) + 1

    If snail_2(20).move_right = 1 Then
        snail_2(20).y = 1051
    End If
    If snail_2(20).move_right = 2 Then
        snail_2(20).y = 1052
    End If
    If snail_2(20).move_right > 2 Then
        snail_2(20).move_right = 2
        snail_2(20).y = 1052
    End If

    snail_2(21).x = (Rnd * 1850) + 1850
    snail_2(21).move_up = 3
    snail_2(21).move_right = Int(Rnd * 789) + 1

    If snail_2(21).move_right = 1 Then
        snail_2(21).y = 1051
    End If
    If snail_2(21).move_right = 2 Then
        snail_2(21).y = 1052
    End If
    If snail_2(21).move_right > 2 Then
        snail_2(21).move_right = 1
        snail_2(21).y = 1052
    End If

    snail_2(22).x = (Rnd * 900)
    snail_2(22).move_up = 3
    snail_2(22).move_right = Int(Rnd * 1025) + 1

    If snail_2(22).move_right = 1 Then
        snail_2(22).y = 1051
    End If
    If snail_2(22).move_right = 2 Then
        snail_2(22).y = 1052
    End If
    If snail_2(22).move_right > 2 Then
        snail_2(22).move_right = 2
        snail_2(22).y = 1052
    End If

    snail_2(23).x = (Rnd * 1050)
    snail_2(23).move_up = 3
    snail_2(23).move_right = Int((Rnd * 1266) + 1)

    If snail_2(23).move_right = 1 Then
        snail_2(23).y = 1051
    End If
    If snail_2(23).move_right = 2 Then
        snail_2(23).y = 1052
    End If
    If snail_2(23).move_right > 2 Then
        snail_2(23).move_right = 1
        snail_2(23).y = 1052
    End If

    snail_2(24).x = (Rnd * 1200)
    snail_2(24).move_up = 3
    snail_2(24).move_right = Int((Rnd * 1800) + 1)

    If snail_2(24).move_right = 1 Then
        snail_2(24).y = 1051
    End If
    If snail_2(24).move_right = 2 Then
        snail_2(24).y = 1052
    End If
    If snail_2(24).move_right > 2 Then
        snail_2(24).move_right = 2
        snail_2(24).y = 1052
    End If

    snail_2(25).x = (Rnd * 1500)
    snail_2(25).move_up = 3
    snail_2(25).move_right = Int((Rnd * 80) + 1)

    If snail_2(25).move_right = 1 Then
        snail_2(25).y = 1051
    End If
    If snail_2(25).move_right = 2 Then
        snail_2(25).y = 1052
    End If
    If snail_2(25).move_right > 2 Then
        snail_2(25).move_right = 1
        snail_2(25).y = 1052
    End If

    snail_2(26).x = (Rnd * 1500)
    snail_2(26).move_up = 3
    snail_2(26).move_right = Int((Rnd * 1547) + 1)

    If snail_2(26).move_right = 1 Then
        snail_2(26).y = 1051
    End If
    If snail_2(26).move_right = 2 Then
        snail_2(26).y = 1052
    End If
    If snail_2(26).move_right > 2 Then
        snail_2(26).move_right = 2
        snail_2(26).y = 1052
    End If

    snail_2(27).x = (Rnd * 1650)
    snail_2(27).move_up = 3
    snail_2(27).move_right = Int((Rnd * 200) + 1)

    If snail_2(27).move_right = 1 Then
        snail_2(27).y = 1051
    End If
    If snail_2(27).move_right = 2 Then
        snail_2(27).y = 1052
    End If
    If snail_2(27).move_right > 2 Then
        snail_2(27).move_right = 1
        snail_2(27).y = 1052
    End If


    For sn = 1 To 16
        snail_1(sn).x = 2000
        snail_1(sn).y = -100
        snail_1(sn).move_right = 3
        snail_1(sn).move_up = 3
    Next sn
    For sn = 18 To 58
        snail_1(sn).x = 2000
        snail_1(sn).y = -100
        snail_1(sn).move_right = 3
        snail_1(sn).move_up = 3
    Next sn



    snail_1(60).x = 45
    snail_1(60).y = (Rnd * 1050) + 950
    snail_1(60).move_right = 3
    snail_1(60).move_up = Int((Rnd * 2))

    snail_1(61).x = (Rnd * 690)
    snail_1(61).move_up = 3
    snail_1(61).move_right = Int((Rnd * 200) + 1)
    If snail_1(61).move_right = 1 Then
        snail_1(61).y = 1051
    End If
    If snail_1(61).move_right = 2 Then
        snail_1(61).y = 1052
    End If
    If snail_1(61).move_right > 2 Then
        snail_1(61).move_right = 1
        snail_1(61).y = 1052
    End If

    snail_1(62).x = 1860
    snail_1(62).y = (Rnd * 1050) + 25
    snail_1(62).move_right = 3
    snail_1(62).move_up = Int((Rnd * 2))


    snail_1(63).x = 45
    snail_1(63).y = (Rnd * 1050) + 540
    snail_1(63).move_right = 3
    snail_1(63).move_up = Int((Rnd * 2))

    snail_1(64).x = (Rnd * 1890)
    snail_1(64).move_up = 3
    snail_1(64).move_right = Int((Rnd * 200) + 1)
    If snail_1(64).move_right = 1 Then
        snail_1(64).y = 1051
    End If
    If snail_1(64).move_right = 2 Then
        snail_1(64).y = 1052
    End If
    If snail_1(64).move_right > 2 Then
        snail_1(64).move_right = 1
        snail_1(64).y = 1052
    End If

    snail_1(65).x = 1860
    snail_1(65).y = (Rnd * 1050) + 25
    snail_1(65).move_right = 3
    snail_1(65).move_up = Int((Rnd * 2))



    snail_1(66).x = 45
    snail_1(66).y = (Rnd * 1050) + 25
    snail_1(66).move_right = 3
    snail_1(66).move_up = Int((Rnd * 2))

    snail_1(67).x = (Rnd * 1650)
    snail_1(67).move_up = 3
    snail_1(67).move_right = Int((Rnd * 200) + 1)
    If snail_1(67).move_right = 1 Then
        snail_1(67).y = 1051
    End If
    If snail_1(67).move_right = 2 Then
        snail_1(67).y = 1052
    End If
    If snail_1(67).move_right > 2 Then
        snail_1(67).move_right = 1
        snail_1(67).y = 1052
    End If

    snail_1(68).x = 1860
    snail_1(68).y = (Rnd * 1050) + 25
    snail_1(68).move_right = 3
    snail_1(68).move_up = Int((Rnd * 2))







    For r = 1 To num_fish
        fish(r).x = Rnd * -20000
        fish(r).y = Rnd * 1080
        fish(r).move_right = 1
        fish(r).move_up = Int(Rnd * 3)
    Next r

    Dim r2 As Integer
    For r2 = 1 To num_fisha
        fisha(r2).x = Rnd * -20000
        fisha(r2).y = Rnd * 1080
        fisha(r2).move_right = 1
        fisha(r2).move_up = Int(Rnd * 3)
    Next r2


    For s = 1 To num_fishb
        fishb(s).x = Rnd * 15000
        fishb(s).y = Rnd * 540
        fishb(s).move_right = 0
        fishb(s).move_up = Int(Rnd * 3)
    Next s

    Dim s2 As Integer
    For s2 = 1 To num_fishba
        fishba(s2).x = Rnd * 15000
        fishba(s2).y = Rnd * 540
        fishba(s2).move_right = 0
        fishba(s2).move_up = Int(Rnd * 3)
    Next s2


    '------------------------

    Dim t As Integer
    For t = 1 To num_fish2
        fish2(t).x = Rnd * 1900
        fish2(t).y = Rnd * 1080
        fish2(t).move_right = Int(Rnd * 2)
        fish2(t).move_up = Int(Rnd * 2)
    Next t

    Dim u As Integer
    For u = 1 To num_fish6
        fish6(u).x = Rnd * 1900
        fish6(u).y = Rnd * 1080
        fish6(u).move_right = Int(Rnd * 2)
        fish6(u).move_up = Int(Rnd * 3)
    Next u
    '--------------------------------------
    Randomize Timer
    Dim f3t As Integer
    For f3t = 1 To 14
        fish3(f3t).x = Rnd * 3000
        fish3(f3t).y = Rnd * 1080 + 250
        fish3(f3t).move_right = Int(Rnd * 2)
        fish3(f3t).move_up = Int(Rnd * 3)
    Next f3t
    Dim f3tb As Integer
    For f3tb = 15 To num_fish3
        fish3(f3tb).x = Rnd * -3000
        fish3(f3tb).y = Rnd * 1080 + 540
        fish3(f3tb).move_right = Int(Rnd * 2)
        fish3(f3tb).move_up = Int(Rnd * 3)
    Next f3tb

    '---------------------------------------

    'Dim a As Integer
    'For a = 1 To num_fish4
    '    fish4(a).x = Rnd * 1200
    '    fish4(a).y = Rnd * 720
    '    fish4(a).move_up = Int(Rnd * 2)
    '    fish4(a).move_right = Int(Rnd * 2)
    'Next a

    Dim d As Integer
    For d = 1 To num_fish5
        fish5(d).x = Rnd * 1889
        fish5(d).y = Rnd * 720
        fish5(d).move_up = Int(Rnd * 3)
        fish5(d).move_right = Int(Rnd * 2)
    Next d

    '---------------------------------------
    Dim b As Integer
    For b = 1 To num_bubbles
        bub(b).x = Rnd * 1900
        bub(b).y = Rnd * 1080
        bub(b).move_right = Int(Rnd * 2)
    Next b
    '-------------------------------------
    '-------------------------
    hook(1).x = Rnd * 1899
    hook(1).y = Int(Rnd * -1000)
    hook(1).move_up = 0

    hook2(1).x = Rnd * 1899
    hook2(1).y = Int(Rnd * -1000)
    hook2(1).move_up = 0

    hook3(1).x = Rnd * 1899
    hook3(1).y = Int(Rnd * -2400)
    hook3(1).move_up = 0

    hook4(1).x = Rnd * 1899
    hook4(1).y = Int(Rnd * -400)
    hook4(1).move_up = 0

    hook5(1).x = Int((Rnd * 950)) + 950
    hook5(1).y = Int(Rnd * -400)
    hook5(1).move_up = 0

    Dim pl As Integer
    For pl = 1 To num_plants


        plant(1).x = Rnd * 1899
        plant(1).y = 1080

        plant(2).x = Rnd * 1899
        plant(2).y = 1080
        'Paint (1024, 700), GREEN

        plant(3).x = Rnd * 1899
        plant(3).y = 1080
        1
        plant(4).x = Rnd * 1899
        plant(4).y = 1080

        plant(5).x = Rnd * 1899
        plant(5).y = 1080

        plant(6).x = Rnd * 1899
        plant(6).y = 1080
        plant(7).x = Rnd * 1899
        plant(7).y = 1080

        plant(8).x = Rnd * 1899
        plant(8).y = 1080

        plant(9).x = Rnd * 1899
        plant(9).y = 1080

        plant(10).x = Rnd * 1899
        plant(10).y = 1080

        plant(11).x = Rnd * 1899
        plant(11).y = 1080

        plant(12).x = Rnd * 1899
        plant(12).y = 1080

        plant(13).x = Rnd * 1899
        plant(13).y = 1080
    Next pl

End Sub

Sub fish_move
    Dim i As Integer
    Dim t As Integer
    Dim t2%
    Dim l As Integer
    Dim m As Integer

    t = 6

    For i = 1 To 3

        If fish(i).move_right >= 1 Then
            fish(i).x = fish(i).x + t
        Else
            fish(i).x = fish(i).x + -t
        End If

        Select Case fish(i).move_up
            Case 1
                fish(i).y = fish(i).y - t
            Case 3
                fish(i).y = fish(i).y - 0
            Case 0
                fish(i).y = fish(i).y + t
        End Select

        If fish(i).x >= 5000 Then
            fish(i).x = -5000
            fish(i).y = (Rnd * 1080) + 50
        End If
        If fish(i).y > 1075 Then fish(i).move_up = 1
        If fish(i).y <= 50 Then fish(i).move_up = 0

    Next i

    For i = 4 To num_fish
        t2% = 7.5

        If fish(i).move_right >= 1 Then
            fish(i).x = fish(i).x + t2%
        Else
            fish(i).x = fish(i).x + -t2%
        End If

        Select Case fish(i).move_up
            Case 1
                fish(i).y = fish(i).y - t2%
            Case 3
                fish(i).y = fish(i).y - 0
            Case 0
                fish(i).y = fish(i).y + t2%
        End Select

        If fish(i).x >= 35000 Then
            fish(i).x = (Rnd * -35000)
            fish(i).y = (Rnd * 1080)
        End If
        If fish(i).y > 1040 Then fish(i).move_up = 1
        If fish(i).y <= 50 Then fish(i).move_up = 0
    Next i
    Dim i2 As Integer

    For i2 = 1 To 3
        If fisha(i2).move_right >= 1 Then
            fisha(i2).x = fisha(i2).x + 8.8
        Else
            fisha(i2).x = fisha(i2).x + -8.8
        End If

        Select Case fisha(i2).move_up
            Case 1
                fisha(i2).y = fisha(i2).y - 8.8
            Case 3
                fisha(i2).y = fisha(i2).y - 0
            Case 0
                fisha(i2).y = fisha(i2).y + 8.8
        End Select

        If fisha(i2).x >= 5000 Then
            fisha(i2).x = -5000
            fisha(i2).y = (Rnd * 1080) + 50
        End If
        If fisha(i2).y > 1040 Then fisha(i2).move_up = 1
        If fisha(i2).y <= 50 Then fisha(i2).move_up = 0

    Next i2
    Dim t22%

    For i2 = 4 To num_fisha
        t22% = 8

        If fisha(i2).move_right >= 1 Then
            fisha(i2).x = fisha(i2).x + t22%
        Else
            fisha(i2).x = fisha(i2).x + -t22%
        End If

        Select Case fisha(i2).move_up
            Case 1
                fisha(i2).y = fisha(i2).y - t22%
            Case 3
                fisha(i2).y = fisha(i2).y - 0
            Case 0
                fisha(i2).y = fisha(i2).y + t22%
        End Select

        If fisha(i2).x >= 35000 Then
            fisha(i2).x = (Rnd * -35000)
            fisha(i2).y = (Rnd * 1080)
        End If
        If fisha(i2).y > 1040 Then fisha(i2).move_up = 1
        If fisha(i2).y <= 50 Then fisha(i2).move_up = 0
    Next i2

    Dim z As Integer
    For z = 1 To 15
        If fishb(z).move_right = 1 Then
            fishb(z).x = fishb(z).x + 8.5
        Else
            fishb(z).x = fishb(z).x + -8.5
        End If

        Select Case fishb(z).move_up
            Case 1
                fishb(z).y = fishb(z).y - 8.5
            Case 3
                fishb(z).y = fishb(z).y - 0
            Case 0
                fishb(z).y = fishb(z).y + 8.5
        End Select

        If fishb(z).x <= -5000 Then
            fishb(z).x = (Rnd * 5000) + 2000
            fishb(z).y = (Rnd * 600) + 50
        End If
        'If fishb(z).y >= 1020 And fishb(z).y < 1079 Then fishb(z).move_up = 3
        If fishb(z).y >= 1079 Then fishb(z).move_up = 1
        'If fishb(z).y <= 250 And fishb(z).y > 50 Then fishb(z).move_up = 3
        If fishb(z).y <= 50 Then fishb(z).move_up = 0
    Next z

    For z = 16 To num_fishb
        If fishb(z).move_right = 1 Then
            fishb(z).x = fishb(z).x + 7.8
        Else
            fishb(z).x = fishb(z).x + -7.8
        End If

        Select Case fishb(z).move_up
            Case 1
                fishb(z).y = fishb(z).y - 1.8
            Case 3
                fishb(z).y = fishb(z).y - 0
            Case 0
                fishb(z).y = fishb(z).y + 2.3
        End Select

        If fishb(z).x <= -5000 Then
            fishb(z).x = (Rnd * 5000) + 3000
            fishb(z).y = (Rnd * 540) + 50
        End If
        If fishb(z).y >= 1020 And fishb(z).y < 1079 Then fishb(z).move_up = 3
        If fishb(z).y >= 1079 Then fishb(z).move_up = 1
        'If fishb(z).y < 250 And fishb(z).y > 50 Then fishb(z).move_up = 3
        If fishb(z).y <= 50 Then fishb(z).move_up = 0
    Next z

    Dim z2 As Integer

    For z2 = 1 To 9
        If fishba(z2).move_right = 1 Then
            fishba(z2).x = fishba(z2).x + 9
        Else
            fishba(z2).x = fishba(z2).x + -9
        End If

        Select Case fishba(z2).move_up
            Case 1
                fishba(z2).y = fishba(z2).y - 1.5
            Case 3
                fishba(z2).y = fishba(z2).y - 0
            Case 0
                fishba(z2).y = fishba(z2).y + 1.8
        End Select

        If fishba(z2).x <= -15000 Then
            fishba(z2).x = (Rnd * 15000) + 5000
            fishba(z2).y = (Rnd * 1020) + 50
        End If
        'If fishba(z2).y >= 1020 And fishba(z2).y < 1079 Then fishba(z2).move_up = 3
        If fishba(z2).y >= 1079 Then fishba(z2).move_up = 1
        'If fishba(z2).y < 250 And fishba(z2).y > 50 Then fishba(z2).move_up = 3
        If fishba(z2).y <= 50 Then fishba(z2).move_up = 0
    Next z2

    For z2 = 10 To num_fishba
        If fishba(z2).move_right = 1 Then
            fishba(z2).x = fishba(z2).x + 5.8
        Else
            fishba(z2).x = fishba(z2).x + -5.8
        End If

        Select Case fishba(z2).move_up
            Case 1
                fishba(z2).y = fishba(z2).y - 2.8
            Case 3
                fishba(z2).y = fishba(z2).y - 0
            Case 0
                fishba(z2).y = fishba(z2).y + 2.3
        End Select

        If fishba(z2).x <= -25000 Then
            fishba(z2).x = (Rnd * 25000) + 10000
            fishba(z2).y = (Rnd * 540) + 120
        End If
        If fishba(z2).y >= 1020 And fishba(z2).y < 1079 Then fishba(z2).move_up = 3
        If fishba(z2).y >= 1079 Then fishba(z2).move_up = 1
        'If fishba(z2).y < 250 And fishba(z2).y > 50 Then fishba(z2).move_up = 3
        If fishba(z2).y <= 50 Then fishba(z2).move_up = 0
    Next z2

    If fish(5).x >= 10000 Then
        fish(5).x = Rnd * -5000
        fish(5).y = Rnd * 1080
    End If
    If fish(5).y > 650 Then fish(5).move_up = 1
    If fish(5).y <= 5 Then fish(5).move_up = 0
    If fish(5).move_right = 1 Then
        fish(5).x = fish(5).x + 2
    End If
    If fish(5).move_up = 1 Then
        fish(5).y = fish(5).y - 2
    Else
        fish(5).y = fish(5).y + 2
    End If


    Dim k As Integer
    Dim speed%
    speed% = 2.8
    For k = 1 To num_fish2
        Select Case fish2(k).move_up
            Case 1
                fish2(k).y = fish2(k).y - speed%
            Case 3
                fish2(k).y = fish2(k).y - 0
            Case 0
                fish2(k).y = fish2(k).y + speed%
        End Select

        Select Case fish2(k).move_right
            Case 0
                fish2(k).x = fish2(k).x - speed%
            Case 1
                fish2(k).x = fish2(k).x + speed%
        End Select

        If fish2(k).x <= -40 Then
            fish2(k).move_right = 1
        End If
        If fish2(k).x >= 1980 Then
            fish2(k).move_right = 0
        End If
        If fish2(k).y <= 1 Then
            fish2(k).move_up = 0
        End If
        If fish2(k).y >= 1079 Then
            fish2(k).move_up = 1
        End If

    Next k

    Dim fish6_loop As Integer

    For fish6_loop = 1 To num_fish6
        Select Case fish6(fish6_loop).move_up
            Case Is >= 1 And fish6(fish6_loop).move_up < 3
                fish6(fish6_loop).y = fish6(fish6_loop).y - 1.5
            Case 3
                fish6(fish6_loop).y = fish6(fish6_loop).y - 0
            Case 0
                fish6(fish6_loop).y = fish6(fish6_loop).y + 1.5
        End Select

        Select Case fish6(fish6_loop).move_right
            Case 0
                fish6(fish6_loop).x = fish6(fish6_loop).x - 1.5
            Case Is >= 1
                fish6(fish6_loop).x = fish6(fish6_loop).x + 1.5
        End Select
        Select Case fish6(fish6_loop).x
            Case Is = -10000
                fish6(fish6_loop).y = Rnd * 1080
                fish6(fish6_loop).x = 10000
            Case Is > 2100
                fish6(fish6_loop).y = Rnd * 1080
                fish6(fish6_loop).x = -400
        End Select
        Select Case fish6(fish6_loop).y
            Case Is <= 0
                fish6(fish6_loop).move_up = 0
            Case Is >= 1042
                fish6(fish6_loop).move_up = 1
        End Select
    Next fish6_loop

    Dim t3 As Integer
    t3 = 4.8
    For l = 1 To 14
        Select Case fish3(l).move_right
            Case Is = 1
                fish3(l).x = fish3(l).x + t3
            Case Is = 0
                fish3(l).x = fish3(l).x - t3
        End Select
        Select Case fish3(l).move_up
            Case Is = 1
                fish3(l).y = fish3(l).y - t3
            Case Is = 0
                fish3(l).y = fish3(l).y + t3
        End Select
        Select Case fish3(l).y
            Case Is <= 20
                fish3(l).move_up = 0
            Case Is >= 900
                fish3(l).move_up = 1
        End Select
        Select Case fish3(l).x
            Case Is <= -1600
                fish3(l).x = 2500
                fish3(l).y = Rnd * 1080
            Case Is >= 2100
                fish3(l).x = -500
                fish3(l).y = Rnd * 1080
        End Select
    Next l

    For l = 15 To 20
        Select Case fish3(l).move_right
            Case Is = 1
                fish3(l).x = fish3(l).x + 3.5
            Case Is = 0
                fish3(l).x = fish3(l).x - 3.5
        End Select
        Select Case fish3(l).move_up
            Case Is = 1
                fish3(l).y = fish3(l).y - 3.5
            Case Is = 0
                fish3(l).y = fish3(l).y + 3.5
        End Select
        Select Case fish3(l).y
            Case Is <= 50
                fish3(l).move_up = 0
            Case Is >= 1000
                fish3(l).move_up = 1
        End Select
        Select Case fish3(l).x
            Case Is <= -1600
                fish3(l).x = 2200
                fish3(l).y = Rnd * 1080
            Case Is >= 2300
                fish3(l).x = -1500
                fish3(l).y = Rnd * 1080
        End Select
    Next l


    For l = 21 To num_fish3
        Select Case fish3(l).move_right
            Case Is = 1
                fish3(l).x = fish3(l).x + 2.5
            Case Is = 0
                fish3(l).x = fish3(l).x - 2.5
        End Select
        Select Case fish3(l).move_up
            Case Is = 1
                fish3(l).y = fish3(l).y - 2.5
            Case Is = 0
                fish3(l).y = fish3(l).y + 2.5
        End Select
        Select Case fish3(l).y
            Case Is <= 540
                fish3(l).move_up = 0
            Case Is >= 1050
                fish3(l).move_up = 1
        End Select
        Select Case fish3(l).x
            Case Is <= -1600
                fish3(l).x = 3000
                fish3(l).y = Rnd * 1080
            Case Is >= 3100
                fish3(l).x = -1500
                fish3(l).y = Rnd * 1080
        End Select
    Next l




    For m = 1 To 10
        Select Case bub(m).move_right
            Case Is = 1
                bub(m).x = bub(m).x + .65
            Case Is = 0
                bub(m).x = bub(m).x - .65
        End Select

        bub(m).y = bub(m).y - 12.7

        If bub(m).y <= 0 Then
            bub(m).y = 1080 + 10
            bub(m).x = Rnd * 1900
            bub(m).move_right = (Rnd * 1) + 1
        End If
        Select Case bub2(m).move_right
            Case Is = 1
                bub2(m).x = bub2(m).x + .75
            Case Is = 0
                bub2(m).x = bub2(m).x - .75
        End Select

        bub2(m).y = bub2(m).y - 23.7

        If bub2(m).y <= 0 Then
            bub2(m).y = 1080 + 10
            bub2(m).x = Rnd * 1900
            bub2(m).move_right = (Rnd * 1) + 1
        End If


        Select Case bub3(m).move_right
            Case Is = 1
                bub3(m).x = bub3(m).x + .55
            Case Is = 0
                bub3(m).x = bub3(m).x - .55
        End Select

        bub3(m).y = bub3(m).y - 12.5

        If bub3(m).y <= 0 Then
            bub3(m).y = 1080 + 10
            bub3(m).x = Rnd * 1900
            bub3(m).move_right = (Rnd * 1) + 1
        End If

    Next m
    Dim n As Integer
    For n = 11 To 20
        Select Case bub(n).move_right
            Case Is = 1
                bub(n).x = bub(n).x + .87
            Case Is = 0
                bub(n).x = bub(n).x - .87
        End Select
        bub(n).y = bub(n).y - 12
        If bub(n).y <= 0 Then
            bub(n).y = 1080 + 10
            bub(n).x = Rnd * 1900
            bub(n).move_right = Rnd * 2
        End If
        Select Case bub2(n).move_right
            Case Is = 1
                bub2(n).x = bub2(n).x + .65
            Case Is = 0
                bub2(n).x = bub2(n).x - .65
        End Select

        bub2(n).y = bub2(n).y - 11.7

        If bub2(n).y <= 0 Then
            bub2(n).y = 1080 + 10
            bub2(n).x = Rnd * 1900
            bub2(n).move_right = (Rnd * 1) + 1
        End If
        Select Case bub3(n).move_right
            Case Is = 1
                bub3(n).x = bub3(n).x + .65
            Case Is = 0
                bub3(n).x = bub3(n).x - .65
        End Select

        bub3(n).y = bub3(n).y - 28.7

        If bub3(n).y <= 0 Then
            bub3(n).y = 1080 + 10
            bub3(n).x = Rnd * 1900
            bub3(n).move_right = (Rnd * 1) + 1
        End If
    Next n

    Dim p As Integer
    For p = 1 To num_fish4
        Select Case fish4(p).move_up
            Case Is = 0
                fish4(p).y = fish4(p).y + .75
            Case Is = 1
                fish4(p).y = fish4(p).y - .75
        End Select
        Select Case fish4(p).move_right
            Case Is = 0
                fish4(p).x = fish4(p).x - .65
            Case Is = 1
                fish4(p).x = fish4(p).x + .65
        End Select
        Select Case fish4(p).x
            Case Is = -500
                fish4(p).x = 2000
                fish4(p).y = (Rnd * 1080)
            Case Is = 2100
                fish4(p).x = -400
                fish4(p).y = (Rnd * 1080)
        End Select
        Select Case fish4(p).y
            Case Is <= 0
                fish4(p).move_up = 0
            Case Is >= 1080
                fish4(p).move_up = 1
        End Select
    Next p

    For p = 1 To num_fish5
        Select Case fish5(p).y
            Case Is <= 0
                fish5(p).move_up = 0
            Case Is >= 420 + (p * 8)
                fish5(p).move_up = 1
        End Select
        Select Case fish5(p).x
            Case Is <= -500
                fish5(p).x = 2000
                fish5(p).y = (Rnd * 420) + 1
                fish5(p).move_up = Int(Rnd * 3)
            Case Is >= 2100
                fish5(p).x = -400
                fish5(p).y = (Rnd * 420) + 1
                fish5(p).move_up = Int(Rnd * 3)
        End Select
        Select Case fish5(p).move_up
            Case Is = 0
                fish5(p).y = fish5(p).y + 2.65
            Case Is = 1
                fish5(p).y = fish5(p).y - 2.65
            Case Is = 2
                fish5(p).y = fish5(p).y + 0
        End Select
        Select Case fish5(p).move_right
            Case Is = 0
                fish5(p).x = fish5(p).x - 2.75
            Case Is = 1
                fish5(p).x = fish5(p).x + 2.75
        End Select
    Next p
End Sub


Sub snail_move
    Dim sm As Integer

    For sn = 1 To 16
        snail_1(sn).x = 2000
        snail_1(sn).y = -100
        snail_1(sn).move_right = 3
        snail_1(sn).move_up = 3
    Next sn
    For sn = 18 To 58
        snail_1(sn).x = 2000
        snail_1(sn).y = -100
        snail_1(sn).move_right = 3
        snail_1(sn).move_up = 3
    Next sn


    For sn = 60 To 62
        Select Case snail_1(sn).move_up
            Case Is = 0
                snail_1(sn).y = snail_1(sn).y + (Rnd * 1.8)
                snail_1(sn).move_right = 3
            Case Is = 1
                snail_1(sn).y = snail_1(sn).y - (Rnd * 1.2)
                snail_1(sn).move_right = 3
            Case Is = 3
                snail_1(sn).y = snail_1(sn).y + 0
        End Select
        Select Case snail_1(sn).move_right
            Case Is = 0
                snail_1(sn).x = snail_1(sn).x - (Rnd * 1.8)
                snail_1(sn).move_up = 3
            Case Is = 1
                snail_1(sn).x = snail_1(sn).x + (Rnd * 1.6)
                snail_1(sn).move_up = 3
            Case Is = 3
                snail_1(sn).x = snail_1(sn).x + 0
        End Select
    Next sn
    For sm = 63 To 65
        Select Case snail_1(sm).move_up
            Case Is = 0
                snail_1(sm).y = snail_1(sm).y + Rnd * 1.6
                snail_1(sm).move_right = 3
            Case Is = 1
                snail_1(sm).y = snail_1(sm).y - Rnd * 1.1
                snail_1(sm).move_right = 3
            Case Is = 3
                snail_1(sm).y = snail_1(sm).y + 0
        End Select
        Select Case snail_1(sm).move_right
            Case Is = 0
                snail_1(sm).x = snail_1(sm).x - Rnd * 1.6
                snail_1(sm).move_up = 3
            Case Is = 1
                snail_1(sm).x = snail_1(sm).x + Rnd * 1.6
                snail_1(sm).move_up = 3
            Case Is = 3
                snail_1(sm).x = snail_1(sm).x + 0
        End Select
    Next sm
    For sm = 66 To num_snail_1
        Select Case snail_1(sm).move_up
            Case Is = 0
                snail_1(sm).y = snail_1(sm).y + Rnd * 2.8
                snail_1(sm).move_right = 3
            Case Is = 1
                snail_1(sm).y = snail_1(sm).y - Rnd * 2.2
                snail_1(sm).move_right = 3
            Case Is = 3
                snail_1(sm).y = snail_1(sm).y + 0
        End Select
        Select Case snail_1(sm).move_right
            Case Is = 0
                snail_1(sm).x = snail_1(sm).x - Rnd * 2.4
                snail_1(sm).move_up = 3
            Case Is = 1
                snail_1(sm).x = snail_1(sm).x + Rnd * 2.4
                snail_1(sm).move_up = 3
            Case Is = 3
                snail_1(sm).x = snail_1(sm).x + 0
        End Select
    Next sm

    For sm = 1 To num_snail_1
        If snail_1(sm).x <= 45 And snail_1(sm).y >= 1055 And snail_1(sm).move_up = 3 Then
            snail_1(sm).x = 45
            snail_1(sm).move_right = 3
            snail_1(sm).move_up = 1
        Else If snail_1(sm).x <= 45 And snail_1(sm).y >= 1054 And snail_1(sm).move_up = 0 Then
                snail_1(sm).y = 1055
                snail_1(sm).x = 46
                snail_1(sm).move_right = 1
                snail_1(sm).move_up = 3
            End If
        End If

        If snail_1(sm).x >= 1860 And snail_1(sm).y >= 1055 And snail_1(sm).move_up = 3 Then
            snail_1(sm).move_right = 3
            snail_1(sm).move_up = 1
        Else If snail_1(sm).x >= 1860 And snail_1(sm).y > 1055 And snail_1(sm).move_up = 0 Then
                snail_1(sm).y = 1055
                snail_1(sm).x = 1859
                snail_1(sm).move_right = 0
                snail_1(sm).move_up = 3
            End If
        End If

        If snail_1(sm).x >= 1860 And snail_1(sm).y = 1055 And snail_1(sm).move_right = 1 Then
            snail_1(sm).move_right = 3
            snail_1(sm).move_up = 1
        End If

        If snail_1(sm).x <= 45 And snail_1(sm).y <= 10 Then
            snail_1(sm).move_up = 0
        End If

        If snail_1(sm).x >= 1860 And snail_1(sm).y < 10 Then
            snail_1(sm).move_up = 0
        End If
    Next sm

End Sub


Sub snail_move_2

    For sv = 17 To 27
        Select Case snail_2(sv).move_up
            Case Is = 1
                snail_2(sv).y = snail_2(sv).y + Rnd * 1.8
            Case Is = 2
                snail_2(sv).y = snail_2(sv).y - Rnd * 1.4
            Case Is = 3
                snail_2(sv).y = snail_2(sv).y + 0
        End Select
        Select Case snail_2(sv).move_right
            Case Is = 1
                snail_2(sv).x = snail_2(sv).x - Rnd * 2.5
            Case Is = 2
                snail_2(sv).x = snail_2(sv).x + Rnd * 2.5
            Case Is = 3
                snail_2(sv).x = snail_2(sv).x + 0
        End Select

        ''...left
        If snail_2(sv).x <= 1625 And snail_2(sv).y = 1051 And snail_2(sv).move_right = 1 Then
            snail_2(sv).move_up = 2
            snail_2(sv).move_right = 3
            snail_2(sv).x = 1625
            snail_2(sv).y = 1050
        End If
        ''...right
        If snail_2(sv).x >= 1625 And snail_2(sv).y = 1052 And snail_2(sv).move_right = 2 Then
            snail_2(sv).move_up = 2
            snail_2(sv).move_right = 3
            snail_2(sv).x = 1625
            snail_2(sv).y = 1050
        End If

        If snail_2(sv).x = 1625 And snail_2(sv).y <= 710 Then
            snail_2(sv).move_up = 1
            snail_2(sv).move_right = 3
        End If

        If snail_2(sv).x = 1625 And snail_2(sv).y >= 1049 And snail_2(sv).move_up = 1 Then
            snail_2(sv).move_up = 3
            snail_2(sv).move_right = Int((Rnd * 2)) + 1
            snail_2(sv).x = 1624
            snail_2(sv).y = 1050
        End If

        ''...right
        If snail_2(sv).x = 275 And snail_2(sv).y = 1052 Then
            If snail_2(sv).move_right = 2 Then
                snail_2(sv).move_up = 2
                snail_2(sv).move_right = 3
                'snail_2(sv).x = 275
                snail_2(sv).y = 1049
            End If
        End If

        ''...left
        If snail_2(sv).x <= 275 And snail_2(sv).y = 1050 Then
            If snail_2(sv).move_right = 1 Then
                snail_2(sv).move_up = 2
                snail_2(sv).move_right = 3
                snail_2(sv).x = 275
                snail_2(sv).y = 1049
            End If
        End If
        If snail_2(sv).x = 275 And snail_2(sv).y <= 730 And snail_2(sv).move_up = 2 Then
            snail_2(sv).move_up = 1
            snail_2(sv).move_right = 3
        End If


        If snail_2(sv).x = 275 And snail_2(sv).y >= 1048 And snail_2(sv).move_up = 1 Then
            snail_2(sv).move_up = 3
            snail_2(sv).move_right = Int((Rnd * 2)) + 1
            snail_2(sv).y = 1052
            snail_2(sv).x = 276

        End If


        If snail_2(sv).x <= 190 And snail_2(sv).y >= 1049 And snail_2(sv).move_right = 1 Then
            snail_2(sv).move_up = 2
            snail_2(sv).move_right = 3
            snail_2(sv).x = 190
            snail_2(sv).y = 1048
        End If
        If snail_2(sv).x = 190 And snail_2(sv).y <= 790 And snail_2(sv).move_up = 2 Then
            snail_2(sv).move_up = 1
            snail_2(sv).move_right = 3
        End If

        If snail_2(sv).x = 190 And snail_2(sv).y >= 1048 And snail_2(sv).move_up = 1 Then
            snail_2(sv).move_up = 3
            snail_2(sv).y = 1052
            snail_2(sv).x = 189
            snail_2(sv).move_right = Int((Rnd * 2)) + 1
        End If


        If snail_2(sv).x <= 1 Then
            snail_2(sv).x = 1900
            snail_2(sv).y = 1051
            snail_2(sv).move_up = 3
            snail_2(sv).move_right = 1
        End If

        If snail_2(sv).x > 1900 Then
            snail_2(sv).x = 2
            snail_2(sv).y = 1052
            snail_2(sv).move_up = 3
            snail_2(sv).move_right = 2
        End If





    Next sv
End Sub


Sub convert_to_12hr
    Shared h%
    Shared clock_timer%

    Select Case h%
        Case Is > 12
            h% = h% - 12
        Case Is = 0
            h% = h% + 12
    End Select
End Sub

Sub move_clock
    Select Case clock_right
        Case Is = 1
            x% = x% + .75
        Case Is = 0
            x% = x% - .75
    End Select
    Select Case clock_up
        Case Is = 1
            y% = y% - .75
        Case Is = 0
            y% = y% + .75
    End Select

    Select Case x%
        Case Is >= 1899 - 90
            clock_right = 0
        Case Is <= 0 + 90
            clock_right = 1
    End Select
    Select Case y%
        Case Is >= 1079 - 90
            clock_up = 1
        Case Is <= 0 + 90
            clock_up = 0
    End Select
End Sub


Sub holiday_check

    Select Case Left$(current_date$, 5)
        'Case "01-04" ' current date
        '    _PutImage , alert420&
        Case "01-01" 'new year
            _PutImage , new_year_pic&
        Case "03-17" ' st paddy
            _PutImage , st_pat_pic&
        Case "04-20" ' 420
            _PutImage , alert420&
        Case "07-04" '4th of july
            _PutImage , july_4th_pic&
        Case "10-31" 'halloween
            _PutImage , halloween_pic&
        Case "11-01" ' dia del meurtos
            _PutImage , de_los_meurtos_pic&
        Case "12-25" 'christmas
            _PutImage , xmas_pic&
        Case Else
            screen_pic
    End Select
End Sub


Sub screen_pic


    '====420 alert===='
    current_hr = Val(Left$(tm$, 2))
    If current_hr >= 4 And current_hr <= 16 Then
        _PutImage , day_pic&
    Else
        _PutImage , night_pic&
    End If
End Sub

Sub clock_color_day
    Shared x%, y%, h%, tm$
    Circle (x%, y%), 150, BLUE
    Paint (x%, y%), YELLOW, BLUE
    Circle (x%, y%), 145, BLUE
    Circle (x%, y%), 140, YELLOW
    Paint (x%, y%), LIGHTBLUE, BLUE
    Color LIGHTYELLOW, LIGHTBLUE
    If f& > 0 Then _Font f&
    _PrintString (x% - 118, y%), Right$("0" + LTrim$(Str$(h%)), 2) + Right$(tm$, 6)
    Color _RGB32(255, 150, 0), LIGHTBLUE
    If fkn& > 0 Then _Font fkn&
    _PrintString (x% - 100, y% - 50), "kn0ne"
    Circle (x%, y%), BLUE
    Color LIGHTYELLOW, LIGHTBLUE
    If fdt& > 0 Then _Font fdt&

    _PrintString (x% - 112, y% + 30), current_date$
    '_PrintString (x% - 23, y% - 75), Str$(Int((Rnd * 2)) + 1)
    Circle (x%, y%), 125, BLUE
    Circle (x%, y%), 160, YELLOW
    Circle (x%, y%), 170, BLUE
    Circle (x%, y%), 123, BLUE
    Circle (x%, y%), 158, YELLOW
    Circle (x%, y%), 168, BLUE
End Sub

Sub clock_color_night

    Shared x%, y%, h%, tm$
    Circle (x%, y%), 150, GRAY
    Paint (x%, y%), DARKGRAY, GRAY
    Circle (x%, y%), 145, BRIGHTGREEN
    Circle (x%, y%), 140, GREEN '
    Paint (x%, y%), BLACK, GRAY
    Color BRIGHTGREEN, BLACK
    If fdt& > 0 Then _Font fdt&
    _PrintString (x% - 112, y% + 30), current_date$
    If f& > 0 Then _Font f&
    _PrintString (x% - 118, y%), Right$("0" + LTrim$(Str$(h%)), 2) + Right$(tm$, 6)
    Circle (x%, y%), GREEN
    Color GREEN, BLACK
    If fkn& > 0 Then _Font fkn&
    _PrintString (x% - 100, y% - 50), "kn0ne"
    '_PrintString (x% - 100, y% - 50), Str$(Int(Rnd * 3) + 1)
    'Color BLACK, WHITE
    '_PrintString (540, 540), Str$(Int((Rnd * 2)) + 1)
    Circle (x%, y%), 130, BRIGHTGREEN
    Circle (x%, y%), 150, GREEN
    Circle (x%, y%), 170, BRIGHTGREEN
End Sub

Sub move_hook

    Select Case hook(1).y
        Case Is <= Int(Rnd * -2400) - 800
            hook(1).move_up = 0
            hook(1).x = Rnd * 1899
        Case Is >= (Rnd * 840) + 350
            hook(1).move_up = 1
    End Select
    Select Case hook(1).x
        Case Is <= 0
            hook(1).x = 10
        Case Is >= 1899
            hook(1).x = 1890
    End Select

    Select Case hook2(1).y
        Case Is <= Int(Rnd * -4000) - 900
            hook2(1).move_up = 0
            hook2(1).x = Rnd * 1890
        Case Is >= (Rnd * 900) + 567
            hook2(1).move_up = 3
    End Select

    my_timer2 = my_timer2 + 1
    If my_timer2 > 2000 Then my_timer2 = 0

    If hook2(1).y >= 567 And my_timer2 > 1800 Then
        hook2(1).move_up = 1
    End If
    Select Case hook2(1).move_up
        Case Is = 0
            hook2(1).y = hook2(1).y + 1.65
        Case Is = 1
            hook2(1).y = hook2(1).y - 4
    End Select

    Select Case hook3(1).y
        Case Is <= Int(Rnd * -5000) - 700
            hook3(1).move_up = 0
            hook3(1).x = Rnd * 1899
        Case Is >= (Rnd * 890) + 850
            hook3(1).move_up = 3
    End Select
    If hook3(1).y >= 850 And my_timer2 > 1500 Then
        hook3(1).move_up = 1
    End If
    Select Case hook3(1).move_up
        Case Is = 0
            hook3(1).y = hook3(1).y + 1.55
        Case Is = 1
            hook3(1).y = hook3(1).y - 6.5
    End Select

    Select Case hook4(1).y
        Case Is <= Int(Rnd * -850) - 420
            hook4(1).move_up = 0
            hook4(1).x = Rnd * 1899
        Case Is >= (Rnd * 420) + 245
            hook4(1).move_up = 3
    End Select

    my_timer3 = my_timer3 + 1
    If my_timer3 > 1500 Then my_timer3 = 0

    If hook4(1).y >= 245 And my_timer3 > 654 Then
        hook4(1).move_up = 1
    End If
    Select Case hook4(1).move_up
        Case Is = 0
            hook4(1).y = hook4(1).y + .85
        Case Is = 1
            hook4(1).y = hook4(1).y - 1.85
    End Select

    Select Case hook5(1).y
        Case Is <= Int(Rnd * -850) - 420
            hook5(1).move_up = 0
            hook5(1).x = Rnd * 1899
        Case Is >= (Rnd * 420) + 245
            hook5(1).move_up = 3
    End Select

    If hook5(1).y >= 245 And my_timer3 > 850 Then
        hook5(1).move_up = 1
    End If
    Select Case hook5(1).move_up
        Case Is = 0
            hook5(1).y = hook5(1).y + .85
        Case Is = 1
            hook5(1).y = hook5(1).y - 1.85
    End Select
End Sub

Sub fish_AI
    Randomize Timer

    '--hook(1)&fish3(11)--

    If randf = 1 And hook(1).move_up = 1 Then
        fish6(8).y = hook(1).y + Rnd * 5
        fish6(8).x = hook(1).x + Rnd * 50
        hook(1).move_up = 1
        If hook(1).x <= 950 Then
            hook(1).x = hook(1).x + 4
        Else
            hook(1).x = hook(1).x - 4
        End If
        hook(1).y = hook(1).y - 5
    ElseIf randf = 2 And hook(1).move_up = 1 Then
        fishb(33).y = hook(1).y + Rnd * 5
        fishb(33).x = hook(1).x + Rnd * 25
        fishb(33).move_up = 1
        hook(1).move_up = 1
        If hook(1).x <= 950 Then
            hook(1).x = hook(1).x + 4
        Else
            hook(1).x = hook(1).x - 4
        End If
        hook(1).y = hook(1).y - 5
        fishb(33).y = fishb(33).y - 10
    ElseIf randf = 3 And hook(1).move_up = 1 Then
        fish(35).y = hook(1).y + Rnd * 5
        fish(35).x = hook(1).x - Rnd * 35
        fish(35).move_up = 1
        hook(1).move_up = 1
        hook(1).y = hook(1).y - 5
        If hook(1).x <= 950 Then
            hook(1).x = hook(1).x + 4
        Else
            hook(1).x = hook(1).x - 4
        End If
        fish(35).y = fish(35).y - 10
    ElseIf randf = 4 And hook(1).move_up = 1 Then
        fish3(15).y = hook(1).y + Rnd * 5
        fish3(15).x = hook(1).x - Rnd * 35
        fish3(15).move_up = 1
        hook(1).move_up = 1
        hook(1).y = hook(1).y - 5
        If hook(1).x <= 950 Then
            hook(1).x = hook(1).x + 4
        Else
            hook(1).x = hook(1).x - 4
        End If
    ElseIf randf >= 5 And hook(1).move_up = 1 Then
        fish2(15).y = hook(1).y + Rnd * 5
        fish2(15).x = hook(1).x - Rnd * 35
        fish2(15).move_up = 1
        hook(1).move_up = 1
        hook(1).y = hook(1).y - 5
        If hook(1).x <= 950 Then
            hook(1).x = hook(1).x + 4
        Else
            hook(1).x = hook(1).x - 4
        End If
    End If

    If hook(1).y < -500 Then
        randf = (Rnd * 5) + 1
    End If
    '===================================================='

    Dim l As Integer
    '--hook2(1)&fish3(9)--
    Dim g As Integer

    g = 0
    If randf2 = 1 And hook2(1).move_up = 1 Then
        fish3(11).y = hook2(1).y + Rnd * 5
        fish3(11).x = hook2(1).x + Rnd * 20
        fish3(11).move_up = 1
        hook2(1).move_up = 1
        hook2(1).y = hook2(1).y - 5
        If hook2(1).x <= 599 Then
            hook2(1).x = hook2(1).x + 4
        Else
            hook2(1).x = hook2(1).x - 4
        End If
        fish3(11).y = fish3(11).y - 10
    ElseIf randf2 = 2 And hook2(1).move_up = 1 Then
        fishb(7).y = hook2(1).y + Rnd * 5
        fishb(7).x = hook2(1).x + Rnd * 30
        fishb(7).move_up = 1
        hook2(1).move_up = 1
        hook2(1).y = hook2(1).y - 5
        If hook2(1).x <= 599 Then
            hook2(1).x = hook2(1).x + 4
        Else
            hook2(1).x = hook2(1).x - 4
        End If
        fishb(7).y = fishb(7).y - 10
    ElseIf randf2 = 3 And hook2(1).move_up = 1 Then
        fish(7).y = hook2(1).y + Rnd * 5
        fish(7).x = hook2(1).x + Rnd * 25
        fish(7).move_up = 1
        hook2(1).move_up = 1
        hook2(1).y = hook2(1).y - 5
        If hook2(1).x <= 599 Then
            hook2(1).x = hook2(1).x + 4
        Else
            hook2(1).x = hook2(1).x - 4
        End If
        fish(7).y = fish(7).y - 10
    ElseIf randf2 = 4 And hook2(1).move_up = 1 And hook2(1).y > 226 Then
        fish(10).y = hook2(1).y + Rnd * 5
        fish(10).x = hook2(1).x + Rnd * 25
        fish(10).move_up = 1
        hook2(1).move_up = 1
        hook2(1).y = hook2(1).y - 5
        If hook2(1).x <= 950 Then
            hook2(1).x = hook2(1).x + 4
        Else
            hook2(1).x = hook2(1).x - 4
        End If
    Else
        fish(10).move_up = 0
        fish(10).x = fish(10).x + 9.5
    End If

    If hook2(1).y < -500 Then
        randf2 = Int(Rnd * 4) + 1
    End If
    'If hook2(1).y < 0 Then
    'fish(7).y = 1201
    'fishb(7).y = 1201
    'fish3(11).y = 1201
    'End If
    '==== hook3(1)&fish(i)========='

    'randf3 = 4

    If randf3 = 1 And hook3(1).move_up = 1 Then
        fish3(25).y = hook3(1).y + Rnd * 5
        fish3(25).x = hook3(1).x + Rnd * 20
        fish3(25).move_up = 1
        hook3(1).move_up = 1
        hook3(1).y = hook3(1).y - 5
        If hook3(1).x <= 599 Then
            hook3(1).x = hook3(1).x + 4
        Else
            hook3(1).x = hook3(1).x - 4
        End If
        fish3(25).y = fish3(25).y - 10
    End If
    If randf3 = 2 And hook3(1).move_up = 1 Then
        fish(1).y = hook3(1).y + Rnd * 5
        fish(1).x = hook3(1).x + Rnd * 20
        fish(1).move_up = 1
        hook3(1).move_up = 1
        hook3(1).y = hook3(1).y - 5
        If hook3(1).x <= 599 Then
            hook3(1).x = hook3(1).x + 4
        Else
            hook3(1).x = hook3(1).x - 4
        End If
        fish(1).y = fish(1).y - 8
    End If
    If randf3 = 3 And hook3(1).move_up = 1 Then
        fishb(35).y = hook3(1).y + Rnd * 5
        fishb(35).x = hook3(1).x + Rnd * 20
        fishb(35).move_up = 1
        hook3(1).move_up = 1
        hook3(1).y = hook3(1).y - 5
        If hook3(1).x <= 599 Then
            hook3(1).x = hook3(1).x + 4
        Else
            hook3(1).x = hook3(1).x - 4
        End If
        fishb(35).y = fishb(35).y - 10
    ElseIf randf3 = 4 And hook3(1).move_up = 1 And hook3(1).y > 400 Then
        fishb(35).y = hook3(1).y + Rnd * 5
        fishb(35).x = hook3(1).x + Rnd * 20
        fishb(35).move_up = 1
        hook3(1).move_up = 1
        hook3(1).y = hook3(1).y - 5
        If hook3(1).x <= 599 Then
            hook3(1).x = hook3(1).x + 4
        Else
            hook3(1).x = hook3(1).x - 4
        End If
    Else
        fishb(35).move_up = 0
        fishb(35).x = fishb(35).x - 9.3
    End If

    If hook3(1).y < -500 Then
        randf3 = Int(Rnd * 4) + 1
    End If

    If randf4 = 1 And hook4(1).move_up = 1 Then
        fish4(2).y = hook4(1).y + Rnd * 2
        fish4(2).x = hook4(1).x + Rnd * 4
        hook4(1).move_up = 1
    End If
    If hook4(1).x <= 950 And randf4 = 1 And hook4(1).move_up = 1 Then
        hook4(1).x = hook4(1).x + 2
    Else
        If hook4(1).x > 950 And randf4 = 1 And hook4(1).move_up = 1 Then
            hook4(1).x = hook4(1).x - 2
        End If
    End If

    If randf4 = 2 And hook4(1).move_up = 1 Then
        fish6(2).y = hook4(1).y + Rnd * 2
        fish6(2).x = hook4(1).x + Rnd * 5
        hook4(1).move_up = 1
    End If
    If hook4(1).x <= 950 And randf4 = 2 And hook4(1).move_up = 1 Then
        hook4(1).x = hook4(1).x + 2
    Else
        If hook4(1).x > 950 And randf4 = 2 And hook4(1).move_up = 1 Then
            hook4(1).x = hook4(1).x - 2
        End If
    End If

    If randf4 = 3 And hook4(1).move_up = 1 Then
        fish2(4).y = hook4(1).y + Rnd * 2
        fish2(4).x = hook4(1).x + Rnd * 2
        hook4(1).move_up = 1
    End If
    If hook4(1).x <= 950 And randf4 = 3 And hook4(1).move_up = 1 Then
        hook4(1).x = hook4(1).x + 2
    Else
        If hook4(1).x > 950 And randf4 = 3 And hook4(1).move_up = 1 Then
            hook4(1).x = hook4(1).x - 2
        End If
    End If

    If randf4 = 4 And hook4(1).move_up = 1 And hook4(1).y > 50 Then
        fish2(4).y = hook4(1).y + Rnd * 2
        fish2(4).x = hook4(1).x + Rnd * 2
        hook4(1).move_up = 1
    End If
    If hook4(1).x <= 950 And randf4 = 4 And hook4(1).move_up = 1 Then
        hook4(1).x = hook4(1).x + 2
        'fish2(4).move_up = 0
        fish2(4).x = fish2(4).x - 9.3
    Else
        If hook4(1).x > 950 And randf4 = 4 And hook4(1).move_up = 1 Then
            hook4(1).x = hook4(1).x - 2
            fish2(4).move_up = 0
            fish2(4).x = fish2(4).x + 9.3
        End If
    End If

    If randf5 = 1 And hook5(1).move_up = 1 Then
        fish4(2).y = hook5(1).y + Rnd * 2
        fish4(2).x = hook5(1).x + Rnd * 4
        hook5(1).move_up = 1
    End If
    If hook5(1).x <= 950 And randf5 = 1 And hook5(1).move_up = 1 Then
        hook5(1).x = hook5(1).x + 2
    Else
        If hook5(1).x > 950 And randf5 = 1 And hook5(1).move_up = 1 Then
            hook5(1).x = hook5(1).x - 2
        End If
    End If

    If randf5 = 2 And hook5(1).move_up = 1 Then
        fish6(3).y = hook5(1).y + Rnd * 2
        fish6(3).x = hook5(1).x + Rnd * 5
        hook5(1).move_up = 1
    End If
    If hook5(1).x <= 950 And randf5 = 2 And hook5(1).move_up = 1 Then
        hook5(1).x = hook5(1).x + 2
    Else
        If hook5(1).x > 950 And randf5 = 2 And hook5(1).move_up = 1 Then
            hook5(1).x = hook5(1).x - 2
        End If
    End If
    If randf5 = 3 And hook5(1).move_up = 1 Then
        fish5(2).y = hook5(1).y + Rnd * 2
        fish5(2).x = hook5(1).x + Rnd * 2
        hook5(1).move_up = 1
    End If
    If hook5(1).x <= 950 And randf5 = 3 And hook5(1).move_up = 1 Then
        hook5(1).x = hook5(1).x + 2
    Else
        If hook5(1).x > 950 And randf5 = 3 And hook5(1).move_up = 1 Then
            hook5(1).x = hook5(1).x - 2
        End If
    End If

    If randf5 = 4 And hook5(1).move_up = 1 And hook5(1).y > 50 Then
        fish5(5).y = hook5(1).y + Rnd * 4
        fish5(5).x = hook5(1).x + Rnd * 4
        hook5(1).move_up = 1
    End If
    If hook5(1).x <= 950 And randf5 = 4 And hook5(1).move_up = 1 Then
        hook5(1).x = hook5(1).x + 2
        fish5(5).x = fish5(5).x - 7.3
        fish5(5).move_up = 0
        fish5(5).y = fish5(5).y + 7.3
    Else
        If hook5(1).x > 950 And randf5 = 4 And hook5(1).move_up = 1 Then
            hook(1).x = hook5(1).x - 2
            fish5(5).x = fish5(5).x + 7.3
            fish5(5).move_up = 0
            fish5(5).y = fish5(5).y + 7.3
        End If
    End If

    '===============
    Dim i As Integer
    For i = 1 To 10
        Select Case fish(i).x
            Case Is < hook3(1).x
                fish(i).x = fish(i).x + 3.8
        End Select
        Select Case fish(i).y
            Case Is > hook3(1).y
                fish(i).y = fish(i).y - .5
        End Select
    Next i

    For i = 12 To 25
        Select Case fish(i).x
            Case Is < hook(1).x
                fish(i).x = fish(i).x + 1.8
        End Select
        Select Case fish(i).y
            Case Is > hook(1).y
                fish(i).y = fish(i).y - .5
        End Select
    Next i

    For i = 1 To 12
        Select Case fishb(i).x
            Case Is < hook2(1).x
                fishb(i).x = fishb(i).x - 3.8
        End Select
        Select Case fishb(i).y
            Case Is > hook2(1).y
                fishb(i).y = fishb(i).y - 1
            Case Is < hook2(1).y
                fishb(i).y = fishb(i).y + 1
        End Select
    Next i

    For i = 5 To 15
        Select Case fish3(i).x
            Case Is < hook(1).x
                fish3(i).x = fish3(i).x - 3.8
        End Select
        Select Case fish3(i).y
            Case Is > hook(1).y
                fish3(i).y = fish3(i).y - 1
            Case Is < hook(1).y
                fish3(i).y = fish3(i).y + 1
        End Select
    Next i
    For i = 1 To 4
        Select Case fish3(i).x
            Case Is > hook(1).x
                fish3(i).x = fish3(i).x + 5.8
        End Select
        Select Case fish3(i).y
            Case Is > hook(1).y
                fish3(i).y = fish3(i).y - 2
            Case Is < hook(1).y
                fish3(i).y = fish3(i).y + 1
        End Select
    Next i

    '======================================================'
    If fish2(1).x < hook(1).x Then
        hook(1).x = hook(1).x - .65
        hook(1).move_right = 0
    ElseIf fish2(1).x > hook(1).x Then
        hook(1).x = hook(1).x + .65
        hook(1).move_right = 1
    End If
    If fish2(1).y < hook(1).y And hook(1).y > 360 Then
        hook(1).y = hook(1).y - .65
    ElseIf fish2(1).y > hook(1).y Then
        hook(1).y = hook(1).y + .55
    End If

    '====fish3(i)&hook2(1)===
    For l = 1 To 3
        Select Case fish3(l).x
            Case Is < hook2(1).x
                fish3(l).x = fish3(l).x + 2
        End Select
        Select Case fish3(l).y
            Case Is > hook2(1).y
                fish3(l).y = fish3(l).y - 2
            Case Is < hook2(1).y
                fish3(l).y = fish3(l).y + 2
        End Select
    Next l

    '====fish3(i)&hook3(1)===

    For l = 7 To 10
        Select Case fish3(l).x
            Case Is < hook3(1).x And hook3(1).y > 0
                fish3(l).x = fish3(l).x + 2
        End Select
        Select Case fish3(l).y
            Case Is > hook3(1).y And hook3(1).y > 0
                fish3(l).y = fish3(l).y - 2
            Case Is < hook3(1).y And hook3(1).y > 0
                fish3(l).y = fish3(l).y + 2
        End Select
    Next l

    Dim fb As Integer
    For fb = 1 To 6
        Select Case hook(1).y
            Case Is < fishb(fb).y And hook(1).x < fishb(fb).x
                fishb(fb).y = fishb(fb).y - .5
            Case Is > fishb(fb).y And hook(1).x < fishb(fb).x
                fishb(fb).y = fishb(fb).y + 3
        End Select
        Select Case hook(1).x And hook(1).x < fishb(fb).x
            Case Is < fishb(fb).x
                fishb(fb).x = fishb(fb).x - 3
        End Select
    Next fb

    Dim bf As Integer

    For bf = 7 To 12
        Select Case hook(1).y
            Case Is < fishb(bf).y And hook(1).x < fishb(bf).x
                fishb(bf).y = fishb(bf).y - .5
            Case Is > fishb(bf).y And hook(1).x < fishb(bf).x
                fishb(bf).y = fishb(bf).y + 2.5
        End Select
        Select Case hook(1).x And hook(1).x < fishb(bf).x
            Case Is < fishb(bf).x
                fishb(bf).x = fishb(bf).x - 2.8
        End Select
    Next bf

    Dim z As Integer
    For z = 13 To 20
        Select Case hook(1).y
            Case Is < fishb(z).y And hook(1).x < fishb(z).x
                fishb(z).y = fishb(z).y - .5
            Case Is > fishb(z).y And hook(1).x < fishb(z).x
                fishb(z).y = fishb(z).y + 1.5
        End Select
        Select Case hook(1).x And hook(1).x < fishb(z).x
            Case Is < fishb(z).x
                fishb(z).x = fishb(z).x - 1.8
        End Select
        If fishb(z).y <= 0 Then
            fishb(z).move_up = 0
        End If
    Next z

    Dim z2%
    For z2% = 1 To 5
        If fish3(z2%).x > hook3(1).x And fish3(z2%).y + 2 >= hook3(1).y Then
            fish5(z2%).x = fish5(z2%).x - 2.8
        Else
            If fish3(z2%).x < hook3(1).x And fish3(z2%).y + 2 >= hook3(1).y Then
                fish3(z2%).x = fish3(z2%).x + 2.8
            End If
        End If
    Next z2%

    Select Case hook2(1).x
        Case Is > fish(34).x
            fish(34).x = fish(34).x + ((Rnd * 20) + 10)
            fish(34).move_up = 3
        Case Is < fish(34).x And hook2(1).y > 1
            fish(34).x = fish(34).x + ((Rnd * 10) + 5)
    End Select

    Select Case hook2(1).x
        Case Is > fish(32).x And hook2(1).y > 1
            fish(32).x = fish(32).x + ((Rnd * 10) + 5)
        Case Is < fish(32).x
            fish(32).x = fish(32).x + ((Rnd * 20) + 10)
            fish(32).move_up = 3
    End Select

    Dim zx As Integer
    Randomize Timer
    For zx = 1 To 7
        Select Case fish(34).x
            Case Is > fishb(zx).x
                fishb(zx).x = fishb(zx).x - (Rnd * 5.3) + 1
                fishb(zx).move_up = 3
            Case Else
                fishb(zx).x = fishb(zx).x - (Rnd * 4.4) + 1
                fishb(zx).move_up = 3
        End Select
    Next zx

    Select Case fish3(8).x
        Case Is > fish(14).x
            fish(14).x = fish(14).x + (Rnd * 6) + 1
        Case Else
            fish(14).x = fish(14).x + (Rnd * 6) + 1
    End Select

    Dim xz As Integer
    For xz = 5 To 10
        Select Case fish3(8).x
            Case Is < fish2(xz).x
                fish2(xz).x = fish2(xz).x - (Rnd * 5) + 2
            Case Else
                fish2(xz).x = fish2(xz).x + (Rnd * 4) + 2
        End Select
    Next xz

    Dim zf As Integer
    For zf = 1 To num_fish2
        If fish2(zf).y <= y% + 100 And fish2(zf).y >= y% - 100 And x% > fish2(zf).x Then
            fish2(zf).x = fish2(zf).x - ((Rnd * 9.4) + 4)
        End If
        If fish2(zf).y <= y% + 100 And fish2(zf).y >= y% - 100 And x% < fish2(zf).x Then
            fish2(zf).x = fish2(zf).x + ((Rnd * 9.4) + 4)
        End If
    Next zf

    Dim z3 As Integer
    For z3 = 1 To num_fish3
        If fish3(z3).y <= y% + 100 And fish3(z3).y >= y% - 100 And x% > fish3(z3).x Then
            fish3(z3).x = fish3(z3).x - ((Rnd * 9.4) + 4)
        End If
        If fish3(z3).y <= y% + 100 And fish3(z3).y >= y% - 100 And x% < fish3(z3).x Then
            fish3(z3).x = fish3(z3).x + ((Rnd * 9.4) + 4)
        End If
    Next z3

    For z3 = 1 To num_fish
        If fish(z3).y <= y% + 50 And fish(z3).y >= y% - 50 And x% > fish(z3).x Then
            fish(z3).x = fish(z3).x + ((Rnd * 17.8) + 5)
        End If
        If fish(z3).y <= y% + 50 And fish(z3).y >= y% - 50 And x% < fish(z3).x Then
            fish(z3).x = fish(z3).x + ((Rnd * 11.8) + 5)
        End If
    Next z3

    For z3 = 1 To num_fishb
        If fishb(z3).y <= y% + 80 And fishb(z3).y >= y% - 80 And x% > fishb(z3).x Then
            fishb(z3).x = fishb(z3).x - ((Rnd * 7.8) + 5)
        End If
        If fishb(z3).y <= y% + 80 And fishb(z3).y >= y% - 80 And x% < fishb(z3).x Then
            fishb(z3).x = fishb(z3).x - ((Rnd * 15.8) + 5)
        End If
    Next z3

    For z3 = 1 To num_fishba
        If fishba(z3).y <= y% + 100 And fishba(z3).y >= y% - 100 And x% > fishba(z3).x Then
            fishba(z3).x = fishba(z3).x - ((Rnd * 8.8) + 5)
        End If
        If fishba(z3).y <= y% + 100 And fishba(z3).y >= y% - 100 And x% < fishba(z3).x Then
            fishba(z3).x = fishba(z3).x - ((Rnd * 16.8) + 5)
        End If
    Next z3


    For z3 = 1 To num_fish6
        If fish6(z3).y <= y% + 150 And fish6(z3).y >= y% - 150 And x% > fish6(z3).x Then
            fish3(z3).x = fish3(z3).x - ((Rnd * 10.4) + 4)
        End If
        If fish6(z3).y <= y% + 150 And fish6(z3).y >= y% - 150 And x% < fish6(z3).x Then
            fish6(z3).x = fish6(z3).x + ((Rnd * 11.4) + 4)
        End If
    Next z3

    Dim z4 As Integer
    For z4 = 1 To num_fish4
        If fish4(z4).y <= y% + 100 And fish4(z4).y >= y% - 100 And x% > fish4(z4).x Then
            fish4(z4).x = fish4(z4).x - ((Rnd * 9.4) + 4)
        End If
        If fish4(z4).y <= y% + 100 And fish4(z4).y >= y% - 100 And x% < fish4(z4).x Then
            fish4(z4).x = fish4(z4).x + ((Rnd * 9.4) + 4)
        End If
    Next z4
    Dim z5 As Integer
    For z5 = 1 To num_fish5
        If fish5(z5).y <= y% + 180 And fish5(z5).y >= y% - 180 And x% > fish5(z5).x Then
            fish5(z5).x = fish5(z5).x - ((Rnd * 9.4) + 5)
        End If
        If fish5(z5).y <= y% + 180 And fish5(z5).y >= y% - 180 And x% < fish5(z5).x Then
            fish5(z5).x = fish5(z5).x + ((Rnd * 11.4) + 3)
        End If
    Next z5
End Sub



Attached Files
.zip   aquascape_screen_saver.zip (Size: 152.9 MB / Downloads: 29)
Print this item

  QB64PE at work
Posted by: bobalooie - 04-22-2024, 11:31 PM - Forum: Programs - Replies (5)

I'm an electrical power engineer by profession. Frequently I need to calculate the available short circuit current in a circuit (electrical code requirement). I have very fancy analysis programs to calculate fault currents in a large system (say an entire building), but occasionally I need to quickly calculate a short circuit current for a single circuit or a very small network.

There is a well-documented method to calculate a short circuit current from point A to point B. Doing the calculation by hand is a PITA. So I put together a utility to do the calculation with a form-style data entry to avoid having to refer to all those tables.

The method's conductor constants as published only work on 60 Hz power systems. The conductor constants are invalid on 50 Hz power systems because the overall impedances are different. I haven't located an equivalent set of tables for 50 Hz systems, but I would be surprised to find they don't exist somewhere.

I plan to extend this to allow me to retrieve results from other studies and create a network in one overall project.

Real life QB64PE paying me back for all that money I spent on it. Cool


[Image: Screenshot-2024-04-22-191257.jpg]



Attached Files
.bas   Faults.bas (Size: 55.28 KB / Downloads: 44)
.bi   Faults data.bi (Size: 4.64 KB / Downloads: 45)
Print this item