Newer
Older
Ruby / animation.rb
@AKIBA Hiroki AKIBA Hiroki on 21 Jul 2024 547 bytes 2024-07-21 17:44:48
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
e=0
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