blacktiger
New Coder
The whole program will be based on values that will be entered by a user either "B" or "P"
Suppose user entered values
1. B
2. P
3. B
4. P
5. P
Now we should collect these data in set of three and we will therefore get -> BPB, PP...
Now our second set is incomplete, we will wait if user enters another values
6. B
7. P
8. P
9. P
Now we have BPB, PPB, PPP. Now we will count if any of these sets matches with our eight patterns
What are my eight patterns?
BBB, BPB, BPP, BBP, PPP, PPB, PBP, PBB
Then we will count if our collected sets match with any of these eight patterns
BBB - 0
PPB - 1
PPP - 1
BPB - 1
PBP - 0
PBB - 0
BPP - 0
BBP - 0
We will keep counting these patterns until we are left with only one pattern with zero frequency
Suppose after 30 entries we have below data
BBB - 1
PPB - 1
PPP - 1
BPB - 1
PBP - 3
PBB - 1
BPP - 2
BBP - 0
Now, the program should alert the user and print this left pattern for e.g BBP. And now if next three entries are exact same we will print true otherwise false.
Suppose user entered values
1. B
2. P
3. B
4. P
5. P
Now we should collect these data in set of three and we will therefore get -> BPB, PP...
Now our second set is incomplete, we will wait if user enters another values
6. B
7. P
8. P
9. P
Now we have BPB, PPB, PPP. Now we will count if any of these sets matches with our eight patterns
What are my eight patterns?
BBB, BPB, BPP, BBP, PPP, PPB, PBP, PBB
Then we will count if our collected sets match with any of these eight patterns
BBB - 0
PPB - 1
PPP - 1
BPB - 1
PBP - 0
PBB - 0
BPP - 0
BBP - 0
We will keep counting these patterns until we are left with only one pattern with zero frequency
Suppose after 30 entries we have below data
BBB - 1
PPB - 1
PPP - 1
BPB - 1
PBP - 3
PBB - 1
BPP - 2
BBP - 0
Now, the program should alert the user and print this left pattern for e.g BBP. And now if next three entries are exact same we will print true otherwise false.