[chbot] New chocolate fish challenge

Mark Atherton markaren1 at xtra.co.nz
Wed Nov 19 06:13:42 GMT 2014


Below is a working simulation of the cascaded T type flip flop 
solution. Still not too sure about coding size constrains, I think it 
is a bit large.

Of all the solutions so far, my preference is Charles Manning's  PRN 
since there is not a requirement for linear counting. His idea could 
be coded quite tightly. Just a shift, an XOR or two, and when the 
terminal pattern is reached, reload the initial seed and flag the 
output. I guess the next step is to see if CMs solution can be coded 
in 10 instructions of assembler. If that fits, how about 10 bytes of 
assembler, maybe using the 6800.

-mark

=========================

int main(void)
{
	unsigned char val = 0;
	while(1)
	{
		val ^= 0x01;
		if((val & 0x01) == 0x00)	val^= 0x02;
		if((val & 0x03) == 0x00)	val^= 0x04;
		if((val & 0x07) == 0x00)	val^= 0x08;
		if((val & 0x0F) == 0x00)	val^= 0x10;
		if((val & 0x1F) == 0x00)	val^= 0x20;
		if(val == 60)
		{
			val = 0;
			printf("BINGO\n", val);
		}
		printf("val %d\n", val);
	}
	return(0);
}

val 0
val 1
val 2
val 3
val 4
val 5
val 6
val 7
val 8
val 9
val 10
val 11
val 12
val 13
val 14
val 15
val 16
val 17
val 18
val 19
val 20
val 21
val 22
val 23
val 24
val 25
val 26
val 27
val 28
val 29
val 30
val 31
val 32
val 33
val 34
val 35
val 36
val 37
val 38
val 39
val 40
val 41
val 42
val 43
val 44
val 45
val 46
val 47
val 48
val 49
val 50
val 51
val 52
val 53
val 54
val 55
val 56
val 57
val 58
val 59
BINGO




More information about the Chchrobotics mailing list