[chbot] New chocolate fish challenge

Charles Manning cdhmanning at gmail.com
Wed Nov 19 20:12:05 GMT 2014


There are a lot of similar useful counters and such that are often used in
FPGAs etc because add 1 and compare style counting is often too slow.

eg. http://en.wikipedia.org/wiki/Ring_counter



On Thu, Nov 20, 2014 at 7:41 AM, Volker Kuhlmann <list0570 at paradise.net.nz>
wrote:

> 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.
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Web site: http://kiwibots.org
> Meetings 3rd Monday each month.
>
> When replying, please edit your Subject line to reflect new content.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20141120/0179f53f/attachment.html>


More information about the Chchrobotics mailing list