Newer
Older
Ruby / #animation.rb#
@AKIBA Hiroki AKIBA Hiroki on 22 Jul 2024 544 bytes 2024-07-22 05:16:20
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

while true
  x=1
  a=["○"," "," "," "," "," "," "," "," "," "]
  b=[" "," "," "," "," "," "," "," "," ","○"]
  y=8
  while x<11
    puts()
    c=0
    while c<a.length
      print(a[c])
      c+=1
    end
    puts()
    d=0
    while d<b.length
      print(b[d])
      d+=1
    end
    puts()
    a[x-1]=" "
    b[y+1]=" "
    if e%2==0
      a[x]="●"
      b[y]="○"
    elsif e%2==1
      a[x]="○"
      b[y]="●"
    end
    x+=1
    y-=1
    sleep(0.05)
  end
  e+=1
  sleep(0.05)
end