Hello guys!
I am making a rather simple game and need some help building the logic.
Basically it is a game of strategy (probably not a very good one mind lol!). What it involves is a grid of 100 squares (10 x 10) and is a two player.
The players take it in turns to 'capture' a square by clicking on it to make it change the backcolor property to the colour of their team. Once all the squares have been changed from their default colour the game is over and the player with the most squares of their colour wins.
The really simple answer is, the first person that goes will win, unless I add some logic that will allow players to 'capture' other player's squares. However, I want there to be rules about what they can 'capture' and when, otherwise they'll just be able to keep capturing each others square willy nilly.
I have it so that the red player cannot simply 'capture' a blue square for the sake of it and vice versa. I want to be able to code the rules so that if a blue square is sharing two (or three, I haven't decided that bit yet) sides of red squares then the red player can 'capture' it. The rules are going to be a little more complicated than that to add a bit of a challenge once the board starts to get filled.
What I need to know, is how to make the application detect what the surrounding squares colours are if a player tries to capture another player's square.
The code I have so far is not really relevant to this bit of the exercise, it is merely detecting what colour the current square is at and if it's anything other than the default colour then it doesn't allow it to be selected again. However, if anyone wants to see what I've got let me know.
Cheers guys
I am making a rather simple game and need some help building the logic.
Basically it is a game of strategy (probably not a very good one mind lol!). What it involves is a grid of 100 squares (10 x 10) and is a two player.
The players take it in turns to 'capture' a square by clicking on it to make it change the backcolor property to the colour of their team. Once all the squares have been changed from their default colour the game is over and the player with the most squares of their colour wins.
The really simple answer is, the first person that goes will win, unless I add some logic that will allow players to 'capture' other player's squares. However, I want there to be rules about what they can 'capture' and when, otherwise they'll just be able to keep capturing each others square willy nilly.
I have it so that the red player cannot simply 'capture' a blue square for the sake of it and vice versa. I want to be able to code the rules so that if a blue square is sharing two (or three, I haven't decided that bit yet) sides of red squares then the red player can 'capture' it. The rules are going to be a little more complicated than that to add a bit of a challenge once the board starts to get filled.
What I need to know, is how to make the application detect what the surrounding squares colours are if a player tries to capture another player's square.
The code I have so far is not really relevant to this bit of the exercise, it is merely detecting what colour the current square is at and if it's anything other than the default colour then it doesn't allow it to be selected again. However, if anyone wants to see what I've got let me know.
Cheers guys