Hello,
I am pretty new to the c++ language I am doing a coding challenge regarding checking the values of a vector.
I have been stuck on this challenge for hours and I can't think of a proper solution.
I have a vector which is called values that looks like this :
Code:
std::vector <char > values {a,b,a,b,b,b,a,a,a,a,b,b,a};
Then after three values a column is started , so at the end this is how the values should be looked at
Player 1 has the letter a and player 2 the letter b.
If player one has orthogonally connecting a's (exluding diagonal a's) he get's points at the end of the iteration.
If one a is not connected to any other a player 1 get's one point. Two a's are worth 2 points and for 3 a's 5 points. Always excluding diagonal a's.
If there are more than 3 connected a's player 1 gets 2 points extra. for example 4 a's 7 points and 5' as 9 points.
This applies for player 2 as well.
The tricky part is that a player can get points for more than one group of orthogonally connects a's or b's.
So for example if player 1 has a group of 3 'as he gets 5 points. If he also has a single a he get's a point.
So at the end he get's 6 points altogether.
in this case:
Player 1 gets : 9+1+1
Player 2 gets: 7+2
I hope my question is clear.
I would be thankful for any hint.