tic tac toe vb.net

New product

Game of three online or the old one programmed in Visual Basic NET. Free source code download.

tic tac toe vb.net


The popular and very simple game of three online or the old one programmed in Visual Basic NET. Use the basics of games, such as moments of updating and painting immediately.

 

Game rules


A player chooses to be the X or the O. In each turn he can only place one in order to get 3 in a row on a vertical, horizontal or diagonal line.

The game ends once all 3 in a row are achieved or when all the spaces are filled, ending in a draw if none of them manages to link three of their pieces in a row.

Some examples of combinations:

game rules tic tac toe

Game programming tic tac toe at vb.net.

Do not use sprites for the board elements, or for the board given their simplicity. GDI + is used for this painting job.

As we are painting on the bottom of the form immediately, it is necessary to enable the doublebuffer of the form to avoid flickering.

Basically two objects are programmed.

  - Board: General container.

  - Cell: Manage the behavior of each cell on the board.

  - FormPrincipal: The form where objects are painted.

To search for the winning player, use a bit marking scheme, using two 32-bit integer registers.

bit register of tic tac toe movements


As you can see in the previous image, each box is a bit of weight of an integer register, only use 9 bits of the 32 that make up the register.

The program goes through the boxes and dials the corresponding bit if you get the icon in the box.

Once this is done, a masking is made for the possible winning combinations and the winner is determined.

It is simple and fast. An example is seen below:

bit register of tic tac toe movements example


Note that bits 0, 4 and 8 of the 32-bit integer array are on.

Source code download

To better see everything I explain here, below I leave the link to download the entire project in Visual Basic .NET

Download source code

Written by:

Delete G.

Eliprogram

09/05/2019
Grade 
09/06/2019

Muy buena explicacion

El codigo fuente totalmente disponible. Gracias

    Write your review!

    Write a review

    tic tac toe vb.net

    tic tac toe vb.net

    Game of three online or the old one programmed in Visual Basic NET. Free source code download.

    Ask a question

    NO registration required!

    If the question you have has not yet been answered here, use the form below to ask something about this addon.

    (optional)
    *(Required to be notified when an answer is available)

    If the download link redirects to another product that is not described in the article or is broken, report it using our Reporting Form