
Overview of Connectx
So, Connectx is another one of our wannabe Excel creations. Basically, it was supposed to function as a Tic-Tac-Toe clone. However, we did not complete it. Therefore, it is up to you to finish the dream.
To tell you the truth, when we looked at the code, it seems pretty simple. But, you know how that goes.
After saying that, we may take another shot at it, in Excel. However, we have to make it funky for you.
Requirements and download
Excel 2003 or higher or compatible.
If you are ready to use this tool, 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 for Connectx
Below, take a look at the code for the program. It only took about a day to do it. Still, not completed though.
'connectx
'Designed and programmed by: Alex Shaw III
Option Explicit
Public gameLev As Integer
Public gameOver As Boolean
Private Sub Check_Level()
    If ((Range("F16").Value <> "Easy") And (Range("F16").Value <> "Difficult")) Then
        Range("F16").Value = "Easy"
    End If
    
    If (Range("F16").Value = "Easy") Then gameLev = 1 Else gameLev = 2
End Sub
Private Sub CheckXO(boxNum As String)
    Select Case boxNum
        Case "E9"
            If ((Range("E9:G9").Text = "X") Or (Range("E9:G9").Text = "O")) Then Call Game_Over("cLine1")
            If ((Range("E9:E11").Text = "X") Or (Range("E9:E11").Text = "O")) Then Call Game_Over("cLine4")
            If ((Range("E9,F10,G11").Text = "X") Or (Range("E9,F10,G11").Text = "O")) Then Call Game_Over("cLine7")
        Case "E10"
            If ((Range("E9:E11").Text = "X") Or (Range("E9:E11").Text = "O")) Then Call Game_Over("cLine4")
            If ((Range("E10:G10").Text = "X") Or (Range("E10:G10").Text = "O")) Then Call Game_Over("cLine2")
        Case "E11"
            If ((Range("E9:E11").Text = "X") Or (Range("E9:E11").Text = "O")) Then Call Game_Over("cLine4")
            If ((Range("E11:G11").Text = "X") Or (Range("E11:G11").Text = "O")) Then Call Game_Over("cLine3")
            If ((Range("E11,F10,G9").Text = "X") Or (Range("E11,F10,G9").Text = "O")) Then Call Game_Over("cLine8")
        Case "F9"
            If ((Range("E9:G9").Text = "X") Or (Range("E9:G9").Text = "O")) Then Call Game_Over("cLine1")
            If ((Range("F9:F11").Text = "X") Or (Range("F9:F11").Text = "O")) Then Call Game_Over("cLine5")
        Case "F10"
            If ((Range("E9,F10,G11").Text = "X") Or (Range("E9,F10,G11").Text = "O")) Then Call Game_Over("cLine7")
            If ((Range("E10:G10").Text = "X") Or (Range("E10:G10").Text = "O")) Then Call Game_Over("cLine2")
            If ((Range("F9:F11").Text = "X") Or (Range("F9:F11").Text = "O")) Then Call Game_Over("cLine5")
        Case "F11"
            If ((Range("E11:G11").Text = "X") Or (Range("E11:G11").Text = "O")) Then Call Game_Over("cLine3")
            If ((Range("F9:F11").Text = "X") Or (Range("F9:F11").Text = "O")) Then Call Game_Over("cLine5")
        Case "G9"
            If ((Range("E9:G9").Text = "X") Or (Range("E9:G9").Text = "O")) Then Call Game_Over("cLine1")
            If ((Range("E11,F10,G9").Text = "X") Or (Range("E11,F10,G9").Text = "O")) Then Call Game_Over("cLine8")
            If ((Range("G9:G11").Text = "X") Or (Range("G9:G11").Text = "O")) Then Call Game_Over("cLine6")
        Case "G10"
            If ((Range("E10:G10").Text = "X") Or (Range("E10:G10").Text = "O")) Then Call Game_Over("cLine2")
            If ((Range("G9:G11").Text = "X") Or (Range("G9:G11").Text = "O")) Then Call Game_Over("cLine6")
        Case "G11"
            If ((Range("E9,F10,G11").Text = "X") Or (Range("E9,F10,G11").Text = "O")) Then Call Game_Over("cLine7")
            If ((Range("E11:G11").Text = "X") Or (Range("E11:G11").Text = "O")) Then Call Game_Over("cLine3")
            If ((Range("G9:G11").Text = "X") Or (Range("G9:G11").Text = "O")) Then Call Game_Over("cLine6")
    End Select
End Sub
Private Sub Clear_Board()
    Dim i, j As Integer
    
    For i = 1 To 3                                                      'clear board and reassign boxes
        For j = 1 To 3
            Range(Chr(68 + j) & (i + 8)).Value = ""                     'clear board
            Shapes("cBox" & Chr(68 + j) & (i + 8)).Visible = True       'display boxes
        Next
    Next
    For i = 1 To 8
        Shapes("cLine" & i).Visible = False                             'remove cross line
    Next
End Sub
Private Sub Game_Over(lineNum As String)
    Shapes(lineNum).Visible = True                                      'show cross line
    
    gameOver = True                                                     'game over
End Sub
Public Sub PlaceX(boxNum As String)
    If (Range(boxNum).Value = "") Then
        Range(boxNum).Value = "X"                                       'place X
        Shapes("cBox" & boxNum).Visible = False                         'remove clicked box
    
        Call CheckXO(boxNum)                                            'check for consecutive Xs
    End If
End Sub
Private Sub Initialize()
    gameLev = 0                                                         'set game level
    gameOver = False                                                    'game over
    
    Range("F19").Select                                                 'position location
End Sub
Public Sub Start_Game()
    Call Initialize                                                     'initialize variables
    Call Clear_Board                                                    'clear board and display boxes
    Call Check_Level                                                    'check game level
End Sub
Private Sub Worksheet_Activate()
    Call Start_Game                                                     'start game
End Sub
Related
Here are some additional topics associated with this experiment.
- Desktop games
 - Excel
 - Free downloads
 - Games
 - Guessword
 - Original version of Wingding Match game
 - Scrambler game for Excel – Experiment
 - Software library
 - Vintage stuff
 
Support
Techronology does not offer support for any experiments.
