[chbot] New chocolate fish challenge

Volker Kuhlmann list0570 at paradise.net.nz
Wed Nov 19 03:51:48 GMT 2014


On Wed 19 Nov 2014 16:30:31 NZDT +1300, Mark Atherton wrote:

> should be possible to build a 6 bit counter using xors and tests -

One could consider xor to be a mathematical operation.

> I think the brain may need plugging in backwards for this one.

Buy your own chocolate fish...? ;-)

Use a counter of the microcontroller. Step each call, test, reload +
return 1 on over-/underflow. Is this called "outsourcing the heavy
lifting"? The function used to explain the algorithm would be easier
though. Or are we dealing with one of these retarded microchip 3bit CPUs
here? *ducks for cover*

> >int chocolate_fish(void)
> >{
> >  unsigned counter = 0;

  static unsigned counter = 0;

> >   if(counter == 59) {
> >      counter = 0;
> >      return 1;
> >   }
> >   counter++;
> >   return 0;
> >}

Volker

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



More information about the Chchrobotics mailing list