Visual Basic Memory Game
VerifiedAdded on  2022/08/15
|19
|3047
|23
AI Summary
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Running head: VISUAL BASIC MEMORY GAME
VISUAL BASIC MEMORY GAME
Name of the Student
Name of the University
Author Note
VISUAL BASIC MEMORY GAME
Name of the Student
Name of the University
Author Note
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
1VISUAL BASIC MEMORY GAME
Table of Contents
The Fun of Developing the Memory Game...............................................................................2
References..................................................................................................................................6
Appendix:...................................................................................................................................7
Answer 1 Logic:.....................................................................................................................7
Answer 1 Code:......................................................................................................................9
Running Game Screenshots:................................................................................................14
Table of Contents
The Fun of Developing the Memory Game...............................................................................2
References..................................................................................................................................6
Appendix:...................................................................................................................................7
Answer 1 Logic:.....................................................................................................................7
Answer 1 Code:......................................................................................................................9
Running Game Screenshots:................................................................................................14
2VISUAL BASIC MEMORY GAME
The Fun of Developing the Memory Game
The basic idea of the game was a fascinating one. I had a lot of fun in the developing
stage. At the time of research, before starting to do the assignment, I did learn a lot of new
things as well that I previously did not know about and I will go into the details in later
sections.
Initially, after reading the full details of the assignment, I thought of developing the
game in a new way. It should include small features that happen in real-time games like
waiting while checking whether the picked cards match or not and doing the tasks of a
stopwatch (already mentioned as a requirement) and stopping on finishing the game. The new
thing that I especially discovered and got amazed while doing my research about the project
is that I can make use of the button click operation and assign certain tasks to the button to
handle specific events (Gaikwad and Pawar 2015). The use of the button click operation
helped me a lot while implementing the function for checking whether the pickled cards
match or not and removing the matched cards using proper functionalities from the screen.
The Visual Basic Memory Game was designed using Visual Studio IDE (Integrated
Development Environment). The whole assignment has been designed and coded using
Visual Basic Form Application development environment.
After going thoroughly throughout the requirements of the game initially, I chalked
out about what needs to be done as the functioning parts; for the ease of understanding, I used
a flowchart detailing exactly how I will develop the game (after performing which part, what
comes next). The following Flowchart is the final layout that I designed and decided to use as
my game layout.
The Fun of Developing the Memory Game
The basic idea of the game was a fascinating one. I had a lot of fun in the developing
stage. At the time of research, before starting to do the assignment, I did learn a lot of new
things as well that I previously did not know about and I will go into the details in later
sections.
Initially, after reading the full details of the assignment, I thought of developing the
game in a new way. It should include small features that happen in real-time games like
waiting while checking whether the picked cards match or not and doing the tasks of a
stopwatch (already mentioned as a requirement) and stopping on finishing the game. The new
thing that I especially discovered and got amazed while doing my research about the project
is that I can make use of the button click operation and assign certain tasks to the button to
handle specific events (Gaikwad and Pawar 2015). The use of the button click operation
helped me a lot while implementing the function for checking whether the pickled cards
match or not and removing the matched cards using proper functionalities from the screen.
The Visual Basic Memory Game was designed using Visual Studio IDE (Integrated
Development Environment). The whole assignment has been designed and coded using
Visual Basic Form Application development environment.
After going thoroughly throughout the requirements of the game initially, I chalked
out about what needs to be done as the functioning parts; for the ease of understanding, I used
a flowchart detailing exactly how I will develop the game (after performing which part, what
comes next). The following Flowchart is the final layout that I designed and decided to use as
my game layout.
3VISUAL BASIC MEMORY GAME
Fig: Sequence layout of the game functioning
Fig: Sequence layout of the game functioning
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
4VISUAL BASIC MEMORY GAME
The above flowchart clearly states the proper working structure of the currently
developed memory game (Ensmenger 2016). As for how the sequence works, initially on
starting the application, the cards get automatically suffered for the first time and waits for
the player to press the start button. On clicking the start button, the timer of the game starts to
count, and the click functionality of the card images gets enabled with the backside of the
card still visible on the top. On clicking the cards on the screen, the selected cards get flipped
(the image of the actual card gets to the top, and the picture of the backside of the card gets
below the slot chosen). After selecting a second card, the second card gets flipped (same
functionalities happen to that of the first one), and then identification of the chosen cards are
made (whether the two selected cards match or not). If the two selected cards are found to be
the same (i.e., the image number of the two chosen picture boxes are the same), the
nominated cards get taken out from the screen. In other words, the visibility status of the
matched boxes are turned into false; it hides the picture box from the window and cannot
further be selected until the shuffle button is pressed. However, if the chosen cards do not
match, the cards are then again flipped back to its original state (backside to the top) (Mani
and Manickam 2017).
The new thing that I learned and implemented in the game is waiting for the decision
process to handle. For this part, I took an extra timer and set it for a delay of 1000 msec (1
second) (Zaki and Edy 2015). As this delay will be done during the checking process, I
included the checking parts in the timer section. This, in turn, helped to ease up the coding
process by a lot. As per requirement, two message boxes were added as well (Rahouma
2016). One during the time a match is found, and the other at times, no match was found. The
messages will be displayed as the situation arises. Next comes the functionality of the
‘Shuffle Deck’ button. The user of the game application can click the ‘Shuffle Deck’ button
at any point in time; for this sole reason, the condition checking for the ‘Shuffle Deck’ button
The above flowchart clearly states the proper working structure of the currently
developed memory game (Ensmenger 2016). As for how the sequence works, initially on
starting the application, the cards get automatically suffered for the first time and waits for
the player to press the start button. On clicking the start button, the timer of the game starts to
count, and the click functionality of the card images gets enabled with the backside of the
card still visible on the top. On clicking the cards on the screen, the selected cards get flipped
(the image of the actual card gets to the top, and the picture of the backside of the card gets
below the slot chosen). After selecting a second card, the second card gets flipped (same
functionalities happen to that of the first one), and then identification of the chosen cards are
made (whether the two selected cards match or not). If the two selected cards are found to be
the same (i.e., the image number of the two chosen picture boxes are the same), the
nominated cards get taken out from the screen. In other words, the visibility status of the
matched boxes are turned into false; it hides the picture box from the window and cannot
further be selected until the shuffle button is pressed. However, if the chosen cards do not
match, the cards are then again flipped back to its original state (backside to the top) (Mani
and Manickam 2017).
The new thing that I learned and implemented in the game is waiting for the decision
process to handle. For this part, I took an extra timer and set it for a delay of 1000 msec (1
second) (Zaki and Edy 2015). As this delay will be done during the checking process, I
included the checking parts in the timer section. This, in turn, helped to ease up the coding
process by a lot. As per requirement, two message boxes were added as well (Rahouma
2016). One during the time a match is found, and the other at times, no match was found. The
messages will be displayed as the situation arises. Next comes the functionality of the
‘Shuffle Deck’ button. The user of the game application can click the ‘Shuffle Deck’ button
at any point in time; for this sole reason, the condition checking for the ‘Shuffle Deck’ button
5VISUAL BASIC MEMORY GAME
is done at both ends of the flowchart. As for the implementation, all the cards are shuffled
and placed upside down on the screen. Whereas for the logic in the programming section, the
visibility of all the picture boxes are turned on, with the backside image on the top (Agbo
2017). The front side values of the cards are shuffled using a random function and the main
timer calculating the total in-game time is reset to zero (label value set to zero and the timer is
stopped so that the label value does not increase with the increment formula within the timer
handling event). With the complete implementation of this, the game development is finally
finished with a fairly working stage, presentable to the end-user.
Throughout the whole process of developing the game, I have developed and
implemented the entire game fully. It has a timer that counts how much time has passed since
the starting of the game, and it displays a message box mentioning whether the picked cards
match or not and takes necessary steps afterward (Hendrawati and Lesmana 2016). It also has
a start and shuffle deck button, which begins the game and shuffles the card deck with
resetting the timer to zero for the next game, respectively. Apart from playing the game
displaying, the time takes, when the shuffle deck button is clicked for starting the second
game without closing the application, the cards are selectable without clicking the start
button. This part can be improved in order to make the game more suitable and prominent. If
I were to get more time in this portfolio, specific parts like including sound effect when the
game is completed, displaying a popup with congratulations statement could be added (Elechi
2017). This would, in turn, make the game more interactive to the users who might play the
game, and this welcoming gesture would make the developed Memory Game application
striking to the users as well.
is done at both ends of the flowchart. As for the implementation, all the cards are shuffled
and placed upside down on the screen. Whereas for the logic in the programming section, the
visibility of all the picture boxes are turned on, with the backside image on the top (Agbo
2017). The front side values of the cards are shuffled using a random function and the main
timer calculating the total in-game time is reset to zero (label value set to zero and the timer is
stopped so that the label value does not increase with the increment formula within the timer
handling event). With the complete implementation of this, the game development is finally
finished with a fairly working stage, presentable to the end-user.
Throughout the whole process of developing the game, I have developed and
implemented the entire game fully. It has a timer that counts how much time has passed since
the starting of the game, and it displays a message box mentioning whether the picked cards
match or not and takes necessary steps afterward (Hendrawati and Lesmana 2016). It also has
a start and shuffle deck button, which begins the game and shuffles the card deck with
resetting the timer to zero for the next game, respectively. Apart from playing the game
displaying, the time takes, when the shuffle deck button is clicked for starting the second
game without closing the application, the cards are selectable without clicking the start
button. This part can be improved in order to make the game more suitable and prominent. If
I were to get more time in this portfolio, specific parts like including sound effect when the
game is completed, displaying a popup with congratulations statement could be added (Elechi
2017). This would, in turn, make the game more interactive to the users who might play the
game, and this welcoming gesture would make the developed Memory Game application
striking to the users as well.
6VISUAL BASIC MEMORY GAME
References
Agbo, E.C., 2017. Identity Verification System (A Case Study of University of Nigeria,
Nsukka) (Doctoral dissertation).
Elechi, P., 2017. Design and Implementation of an Improved Smoke Detection System.
European Journal of Electrical Engineering and Computer Science, 1(3).
Ensmenger, N., 2016. The multiple meanings of a flowchart. Information & Culture, 51(3),
pp.321-351.
Gaikwad, P.K. and Pawar, S.J., 2015, May. Implementation of real-time GPS receiver system
for providing navigation based services and SMS tracking. In 2015 International Conference
on Industrial Instrumentation and Control (ICIC) (pp. 630-634). IEEE.
Hendrawati, T.D. and Lesmana, I., 2016. Rancang bangun saklar lampu otomatis dan
monitoring suhu rumah menggunakan VB. Net dan Arduino. Jurnal Teknologi Rekayasa,
1(1), pp.67-72.
Mani, U. and Manickam, P., 2017. CoMat: An Integrated Tool for Comet Assay Image
Analysis. Journal of Pharmaceutical Sciences and Research, 9(6), p.919.
Rahouma, K.H., 2016. Securing software programs by applying security services with
microsoft VB net programming. Amer. J. Inf. Sci. Comput. Eng., 2(6), pp.79-90.
Zaki, A. and Edy Winarno ST, M., 2015. VB. NET untuk Skripsi. Elex Media Komputindo.
References
Agbo, E.C., 2017. Identity Verification System (A Case Study of University of Nigeria,
Nsukka) (Doctoral dissertation).
Elechi, P., 2017. Design and Implementation of an Improved Smoke Detection System.
European Journal of Electrical Engineering and Computer Science, 1(3).
Ensmenger, N., 2016. The multiple meanings of a flowchart. Information & Culture, 51(3),
pp.321-351.
Gaikwad, P.K. and Pawar, S.J., 2015, May. Implementation of real-time GPS receiver system
for providing navigation based services and SMS tracking. In 2015 International Conference
on Industrial Instrumentation and Control (ICIC) (pp. 630-634). IEEE.
Hendrawati, T.D. and Lesmana, I., 2016. Rancang bangun saklar lampu otomatis dan
monitoring suhu rumah menggunakan VB. Net dan Arduino. Jurnal Teknologi Rekayasa,
1(1), pp.67-72.
Mani, U. and Manickam, P., 2017. CoMat: An Integrated Tool for Comet Assay Image
Analysis. Journal of Pharmaceutical Sciences and Research, 9(6), p.919.
Rahouma, K.H., 2016. Securing software programs by applying security services with
microsoft VB net programming. Amer. J. Inf. Sci. Comput. Eng., 2(6), pp.79-90.
Zaki, A. and Edy Winarno ST, M., 2015. VB. NET untuk Skripsi. Elex Media Komputindo.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
7VISUAL BASIC MEMORY GAME
Appendix:
Answer 1 Logic:
BEGIN
Declare 25 picture box with 16 visible for choosing and selected game remaining 9 for
switching pictures from them to the 16 visible picture boxes, 8 for the front side image and
the last one for the back side image;
On starting of the game for first time the shuffle button will perform the click operation once
to display the back side image from the picture box to all the 16 visible picture box and
perform a shuffle operation with random function;
On clicking the start button, all the 16 picture box will be enabled for clicking and a match
timing counter will start counting the time in seconds;
On selecting each visible picture box, a check operation will invoke it will only execute if not
trying to picksame box;
If Selection is the first one or (Selection is the second And first selection NOT EQUAL to
second selection) Then
Display selected picture by switching the frontside image with the selected picture box;
If the Selection is the first one Then
Just display the selection;
Else
Appendix:
Answer 1 Logic:
BEGIN
Declare 25 picture box with 16 visible for choosing and selected game remaining 9 for
switching pictures from them to the 16 visible picture boxes, 8 for the front side image and
the last one for the back side image;
On starting of the game for first time the shuffle button will perform the click operation once
to display the back side image from the picture box to all the 16 visible picture box and
perform a shuffle operation with random function;
On clicking the start button, all the 16 picture box will be enabled for clicking and a match
timing counter will start counting the time in seconds;
On selecting each visible picture box, a check operation will invoke it will only execute if not
trying to picksame box;
If Selection is the first one or (Selection is the second And first selection NOT EQUAL to
second selection) Then
Display selected picture by switching the frontside image with the selected picture box;
If the Selection is the first one Then
Just display the selection;
Else
8VISUAL BASIC MEMORY GAME
display the second image and invoke a delay timer for one second and then perform
the checking procedure;
If the selected two picture box image match Then
Timing timer will pause;
A message box will show "Matched";
The two matched image picture box visibility will be set to false resulting
hiding the same;
MatchCount will increment by 1;
If MatchCount is less than 8 Then
The timing timer will resume;
End If;
Else
Timing timer will pause;
A message box will show "Not Matched";
The two selected picture box image will again swithed back to the back side of
the card;
The timing timer will resume;
End If
End If;
End If;
display the second image and invoke a delay timer for one second and then perform
the checking procedure;
If the selected two picture box image match Then
Timing timer will pause;
A message box will show "Matched";
The two matched image picture box visibility will be set to false resulting
hiding the same;
MatchCount will increment by 1;
If MatchCount is less than 8 Then
The timing timer will resume;
End If;
Else
Timing timer will pause;
A message box will show "Not Matched";
The two selected picture box image will again swithed back to the back side of
the card;
The timing timer will resume;
End If
End If;
End If;
9VISUAL BASIC MEMORY GAME
On clicking the shuffle button, all the 16 card picture box irrespective of their status will turn
into visible with back side visible;
For each selecting sixteen picture box
Replace the card image with card back image;
Turn their visibility into true;
For each selecting picture box
Pick an item image in random;
swap the image with backward side of the selecting picture box;
Stop the counting timer;
Reset the label displaying counting value to zero;
Reset MatchCount to zero;
END.
Answer 1 Code:
Public Class Form1
Dim Selection As Integer
Dim Opted(2) As Integer
Dim SideVisible(16) As PictureBox
Dim BackwardSide(16) As Integer
Dim OptionChosen(8) As PictureBox
Dim Rand As New Random
Dim MatchCount As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
'establish display and OptionChosen picture boxes
On clicking the shuffle button, all the 16 card picture box irrespective of their status will turn
into visible with back side visible;
For each selecting sixteen picture box
Replace the card image with card back image;
Turn their visibility into true;
For each selecting picture box
Pick an item image in random;
swap the image with backward side of the selecting picture box;
Stop the counting timer;
Reset the label displaying counting value to zero;
Reset MatchCount to zero;
END.
Answer 1 Code:
Public Class Form1
Dim Selection As Integer
Dim Opted(2) As Integer
Dim SideVisible(16) As PictureBox
Dim BackwardSide(16) As Integer
Dim OptionChosen(8) As PictureBox
Dim Rand As New Random
Dim MatchCount As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
'establish display and OptionChosen picture boxes
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
10VISUAL BASIC MEMORY GAME
SideVisible(1) = picHidden1
SideVisible(2) = picHidden2
SideVisible(3) = picHidden3
SideVisible(4) = picHidden4
SideVisible(5) = picHidden5
SideVisible(6) = picHidden6
SideVisible(7) = picHidden7
SideVisible(8) = picHidden8
SideVisible(9) = picHidden9
SideVisible(10) = picHidden10
SideVisible(11) = picHidden11
SideVisible(12) = picHidden12
SideVisible(13) = picHidden13
SideVisible(14) = picHidden14
SideVisible(15) = picHidden15
SideVisible(16) = picHidden16
OptionChosen(1) = picChoice1
OptionChosen(2) = picChoice2
OptionChosen(3) = picChoice3
OptionChosen(4) = picChoice4
OptionChosen(5) = picChoice5
OptionChosen(6) = picChoice6
OptionChosen(7) = picChoice7
OptionChosen(8) = picChoice8
'start new game
btnShuffle.PerformClick()
End Sub
Private Sub picHidden1_Click(sender As Object, e As EventArgs) Handles
picHidden1.Click
Opted(Selection) = 1
btnCheck.PerformClick()
End Sub
Private Sub picHidden2_Click(sender As Object, e As EventArgs) Handles
picHidden2.Click
Opted(Selection) = 2
btnCheck.PerformClick()
End Sub
Private Sub picHidden3_Click(sender As Object, e As EventArgs) Handles
picHidden3.Click
Opted(Selection) = 3
btnCheck.PerformClick()
End Sub
Private Sub picHidden4_Click(sender As Object, e As EventArgs) Handles
picHidden4.Click
Opted(Selection) = 4
btnCheck.PerformClick()
End Sub
Private Sub picHidden5_Click(sender As Object, e As EventArgs) Handles
picHidden5.Click
Opted(Selection) = 5
btnCheck.PerformClick()
End Sub
Private Sub picHidden6_Click(sender As Object, e As EventArgs) Handles
picHidden6.Click
SideVisible(1) = picHidden1
SideVisible(2) = picHidden2
SideVisible(3) = picHidden3
SideVisible(4) = picHidden4
SideVisible(5) = picHidden5
SideVisible(6) = picHidden6
SideVisible(7) = picHidden7
SideVisible(8) = picHidden8
SideVisible(9) = picHidden9
SideVisible(10) = picHidden10
SideVisible(11) = picHidden11
SideVisible(12) = picHidden12
SideVisible(13) = picHidden13
SideVisible(14) = picHidden14
SideVisible(15) = picHidden15
SideVisible(16) = picHidden16
OptionChosen(1) = picChoice1
OptionChosen(2) = picChoice2
OptionChosen(3) = picChoice3
OptionChosen(4) = picChoice4
OptionChosen(5) = picChoice5
OptionChosen(6) = picChoice6
OptionChosen(7) = picChoice7
OptionChosen(8) = picChoice8
'start new game
btnShuffle.PerformClick()
End Sub
Private Sub picHidden1_Click(sender As Object, e As EventArgs) Handles
picHidden1.Click
Opted(Selection) = 1
btnCheck.PerformClick()
End Sub
Private Sub picHidden2_Click(sender As Object, e As EventArgs) Handles
picHidden2.Click
Opted(Selection) = 2
btnCheck.PerformClick()
End Sub
Private Sub picHidden3_Click(sender As Object, e As EventArgs) Handles
picHidden3.Click
Opted(Selection) = 3
btnCheck.PerformClick()
End Sub
Private Sub picHidden4_Click(sender As Object, e As EventArgs) Handles
picHidden4.Click
Opted(Selection) = 4
btnCheck.PerformClick()
End Sub
Private Sub picHidden5_Click(sender As Object, e As EventArgs) Handles
picHidden5.Click
Opted(Selection) = 5
btnCheck.PerformClick()
End Sub
Private Sub picHidden6_Click(sender As Object, e As EventArgs) Handles
picHidden6.Click
11VISUAL BASIC MEMORY GAME
Opted(Selection) = 6
btnCheck.PerformClick()
End Sub
Private Sub picHidden7_Click(sender As Object, e As EventArgs) Handles
picHidden7.Click
Opted(Selection) = 7
btnCheck.PerformClick()
End Sub
Private Sub picHidden8_Click(sender As Object, e As EventArgs) Handles
picHidden8.Click
Opted(Selection) = 8
btnCheck.PerformClick()
End Sub
Private Sub picHidden9_Click(sender As Object, e As EventArgs) Handles
picHidden9.Click
Opted(Selection) = 9
btnCheck.PerformClick()
End Sub
Private Sub picHidden10_Click(sender As Object, e As EventArgs) Handles
picHidden10.Click
Opted(Selection) = 10
btnCheck.PerformClick()
End Sub
Private Sub picHidden11_Click(sender As Object, e As EventArgs) Handles
picHidden11.Click
Opted(Selection) = 11
btnCheck.PerformClick()
End Sub
Private Sub picHidden12_Click(sender As Object, e As EventArgs) Handles
picHidden12.Click
Opted(Selection) = 12
btnCheck.PerformClick()
End Sub
Private Sub picHidden13_Click(sender As Object, e As EventArgs) Handles
picHidden13.Click
Opted(Selection) = 13
btnCheck.PerformClick()
End Sub
Private Sub picHidden14_Click(sender As Object, e As EventArgs) Handles
picHidden14.Click
Opted(Selection) = 14
btnCheck.PerformClick()
End Sub
Private Sub picHidden15_Click(sender As Object, e As EventArgs) Handles
picHidden15.Click
Opted(Selection) = 15
btnCheck.PerformClick()
End Sub
Private Sub picHidden16_Click(sender As Object, e As EventArgs) Handles
picHidden16.Click
Opted(Selection) = 16
btnCheck.PerformClick()
End Sub
Opted(Selection) = 6
btnCheck.PerformClick()
End Sub
Private Sub picHidden7_Click(sender As Object, e As EventArgs) Handles
picHidden7.Click
Opted(Selection) = 7
btnCheck.PerformClick()
End Sub
Private Sub picHidden8_Click(sender As Object, e As EventArgs) Handles
picHidden8.Click
Opted(Selection) = 8
btnCheck.PerformClick()
End Sub
Private Sub picHidden9_Click(sender As Object, e As EventArgs) Handles
picHidden9.Click
Opted(Selection) = 9
btnCheck.PerformClick()
End Sub
Private Sub picHidden10_Click(sender As Object, e As EventArgs) Handles
picHidden10.Click
Opted(Selection) = 10
btnCheck.PerformClick()
End Sub
Private Sub picHidden11_Click(sender As Object, e As EventArgs) Handles
picHidden11.Click
Opted(Selection) = 11
btnCheck.PerformClick()
End Sub
Private Sub picHidden12_Click(sender As Object, e As EventArgs) Handles
picHidden12.Click
Opted(Selection) = 12
btnCheck.PerformClick()
End Sub
Private Sub picHidden13_Click(sender As Object, e As EventArgs) Handles
picHidden13.Click
Opted(Selection) = 13
btnCheck.PerformClick()
End Sub
Private Sub picHidden14_Click(sender As Object, e As EventArgs) Handles
picHidden14.Click
Opted(Selection) = 14
btnCheck.PerformClick()
End Sub
Private Sub picHidden15_Click(sender As Object, e As EventArgs) Handles
picHidden15.Click
Opted(Selection) = 15
btnCheck.PerformClick()
End Sub
Private Sub picHidden16_Click(sender As Object, e As EventArgs) Handles
picHidden16.Click
Opted(Selection) = 16
btnCheck.PerformClick()
End Sub
12VISUAL BASIC MEMORY GAME
Private Sub btnCheck_Click(sender As Object, e As EventArgs) Handles
btnCheck.Click
'Only execute if not trying to picksame box
If Selection = 1 Or (Selection = 2 And Opted(1) <> Opted(2)) Then
'Display selected picture
SideVisible(Opted(Selection)).Image =
OptionChosen(BackwardSide(Opted(Selection))).Image
SideVisible(Opted(Selection)).Refresh()
If Selection = 1 Then
'first Selection - just display
Selection = 2
Else
'Delay for one second before checking
timDelay.Enabled = True
End If
End If
End Sub
Private Sub btnShuffle_Click(sender As Object, e As EventArgs) Handles
btnShuffle.Click
Dim I As Integer
Dim TempValue As Integer
Dim Remaining As Integer
For I = 1 To 16
'replace with card back
SideVisible(I).Image = My.Resources.back
SideVisible(I).Visible = True
BackwardSide(I) = I
Next I
For Remaining = 16 To 2 Step -1
'Pick item at random
I = Rand.Next(Remaining) + 1
'swap Opted item with bottom item
TempValue = BackwardSide(Remaining)
BackwardSide(Remaining) = BackwardSide(I)
BackwardSide(I) = TempValue
Next Remaining
For I = 1 To 16
If BackwardSide(I) > 8 Then
BackwardSide(I) = BackwardSide(I) - 8
End If
Next I
Selection = 1
timTimer.Stop()
lblTime.Text = 0
MatchCount = 0
End Sub
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles
btnStart.Click
picHidden1.Enabled = True
picHidden2.Enabled = True
picHidden3.Enabled = True
picHidden4.Enabled = True
picHidden5.Enabled = True
picHidden6.Enabled = True
picHidden7.Enabled = True
picHidden8.Enabled = True
picHidden9.Enabled = True
picHidden10.Enabled = True
Private Sub btnCheck_Click(sender As Object, e As EventArgs) Handles
btnCheck.Click
'Only execute if not trying to picksame box
If Selection = 1 Or (Selection = 2 And Opted(1) <> Opted(2)) Then
'Display selected picture
SideVisible(Opted(Selection)).Image =
OptionChosen(BackwardSide(Opted(Selection))).Image
SideVisible(Opted(Selection)).Refresh()
If Selection = 1 Then
'first Selection - just display
Selection = 2
Else
'Delay for one second before checking
timDelay.Enabled = True
End If
End If
End Sub
Private Sub btnShuffle_Click(sender As Object, e As EventArgs) Handles
btnShuffle.Click
Dim I As Integer
Dim TempValue As Integer
Dim Remaining As Integer
For I = 1 To 16
'replace with card back
SideVisible(I).Image = My.Resources.back
SideVisible(I).Visible = True
BackwardSide(I) = I
Next I
For Remaining = 16 To 2 Step -1
'Pick item at random
I = Rand.Next(Remaining) + 1
'swap Opted item with bottom item
TempValue = BackwardSide(Remaining)
BackwardSide(Remaining) = BackwardSide(I)
BackwardSide(I) = TempValue
Next Remaining
For I = 1 To 16
If BackwardSide(I) > 8 Then
BackwardSide(I) = BackwardSide(I) - 8
End If
Next I
Selection = 1
timTimer.Stop()
lblTime.Text = 0
MatchCount = 0
End Sub
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles
btnStart.Click
picHidden1.Enabled = True
picHidden2.Enabled = True
picHidden3.Enabled = True
picHidden4.Enabled = True
picHidden5.Enabled = True
picHidden6.Enabled = True
picHidden7.Enabled = True
picHidden8.Enabled = True
picHidden9.Enabled = True
picHidden10.Enabled = True
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
13VISUAL BASIC MEMORY GAME
picHidden11.Enabled = True
picHidden12.Enabled = True
picHidden13.Enabled = True
picHidden14.Enabled = True
picHidden15.Enabled = True
picHidden16.Enabled = True
If MatchCount < 8 Then
timTimer.Start()
End If
End Sub
Private Sub timDelay_Tick(sender As Object, e As EventArgs) Handles
timDelay.Tick
timDelay.Enabled = False
'After delay, Check for match
If BackwardSide(Opted(1)) = BackwardSide(Opted(2)) Then
timTimer.Stop()
MessageBox.Show("Matched")
'If match, remove picture
SideVisible(Opted(1)).Visible = False
SideVisible(Opted(2)).Visible = False
MatchCount += 1
If MatchCount < 8 Then
timTimer.Start()
End If
Else
timTimer.Stop()
MessageBox.Show("No Match")
SideVisible(Opted(1)).Image = My.Resources.back
SideVisible(Opted(2)).Image = My.Resources.back
timTimer.Start()
End If
Selection = 1
End Sub
Private Sub timTimer_Tick(sender As Object, e As EventArgs) Handles
timTimer.Tick
lblTime.Text += 1
End Sub
End Class
picHidden11.Enabled = True
picHidden12.Enabled = True
picHidden13.Enabled = True
picHidden14.Enabled = True
picHidden15.Enabled = True
picHidden16.Enabled = True
If MatchCount < 8 Then
timTimer.Start()
End If
End Sub
Private Sub timDelay_Tick(sender As Object, e As EventArgs) Handles
timDelay.Tick
timDelay.Enabled = False
'After delay, Check for match
If BackwardSide(Opted(1)) = BackwardSide(Opted(2)) Then
timTimer.Stop()
MessageBox.Show("Matched")
'If match, remove picture
SideVisible(Opted(1)).Visible = False
SideVisible(Opted(2)).Visible = False
MatchCount += 1
If MatchCount < 8 Then
timTimer.Start()
End If
Else
timTimer.Stop()
MessageBox.Show("No Match")
SideVisible(Opted(1)).Image = My.Resources.back
SideVisible(Opted(2)).Image = My.Resources.back
timTimer.Start()
End If
Selection = 1
End Sub
Private Sub timTimer_Tick(sender As Object, e As EventArgs) Handles
timTimer.Tick
lblTime.Text += 1
End Sub
End Class
14VISUAL BASIC MEMORY GAME
Running Game Screenshots:
Fig: First Screen after starting the game
Running Game Screenshots:
Fig: First Screen after starting the game
15VISUAL BASIC MEMORY GAME
Fig: Massage Box mentioning no match found between the selected cards
Fig: Massage Box mentioning no match found between the selected cards
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
16VISUAL BASIC MEMORY GAME
Fig: Massage Box mentioning match found between the selected cards
Fig: Massage Box mentioning match found between the selected cards
17VISUAL BASIC MEMORY GAME
Fig: Displaying the time after finding all the matched cards
Fig: Displaying the time after finding all the matched cards
18VISUAL BASIC MEMORY GAME
Fig: View after selecting the Shuffle Deck Button
Fig: View after selecting the Shuffle Deck Button
1 out of 19
Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024  |  Zucol Services PVT LTD  |  All rights reserved.