9 ms·
Resetting the state isn't one of the rules ;) I'd make a solution which resets the state linked by the table though, so please submit one!
by eatnumber1 12y ago
Resetting the state isn't one of the rules ;)
I'd make a solution which resets the state linked by the table though, so please submit one!
- bobbyi_settv 12y agoRule 7 says: g('al') must return "gal". If you add assert g('al') == 'gal' as the last line of solution 1, the assertion will not pass. I'm not saying there is a rule that mentions "resetting state". I'm saying that their failure to reset state is the bug leading to them not following the rules.
- nickdepinet 12y agoThanks for pointing this out, it's now fixed. https://github.com/eatnumber1/goal/pull/18 https://github.com/eatnumber1/goal/pull/18
- bobbyi_settv 12y agoNick, That helps but doesn't completely solve the state problem. Try adding these two lines to the end of the program: g()()()()() print g('al') I think 'gal' should be printed here. Rule 7 says that's what your function should return given 'al', and the fact that we've called it in some other way before doesn't change the fact that it is required to return 'gal' given 'al'. The solution I posted above handles this scenario (and, as a bonus, is thus threadsafe in case multiple people were doing g()()()('al') simultaneously).