11/16の課題

  1. ( g140057 )

    def draw_kadai(s)
      a = sqrt(3)
      b = s/2.0
      image = make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          c = x-b
          d = y-b
          image[y][x]=[kadai(x,y,s),kadai(-x/2.0+a*y/2.0+10,-a*x/2.0-y/2.0-10,s),kadai(-c/2.0-
                          a*d/2.0+b,a*c/2.0-d/2.0+b+10,s)]
        end
      end
      image
    end
    def kadai(y,x,s)
      a=(-y+s/2.0+s*sin(x*6.28/s)/2.0)/s*2+0.5
      a
    end
    
  2. ( g140477 )

    def is_even_ex(a,b)
      if (a-b)%2==0
        1
      else
        0
      end
    end
    def check(s)
      image = make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x] = is_even_ex(y,x)
        end
      end
      image
    end
    

    def c(s,x,y)
      r=s/2
      if distance(x,y,r,r)<=r
        (r-distance(x,y,r,r))/r
      else 
        0
      end
    end
    def d(s,x,y)
      r=s/2
      if distance(x,y,r,r)<=r/10
        [0,0,0]
      else
        [c(s,x,y),0,0]
      end
    end 
    def red_sphere2(s)
      image = make2d(s,s)
      for y in 0..(s-1) 
        for x in 0..(s-1)
          image[y][x] = [(c(s,x,y)),0,0]
          for z in (39*s/80)..(41*s/80)  
            image[z][x]=[0,0,0]
          end
        end
      end
    for a in (9*s/20)..(11*s/20) 
      for b in (9*s/20)..(11*s/20)
        image[a][b]=d(s,a,b)
      end
    end
    image
    
  3. ( g140560 )

    load("./make2d.rb")
    def a(s,x,y)
     if x>=y
      1
     else
      1.0*(s-x)/s
     end
    end
    def b(s,x,y)
     if x>=y
      1
     else
      1.0*y/s
     end
    end
    def kadai6(s)
      image = make2d(s,s)
      for y in 0..(s-1) 
        for x in 0..(s-1)
          image[y][x] =[0,a(s,x,y),b(s,x,y)]
        end  
      end  
     image
    end
    
  4. ( g140176 )

    def br(s,x,y)
      [sin(x-y)/(2.0*s),(x+y)**2/(4.0*s),(x-y)**2/(2.0*s)]
    end
    
    def square(s)
      image= make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[x][y]=br(s,x,y)
        end
      end
      image
    end
    
  5. ( g140180 )

    def sphere2(s)
     image = make2d(s,s)
      for y in 0..(s-1)
       for x in 0..(s-1)
        image[y][x] = (((2.0*y+x)%s)/s + ((1.0*y+2.0*x)%s)/s)/2
       end
      end
     image
    end
    
  6. ( g140470 )

    def b(s,x,y)
      r=s/2
      if r**2/16<=(x-r)*(y-r)  && (x-r)*(y-r)<=r**2/12
        [1,1,1]
      elsif distance(x,y,r,r)<=r
        [1,1,(r-distance(x,y,r/2,r/2))/r]
      else
        [0.8,1,1]
     end
    end
    def spheret(s)
      image = make2d(s,s)
      for y in 0..(s-1) 
        for x in 0..(s-1)
          image[y][x] = b(s,x,y)
        end  
      end  
      image
    end
    
  7. ( g140971 )

    require 'complex'
    
    EPS = 1e-5
    OMG = Complex.new(-0.5, 3**0.5/2)
    
    def solve(z)
      if z.abs<EPS
        return [1,1,1]
      end
      
      while true
        if (z-1).abs<EPS
          return [1,0,0]
        elsif (z-OMG).abs<EPS
          return [0,1,0]
        elsif (z-OMG*OMG).abs<EPS
          return [0,0,1]
        end
        z = (2.0*z+z**(-2))/3.0
      end
    end
    
    def chaos(n)
      grid=[]
      n.times do
        grid << [0]*n
      end
      
      (0...n).each do |y|
        (0...n).each do |x|
          grid[y][x] = solve(Complex.new( (x-n/2.0)*4/n,(y- n/2.0)*4/n))
        end
        puts y
      end
      
      return grid
    end
    
  8. ( g140557 )

    def qb()
      a=make2d(400,400)
      for y in 0..399
        for x in 0..399
          if d(x,y,100,140)<=10 || d(x,y,340,140)<=10
            a[y][x]=[1,1,1]
          else if d(x,y,80,160)<=30 || d(x,y,320,160)<=30
            a[y][x]=[0.7,0.1,0.1]
          else if d(x,y,80,160)<=40 || d(x,y,320,160)<=40
            a[y][x]=[1,0.2,0.2]
          else if y>278 && ((d(x,y,172,270)<=28 && d(x,y,172,270)>=26) || (d(x,y,224,270)<=28 
                  && d(x,y,224,270)>=26))
            a[y][x]=[0,0,0]
          else
            a[y][x]=[1,1,1]
          end
          end
          end
          end
        end
      end
      a
    end
    
  9. ( g140585 ) 画像は著作権的に問題があるため,投票後に削除しました.
    def italy(x)
      if x != 0 && x != 1
        print "マンマミーア!"
      else
        r = color(x)
        w = [1,1,1]
        g = [0.45,0.43,0.15]
        s = [1,0.6,0.4]
        a = make1d(18)
        for i in 0..17
          a[i] = mkitaly(i,r,w,g,s)
        end
        d = make1d(18)
        for j in 0..17
          d[j] = a[j]
        end
        show(d)
      end
    end
    
    def mkitaly(i,r,w,g,s)
      case i
      when 0
        [w,w,w,w,w,w,w,w,w,w,w,w,w,w]
      when 1     
        [w,w,w,w,r,r,r,r,r,w,w,w,w,w]
      when 2
        [w,w,w,r,r,r,r,r,r,r,r,r,w,w]
      when 3 
        [w,w,w,g,g,g,s,s,g,s,w,w,w,w]
      when 4
        [w,w,g,s,g,s,s,s,g,s,s,s,w,w]
      when 5
        [w,w,g,s,g,g,s,s,s,g,s,s,s,w]
      when 6
        [w,w,g,g,s,s,s,s,g,g,g,g,w,w]
      when 7
        [w,w,w,w,s,s,s,s,s,s,s,w,w,w]
      when 8
        [w,w,w,g,g,r,g,g,g,w,w,w,w,w]
      when 9
        [w,w,g,g,g,r,g,g,r,g,g,g,w,w]
      when 10
        [w,g,g,g,g,r,r,r,r,g,g,g,g,w]
      when 11 
        [w,s,s,g,r,s,r,r,s,r,g,s,s,w]
      when 12 
        [w,s,s,s,r,r,r,r,r,r,s,s,s,w]
      when 13
        [w,s,s,r,r,r,r,r,r,r,r,s,s,w]
      when 14
        [w,w,w,r,r,r,w,w,r,r,r,w,w,w]
      when 15
        [w,w,g,g,g,w,w,w,w,g,g,g,w,w]
      when 16
        [w,g,g,g,g,w,w,w,w,g,g,g,g,w]
      when 17
        [w,w,w,w,w,w,w,w,w,w,w,w,w,w]
      end
    end
    
    def color(x)
      if x == 0
        [1,0,0]
      else 
        [0,1,0]
      end
    end
    
  10. ( g140968 )

    def wave(n)
      m=n+2
      i=make2d(m,m) #準備に使う画像
      g=make2d(n,n) #実際に表示する画像
      for x in 0..(m-1) #背景
        for y in 0..(m-1)
          i[y][x]=[0.2,0.4,0.6]
        end
      end
      
      k=8
      def s(m,k)
        m*k/30.0
      end
      while k<28 #波
        for x in 0..(m-1)
          for y in 0..(m-1)
            if s(m,k)+(m/30.0)*sin(4.0*3.1415/m*(x- 
    1.5*s(m,k)))<y&&y<=s(m,k+1)+(m/30.0)*sin(4.0*3.1415/m*(x-1.5*s(m,k+1)))
              i[y][x]=[0,0.75,0.9]
            end
          end
        end
      k=k+2
      end
      
      def ave(i,x,y,j) #端にある点は考えない
        a=0
        for b in -1..1
          for c in -1..1
            a=a+i[y+c][x+b][j]
          end
        end
        a/9.0
      end
      for x in 1..(m-2) #aveを使って滑らかにする。考えていない端の点は落とす。
        for y in 1..(m-2)
          g[y-1][x-1]=[ave(i,x,y,0),ave(i,x,y,1),ave(i,x,y,2)]
        end
      end  
      g
    end

    def heart(n)
      m=n+2
      o=m/2.0
      i=make2d(m,m) #準備に使う画像
      g=make2d(n,n) #実際に表示する画像
      for x in 0..(m-1) #背景
        for y in 0..(m-1)
          i[y][x]=[0,0,0]
        end
      end
      for x in 0..(m-1)
        for y in 0..(m-1)
          if 0.95<= ( (x-o)/(m/3.0))**2+(((m-y+m/6.0)-o)/(m/4.0)-
    ( ( (x-o)/(m/3.0))**2.0)**(1.0/3))**2&&( ( x-o)/(m/3.0))**2+( ( (m-y+m/6.0)-
    o)/(m/4.0)-( ( (x-o)/(m/3.0))**2.0)**(1.0/3))**2<=1.05
            i[y][x]=[1,rand(100)*0.01,rand(100)*0.01]
          end
        end
      end
      def ave(i,x,y,j) #端にある点は考えない
        a=0
        for b in -1..1
          for c in -1..1
            a=a+i[y+c][x+b][j]
          end
        end
        a/9.0
      end
      for x in 1..(m-2) #aveを使って滑らかにする。考えていない端の点は落とす。
        for y in 1..(m-2)
          g[y-1][x-1]=[ave(i,x,y,0),ave(i,x,y,1),ave(i,x,y,2)]
        end
      end  
      g  
    end
    
  11. ( g140969 )

    def pic(s)
     image=make2d(s,s)
      for y in 0..(s-1)
       for x in 0..(s-1)
        image[y][x]=[x/(2*x+2*y+0.10),x/(x+y+0.10),x/(3*x+3*y+0.10)]
       end
      end
     image
    end
    show (pic(200))
    
  12. ( g140954 )

    def image7(s)
     image = make2d(s,s)
      for y in 0..(s-1)
       for x in 0..(s-1)
        image[y][x] = [tan(distance(x,y,s/2.0,s/2.0)),tan(distance(x,y,s/2.0,s/2.0)),1]
       end
      end
      image
    end
    

    def h(s,x,y)
      if x >= s/2.0
        if y >= s/2.0 
      if (x/4+y/4)%2 == 0
         [tan(distance(x,y,s/2.0,s/2.0)),tan(distance(x,y,s/2.0,s/2.0)),1]
           else
            [0.5,0,0]
           end
        else
           if (x/2+y/2)%2 == 0
         [tan(distance(x,y,s/2.0,s/2.0)),tan(distance(x,y,s/2.0,s/2.0)),1]
           else
              [0.5,0,0]
           end
        end
      else
        if y >= s/2.0
           if (x/3+y/3)%2 == 0
        [tan(distance(x,y,s/2.0,s/2.0)),tan(distance(x,y,s/2.0,s/2.0)),1]
           else
        [0.5,0,0]
           end
        else
           if (x+y)%2 == 0
        [tan(distance(x,y,s/2.0,s/2.0)),tan(distance(x,y,s/2.0,s/2.0)),1]   
           else
        [0.5,0,0]
           end
        end 
      end
    end
    def image6(s)
     image = make2d(s,s)
      for y in 0..(s-1)
       for x in 0..(s-1)
        image[y][x] = h(s,x,y)
       end
      end
      image
    end
    
  13. ( g140960 )

    def kadai(s) 
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          if (x>s/2&&y>s/2)||(x<s/2&&y<s/2)
            r=(cos(0.6*(x-y))*(0.5-distance(x,y,s/2,s/2)/sqrt(0.5*s**2))+(0.3-
              distance(x,y,s/2,s/2)/sqrt(0.5*s**2))*cos(0.6*(x+y)))*0.7
          else
            r=(cos(0.6*(x-y))*(0.3-distance(x,y,s/2,s/2)/sqrt(0.5*s**2))+(0.5-
              distance(x,y,s/2,s/2)/sqrt(0.5*s**2))*cos(0.6*(x+y)))*0.7
          end
          g=0
          b=(cos(0.3*(x-y))*(0.9-distance(x,y,s/2,s/2)/sqrt(0.5*s**2))+(0.9-
             distance(x,y,s/2,s/2)/sqrt(0.5*s**2))*cos(0.3*(x+y)))*0.7
          image[y][x]=[r,g,b]
        end
      end
      image
    end
    show(kadai(250))
    
  14. ( g140054 )

    def ban()
     a=make3d(140,120,3)
     for y in 0..139
       for x in 0..119
    a[y][x]=[as(x,y),as(x,y),0]
       end 
     end
     show(a)
    end
    def as(x,y)
     if (x>4&&y>4)&&(x<114&&y<132)&&((x%12==5)||(y%14==5))
       0
     else
     0.32+sin(x)/30.0+sqrt(y)/350.0
     end
    end
    
  15. ( g141172 )

    def pic141172()
     b=111
     a=make2d(b,b)
     for y in 0..b-1
       for x in 0..b-1
        a[y][x]= [p(x,y),p(3*x,2*y),p(5*x,y)] 
       end 
     end
     a
    end
    def p(z,x)
      cos(x)*sin(z)
    end
    
  16. ( g140469 )

    def b(s,x,y)
      r=s/2.0
      if distance(r,r,x,y)<=r
        [1,(r-distance(r,r,x,y))/r,(r-distance(r,r,x,y))/r]
      else
        [0,1,1]
      end
    end
    def sphere(s)
      image = make2d(s,s)
      for y in 0..(s-1) 
        for x in 0..(s-1)
          image[y][x] = b(s,x,y)
        end  
      end  
      image
    end
    
  17. ( g140484 )

    def show_kadai(s)
      s = s * 1.0
      pi = 3.141592
      img = make2d(s, s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          img[y][x] = toColor(1.0-((x-s/2.0)**2 + (y-s)**2) *5.0/4.0/s/s )
        end
      end
      show(img)
    end
    
    def toColor(x)
      if x < 1.0/5.0
        [1.0, x*5.0, 0]
      elsif x < 2.0/5.0
        [2.0-x*5.0,1.0,0]
      elsif x < 3.0/5.0
        [0,1.0,x*5.0-2.0]
      elsif x < 4.0/5.0
        [0,4.0-x*5.0,1.0]
      else
        [x*5.0-4.0,0,1.0]
      end
    end
    

    load("make2d.rb")
    def show_kadai(s)
      s = s * 1.0
      pi = 3.141592
      img = make2d(s, s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          img[y][x] = toColor(Math.sin(x*x*0.01 + y*y*0.01)*0.5 + 0.5)
        end
      end
      show(img)
    end
    
    def toColor(x)
      if x < 1.0/5.0
        [1.0, x*5.0, 0]
      elsif x < 2.0/5.0
        [2.0-x*5.0,1.0,0]
      elsif x < 3.0/5.0
        [0,1.0,x*5.0-2.0]
      elsif x < 4.0/5.0
        [0,4.0-x*5.0,1.0]
      else
        [x*5.0-4.0,0,1.0]
      end
    end
    
  18. ( g140063 )

    def dist2p(x,y,s,t,u,v)
      sqrt((x-s)**2+(y-t)**2)+sqrt((x-u)**2+(y-v)**2)
    end
    def dist2n(x,y,s,t,u,v)
      sqrt((x-s)**2+(y-t)**2)-sqrt((x-u)**2+(y-v)**2)
    end
    def dist(x,y,u,v)
      sqrt((x-u)**2+(y-v)**2)
    end
    a=make3d(501,501,3)
    for y in 0..500
      for x in 0..500
        r=(dist(250,250,x,y))*(1.3+0.7*rand())/500/sqrt(2)
        g=sin(dist2p(x,y,180,180,320,320)/16)/2+0.3
        b=cos(dist2n(x,y,180,320,320,180)/8)/2+0.5
        a[x][y]=[r,g,b]
      end
    end
    
  19. ( g140472 )

    def target()
     image=make2d(360,360)
     r=180.0
     for y in 0..359
      for x in 0..359
       if distance(y,x,r,r)<36.0
        image[y][x]=[1,1,1]
       else
        if distance(y,x,r,r)>=36.0 && distance(y,x,r,r)<72.0
         image[y][x]=[0,0,0]
        else
         if distance(y,x,r,r)>=72.0 && distance(y,x,r,r)<102.0
          image[y][x]=[1,1,1]
         else
          if distance(y,x,r,r)>=102.0 && distance(y,x,r,r)<117.0
           image[y][x]=[0,0,0]
          else
           if distance(y,x,r,r)>=117.0 && distance(y,x,r,r)<147.0
            image[y][x]=[1,1,1]
           else
            if distance(y,x,r,r)>=147.0 && distance(y,x,r,r)<=180.0
             image[y][x]=[0,0,0]
            else
             image[y][x]=[1,1,1]
            end
           end
          end
         end
        end
       end
      end
     end
     image
    end
    
  20. ( g140476 )

    def dbz(s,x,y)
      if distance(x,y,(0.22*s),(0.2*s))<=(0.07*s)
        o=distance(x,y,(0.22*s),(0.2*s))/(0.07*s)
        [1,1-o/3,0.5-0.5*o]
      elsif distance(x,y,(0.55*s),(0.25*s))<=(0.03*s)
        p=distance(x,y,(0.55*s),(0.25*s))/(0.03*s)
        [1,1-p/3,0.5-0.5*p]
      elsif distance(x,y,(0.27*s),(0.4*s))<=(0.05*s)
        q=distance(x,y,(0.27*s),(0.4*s))/(0.05*s)
        [1,1-q/3,0.5-0.5*q]
      elsif distance(x,y,(0.50*s),(0.5*s))<=(0.08*s)
        r=distance(x,y,(0.50*s),(0.5*s))/(0.08*s)
        [1,1-r/3,0.5-0.5*r]
      elsif distance(x,y,(0.9*s),(0.45*s))<=(0.04*s)
        s=distance(x,y,(0.9*s),(0.45*s))/(0.04*s)
        [1,1-s/3,0.5-0.5*s]
      elsif distance(x,y,(0.15*s),(0.75*s))<=(0.12*s)
        t=distance(x,y,(0.15*s),(0.75*s))/(0.12*s)
        [1,1-t/3,0.5-0.5*t]
      elsif distance(x,y,(0.8*s),(0.7*s))<=(0.1*s)
        u=distance(x,y,(0.8*s),(0.7*s))/(0.1*s)
        [1,1-u/3,0.5-0.5*u]
      else
        [0.8,1,1]
      end
    end
    
    def db(s)
      image = make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x] = dbz(s,x,y)
        end
      end
      image
    end
    
  21. ( g140480 )

    def Olympic(x,y,s)
    if distance(0.26*s,0.5*s,x,y)>=0.1*s && distance(0.26*s,0.5*s,x,y)<=0.11*s
     [0,0,1]
    elsif distance(0.5*s,0.5*s,x,y)>=0.1*s && distance(0.5*s,0.5*s,x,y)<=0.11*s
     [0,0,0]
    elsif distance(0.74*s,0.5*s,x,y)>=0.1*s &&  distance(0.74*s,0.5*s,x,y)<=0.11*s
     [1,0,0]
    elsif distance(0.38*s,0.59*s,x,y)>=0.1*s && distance(0.38*s,0.59*s,x,y)<=0.11*s
     [1,1,0]
    elsif distance(0.62*s,0.59*s,x,y)>=0.1*s && distance(0.62*s,0.59*s,x,y)<=0.11*s
     [0,1,0]
    else 
     [1,1,1]
    end
    def homework(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
        image[y][x]=Olympic(x,y,s)
       end  
      end
      image
    end 
    
  22. ( g140970 )

    def b1(s,k,m,x,y)
      u=s*cos(k)/4.0+s/2.0
      v=s*sin(k)/4.0+s/2.0
      r=s/4.0
      if distance(x,y,u,v)<=r
        sin(k+m)/2.0+0.5
      else
        0
      end
    end
    def b2(s,m,x,y)
      n=0
      k=0
      while k<6.28
        n=n+b1(s,k,m,x,y)
        k=k+3.14/24
      end
      n
    end
    def image(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x]=[b2(s,0,x,y)/8,b2(s,6.28/3,x,y)/8,b2(s,12.56/3,x,y)/8]
        end
      end
      image
    end
    show(image(200))
    
  23. ( g140569 )

    def show_color_picture()
      a=make3d(50,50,3)
      for y in 0..49
        for x in 0..49
          a[y][x]=[sin(distance(x,y,50/2,50/2)),sin(distance(x,y,0,0)),sin(distance(x,y,50,50))]
        end 
      end
      show(a)
    end
    
  24. ( g140464 )

    def practice(n)
      a=make2d(n,n)
      for x in 0..n-1
        for y in 0.. n-1
          if (x+y)%2==0
            a[y][x]=1
          else
            a[y][x]=0
          end
        end
      end
      a
    end
    def b(s,x,y)
      if d(x,y,(s-1)/2.0,(s-1)/2.0)<=((s-1)/2.0)
        (((s-1)/2.0)-d(x,y,(s-1)/2.0,(s-1)/2.0))/((s-1)/2.0)
      else
        1
      end
    end
    def sphere(s)
      image = make2d(s,s)
      for y in 0..(s-1) 
        for x in 0..(s-1)
          image[y][x] = b(s,x,y)
        end
      end
      image
    end
    def image00(n)
      c=make2d(n,n)
      a=practice(n)
      b=sphere(n)
      for x in 0..n-1
        for y in 0..n-1
          c[y][x]=[a[y][x],0.3,b[y][x]]
        end
      end
      c
    end
    show(image(100))
    
  25. ( g140050 )

    def orion
      image= make2d(400,315)
      for x in 0..399
        for y in 0..314
          if (x==67 && y==40) || (x==59&&y==53) || (x==120&&y==67) || (x==0&&y==96) || 
             (x==218&&y==120) || (x==195&&y==133) || (x==120&&y==147) || (x==173&&y==163) || 
             (x==280&&y==176) || (x==83&&y==275) || (x==141&&y==293) || (x==168&&y==293) || 
             (x==187&&y==288) || (x==227&&y==277 )|| (x==235&&y==264)
           image[x][y]=[0,0,1]
         else
           if (148359&&x<362&& y>199&& y<202) || (x==373&&y==96) || (x==267&&y==133) || 
                (x==274&&y==123) || (x==253&&y==155) || (x==168&&y==168)|| (x==319&&y==132)||
                (x==319&&y==134) || (x==320&&y==133) || (x==320&&y==135) || (x==321&&y==134) || 
                (x==321&&y==136)
               image[x][y]=[1,1,1]
             else
               image[x][y]=[0,0,0.3]
             end
           end
         end
       end
      end
      image
    end
    
    (上のプログラムはコピー&ペーストのミスらしく不完全なものになっています)
  26. ( g140567 )

    def image_ex(s,t)
      def b(s,t,x,y)
        if (x-t/2.0)**2/2+(y-s/4.0)**2<(s/6.0+t/6.0)**2
          0.3+y*0.5/(s-1)
        else
          1
        end
      end
      def c(s,t,x,y)
        if (x-t/2.0)**2/2+(y-3.0*s/4.0)**2<(s/6.0+t/6.0)**2 
          0.3+x*0.5/(t-1)
        else
          1
        end
      end
      def d(s,t,x,y)
        1.0-sqrt((y-s/2.0)**2+(x-t/2.0)**2)/(s+t)*4
      end
      image=make3d(s,t)
      for y in 0..(s-1)
        for x in 0..(t-1)
          image[y][x][1]=b(s,t,x,y)
          image[y][x][2]=c(s,t,x,y)
          image[y][x][0]=d(s,t,x,y)
        end
      end
      image
    end
    
  27. ( g140565 ) 画像は著作権的に問題があるため,投票後に削除しました.
    image = s
     b=[0,0,0]
     g=[0,1,0]
      s=[[b,b,b,b,b,b,b,b,b,b,b,b,b],
          [b,b,b,g,b,b,b,b,b,g,b,b,b],
          [b,b,b,b,g,b,b,b,g,b,b,b,b],
          [b,b,b,g,g,g,g,g,g,g,b,b,b],
          [b,b,g,g,b,g,g,g,b,g,g,b,b],
          [b,g,g,g,g,g,g,g,g,g,g,g,b],
          [b,g,b,g,g,g,g,g,g,g,b,g,b],
          [b,g,b,g,b,b,b,b,b,g,b,g,b],
          [b,b,b,b,g,g,b,g,g,b,b,b,b],
          [b,b,b,b,b,b,b,b,b,b,b,b,b]]
     image
    
  28. ( g140482 )

    def show_color_picture()
     a=make3d(50,50,3)
     for y in 0..49
       for x in 0..49
    a[x][y]=a[y][x]=[sin(y+x),1.0,cos((y-x)/2.0)]
    
       end 
     end
     show(a)
    end
    
  29. ( g140451 )

    load("./make2d.rb")
    load("./distance.rb")
    def kadai(s)
        image=make2d(s,s)
           for y in 0..(s-1)
             for x in 0..(s-1)
                 image[y][x]=[(distance(x,y,s/3.0,s/3.0))/s,(distance(x,y,s*2/3.0,s/3.0))/s,
                                      (distance(x,y,s/2.0,(s*(1/3.0+1/(2*sqrt(3))))))/s]
              end
           end
      image
    end
    # distance.rb
    def distance(x,y,u,v)
      include Math
      sqrt((x-u)**2+(y-v)**2)
    end
    
  30. ( g140066 )

    def picture(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x]=[(sin(log( (x+1.0)/10.0)+y))**16,(cos(log((y+1.0)/10.0)+x) )**16,((x+y)**2)/(((x+y)**2)+1.0)]
        end
      end
      image
    end
    
  31. ( g140475 )

    def cube(s)
    
    cube=Array.new(s)
     for i in 0..(s-1)
      cube[i]=Array.new(s)
     end
    for y in 0..(s-1)
     for x in 0..(s-1)
      if -x+5*s/7.0<=y
       if -x+s>y
        cube[y][x]=0.5
       else
        if -x+9*s/7.0>y
         cube[y][x]=0.3
        else
         cube[y][x]=1
        end
       end
      else
       cube[y][x]=1
      end
     end
    end
    for y in 3*s/7..5*s/7
     for x in 2*s/7..4*s/7
      cube[y][x]=0.8
     end
    end
    for y in 0..2*s/7
     for x in 0..(s-1)
      cube[y][x]=1
     end
    end
    for y in 5*s/7..(s-1)
     for x in 0..(s-1)
      cube[y][x]=1
     end
    end
    for y in 0..(s-1)
     for x in 0..2*s/7
      cube[y][x]=1
     end
     for x in 5*s/7..(s-1)
      cube[y][x]=1
     end
    end
    for x in 4*s/7..5*s/7
     for y in -x+9*s/7..-2*x/7+43*s/49
      cube[y][x]=0
     end
    end
    for x in 5*s/7..(s-1)
     for y in -2*x/7+38*s/49..-2*x/7+43*s/49
      cube[y][x]=0
     end
    end
    cube
    end
    
    
  32. ( g141178 )

    def d(x,y,m,n)
      sqrt((x-m)**2+(y-n)**2)
    end
    def dr(s)
      r=s/2.0
      image =Array.new(s)
      for i in 0..s-1 
        image[i]=make1d(s)
      end
      for i in 0..s-1
        for j in 0..s-1
          image[i][j]=make1d(3)
        end
      end
      for x in 0..(s-1)
        for y in 0..(s-1) 
          if (d(0,0,x,y)<s/2)||(d(0,s-1,x,y)<s/2)||(d(s-1,0,x,y)<s/2)||(d(s-1,s-1,x,y)<s/2)
            image[x][y][0]=0
          else
            image[x][y][0]=2.0*(s/2-d(s/2,s/2,x,y))/s
          end
          image[x][y][1]=0
          st1=4.0*(s/4.0 - sqrt(3*( (s/4.0-(s-x))**2-(s/4.0-y)**2).abs))/s
          st2=4.0*(s/4.0 - sqrt(3*( (s/4.0-x)**2-(s/4.0-y)**2).abs))/s
          st3=4.0*(s/4.0 - sqrt(3*( (s/4.0-(s-x))**2-(s/4.0-(s-y))**2).abs))/s
          st4=4.0*(s/4.0 - sqrt(3*( (s/4.0-x)**2-(s/4.0-(s-y))**2).abs))/s
          if st1<0 
            st1=0 
          end
          if st2<0 
            st2=0 
          end
          if st3<0 
            st3=0 
          end
          if st4<0 
            st4=0 
          end
          image[x][y][2]=st1+st2+st3+st4
        end
      end
      return image
    end
    
  33. ( g140568 )

    def t(s,x,y)
      r=s/2.0
     if d(x,y,r,r)<=r
       (r-d(x,y,r,r))/r
     else
       0
     end
    end
    
    a=make3d(300,300,3)
     for y in 0..299
       for x in 0..299
          a[y][x]=[t(300,x+rand(75),y+rand(75)),t(300,x,y-rand(80)),t(300,x-rand(75),y+rand(75))]
       end 
     end
     show(a)
    
  34. ( g140465 ) 画像は著作権的に問題があるため,投票後に削除しました.
    def anpan(s)
      img = make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          img[y][x] = b(s,x,y)
        end
      end
      img
    end
    
    def b(s,x,y)
      r = s/2.0
      if distance(r,r,x,y) < r * 4.0 / 15.0
        g = 1 - distance(r,r,x,y)/(r*4.0/15.0)
        [1,g,g]
      elsif distance(s*0.35,s*0.3,x,y) < r*0.1
        [0,0,0]
       elsif distance(s*0.65,s*0.3,x,y) < r*0.1
        [0,0,0]
     
      elsif distance(r*7.0/15.0,r,x,y) < r * 4.0 / 15.0
        g = 1 - distance(r*7.0/15.0,r,x,y)/(r*4.0/15.0)
        [1,g,g]
      elsif distance(r*23.0/15.0,r,x,y) < r * 4.0 / 15.0
        g = 1 - distance(r*23.0/15.0,r,x,y)/(r*4.0/15.0)
        [1,g,g]
      elsif distance(r,s*0.7,x,y) <= r*4.0/15.0 && y >= s*0.7
          [1,0,0]
      elsif distance(r,r,x,y) <= r
        g = 1 - distance(r,r,x,y)/r
        [0.825+g*0.675,0.475+g*0.675,0.325+g*0.675]
      else
        [1,1,1]
      end
    end
    
    def distance(x,y,u,v)
      sqrt((x-u)**2.0+(y-v)**2.0)
    end
    
  35. ( g140471 )

    def b(s,x,y)
     if 1-s*(sin(x)*sin(y)) >= 0
      (1-sin(y)*sin(x))*0.50
     else
      1
     end
    end
    def sphere(s)
     image = make2d(s,s)
     for y in 0..s-1
      for x in 0.. s-1
       image[y][x] = b(s,x,y)
      end
     end
     image
    end 
    
  36. ( g140466 )

    def french()
      image=make2d(5,6)
      for x in (0..4)
        image[x][0]=[0,0,1] #青
        image[x][1]=[0,0,1]
        image[x][2]=[1,1,1] #白
        image[x][3]=[1,1,1]
        image[x][4]=[1,0,0] #赤
        image[x][5]=[1,0,0]
      end
      image
    end
    show(french())
    

    def d(x,y,u,v)
      sqrt((x-u)**2+(y-v)**2)
    end
    def b(s,x,y)
      r=s/2
      if d(x,y,r,r)<=r
        (r-d(x,y,r,r))/r
      else
        0
      end
    end
    def problem(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x]=[1-sin(d(x,y,s/2.0,s/2.0)),1-cos(d(x,y,s/2.0,2/2.0)),1-tan(d(x,y,s/2.0,s/2.0))]
        end
      end
      image
    end
    show(problem(100))
    
  37. ( g140182 )

    def zu(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x]=iro(s,x,y)
        end
      end
      image
    end
    def iro(s,x,y)
      a=[sin(x+y)+cos(x*y),2*cos(x*y),2*b(s,x,y)]
      a
    end
    
  38. ( g140196 )

    def b(s,x,y)
      r=s/2
      if distance(x,y,r,r)<r
        [((r-distance(x,y,r,r))+sin(distance(x,y,r,r)))/(0.7*r)+sin(x+y),((r-distance(x,y,r,r))+sin(distance(x,y,r,r)-
          0.535))/(0.9*r)+cos(x-y),((r-distance(x,y,r,r))+sin(distance(x,y,r,r)+0.535))/(0.8*r)+sin(x-y)]
      else
        [1,1,1]
      end
    end
    def sphere(s)
     image = make2d(s,s)
     for y in 0..(s-1) 
       for x in 0..(s-1)
         image[y][x] = b(s,x,y)
       end  
     end  
     image
    end
    
  39. ( g140571 )

    def d(x,y,u,v)
      include(Math)
      sqrt((x-u)**2+(y-v)**2)
    end
    def picture()
      image = make2d(600,600)
      for x in 0..599
        for y in 0..599
          image[x][y] = [1.8+2*cos(d(x,y,400.0,200.0)/60.0), 1.8+2*cos(d(x,y,400.0,400.0)/60.0), 
                              1.8+2*cos(d(x,y,227.0,300.0)/60.0)]
        end
      end
      image
    end
    show(picture)
  40. ( g140570 )

    def a(x,y)
      if y>13||x>20
        if y%4==0||y%4==1
          [1,0,0] 
        else
          [1,1,1] 
        end 
      else
        if y!=13&&y!=0
          if (x%4==1&&y%2==1)||(x%4==3&&y%2==0)
            [1,1,1]
          else
            [0,0,1]
          end
        else
          [0,0,1]
        end
      end
    end
    
    def usa
      america=make2d(26,52)
      for x in 0..51
        for y in 0..25
          america[y][x] = a(x,y)
        end
      end
      america
    end
    

    def nihon(s,x,y)
      r=s/2.0
      if distance(x,y,3*r,2*r)>r
        [1,1,1]
      else
        [1,0,0]
      end
    end
    def japan(s)
      image = make2d(2*s,3*s)
      for y in 0..(2*s-1) 
         for x in 0..(3*s-1)
           image[y][x] = nihon(s,x,y)
         end  
       end  
      image
    end
    
  41. ( g140202 )

    def dex(h)
     image = make2d(h,h)
     for y in 0..(h-1)
       for x in 0..(h-1)
         image[y][x] = [sin(x**2+y**2),cos(x**2+y**2),sin(distance(x,y,100,100))]
       end
     end
     image
    end
    show(dex(200)) 
    
  42. ( g141170 )

    def kadai(s)
      a=make3d(s,s,3)
      for y in 0..(s-1)
        for x in 0..(s-1)
          def b(s,x,y)
            r=s/2
            if distance(x,y,r,r)<=r
              if (x-r)**2*(y-r)**2<=(r)**2 && distance(x,y,r,r)<=r/1.5
                1-distance(x,y,r,r)/r+0.3
              else
                sin(distance(x,y,r,r))/3
              end
            else
              0
            end
          end
          a[y][x]=[b(s,x,y),b(s,x,y)-0.3,0]
        end 
      end
      show(a)
    end
    
  43. ( g140962 )

    def d(x,y,a,b)
      sqrt((x-a)**2+(y-b)**2)
    end
    def un(s)
      a=make3d(s,s,3)
      for y in 0..(s-1)
        for x in 0..(s-1)
          a[y][x]=[0.9,0.4*cos(35*3.14*d(x,y,s*1.0/2,s*1.0/2)*1.0/(sqrt(s)/2)),0]
        end
      end
      show(a)
    end
    show(un(280))
    
  44. ( g140188 )

    def factorial(n)
      if n>=2
        factorial(n-1)*n
      else
        1
      end
    end
    
    def combination(n,k)
      if k>n
        0
      else
        if k==0
          1
        else
          factorial(n)/factorial(n-k)/factorial(k)
        end
      end
    end
    
    def show_color_picture()
      a=make3d(200,200,1)
      for y in 0..199
        for x in 0..199
          a[y][x]=[combination(x+y,x)%3.0/6.0+x/398.0,combination(x+y,y)%3.0/6.0+y/398.0,(x+y/398.0)**0.5]
        end
      end 
      show(a)
    end
    
  45. ( g140460 )

    load("./make2d.rb")
    
    def c(s,x,y)
    if (x+y)%2==0
     [0,(x+y)/(2.0*s),0]
    else
     [1-(x+y)/(2.0*s),0,0]
     end
    end
    def check(s)
      image = make2d(s,s)
      for y in 0..(s-1) 
        for x in 0..(s-1)
          image[y][x] = c(s,x,y)
        end  
      end  
      image
    end
    
  46. ( g140194 )

    def show_color_picture()
     a=make3d(50,50,3)
     for y in 0..49
       for x in 0..49
        a[y][x]=[(x%2)*(1.0-x/50),(y%2)*(y*20/10)/100.0,((x-y)/50)**2]
       end 
     end
     show(a)
    end
    
  47. ( g140191 )

    def picture(n)
      mix=make3d(n,n,3)
      wave=make3d(n,n,3)
      line1=make3d(n,n,3)
      line2=make3d(n,n,3)
      line3=make3d(n,n,3)
      line4=make3d(n,n,3)
      line5=make3d(n,n,3)
      line6=make3d(n,n,3)
      ra=rand()
      rb=rand()
      rc=rand()
      rd=rand()
      re=rand()
      rf=rand()
      for y in 0..n-1
        for x in 0..n-1
          for i in 0..2
            if y-n/2.0>=cos(PI*ra)*(x-n/2.0)-0.025*n+n*(rb-0.5) && y-n/2.0<=cos(PI*ra)*(x-n/2.0)+0.025*n+n*(rb-0.5)
              line1[y][x]=[ra,rb,rc]
            end
            if y-n/2.0>=cos(PI*rc)*(x-n/2.0)-0.025*n+n*(rd-0.5) && y-n/2.0<=cos(PI*rc)*(x-n/2.0)+0.025*n+n*(rd-0.5)
              line2[y][x]=[rb,rc,ra]
            end
            if y-n/2.0>=cos(PI*re)*(x-n/2.0)-0.025*n+n*(rf-0.5) && y-n/2.0<=cos(PI*re)*(x-n/2.0)+0.025*n+n*(rf-0.5)
              line3[y][x]=[rc,ra,rb]
            end
            if y-n/2.0>=cos(PI*rb)*(x-n/2.0)-0.025*n+n*(ra-0.5) && y-n/2.0<=cos(PI*rb)*(x-n/2.0)+0.025*n+n*(ra-0.5)
              line4[y][x]=[ra,rc,rb]
            end
            if y-n/2.0>=cos(PI*rd)*(x-n/2.0)-0.025*n+n*(rc-0.5) && y-n/2.0<=cos(PI*rd)*(x-n/2.0)+0.025*n+n*(rc-0.5)
              line5[y][x]=[rb,ra,rc]
            end
            if y-n/2.0>=cos(PI*rf)*(x-n/2.0)-0.025*n+n*(re-0.5) && y-n/2.0<=cos(PI*rf)*(x-n/2.0)+0.025*n+n*(re-0.5)
              line6[y][x]=[rc,rb,ra]
            end
            wave[y][x]=[0,51.0/255.0*(1-distance(x,y,n/2.0,n/2.0)/n)+0.05*sin(distance(x,y,n/2.0,n/2.0)/1.5),153.0/255.0*(1-distance(x,y,n/2.0,n/2.0)/n)+0.05*sin(distance(x,y,n/2.0,n/2.0)/1.5)]
            mix[y][x][i]=wave[y][x][i]+line1[y][x][i]+line2[y][x][i]+line3[y][x][i]+line4[y][x][i]+line5[y][x][i]+line6[y][x][i]
          end
        end
      end
      show(mix)
    end
    
  48. ( g140463 )

    load("./b.rb")
    def show_color_picture()
    
     a=make3d(100,100,3)
     for y in 0..99
       for x in 0..99
        a[y][x]=[x*y/9801.0,1.0-b(100,x,y),b(100,x,y)]
       end 
     end
     show(a)
    end
    
  49. ( g140064 )

    include(Math)
    include(Precision)
    def colordot()
      a = Array.new(3)
      for i in 0..2
        a[i] = 0
      end
      a
    end
    def colorline(length)
      a = Array.new(length)
      for i in 0..(length-1)
        a[i] = colordot()
      end
      a
    end
    def colormap(size)
      a = Array.new(size)
      for i in 0..(size-1)
        a[i] = colorline(size)
      end
      a
    end
    
    def object(n)
      map=colormap(n)
      def blend(f,b)
        f+(1-f)*(b)*0.99
      end
      def panel(map,n)
        for p_ in 0..(n).prec_i-1
          for q_ in 0..(n).prec_i-1
            for r_ in 0..(n).prec_i-1
              x=n/2+((q_-p_)*cos(PI/3.0)).prec_i
              y=n/2+(((p_+q_)/2.0-r_)/2).prec_i
              if p_%20==0&&p_!=0&&map[y][x][0]<2
                map[y][x][0]=blend((1-p_/n)/10.0,map[y][x][0])
              end
              if q_%20==0&&q_!=0&&map[y][x][1]<2
                map[y][x][1]=blend((1-q_/n)/10.0,map[y][x][1])
              end
              if r_%20==0&&r_!=0&&map[y][x][2]<2
                map[y][x][2]=blend((1-r_/n)/10.0,map[y][x][2])
              end
            end
          end
        end
        map
      end
      map=panel(map,n)
      map
    end
    show(object(150))
    
  50. ( g140461 )

    def tanjent(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x]=[0.2,tan(distance(x,y,s/2.0,y/2.0)),tan(distance(x,y,s/2.0,s/2.0))]
        end
      end
      image
    end
    
  51. ( g140045 )

    # delta is radian
    load("./make2d.rb")
    include(Math)
    
    def li(delta,a,b) 
      x = 551 # size of the map
      y = 500 # size of the showing region
    
      z = 1/(y/2.0)
      image = make2d(x,x)
      t = 0
      
      continue1 = (t < (2.0*PI)/a || t < (2.0*PI)/b)
      while continue1 do
        c = (sin(a*t) / z).round
        d = (sin(b*t+delta)/z).round
        image[(x -1)/2-c][(x-1)/2+d] = 1
        print (x-1)/2-c
        print ","
        print (x-1)/2+d
        print "\n"
        t = t + PI / 10000
        continue1 = (t < (2.0*PI)/a || t < (2.0*PI)/b)
      end
      
      print "end1"
    
      souharenzoku = 0
      while souharenzoku < 1000 do
        cc = c
        dd = d
        c = (sin(a*t) / z).round
        d = (sin(b*t+delta)/z).round
        if (cc != c || dd != d) && image[(x-1)/2-c][(x-1)/2+d] == 1 then
          print "already"
          print "\n"
          souharenzoku = souharenzoku +1
        elsif (cc != c || dd != d) && image[(x-1)/2-c][(x-1)/2+d] != 1 then
          print "new"
          print "\n"
          souharenzoku = 0
        end
        image[(x -1)/2-c][(x-1)/2+d] = 1
        t = t + PI / 10000
      end
       image
    end
    
  52. ( g140041 )

    def zero_or_else(x)
     if -0.001<x && x<0.001
      1
     else
      x
     end
    end
    a=make3d(100,100,3)
    for y in 0..99
      for x in 0..99
        a[y][x]=
    [zero_or_else(0.1+sin(x**2+y**2)),zero_or_else(0.2+sin(x**2+y**2)),zero_or_else(0.5+sin(x**2+y**2))]
      end 
    end
    show(a)
    
  53. ( g140068 )

    def abs(p)
     sqrt(p**2)
    end
    def distance(x,y,u,v)
     sqrt((x-u)**2+(y-v)**2)
    end
    def image_sphere()
     a=make3d(500,500,3)
     for y in 0..499
      for x in 0..499
       if distance(x,y,250,250)<125
        then a[y][x]=[distance(x,y,250,250)*abs(y-250)/(abs(x-250)+1)/800,distance(x,y,250,250)*abs(x-250)/(abs(y-250)+1)/800,distance(x,y,250,250)/100]
        else a[y][x]=[tan(abs(x-250)/250)/distance(x,y,250,250)*200,tan(abs(y-250)/250)/distance(x,y,250,250)*150,200/distance(x,y,250,250)]
       end
      end
     end
     show(a)
    end
    
  54. ( g140949 )

    def color_select1(i,x,y,_x)
     if i % 2 == 0
       a=[0,1.0-1.0*(2.0*x-_x)**2/(_x**2),1.0-1.0*(2.0*y-_x)**2/(_x**2)]
     else
       a=[0,1.0-1.0*(2.0*x-_x)**2/(_x**2),1.0*(2.0*y-_x)**2/(_x**2)]
     end
     return a
    end
    def color_select2(i,x,y,_x)
     if i % 2 == 1
       a=[0,1.0-1.0*(2.0*x-_x)**2/(_x**2),1.0-1.0*(2.0*y-_x)**2/(_x**2)]
     else
       a=[0,1.0-1.0*(2.0*x-_x)**2/(_x**2),1.0*(2.0*y-_x)**2/(_x**2)]
     end
     return a
    end
    def color_select3(i,y,_y_)
     if i % 2 == 0
       a=[0.7-0.7*(y-_y_/2)**2/(_y_**2)]
     else
       a=[0.7*(y-_y_/2)**2/(_y_**2)]
     end
     return a
    end
    def color_select4(i,y,_y_)
     if i % 2 == 1
       a=[0.7-0.7*(y-_y_/2)**2/(_y_**2)]
     else
       a=[0.7*(y-_y_/2)**2/(_y_**2)]
     end
     return a
    end
    def picture(_y,_x)
    a = make3d(_y,_x,3)
    _x_ = _x
    _y_ = _y
    division = 15
    _y = _y/division
    k = 0
    l = _y
    for i in 0..division-1
     for y in k.._y-1
       for x in 0.._x-1
        if y-l*i<(l/2.0)-(l/2.5)*sin(PI*x*4.0/_x)
         a[y][x]=color_select1(i,x,y,_x)
        else
         a[y][x]=color_select2(i,x,y,_x)
        end
       end
     end
      k = _y
      _y += l
    end
    j = 0
    _x = _x/division
    m = _x 
    for i in 0..division-1
     for x in j.._x-1
       for y in 0.._y_-1
         if x-m*i<(m/2.0)-(m/2.5)*sin(PI*y*4.0/_y_)
           a[y][x][0..0]=color_select3(i,y,_y_)
         else
           a[y][x][0..0]=color_select4(i,y,_y_)
         end
       end
     end
     j = _x
     _x += m
    end
    show(a)
    end
    
  55. ( g140577 )

    #偏角(時計回り)
    def pola(x,y)
      atan2(y,x)+PI*3/4
    end
    def gazou(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          r=s/2
          if distance(x,y,r,r)> r/4
            image[x][y] = [sin(pola(x-r,y-r))**2,distance(x,y,r,r)/r/3*
                          (cos(15*distance(x,y,r,r)/r)**2),sin(pola(x-r,y-r)+PI/2)**2]
          else
            image[x][y] = [sin(pola(x-r,y-r))**2,(r/4-distance(x,y,r,r))/(r/4)*rand(),sin(pola(x-r,y-
                          r)+PI/2)**2]
          end
        end
      end
      image
    end
    show(gazou(500))
    
  56. ( g140055 )

    load("./make2d.rb")
    def uzu(extent1,extent2) 
      x = 1001
      image = make2d(x,x)
      center=(x-1)/2
      image[center][center] = 1
      print "done1"
      print "\n"
      di = 0
      angle = 0
      while di <= 708 do
        di = di+extent1
        angle = angle + extent2
        c = (center+di*cos(angle)).round
        d = (center+di*sin(angle)).round
        print c
        print " , "
        print d
        print "\n"
        if 0<= c &&c<= 1001 && 0<= d &&d<= 1001 then
          image[c][d] = 1
          print "done2"
          print "\n"
        else
        end
      end  
      image
    end
    
  57. ( g140483 )

    #draw line
    def line(m,c,pa,pb)
     if pa[0] != pb[0]
      for i in pa[0]..pb[0]
       for j in ((pa[1]+(pb[1]-pa[1])*(i-pa[0])/(pb[0]-pa[0])).ceil)..((pa[1]+(pb[1]-pa[1])*(i+1-pa[0])/(pb[0]-
    pa[0])).ceil)
    
        m[i][j]=c
       end
      end
     else
      for i in pa[1] .. pb[1]
       m[pa[0]][i]=c
      end
     end
     m
    end
    #draw RoseCurve
    def RoseCurve(m,c,a,n,d)
     p=make2d(d+1,2)
     mi=m.length
     mj=m[0].length
     h=make2d(mi,mj)
     for i in 0..d
      p[i][0]=((a*sin(n*6.28318531/d*i)*cos(6.28318531/d*i)).ceil)+a+5
      p[i][1]=((a*sin(n*6.28318531/d*i)*sin(6.28318531/d*i)).ceil)+a+5
     end
    
     for i in 1..d
      if p[i-1][0] < p[i][0]
       h=line(h,1,p[i-1],p[i])
      else
       h=line(h,1,p[i],p[i-1])
      end
     end
    
     for i in 0..2*(a+5)-1
      for j in 0..2*(a+5)-1
       if h[i][j]==1 || h[2*(a+5)-1-i][j]==1
        m[i][j]=c
       end
      end
     end
     m
    
    end
    
  58. ( g140479 )

    def r(s,x,y)
      if (x%2==0 && y%2==0) || (!(x%2==0) && !(y%2==0))
        0
      else
        1-(y+1.0)/s
      end
    end
    def b(s,x,y)
      if (x%2==0 && y%2==0) || (!(x%2==0) && !(y%2==0))
        0
      else
        (y+1.0)/s
      end
    end
    def my_figure(s)
      image=make2d(s,s)
      for y in 0..(s-1)
        for x in 0..(s-1)
          image[y][x]=[r(s,x,y),0,b(s,x,y)]
        end
      end
      image
    end
    
  59. ( g140953 )

    def assumption1(s,r)
     a=make2d(s,s)
     for x in 0..(s-1)
      for y in 0..(s-1)
      a[y][x]=1.0
      end
      for y in 0..((s/2.0-1.0)*sin(x*PI/s*r)+s/2.0)
      a[y][x]=y/s
      end
     end
     a
    end
    show(assumption1(200.0,4.0))
    
  60. ( g140581 )

    def pic()
     image = make2d(100,100)
     for x in 0..99
      for y in 0..99
       image[y][x] = [x*y/99.000/99.000,x/99.00,y/99.00]
      end
     end
     image
    end
    
  61. ( g140452 )

    def linerillusion(s,n)
     #linerillusion(全体の大きさ,平行線の場所)
      r=s/2.0
      a=PI/36
     image = make2d(s,s)
     b=make1d(9)
     c=make1d(9)
     d=make1d(8)
     e=make1d(8)
    
     for k in 0..8
      b[k]=tan((k+1)*a)
     end
    
     for k in 0..8
      c[k]=tan((k+27)*a)
     end
    
     for k in 0..7
      d[k]=tan((k+10)*a)
     end
    
     for k in 0..7
      e[k]=tan((k+19)*a)
     end
    
    #初期条件
     for y in 0..(s-1)
      for x in 0..(s-1)
    
        if (n-1)*r*1.0/n-1 <= x && x <= (n-1)*r*1.0/n+1 ||
           (n+1)*r*1.0/n-1 <= x && x <= (n+1)*r*1.0/n+1
         image[y][x] = [1,0,0]
    
        else
         if distance(x-r,y-r,x-r,(x-r)*b[0]) <= 1 ||
            distance(x-r,y-r,x-r,(x-r)*c[0]) <= 1 ||
            y >= r-1 && y <= r+1
          image[y][x] = [0,0,0]
         else
          image[y][x] = [1,1,1]
         end
        end
       end
      end
    
    #x軸に近い直線群
     for y in 0..(s-1)
      for x in 0..(s-1)
       for k in 1..8
     
        if (n-1)*r*1.0/n-1 <= x && x <= (n-1)*r*1.0/n+1 ||
           (n+1)*r*1.0/n-1 <= x && x <= (n+1)*r*1.0/n+1
         image[y][x] = [1,0,0]  
    
        else
         if distance(x-r,y-r,x-r,(x-r)*b[k]) <= 1 ||
            distance(x-r,y-r,x-r,(x-r)*c[k]) <= 1
          image[y][x] = [0,0,0]
         else
          image[y][x] = image[y][x]
         end
        end
       end
      end
     end
    
    #y軸に近い直線群
     for y in 0..(s-1)
      for x in 0..(s-1)
       for k in 0..7
    
        if (n-1)*r*1.0/n-1 <= y && y <= (n-1)*r*1.0/n+1 ||
           (n+1)*r*1.0/n-1 <= y && y <= (n+1)*r*1.0/n+1
         image[y][x] = [1,0,0]
    
        else
         if distance(x-r,y-r,(y-r)*1.0/d[k],y-r) <= 1 ||
            distance(x-r,y-r,(y-r)*1.0/e[k],y-r) <= 1 ||
            x >= r-1 && x <= r+1
          image[y][x] = [0,0,0]
         else
          image[y][x] = image[y][x]
         end
        end
       end
      end
     end
     image
    end
    linerillusion(500,6)
    
  62. ( g140966 )

    def f(s)
     image=make2d(s,s)
     for x in 0..(s-1)
      for y in 0..(s-1)
       image[y][x]=[cos(x+y),cos(x-y),0]
      end
     end
     image
    end