Original version of Wingding Match game

Original version of Wingding Match game - Techronology

This is the original version of Wingding Match, a game for Excel, which we also call Matches. In addition, we have a fancier version of the game, right here on the Techronology site. However, both versions are challenging in their own way.

Overview of original version of Wingding Match game

Since we consider this version of Wingding Match vintage, we do not go into a lot of detail on this game. Basically, it is a matching game. Thus, you win the game by making matches. That is all to it.


Requirements and download

Requirements: Excel 2003 or higher or compatible.

If you are ready to play this game, then click on the download button below.

Download Size: 15 kB

Note: Instead of running this game from the zip file, save it to a location on your computer. It runs better that way.


Code listing

Here is the code for the Matches game.

Option Explicit
Public attempts As Integer
Public matchChr As Variant
Public matchCnt As Integer
Public matchNum As Integer
Public randChr As Variant
Public score As Integer
Dim matchPick(3) As String
Dim matchPos(48) As Integer
Private Sub Assign_Positions()
    Dim i As Integer
    Dim prevNum, randNum As Integer
    
    prevNum = 0
    randNum = 0
    
    i = 0
    Do While i <= 23
        Randomize
        
        randNum = Int(Rnd * 48)
        
        If (matchPos(randNum) <> 1) Then
            matchPos(randNum) = 1
            i = i + 1
        End If
    
        prevNum = randNum
    Loop
End Sub
Public Sub Check_Match(boxNum As String)
    matchNum = matchNum + 1
    matchPick(matchNum) = boxNum
    
    If (matchNum < 3) Then
        Shapes("box" & matchPick(matchNum)).Visible = False
    Else
        matchNum = 0
        Shapes("box" & matchPick(1)).Visible = True
        Shapes("box" & matchPick(2)).Visible = True
    End If
    
    If (matchNum = 2) Then
        Call TimeDelay(1)
        
        If (Range(matchPick(1)).Value = Range(matchPick(2)).Value) Then
            score = score + 100
            matchCnt = matchCnt + 1
            matchNum = 0
                
            Shapes("box" & matchPick(1)).Visible = False
            Shapes("box" & matchPick(2)).Visible = False
        Else
            score = score - 10
            attempts = attempts + 1
            matchNum = 0
            Shapes("box" & matchPick(1)).Visible = True
            Shapes("box" & matchPick(2)).Visible = True
        End If
    End If
    
    If (matchCnt = 24) Then
        Range("E3").Value = "Final Score: " & score
        Range("G4").Value = "Matches: " & matchCnt
    Else
        Range("E3").Value = "Score: " & score
        Range("E4").Value = "Attempts: " & attempts
        Range("G4").Value = "Matches: " & matchCnt
    End If
End Sub
Private Sub Clear_Match_Positions()
    Dim i, j As Integer
    
    For i = 0 To 47                                         'initialize match positions
        matchPos(i) = 0
    Next
    For i = 0 To 5                                          'clear cell values
        For j = 0 To 7
            Range(Chr(67 + j) & (6 + i)).Value = ""
        Next
    Next
End Sub
Private Sub Initialize()
    matchChr = Array(33, 37, 38, 40, 41, 43, 46, 68, 72, 93, 94, 108, 110, 115, 117, 118, 162, 164, 168, 171, 182, 220, 234, 242)
    matchCnt = 0
    matchNum = 0
    
    attempts = 0
    score = 0
    Range("E3").Value = "Score: " & score
    Range("E4").Value = "Attempts: " & attempts
    
    Range("F13").Select
End Sub
Private Sub Place_Match_Chars()
    Dim i, j As Integer
    Dim mNum1, mNum2, pNum As Integer
    
    mNum1 = 0    'match number
    mNum2 = 0    'position number
    pNum = 0     'character number
    
    For i = 0 To 5
        For j = 0 To 7
            If (matchPos(pNum) = 1) Then
                Range(Chr(67 + j) & (6 + i)).Value = Chr(matchChr(mNum1))
                mNum1 = mNum1 + 1
            Else
                Range(Chr(67 + j) & (6 + i)).Value = Chr(randChr(23 - mNum2))
                mNum2 = mNum2 + 1
            End If
            
            pNum = pNum + 1
        Next
    Next
End Sub
Private Sub Randomize_Match_Chars()
    Dim i, j As Integer
    Dim tmp As Integer
    Dim tmpArr As Variant
    
    tmpArr = matchChr
    Randomize
    
    For i = 0 To 23
        j = Int(i + Rnd * (23 - i + 1))
    
        tmp = tmpArr(i)
        tmpArr(i) = tmpArr(j)
        tmpArr(j) = tmp
    Next
    
    randChr = tmpArr
End Sub
Private Sub TimeDelay(secs As Integer)
    Dim startTime
    
    startTime = Timer
    Do While Timer < startTime + secs
        DoEvents
    Loop
End Sub
Public Sub Show_Buttons()
    Dim i, j As Integer
    
    For i = 0 To 5
        For j = 0 To 7
            Shapes("box" & Chr(67 + j) & (6 + i)).Line.ForeColor.SchemeColor = 48
            Shapes("box" & Chr(67 + j) & (6 + i)).Fill.ForeColor.SchemeColor = 48
            Shapes("box" & Chr(67 + j) & (6 + i)).Visible = True
        Next
    Next
End Sub
    
Public Sub Start_Game()
    Call Initialize
    Call Randomize_Match_Chars
    Call Clear_Match_Positions
    Call Assign_Positions
    Call Show_Buttons
    Call Place_Match_Chars
End Sub
Private Sub Worksheet_Activate()
    Call Start_Game
End Sub

Related


Games home Techronology home