I have started to create a Checkers board for play between two people, or the display of checkers notation files (.pdn files) from written or downloadable texts.
The workbook (I'm not sure how or if the WB should be attachred?) is not intended (at this stage) to be checkers/draughts program, nor govern legal or non-legal moves, it will simply reset the graphics and hopefully record where pieces are moved (in the move cells) and vice versa:
My question, what is the best way to go about recording the picture/piece moves in the move cells (Pieces/pics have a unique name):
I move 11-15. Move 1 cells show 11-15…
Or if I am reviewing .pdn files
11-15 would be inserted into Move 1 cell, selecting the cells in sequence would move the pieces, It would be good if this could only be done in sequence or in reverse i.e. you could not go to the middle of a game as move 1 (but some time down the line clicking on move 23… would set all moves from 1 to 23)
But I am now putting the cart before the horse!!! For the purpose of showing the intention of the final operability.
Should I look at conditional formatting, if then else, do while or could this best handled with a 2d or multi-dimensional array?
I am a vba newbie so bear with my coding…
The Checkers Board is numbered (1-32) and has a reset button to set all the white and black pieces as well as two stacks of kings. I do realise i may need additional coding to cetralise manual moves so that fure indexing finds a piece within one cell only.
current code:
Sub Reset_Draughts_White()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Name = "Picture wk" Then
shp.Top = Range("k3").Top + (Range("k3").Height - shp.Height) / 2
shp.Left = Range("k3").Left + (Range("k3").Width - shp.Width) / 2
ElseIf shp.Name = "Picture bk" Then
shp.Top = Range("l3").Top + (Range("l3").Height - shp.Height) / 2
shp.Left = Range("l3").Left + (Range("l3").Width - shp.Width) / 2
End If
Next shp
'Reset Black Pieces
With ActiveSheet.Shapes("Picture c2")
.Top = Range("C2").Top + (Range("C2").Height - .Height) / 2
.Left = Range("c2").Left + (Range("c2").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture e2")
.Top = Range("e2").Top + (Range("e2").Height - .Height) / 2
.Left = Range("e2").Left + (Range("e2").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture g2")
.Top = Range("g2").Top + (Range("g2").Height - .Height) / 2
.Left = Range("g2").Left + (Range("g2").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture i2")
.Top = Range("i2").Top + (Range("i2").Height - .Height) / 2
.Left = Range("i2").Left + (Range("i2").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture b3")
.Top = Range("b3").Top + (Range("b3").Height - .Height) / 2
.Left = Range("b3").Left + (Range("b3").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture d3")
.Top = Range("d3").Top + (Range("d3").Height - .Height) / 2
.Left = Range("d3").Left + (Range("d3").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture f3")
.Top = Range("f3").Top + (Range("f3").Height - .Height) / 2
.Left = Range("f3").Left + (Range("f3").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture h3")
.Top = Range("h3").Top + (Range("h3").Height - .Height) / 2
.Left = Range("h3").Left + (Range("h3").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture c4")
.Top = Range("c4").Top + (Range("c4").Height - .Height) / 2
.Left = Range("c4").Left + (Range("c4").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture e4")
.Top = Range("e4").Top + (Range("e4").Height - .Height) / 2
.Left = Range("e4").Left + (Range("e4").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture g4")
.Top = Range("g4").Top + (Range("g4").Height - .Height) / 2
.Left = Range("g4").Left + (Range("g4").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture i4")
.Top = Range("i4").Top + (Range("i4").Height - .Height) / 2
.Left = Range("i4").Left + (Range("i4").Width - .Width) / 2
End With
'Reset White Pieces
With ActiveSheet.Shapes("Picture b7")
.Top = Range("b7").Top + (Range("b7").Height - .Height) / 2
.Left = Range("b7").Left + (Range("b7").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture d7")
.Top = Range("d7").Top + (Range("d7").Height - .Height) / 2
.Left = Range("d3").Left + (Range("d7").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture f7")
.Top = Range("f7").Top + (Range("f7").Height - .Height) / 2
.Left = Range("f7").Left + (Range("f7").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture h7")
.Top = Range("h7").Top + (Range("h7").Height - .Height) / 2
.Left = Range("h7").Left + (Range("h7").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture c8")
.Top = Range("c8").Top + (Range("c8").Height - .Height) / 2
.Left = Range("c8").Left + (Range("c8").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture e8")
.Top = Range("e8").Top + (Range("e8").Height - .Height) / 2
.Left = Range("e8").Left + (Range("e8").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture g8")
.Top = Range("g8").Top + (Range("g8").Height - .Height) / 2
.Left = Range("g8").Left + (Range("g8").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture i8")
.Top = Range("i8").Top + (Range("i8").Height - .Height) / 2
.Left = Range("i8").Left + (Range("i8").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture b9")
.Top = Range("b9").Top + (Range("b9").Height - .Height) / 2
.Left = Range("b9").Left + (Range("b9").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture d9")
.Top = Range("d9").Top + (Range("d9").Height - .Height) / 2
.Left = Range("d9").Left + (Range("d9").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture f9")
.Top = Range("f9").Top + (Range("f7").Height - .Height) / 2
.Left = Range("f9").Left + (Range("f7").Width - .Width) / 2
End With
With ActiveSheet.Shapes("Picture h9")
.Top = Range("h9").Top + (Range("h9").Height - .Height) / 2
.Left = Range("h9").Left + (Range("h9").Width - .Width) / 2
End With
End Sub
Display More
S.