Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = File.readlines("shading.txt")
- $i = 0
- $switch = 0
- open('shading_out.txt','a'){|g|
- while $i < f.size do
- if f[$i] == f[$i+1]
- g.puts ($switch).even?.to_s
- else
- if $i == (f.size-1)
- $switch-=1
- g.puts ($switch).even?.to_s
- else
- g.puts ($switch).even?.to_s
- $switch+=1
- end
- end
- $i += 1
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment