Finding a pattern within a string variable in C#
Posted
by lo3
on Stack Overflow
See other posts from Stack Overflow
or by lo3
Published on 2010-04-29T06:54:57Z
Indexed on
2010/04/29
7:07 UTC
Read the original article
Hit count: 463
Ok i'm working on a project for a 200 level C# course, we are required to create a heads or tails project. Basically the project is setup so that the computer will guess randomly up to 5 times, but on the sixth time it will look into the playersGuessHistory variable setup as a string to see if it can find a match for a pattern of 4 entires, if there is a pattern found the computer will guess the next character after the pattern EX: [HHTT]H [HHTTH]H HHTT being the pattern then the computer would guess H for the next turn. My only problem is that i'm having difficulty setting up the project so that it will look through the playersguesshistory and find the patterns and guess the next character in the history. Any suggestions?
© Stack Overflow or respective owner