| 03-01-2007, 12:35 AM | #1 |
Ok, i've been trying to figure this out for a while now and it literally has given me a headache/a few pages of 1's and 0's. I'm trying to make a code, of 1's (trues) and 0's (falses) so that every 6 is a different combination of 1's and 0's, with no repeats. It should be 69 characters. I'm close, close, but I just can't seem to get it right. It should follow a pattern right, as most math stuff does, so I did it for every 4, and every 5 also. For 4. 1111010010110000111 Ex. 1111, 1110, 1101... For 5. 111110110011010100100010111000001111 Notice the patern with # of 0's inbetween and the number of 1's together. This is the first where the 1 zero repeats (for 1). For 6(so far) 1111110111001110101010010001000010110110011000110111001110111100000011111. Its 4 characters over the limit. And a tool I made to help me with this detected that 111001, 001000, 100111, 101010, and 011101 repeat and 101011, 110100, 100101, 010111, and 001001 can't be found. Close, but i'm burnt out and can't think about it anymore. I was just hoping maybe someone has done this before(its for a save/load code), or maybe someone is really good with this stuff. Its almost like one of those tricky puzzles. |
| 03-01-2007, 07:05 AM | #2 |
Use substrings. Ex 1 : 1001001 //1001 repeated Set X = 4 //meaning 4 is the max length of the substrings Take the X first values of the string. //Set Y = (Substring 1,X of Ex 1), returning 1001 Loop from 0 to ((Length of (Ex 1)) - 1 - X) and Do Actions -> If Substring (2 + (Integer A)),(2 + X + (Integer A) - 1) of Ex 1) Equal to Y -> Then Custom Script : call BJDebugMsg(I2S(X)+" has been detected on the code!") -> Else //nothing Lets try the loop if you are not ok for. Loop 0 to (7-1-4 = 2) Loop 0 : Substring(2+0=2 ,2+4+0=5) of Ex 1 = 0010 =! 1001 Loop 1 : Substring(2+1=3 ,2+4+1=6) of Ex 1 = 0100 =! 1001 Loop 2 : Substring(2+2=4 ,2+4+2=7) of Ex 1 = 1001 == 1001, Condition True And you can customize this easily. |
| 03-01-2007, 08:04 AM | #3 |
It's a neat problem but it begs the question why. Here's one solution, you can generate another three by reflecting/inverting it. 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 0 0 0 0 |
