Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- STDOUT.sync = true # DO NOT REMOVE
- # Don't let the machines win. You are humanity's last hope...
- width = gets.to_i # the number of cells on the X axis
- height = gets.to_i # the number of cells on the Y axis
- world = []
- height.times do
- y=[]
- gets.chars.each{|e| y<<e} # width characters, each either 0 or .
- world << y
- end
- STDERR.puts width
- for j in (0..width-1) do
- for i in (0..height-1) do
- STDERR.puts "x: y: "+ j.to_s + " " + i.to_s
- if(world[i][j] == "0") then
- print "#{j} #{i}"
- for jj in (j..width-1) do
- if(world[i][jj]=="0" && jj!=j) then
- print " #{jj} #{i}"
- break
- else
- if jj==(width-1) then print " -1 -1" end
- end
- end
- for ii in (i..height-1) do
- if(world[j][ii]=="0"&&ii!=i) then
- print " #{j} #{ii}"
- break
- else
- if ii==(height-1) then print " -1 -1" end
- end
- end
- puts
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement