Closed jonnycomes closed 2 years ago
Note: after circular look and says are implemented, it would be nice to implement the drawing of look and say rings.
One way (the correct way?) to do this is implement necklace objects. A necklace is just a string where the first character is declared to be adjacent (after) the last character. However, when you split a necklace, you get strings back. Generating look and say necklaces isn't too difficult. However, one needs to (properly) implement the appropriate chemistry object for look and say necklaces. If a L&S necklace splits, then the persistent elements will be string-elements, but if the L&S necklace doesn't split you get persistent necklace-elements.
This would really be better as a separate (student) project.
In each term in a circular look and say sequence, we identify the end of the string with the beginning. For example, the string '012345678910' is the same as '001234567891'. Thus, the count of the first and last run of characters many need to be combined.
There should be a
CircularLookAndSay
class. This could be a wrapper ofLookAndSay
. Maybe there is a better design choice here?