I am creating a game called nim using VB. This game involves having 4 rows of counters. It is a two player game with one player being the computer. The two players take turns taking counters away and the person taking the last counter wins. A player can take any number of counters away on their go but only from one row out of the four at a time. So on one go a player CAN take all the counters from row 3 if they want to, but from no other row until their next go.
The rows are as follows:
row1 = 1 counter
row2 = 3 counters
row3 = 5 counters
row4 = 7 counters
I used labels to represent the counters. There are fifteen counters in total and the names of the counters start from; cmdCounter and end at cmdCounter15.
I put the following code in the click event of each counter, adjusting the counter name accordingly:
Private Sub cmdCounter_Click()
cmdCounter.Visible = False
Having done that for each counter I can now take the counter away when I click on it, which is good. Heres wher i get to my problem.
As i said previously the game is two player with one player being the computer. I want to add a command button so that when the user has taken their turn they click on this command button, so that the computer takes its turn and removes counters. I am not very good at writing code and i was wondering if anyone out their can help me with this problem. I really have no idea where to begin in even thinking of this sort of code!!
Anyone got any ideas??