Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Checkers

Daod43Daod43 Member Posts: 19
Hi, I have an assigment to do, it`s a checkers board, and it has to be playable,I am new with matrixes and I am having trouble with the 2-dimensional matrix board, and setting the pieces, does anyone know where can I find code for reference.

Any help is more than welcome
THNX!

Comments

  • seancampbellseancampbell Pennsylvania, USAMember Posts: 684 ✭✭✭
    What problems are you having with your Matricies?

    Dim iBoard(8,8) as Integer
    'Checker board is 8 squares by 8 squares
    'The square at iBoard(0,0) is white
    Dim i as Integer
    Dim h as Integer
    Dim EveryOther as Boolean

    'This bool is used to place a checker
    'every other square
    EveryOther = False
    For i = 0 to 2
    For h = 0 to 7
    If EveryOther = True Then
    iBoard(i, h) = 1
    EveryOther = False
    Else
    EveryOther = True
    End If
    Next h
    Next i

    EveryOther = False
    For i = 5 to 7
    For h = 0 to 7
    If EveryOther = True Then
    iBoard(i, h) = 2
    EveryOther = False
    Else
    EveryOther = True
    End If
    Next h
    Next i

    This should set up your Matrix to contain 0's in the areas where no peice is and contain a 1 or a 2 in the area where White or Black has peices.

    : Hi, I have an assigment to do, it`s a checkers board, and it has to be playable,I am new with matrixes and I am having trouble with the 2-dimensional matrix board, and setting the pieces, does anyone know where can I find code for reference.
    :
    : Any help is more than welcome
    : THNX!
    :

Sign In or Register to comment.