[chbot] New chocolate fish challenge

Volker Kuhlmann list0570 at paradise.net.nz
Wed Nov 19 18:41:41 GMT 2014


On Wed 19 Nov 2014 22:07:12 NZDT +1300, Michael Field wrote:

> static int chocolate_fish_challenge(void) {
>   static unsigned char reg = 0x22;
>   if(reg) {
>     reg = (reg >> 1) ^ ((reg & 1) ? 0 : 0x30);
>     return 0;
>   }
>   reg = 0x22;
>   return 1;
> }

Interesting!
How did you find the start value, early exit condition and tap positions?

What application do you have requiring this? Incrementing a counter to
60 gives shorter code, faster execution, and a lot less maintenance
headache for the same memory requirements.

Thanks,

Volker

-- 
Volker Kuhlmann
http://volker.top.geek.nz/	Please do not CC list postings to me.



More information about the Chchrobotics mailing list