vba – feels like I have no idea what I'm doing in my "project" – "GAME"

I have never had a programming course. I'm not a programmer. Does not mean to be.

If someone has plenty of time to lose, I feel like I have no idea what I'm doing / that my code is very badly organized.

It should be a "game". Actually, the game codes that.

I'm just looking for a review. Yes, that's a lot. I know this kind of shit is not the main point of this exchange, but I'd like an open-minded mind about how shitty the stuff I've done to lose hours.

ThisWorkbook – Where controls are:

Option explicitly
& # 39; & # 39; PLAY BEGIN & # 39; & # 39;

Sub-Initialization ()
& # 39; UserForm1.Show vbModeless
Go to GameEvents.init
End Sub

Private Sub Workbook_Activate ()
Application.OnKey "{LEFT}", "ThisWorkbook.OnLeftArrowKeyPress"
Application.OnKey "{RIGHT}", "ThisWorkbook.OnRightArrowKeyPress"
Application.OnKey "{UP}", "ThisWorkbook.OnUpArrowKeyPress"
Application.OnKey "{DOWN}", "ThisWorkbook.OnDownArrowKeyPress"
End Sub


Private Sub Workbook_Deactivate ()
Application.OnKey "{LEFT}", ""
Application.OnKey "{RIGHT}", ""
Application.OnKey "{UP}", ""
Application.OnKey "{DOWN}", ""
End Sub
Inputs; & # 39
Sub OnLeftArrowKeyPress ()
Call GameEvents.Move (Hero, 0, -1)
If Hero.Character_IsInside (Maze.BossRoom) = True Then
MsgBox "You have won"
Call Maze.Generate
When
End Sub
Sub OnRightArrowKeyPress ()
Call GameEvents.Move (Held, 0, 1)
If Hero.Character_IsInside (Maze.BossRoom) = True Then
MsgBox "You have won"
Call Maze.Generate
When
End Sub
Sub OnUpArrowKeyPress ()
Call GameEvents.Move (Hero, -1, 0)
If Hero.Character_IsInside (Maze.BossRoom) = True Then
MsgBox "You have won"
Call Maze.Generate
When
End Sub
Sub OnDownArrowKeyPress ()
Call GameEvents.Move (Held, 1, 0)
If Hero.Character_IsInside (Maze.BossRoom) = True Then
MsgBox "You have won"
Call Maze.Generate
When
End Sub

Battle Interface (Not Completed):

Dim enemy as a character
Dim eIndex As Integer

Public Sub LoadChars (h as a character, e as a character, index as a string)

Set enemy = e
eIndex = index

Me.HeroLabel.Caption = h.TheModel
Me.EnemyLabel.Caption = e.TheModel

Me.ATK1.Caption = h.MyAttack
Me.ATK2.Caption = e.MyAttack

Me.HP1.Caption = h.Myhp
Me.HP2.Caption = e.Myhp
End Sub

Private Sub CommandButton1_Click ()

Hero.Character_Myhp = Hero.MyBaseHp - Enemy.MyAttack - 1
Me.HP1.Caption = Hero.Character_Myhp

End Sub

Private Sub UserForm_Click ()

End Sub

GameEvents module – module that keeps the game in which everything is stored.

Option explicitly

& # 39; & # 39; ENEMY & # 39; & # 39;
Private enemies as a new collection
& # 39; & # 39; DOORS & # 39; & # 39;
Private doors as a new collection
& # 39; & # 39; LOOPS & # 39; & # 39;
Private lpchar As a character
Private lpdoor as a door

& # 39; & # 39; INITIALIZE GAME & # 39; & # 39;
Public sub init ()
Call Stuff.limpieza (enemies)
Call Stuff.limpieza (doors)
Set Maze.BossRoom = Nothing

Call Maze.Generate
Call SetChar (Held, 110, 110, "@")
Call Move (Hero, 0, 0)
Call SetChar (enemies (5), enemies (5) .Character_MyPosX, enemies (5) .Character_MyPosY, "S")
Move call (opponent (5), 0, 0)
Call SetChar (enemies (6), enemies (6) .Character_MyPosX, enemies (6) .Character_MyPosY, "G")
Call movement (opponents (6), 0, 0)

Dim testitem As New Items
Call testitem.rnd
Dim testitem1 As New Items
Call testitem1.rnd

Call Hero.AddItemToInventory (testitem)
Call Hero.AddItemToInventory (testitem1)
End Sub
Public Sub PopulateRoom (Which room as a room)
Dimming CurrentEnemy as a new enemy
Call SetChar (CurrentEnemy, WhichRoom.x1 + 2, whichRoom.y1 + 2, "E")
Enemies.Add CurrentEnemy
Call CurrentEnemy.Character_Display
End Sub

Public Sub AddDoorToRoom (Which room as room)
Dimming CurrentDoor as a new door
Call SetDoor (CurrentDoor, whichRoom)
Doors.Add CurrentDoor
& # 39 ;, call CurrentDoor.DisplayOpen
Call CurrentDoor.DisplayClosed
End Sub
Sub Move (as a character, X as an integer, Y as an integer)
Dim EnemyIndex As Integer

Call Who.DisplayOff

Select Case Cells (Who.MyPosX + X, Who.MyPosY + Y) .Value
Case "W"
Cells (Who.MyPosX, Who.MyPosY) .Value = Who.TheModel

Case "E", "S", "G"
EnemyIndex = FindEnemyIndex (Who.MyPosX + X, Who.MyPosY + Y)
OpenFightMenu (Who, Enemies (EnemyIndex), EnemyIndex)

Case else
Who.MyPosX = Who.MyPosX + X
Who.MyPosY = Who.MyPosY + Y
Call Who.Display

If Who.MyPosX> 50 or Who.MyPosY> 50 Then
ActiveWindow.ScrollRow = Who.MyPosX - 60
ActiveWindow.ScrollColumn = Who.MyPosY - 60
When
Select end
End Sub

Private Sub SetChar (character as a character, optional X as an integer, optional Y as an integer, optional model as a string)
char.MyPosX = X
char.MyPosY = Y
char.TheModel = model
End Sub

Private Sub SetDoor (The Door As Door, The Room As A Room) & # 39; & # 39; NEEDS IMPROVEMENT & # 39; & # 39;
Dim long-lived as an integer, large as an integer & # 39; long-lived = x largeur = y
longeur = TheRoom.y2 - TheRoom.y1: largeur = TheRoom.x3 - TheRoom.x1

Select Case TheRoom.MyDirection
Case 0 # UP
TheDoor.x1 = TheRoom.x3
TheDoor.y1 = TheRoom.y1 + Int (long / 2)
TheDoor.x2 = TheRoom.x3 + 1
TheDoor.y2 = TheRoom.y1 + Int (longeur / 2)

Case 1 # RIGHT
TheDoor.x1 = TheRoom.x1 + Int (largeur / 2)
TheDoor.y1 = TheRoom.y3
TheDoor.x2 = TheRoom.x1 + Int (largeur / 2)
TheDoor.y2 = TheRoom.y3 - 1

Case 2 & # 39; DOWN
TheDoor.x1 = TheRoom.x1
TheDoor.y1 = TheRoom.y1 + Int (long / 2)
TheDoor.x2 = TheRoom.x1 - 1
TheDoor.y2 = TheRoom.y1 + Int (longeur / 2)

Case 3 & # 39; LEFT
TheDoor.x1 = TheRoom.x1 + Int (largeur / 2)
TheDoor.y1 = TheRoom.y2
TheDoor.x2 = TheRoom.x1 + Int (largeur / 2)
TheDoor.y2 = TheRoom.y2 + 1
Select end
End Sub
& # 39; & # 39; SEE ENEMY INDEX FROM THE ENTIRES COLLECTION & # 39; & # 39;
Private function FindEnemyIndex (X as an integer, Y as an integer) as an integer
Dim TheEnemyIndex As Integer
Dim Count as an integer
count = 1 & # 39; & # 39; COLLECTIONS INITIALIZE AT 1 & # 39; & # 39;

For every lpchar in enemies
If lpchar.MyPosX = X and lpchar.MyPosY = Y, then
TheEnemyIndex = count
Finish for
Otherwise
count = count + 1
When
Next lpchar

FindEnemyIndex = TheEnemyIndex
End function


Private Sub OpenFightMenu (indexing h as a character, e as a character, as an integer)
Call Fight.LoadChars (h, e, index)
Fight.Show vbModeless
End Sub

Labyrinth – where the "dungeon" is generated

Option explicitly
Option Base 0
Private room as a new collection
Private TmpRooms (3) As a room

Public BossRoom as a room & # 39; & # 39; BOSSROOM & # 39; & # 39;

Generate Sub ()

Application.ScreenUpdating = False
randomize
Worksheets (1) .UsedRange.ClearContents
Worksheets (1) .UsedRange.Interior.ColorIndex = 0

& # 39; & # 39; SETUP START ROOM & # 39; & # 39;
Dim i As Integer, Counter As Integer: Counter = 0 & # 39; & # 39; The counter must be relative to the size of the maze to find a good last space in the maze. 1 is beautiful for 150 * 150
Dim ValidAttempt () as a space
Weak electricity as a new room

If BossRoom is then nothing
Call SetRoom (current)
Otherwise
Set current = BossRoom
When

Call SetTmpRooms (current)
Rooms. Add power
current.Draw
Call Current.colored (4)

Do While Rooms.count> 0
ValidAttempt = GetValidAttempt (current)
If ValidAttempt (0) is nothing and ValidAttempt (1) is nothing and ValidAttempt (2) is nothing and then ValidAttempt (3) is nothing
If counter = 1, then
& # 39; call Clearroom
Call Current.colored (3)
Set BossRoom = current
& # 39; GameEvents.populateBossRoom
When
Set current = Stuff.Pop (rooms)
Counter = counter + 1
Otherwise
Set current = Stuff.GetRnd (ValidAttempt)
current.Draw
Call GameEvents.AddDoorToRoom (currently)
Call GameEvents.PopulateRoom (currently)
Rooms. Add power
When
Call SetTmpRooms (current)
loop

Set power = nothing
Application.ScreenUpdating = True
End Sub
Private Function GetValidAttempt (CurrentRoom as Room) as Room ()
Dim i As Integer, count as integer
Try Dim as a new room
Dim ValidAttempt (3) as a room

count = 0

For i = 0 to 3
Set to try = new room
Call AddRooms (Trial, CurrentRoom)
Call AddRooms (to try TmpRooms (i))
& # 39; trial, valid maze size
Call To try.AmIValid
If ToTry.ValidOrNot = 1, then
Set ValidAttempt (count) = New Room
Call AddRooms (ValidAttempt (Count), ToTry) & ee; ee
count = count + 1
When
Next me

GetValidAttempt = ValidAttempt
End function
& # 39; & # 39; space & # 39; & # 39;
Private function SetRoom (space as space, optional x1 as integer = 100, optional y1 as integer = 100, optional x2 as integer = 100, _
Optional y2 as integer = 120, optional x3 as integer = 120, optional y3 as integer = 100, optional x4 as integer = 100, optional y4 as integer = 100, optional director as integer = 0)
theroomyouwanttosett.x1 = x1
theroomyouwanttosett.y1 = y1
theroomyouwanttosett.x2 = x2
theroomyouwanttosett.y2 = y2
theroomyouwanttosett.x3 = x3
theroomyouwanttosett.y3 = y3
theroomyouwanttosett.x4 = x4
theroomyouwanttosett.y4 = y4
theroomyouwanttosett.MyDirection = Directio
End function
Private Function AddRooms (room as an adjoining room, adjoining room as a room)
theroomyouwanttoset.x1 = theroomyouwanttoset.x1 + addroom.x1
theroomyouwanttoset.y1 = theroomyouwanttoset.y1 + addroom.y1
theroomyouwanttoset.x2 = theroomyouwanttoset.x2 + addroom.x2
theroomyouwanttoset.y2 = theroomyouwanttoset.y2 + addroom.y2
theroomyouwanttoset.x3 = theroomyouwanttoset.x3 + addroom.x3
theroomyouwanttoset.y3 = theroomyouwanttoset.y3 + addroom.y3
theroomyouwanttoset.x4 = theroomyouwanttoset.x4 + addroom.x4
theroomyouwanttoset.y4 = theroomyouwanttoset.y4 + addroom.y4
theroomyouwanttoset.MyDirection = addroom.MyDirection
End function
& # 39; & # 39; RANDOMIZE ROOMS & # 39; & # 39;
Private Sub SetTmpRooms (CurrentRoom As Room)
Dim durable as an integer, largeur as an integer

If not empty (TmpRooms), then delete TmpRooms

longeur = Int (20 * rnd + 7) & # 39; columns
largeur = Int (20 * rnd + 7) & # 39; lines
& # 39; above
Set TmpRooms (0) = New room
Call SetRoom (TmpRooms (0), -large, 0, -large, 0, CurrentRoom.x1 - CurrentRoom.x3 - 1, 0, CurrentRoom.x1 - CurrentRoom.x3 - 1, 0, 0)
Law; & # 39
Set TmpRooms (1) = New Room
Call SetRoom (TmpRooms (1), 0, CurrentRoom.y2 - CurrentRoom.y1 + 1, 0, long-lived, 0, CurrentRoom.y2 - CurrentRoom.y1 + 1, 0, long-lived, 1).
& # 39; bot
Set TmpRooms (2) = New Room
Calling SetRoom (TmpRooms (2), CurrentRoom.x3 - CurrentRoom.x1 + 1, 0, CurrentRoom.x3 - CurrentRoom.x1 + 1, 0, largeur, 0, largeur, 0, 2)
& # 39; left
Set TmpRooms (3) = New room
Call SetRoom (TmpRooms (3), 0, -longeur, 0, CurrentRoom.y1 - CurrentRoom.y2 - 1, 0, -longeur, 0, CurrentRoom.y1 - CurrentRoom.y2 - 1, 3).
End Sub

Stuff module – for stuff

                                & # 39; & # 39; Stuff for randomizing the second axis in the maze & # 39; & # 39;
If random number> 0.49 then
SetRoom (TmpRooms (i), -largeur, CurrentRoom.y2 - CurrentRoom.y1 + 1, -largeur, long-lived, largeur, CurrentRoom.y2 - CurrentRoom.y1 + 1, largeur, long-lived)
& # 39; Otherwise
If largeur> CurrentRoom.x3 - CurrentRoom.x1 Then largeur = 1
& # 39; SetRoom call (TmpRooms (i), largeur, CurrentRoom.y2 - CurrentRoom.y1 + 1, largeur, long-lived, -large, CurrentRoom.y2 - CurrentRoom.y1 + 1, -grour, long-lived)
& # 39; End If
If random number> 0.49 then
& # 39; SetRoom (TmpRooms (i), -largeur, -longeur, -largeur, long-lived, CurrentRoom.x1 - CurrentRoom.x3 - 1, -longeur, CurrentRoom.x1 - CurrentRoom.x3 - 1, long lasting)
& # 39; Otherwise
& # 39; If long-lived> CurrentRoom.y2 - CurrentRoom.y1 Then long-lived = 1
& # 39; call SetRoom (TmpRooms (i), -large, long-lived, -large, long-lived, CurrentRoom.x1 - CurrentRoom.x3-1, long-lived, CurrentRoom.x1-CurrentRoom.x3-1, -longeur)
& # 39; End If


& # 39; & # 39; BLANK COLLECTION & # 39; & # 39;
Sub limpieza (ByRef listilla As Collection)
While listilla.count <> 0
listilla.Remove (listilla.count)
Wend
End Sub
& # 39; & # 39; RANDOM FROM ARRAY & # 39; & # 39;
Function GetRnd (arr)
Dim a
Set = nothing

While one is nothing
Set a = arr (rnd * UBound (arr))
Wend

Set GetRnd = a
End function
& # 39; & # 39; PILE & # 39; & # 39;
Functional bang (WhichCollection As Collection) As a variant
With whichCollection
If .count> 0 then
Set Pop = .item (.count)
Remove .count
When
End with
End function

Function RandomNameGenerator () As String
# PURPOSE: Create a randomized string
# SOURCE: www.TheSpreadsheetGuru.com/the-code- vault

Dim RND1 as a variant
Dim RND2 as a variant

RND1 = Array (Sword, Ax, Spear, Dildo, Pickaxe, Stick, Mace, Hammer, Weapon, Sniper, _
"Sextoy", "Strap-On", "Trebuchet", "Catapult", "Balista")

RND2 = Array ("Destruction", "Thousandthorn", "Pleasure", "Joy", "Mightiness", "Billing", "Fear", "Pain", "Wood", "Iron", _
"Mining", "agility", "precision", "superiority", "defeat", "death")


# Select random characters at random
randomize
RandomNameGenerator = RND1 (Int ((UBound (RND1) - LBound (RND1) + 1) * rnd + LBound (RND1))) & "" of R & D & RND2 (Int ((UBound (RND2) - LBound) (RND2 ) + 1) * rnd + LBound (RND2)))

End function

Characteristic Class Module – Used as an enemy / hero interface

Option explicitly
& # 39; & # 39; POSITIONS & # 39; & # 39;
Public property Get MyPosX () As Integer
End Property
Public property Let MyPosX (v As Integer)
End Property
Public property Get MyPosY () As Integer
End Property
Public property Let MyPosY (v As Integer)
End Property
& # 39; & # 39; MODEL & # 39; & # 39;
Public property Get TheModel () As String
End Property
Public property Let TheModel (v As String)
End Property
& # 39; & # 39; STATS & # 39; & # 39;
Public property Get MyAttack () As Integer
End Property
Public property Get Myhp () As Integer
End Property
Public property Let Myhp (v As Integer)
End Property
& # 39; & # 39; MISC & # 39; & # 39;
Public sub-ad ()
End Sub
Public Sub DisplayOff ()
End Sub
Public Function IsInside (TheRoom As Room) As Boolean
End function

Door class module – for doors (not finished at all)

Option explicitly

Private cell1X as an integer, cell1Y as an integer, cell2X as an integer, cell2X as an integer & # 39; & # 39; POSITION & # 39; & # 39;
Private IsOpen As Boolean & # 39; & # 39; OPEN OR CLOSED & # 39; & # 39;
& # 39; & # 39; POSITIONS & # 39; & # 39;
Public property Get x1 () as Integer
x1 = cell1X
End Property
Public property Get y1 () as an integer
y1 = cell1Y
End Property
Public property Get x2 () as Integer
x2 = cell2X
End Property
Public property Get y2 () as an integer
y2 = cell2Y
End Property
Public property Let x1 (newx1 As Integer)
cell1X = newx1
End Property
Public property Be y1 (newy1 As Integer)
cell1Y = newy1
End Property
Public property Be x2 (newx2 As Integer)
cell2X = newx2
End Property
Public property Be y2 (newy2 As Integer)
cell2Y = newy2
End Property

Sub DisplayOpen ()
Cells (cell1X, cell1Y) .Value = ""
Cells (cell2X, cell2Y) .Value = ""
End Sub
Sub DisplayClosed ()
Cells (cell1X, cell1Y) .Value = "D"
Cells (cell2X, cell2Y) .Value = "D"
End Sub

Enemy class (not completed) – for enemies

Implements character
Option explicitly

Private MyCellX As Integer, MyCellY As Integer & # 39; POSITION
Private hask Integer, hdef As Integer, Hhp As Integer & # 39; STATS
Private MyModel As String

& # 39; & # 39; & # 39; & # 39; & # 39; CHARACTER INTERFACE & # 39; & # 39; & # 39; & # 39;

& # 39; & # 39; POSITIONS & # 39; & # 39;
Public property Gets Character_MyPosX () As Integer
Character_MyPosX = MyCellX
End Property
Public property Let Character_MyPosX (v As Integer)
MyCellX = v
End Property
Public property Get Character_MyPosY () As Integer
Character_MyPosY = MyCellY
End Property
Public property Let Character_MyPosY (v As Integer)
MyCellY = v
End Property
& # 39; & # 39; MODEL & # 39; & # 39;
Public property Hole Character_TheModel () As String
Character_TheModel = MyModel
End Property
Public property Let Character_TheModel (v As String)
MyModel = v
End Property
& # 39; & # 39; STATS & # 39; & # 39;
Public property Get Character_MyAttack () As Integer
Character_MyAttack = hatk
End Property
Public property Get Character_Myhp () As Integer
Character_Myhp = Hhp
End Property
Public property Let Character_Myhp (v As Integer) & # 39; For dmg
Hhp = v
End Property

Sub Character_Display ()
Cells (MyCellX, MyCellY) .Value = Me.Character_TheModel
End Sub

Sub Character_DisplayOff ()
Cells (MyCellX, MyCellY) .Value = ""
End Sub

Function Character_IsInside (TheRoom As Room) as Boolean

If Me.Character_MyPosY> TheRoom.y1 And Me.Character_MyPosY < TheRoom.y2 And Me.Character_MyPosX > TheRoom.x1 and Me.Character_MyPosX <TheRoom.x3 Then
Character_IsInside = True
Otherwise
Character_IsInside = False
When

End function

Hero Class – For you, Predeclared ID

Implements character
Option explicitly
Private objects (0 to 9) as elements & # 39; & # 39;
Private MyCellX As Integer, MyCellY As Integer & # 39; POSITION
Private hask Integer, hdef As Integer, Hhp As Integer & # 39; STATS
Private MyModel as a string "you, :)
& # 39; & # 39; POSITIONS & # 39; & # 39;
Public property Gets Character_MyPosX () As Integer
Character_MyPosX = MyCellX
End Property
Public property Let Character_MyPosX (v As Integer)
MyCellX = v
End Property
Public property Get Character_MyPosY () As Integer
Character_MyPosY = MyCellY
End Property
Public property Let Character_MyPosY (v As Integer)
MyCellY = v
End Property
& # 39; & # 39; MODEL & # 39; & # 39;
Public property Hole Character_TheModel () As String
Character_TheModel = MyModel
End Property
Public property Let Character_TheModel (v As String)
MyModel = v
End Property
& # 39; & # 39; STATS & # 39; & # 39;
Public property Get Character_MyAttack () As Integer
Character_MyAttack = hatk + GetModifier () (0)
End Property
Public property Get Character_Myhp () As Integer
Character_Myhp = Hhp + GetModifier () (1)
End Property
Public property Get MyBaseHp () As Integer
MyBaseHp = Hhp
End Property
Public property Let Character_Myhp (v As Integer) & # 39; For dmg
Hhp = v
End Property

Public Sub Character_Display ()
Cells (MyCellX, MyCellY) .Value = Me.Character_TheModel
End Sub

Public Sub Character_DisplayOff ()
Cells (MyCellX, MyCellY) .Value = ""
End Sub

Public Function Character_IsInside (TheRoom As Room) As Boolean

If Me.Character_MyPosY> TheRoom.y1 And Me.Character_MyPosY < TheRoom.y2 And Me.Character_MyPosX > TheRoom.x1 and Me.Character_MyPosX <TheRoom.x3 Then
Character_IsInside = True
Otherwise
Character_IsInside = False
When

End function

Public Sub AddItemToInventory (article as article)
Static ItemCount as integer

Set hItems (ItemCount) = item
ItemCount = ItemCount + 1

End Sub

Private Function GetModifier () As Integer ()
Dim i As Integer: i = 0
Dim tmparr (0 to 1) as an integer
On Error GoTo error

For i = 0 to UBound (hItems)
On Error Resume Next
tmparr (0) = tmparr (0) + hItems (i) .Iatk
tmparr (1) = tmparr (1) + hItems (i) .Ihp
Next me


GetModifier = tmparr
End function

Error:
GetModifier = Split ("0 | 0", "|")

End function

Article Class – For Articles (barely started)

Option explicitly
Dim Atk Integer, HP As Integer
Dim ID as an integer
Dim Name As String
Public Property Get Iatk ()
Iatk = atk
End Property
Public property Get Ihp ()
Ihp = HP
End Property
Public property Get Iname ()
Iname = name
End Property
Public Property Get Iid ()
Iid = ID
End Property

Public connection ()
atk = 5
HP = 5
Name = Stuff.RandomNameGenerator
End Sub

Space class – For maze (X and Y axis are inverted)

Option explicitly
& # 39; & # 39; Save door positions to open / close them
Private TLr As Integer, TLc As Integer, TRr As Integer, TRc As Integer, BLr As Integer, BLc As Integer, BRr As Integer, BRc As Integer & # 39; Position
Private IsValid As Integer
Private line as integer
Private HasBeenRevisited As Boolean
& # 39; & # 39; VALID & # 39; & # 39;
Public Property Visit () as Boolean
Visited = HasBeenRevisited
End Property
Visited public property (Visited2 As Boolean)
HasBeenRevisited = Visited2
End Property
& # 39; & # 39; DIRECTION & # 39; & # 39;
Public property Get MyDirection () As Integer
MyDirection = direction
End Property
Public property Let MyDirection (MyDirection2 As Integer)
direction = MyDirection2
End Property
& # 39; & # 39; VALID & # 39; & # 39;
Public property Get ValidOrNot () As Integer
ValidOrNot = IsValid
End Property
& # 39; & # 39; POSITIONS & # 39; & # 39;
Public property Get x1 () as Integer
x1 = TLr
End Property
Public property Get y1 () as an integer
y1 = TLc
End Property
Public property Get x2 () as Integer
x2 = TRr
End Property
Public property Get y2 () as an integer
y2 = TRc
End Property
Public property Get x3 () as an integer
x3 = BLr
End Property
Public property Get y3 () as an integer
y3 = BLc
End Property
Public property Get x4 () as an integer
x4 = BRr
End Property
Public property Get y4 () as an integer
y4 = BRc
End Property
Public property Let x1 (newx1 As Integer)
TLr = newx1
End Property
Public property Be y1 (newy1 As Integer)
TLc = newy1
End Property
Public property Be x2 (newx2 As Integer)
TRr = newx2
End Property
Public property Be y2 (newy2 As Integer)
TRc = newy2
End Property
Public property Be x3 (newx3 As Integer)
BLr = newx3
End Property
Public property Be y3 (newy3 As Integer)
BLc = newy3
End Property
Public property Be x4 (newx4 As Integer)
BRr = newx4
End Property
Public property Be y4 (newy4 As Integer)
BRc = newy4
End Property
Sub Draw ()
Dim i As Integer, j As Integer, longeur As Integer, greatur As Integer & # 39; longeur = x largeur = y
i = 0: j = 0
longeur = TRc - TLc: largeur = BLr - TLr
For i = 0 to durable
Cells (TLr, TLc + i) .Value = "W"
Cells (BLr, BLc + i) .Value = "W"
Next me

Too large for j = 1 - 1
Cells (TLr + j, TLc) .Value = "W"
Cells (TRr + j, TRc) .Value = "W"
Next j
Call me

End Sub
Under taste ()

End Sub

Sub colored (color as integer)
Dim long-lived as an integer, large as an integer, as a byte, j as a byte
longeur = TRc - TLc: largeur = BLr - TLr
i = 0: j = 0
For i = 1 to longeur - 1
Too large for j = 1 - 1
Cells (TLr + j, TLc + i) .InteriorColorIndex = color
Next j
Next me
End Sub
Function AmIValid () As Integer # must add size parameter
Dim i As Integer, j As Integer, longeur As Integer, greatur As Integer & # 39; longeur = x largeur = y
i = 0: j = 0
IsValid = 1
longeur = TRc - TLc: largeur = BLr - TLr

If durable <3 or bigger <3 then
IsValid = 2
Otherwise
For i = 0 to durable
If cells (TLr, TLc + i) .Value = "W" Or cells (BLr, BLc + i) .Value = "W" or TLr <100 or TLc < 100 Or BRr > 150 or BRc> 150 Then IsValid = 2 & SIZE OF MAZE must be passed to the input box
Next me
Too large for j = 1 - 1
If cells (TLr + j, TLc) .Value = "W" or cells (TRr + j, TRc) .Value = "W", then IsValid = 2
Next j
When
AmIValid = IsValid
End function