Sha256: 8a1b634088c4b667540247a4210ef253ff6f8791d22096a4c23d6dac4b040c00
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
# example listen speech recognition t = text({content: "Say box, dessine moi un cercle, mets le en jaune, avance le vers la droite", y: 66, x: 33 }) t.touch do listen(:stop) end listen(:french) do |sentence| t.content = sentence if sentence.include?("box") if grab(:the_box) grab(:the_box).delete(true) end box({ atome_id: :the_box, x: 333 }) if sentence.include?("red") grab(:the_box).color("red") end if sentence.include?("smooth") grab(:the_box).smooth(9) end elsif sentence.include?("circle") if grab(:the_circle) grab(:the_circle).delete(true) end circle({ atome_id: :the_circle, x: 66, y: 66 }) if sentence.include?("blue") grab(:the_circle).color("blue") end elsif sentence.include?("cercle") if grab(:the_circle) grab(:the_circle).delete(true) end unless grab(:the_circle) circle({ atome_id: :the_circle, x: 66, y: 66 }) end if sentence.include?("jaune") grab(:the_circle).color("yellow") elsif sentence.include?("avance") && sentence.include?("droite") grab(:the_circle).x=grab(:the_circle).x+90 elsif sentence.include?("recule") && sentence.include?("gauche") grab(:the_circle).x=grab(:the_circle).x-90 end # listen(:stop) # listen(:start) else end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
atome-0.4.7.0 | vendor/assets/build/medias/rubies/examples/Old_examples/listen.rb |
atome-0.4.5.4 | vendor/assets/build/medias/rubies/examples/Old_examples/listen.rb |