Excel VBA Chess Challenge #1

July 29, 2020

Welcome to the Spreadsheet Skunkworks!

Can we create a chess computer in an Excel spreadsheet using Excel VBA?

Download the file used in this video here:

Spreadsheet Skunkworks playlist here:

Welcome to the Spreadsheet Skunkworks! In this video series, Chris tests the boundaries of what is possible in Excel. You will not find the usual step-by-step tuition here; the focus is on experimentation and creativity. Expect plenty of coding challenges, and some nice surprises about what is possible in Excel…

We will seek to use Excel’s functions and Excel VBA to create the functions of a chess computer. We do not know to what extent this is possible but, ultimately, we would like to challenge somebody to a game on Chess.com using our spreadsheet-based system. Along the way, we aim to learn lots about Excel VBA and its capabilities.

Some key questions:
– How can we represent a chess board and chess pieces in Excel?
– Can we make Excel understand where the pieces can move?
– Can we ‘teach’ Excel some simple chess principles (capture the other pieces, move your pieces to good squares), and get Excel to recommend a move to make?

In this video, the challenge is to create a visual ‘chessboard’ effect in Excel. Chris first looks at how to do this ‘manually’ and presents some time-saving tips. Then, we explore how to use Excel VBA to speed up what could be a time-consuming task. Chris first records some code to format a cell and employs a ‘loop within a loop’ to colour the 64 squares of the chessboard. Some VBA techniques on show include ‘do – until’ loops and conditional statements. Enjoy!

What do you think about the Spreadsheet Skunkworks series? Do you have any ideas for Chris? Don’t forget to leave a comment.

Get in touch with Tiger using the platforms below!
For regular spreadsheet hints and tips and more on the #ExcelRevolution:

Nguồn: https://ganeshotsavam.org

Xem thêm bài viết khác: https://ganeshotsavam.org/game/

All Comments

  • Thank you so much, sir, I am making my own monoply board from this method

    TSR Education July 29, 2020 8:28 am Reply
  • Thank you Chris, excellent video, I appreciate your teaching method. Great Job
    I have being searching for something like this for awhile now

    Yves Perron July 29, 2020 8:28 am Reply
  • Awesome challenge and even better video! I've been looking for something like this for a long time. 1+ sub, I'll definitely follow your challenge to end to try to replicate your programs…. Thanks a lot!!!

    Lucas Moraes July 29, 2020 8:28 am Reply
  • very nice sir the same thing I was looking for that great job awesome

    Vinod Poptani July 29, 2020 8:28 am Reply
  • This can be done simply with the following code…
    Sub ColorBoard()
    Dim i As Long, j As Long, r As Long
    Range("C3:J10").Interior.ColorIndex = xlNone
    For i = 10 To 3 Step -1
    r = r + 1
    For j = 3 To 10 Step 2
    If (r Mod 2) = 0 And j = 3 Then j = j + 1
    Cells(i, j).Interior.Color = vbBlack
    Next j
    Next i
    End Sub

    sktneer July 29, 2020 8:28 am Reply

    sandhya jakhar July 29, 2020 8:28 am Reply
  • badiya h bai

    sandhya jakhar July 29, 2020 8:28 am Reply
  • You talk a lot…

    uzair malik July 29, 2020 8:28 am Reply
  • Dear Chris, I'm watching this video after 9 months from the first time and I'm understanding all without subtitles! So I'm happy because in addition to having taught to use the VBA, I have also learned to understand the English language. Thanks again for everything, good work and greetings from Italy.

    Mauro Castagnera July 29, 2020 8:28 am Reply
  • I have programmed a fully functional chess engine in an Excel sheet. Here is the link to download. https://drive.google.com/file/d/1XS7B7rvZeUkPrFbKV-7_0RQlrO4lugTp/view?usp=sharing

    Manulal M Inasu July 29, 2020 8:28 am Reply
  • Dear Chris,
    thank you very much for this video. J'll certainly join you in next videos because you are really a good teacher! Your teaching method is really awesome, simple and clear and with funny example like this. J agree that we need get away the day-to-day working pressure and create a safe space to doing something creative. Another thing I like about you is that you can transmit to those who listen to you not only technical concepts, but also you teach how to learn, that is how to deal with a problem step by step and how to solve it. It's a great quality for which I really congratulate you. I hope you have understood the meaning of my speech because I do not speak English perfectly.
    See you the next video!

    Mauro Castagnera July 29, 2020 8:28 am Reply
  • Nice video. I am building a spreadsheet that can play chess without any macro at the moment. It is will be just formulas.

    bengking001 July 29, 2020 8:28 am Reply
  • Really nice video! Thank you for this!

    André Bastos July 29, 2020 8:28 am Reply
  • thanks for sharing ur knowledge

    Happy Turtle July 29, 2020 8:28 am Reply

Leave a Reply

Your email address will not be published. Required fields are marked *