#!/usr/bin/ruby bomb = [ 0b110000000000, 0b011000000000, 0b001100000000, 0b000110000000, 0b000011000000, 0b000000110000, 0b000000011000, 0b000000001100, 0b000000000110, 0b000000000011, 0b000001000001, 0b000010000010, 0b000100000100, 0b001000001000, 0b010000010000, 0b100000100000 ]; def printlist(num) str = "" 0.upto 11 do |n| str = (((1 << n) & num) == 0 ? "A" : "B") + str end printf("%s\n%s\n", str[0,6],str[6,6]); end count = 0 0.upto 0xfff do |n| chk = true for b in bomb do if (n & b) == b then chk = false break end end if chk then count = count + 1 printf("%d)\n", count) printlist n end end