Created
February 13, 2018 17:08
-
-
Save obelisk68/2bd0e010498489995e13d2c21b1fbfd5 to your computer and use it in GitHub Desktop.
アルゴリズム・パズル q50 の求めるべき最長ルートの画像作成
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'oekaki' | |
W, H = 260, 220 | |
L = 40 | |
yoko = [[1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0]] | |
tate = [[0, 0, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 1, 1, 0, 0], [0, 1, 1, 0, 0], [0, 0, 0, 1, 1]] | |
Oekaki.app width: W, height: H do | |
draw do | |
clear | |
color(0, 0xffff, 0) | |
x0, y0 = 10, 10 | |
yoko.each_with_index do |ar, y| | |
ar.each_with_index do |f, x| | |
x1 = x0 + L * x | |
y1 = y0 + L * y | |
x2 = x1 + L | |
line(x1, y1, x2, y1) if f == 1 | |
end | |
end | |
tate.each_with_index do |ar, x| | |
ar.each_with_index do |f, y| | |
x1 = x0 + L * x | |
y1 = y0 + L * y | |
y2 = y1 + L | |
line(x1, y1, x1, y2) if f == 1 | |
end | |
end | |
#img = get_pic(0, 0, W, H) | |
#save_pic(img, "route_q50.png") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment