Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

PHP, 98 + 270 = 368 bytes

I wanted to take a different approach from what Titus proposedTitus proposed, and ended with a slightly longer, yet less penalized program.

$v=unpack('H*',$argv[1]);$e=base_convert($v[1],16,2);echo!stristr($e,'0000')&&!stristr($e,'1111');

Outputs 1 for truthy, nothing for falsey.

Try it here !

Binary-encoded :

0010010001110110001111010111010101101110011100000110000101100011011010110010100
0001001110100100000101010001001110010110000100100011000010111001001100111011101
1001011011001100010101110100101001001110110010010001100101001111010110001001100
0010111001101100101010111110110001101101111011011100111011001100101011100100111
0100001010000010010001110110010110110011000101011101001011000011000100110110001
0110000110010001010010011101101100101011000110110100001101111001000010111001101
1101000111001001101001011100110111010001110010001010000010010001100101001011000
0100111001100000011000000110000001100000010011100101001001001100010011000100001
0111001101110100011100100110100101110011011101000111001000101000001001000110010
1001011000010011100110001001100010011000100110001001001110010100100111011

(22 occurences of 0000 and 5 occurrences of 1111, hence 270 bytes of penalty)

PHP, 98 + 270 = 368 bytes

I wanted to take a different approach from what Titus proposed, and ended with a slightly longer, yet less penalized program.

$v=unpack('H*',$argv[1]);$e=base_convert($v[1],16,2);echo!stristr($e,'0000')&&!stristr($e,'1111');

Outputs 1 for truthy, nothing for falsey.

Try it here !

Binary-encoded :

0010010001110110001111010111010101101110011100000110000101100011011010110010100
0001001110100100000101010001001110010110000100100011000010111001001100111011101
1001011011001100010101110100101001001110110010010001100101001111010110001001100
0010111001101100101010111110110001101101111011011100111011001100101011100100111
0100001010000010010001110110010110110011000101011101001011000011000100110110001
0110000110010001010010011101101100101011000110110100001101111001000010111001101
1101000111001001101001011100110111010001110010001010000010010001100101001011000
0100111001100000011000000110000001100000010011100101001001001100010011000100001
0111001101110100011100100110100101110011011101000111001000101000001001000110010
1001011000010011100110001001100010011000100110001001001110010100100111011

(22 occurences of 0000 and 5 occurrences of 1111, hence 270 bytes of penalty)

PHP, 98 + 270 = 368 bytes

I wanted to take a different approach from what Titus proposed, and ended with a slightly longer, yet less penalized program.

$v=unpack('H*',$argv[1]);$e=base_convert($v[1],16,2);echo!stristr($e,'0000')&&!stristr($e,'1111');

Outputs 1 for truthy, nothing for falsey.

Try it here !

Binary-encoded :

0010010001110110001111010111010101101110011100000110000101100011011010110010100
0001001110100100000101010001001110010110000100100011000010111001001100111011101
1001011011001100010101110100101001001110110010010001100101001111010110001001100
0010111001101100101010111110110001101101111011011100111011001100101011100100111
0100001010000010010001110110010110110011000101011101001011000011000100110110001
0110000110010001010010011101101100101011000110110100001101111001000010111001101
1101000111001001101001011100110111010001110010001010000010010001100101001011000
0100111001100000011000000110000001100000010011100101001001001100010011000100001
0111001101110100011100100110100101110011011101000111001000101000001001000110010
1001011000010011100110001001100010011000100110001001001110010100100111011

(22 occurences of 0000 and 5 occurrences of 1111, hence 270 bytes of penalty)

Source Link
roberto06
  • 351
  • 2
  • 6

PHP, 98 + 270 = 368 bytes

I wanted to take a different approach from what Titus proposed, and ended with a slightly longer, yet less penalized program.

$v=unpack('H*',$argv[1]);$e=base_convert($v[1],16,2);echo!stristr($e,'0000')&&!stristr($e,'1111');

Outputs 1 for truthy, nothing for falsey.

Try it here !

Binary-encoded :

0010010001110110001111010111010101101110011100000110000101100011011010110010100
0001001110100100000101010001001110010110000100100011000010111001001100111011101
1001011011001100010101110100101001001110110010010001100101001111010110001001100
0010111001101100101010111110110001101101111011011100111011001100101011100100111
0100001010000010010001110110010110110011000101011101001011000011000100110110001
0110000110010001010010011101101100101011000110110100001101111001000010111001101
1101000111001001101001011100110111010001110010001010000010010001100101001011000
0100111001100000011000000110000001100000010011100101001001001100010011000100001
0111001101110100011100100110100101110011011101000111001000101000001001000110010
1001011000010011100110001001100010011000100110001001001110010100100111011

(22 occurences of 0000 and 5 occurrences of 1111, hence 270 bytes of penalty)