|
4 | 4 | require_relative 'grid'
|
5 | 5 | require 'stringio'
|
6 | 6 |
|
7 |
| -(0..5).each do |in_pos| |
8 |
| - (1..5).each do |out_pos| |
9 |
| - next if in_pos == out_pos |
10 |
| - (1..5).each do |end_pos| |
11 |
| - next if end_pos == in_pos || end_pos == out_pos |
12 |
| - code = ' '*6 |
13 |
| - code[in_pos] = ',' |
14 |
| - code[out_pos] = ';' |
15 |
| - code[end_pos] = '@' |
16 |
| - |
17 |
| - $stderr.puts code |
18 |
| - |
19 |
| - (('"'..'~').to_a-['`','?']).repeated_permutation(3) do |a,b,c| |
20 |
| - this_code = code.clone |
21 |
| - this_code.sub!(' ',a) |
22 |
| - this_code.sub!(' ',b) |
23 |
| - this_code.sub!(' ',c) |
24 |
| - |
25 |
| - in_stream = StringIO.new('') |
26 |
| - out_stream = StringIO.new |
27 |
| - errored = false |
28 |
| - begin |
29 |
| - aborted = Hexagony.run(this_code, 0, in_stream, out_stream, 200) |
30 |
| - rescue |
31 |
| - next |
32 |
| - end |
33 |
| - |
34 |
| - next if aborted || !(out_stream.string.empty?) |
35 |
| - |
36 |
| - in_stream = StringIO.new("\x00\x01\x00\x02") |
37 |
| - out_stream = StringIO.new |
38 |
| - errored = false |
39 |
| - begin |
40 |
| - aborted = Hexagony.run(this_code, 0, in_stream, out_stream, 200) |
41 |
| - rescue |
42 |
| - next |
43 |
| - end |
44 |
| - |
45 |
| - next if aborted || !(out_stream.string =~ /^\x00\x01\x00\x02$/) |
46 |
| - |
47 |
| - in_stream = StringIO.new('c0|#') |
48 |
| - out_stream = StringIO.new |
49 |
| - |
50 |
| - begin |
51 |
| - aborted = Hexagony.run(this_code, 0, in_stream, out_stream, 200) |
52 |
| - rescue |
53 |
| - next |
54 |
| - end |
55 |
| - |
56 |
| - if !aborted && (out_stream.string =~ /^c0\|\#$/) |
57 |
| - puts this_code |
58 |
| - $stderr.puts this_code |
| 7 | +[')', '('].each do |count_char| |
| 8 | + (0..5).each do |inc_pos| |
| 9 | + ([*1..5]-[inc_pos]).each do |out_pos| |
| 10 | + ([*1..5]-[inc_pos,out_pos]).each do |out2_pos| |
| 11 | + code = ' '*6 |
| 12 | + code[inc_pos] = count_char |
| 13 | + code[out_pos] = '!' |
| 14 | + code[out2_pos] = ';' |
| 15 | + |
| 16 | + $stderr.puts code |
| 17 | + |
| 18 | + (('"'..'~').to_a-"`?,@".chars).repeated_permutation(3) do |pos| |
| 19 | + this_code = code.clone |
| 20 | + pos.each do |c| this_code.sub!(' ',c) end |
| 21 | + |
| 22 | + in_stream = StringIO.new('') |
| 23 | + out_stream = StringIO.new |
| 24 | + errored = false |
| 25 | + begin |
| 26 | + aborted = Hexagony.run(this_code, 0, in_stream, out_stream, 35) |
| 27 | + rescue |
| 28 | + next |
| 29 | + end |
| 30 | + |
| 31 | + if aborted && (out_stream.string =~ /^1([ \n\t,])2(\1)3/) |
| 32 | + puts this_code |
| 33 | + $stderr.puts this_code |
| 34 | + end |
59 | 35 | end
|
60 | 36 | end
|
61 | 37 | end
|
|
0 commit comments