codeiq2nd_intercal.rb
#!/usr/bin/ruby
#coding:utf-8
STR="CodeIQ 2周年!\n"
last=0
siz=STR.bytes.to_a.size
please=(siz+3)/4-2
puts "DO ,1 <- ##{siz}"
STR.each_byte.with_index{|e,i|
c = e
c = (c & 0x55) << 1 | (c & 0xaa) >> 1
c = (c & 0x33) << 2 | (c & 0xcc) >> 2
c = (c & 0x0f) << 4 | (c & 0xf0) >> 4
last2 = c
c = (last-c)&0xff
last = last2
print 'PLEASE ' if i<=please
puts "DO ,1 SUB ##{i+1} <- ##{c&0xff}"
}
puts 'PLEASE READ OUT ,1'
puts 'PLEASE GIVE UP'
__END__
[cesspool.c]
unsigned int lastout = 0;
c = lastout - a[i];
lastout = c;
c = (c & 0x0f) << 4 | (c & 0xf0) >> 4;
c = (c & 0x33) << 2 | (c & 0xcc) >> 2;
c = (c & 0x55) << 1 | (c & 0xaa) >> 1;
putchar(c);
codeiq2nd_intercal.i
DO ,1 <- #20
PLEASE DO ,1 SUB #1 <- #62
PLEASE DO ,1 SUB #2 <- #204
PLEASE DO ,1 SUB #3 <- #208
PLEASE DO ,1 SUB #4 <- #128
DO ,1 SUB #5 <- #20
DO ,1 SUB #6 <- #8
DO ,1 SUB #7 <- #134
DO ,1 SUB #8 <- #13
DO ,1 SUB #9 <- #186
DO ,1 SUB #10 <- #244
DO ,1 SUB #11 <- #162
DO ,1 SUB #12 <- #30
DO ,1 SUB #13 <- #116
DO ,1 SUB #14 <- #110
DO ,1 SUB #15 <- #10
DO ,1 SUB #16 <- #112
DO ,1 SUB #17 <- #54
DO ,1 SUB #18 <- #186
DO ,1 SUB #19 <- #188
DO ,1 SUB #20 <- #49
PLEASE READ OUT ,1
PLEASE GIVE UP