Skip to content

Instantly share code, notes, and snippets.

View webcrafts's full-sized avatar
💭
避難して帰宅してから心臓の調子がいまいち

Takamasa Suzuki webcrafts

💭
避難して帰宅してから心臓の調子がいまいち
View GitHub Profile
@webcrafts
webcrafts / 0_reuse_code.js
Created March 15, 2014 10:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@webcrafts
webcrafts / ruby_warrior5.rb
Created November 5, 2013 12:18
Ruby Warrior Level.5
class Player
def play_turn(warrior)
# cool code goes here
if @health.nil? then
@health = warrior.health
end
if @health > warrior.health then
if warrior.feel.empty? then
warrior.walk!
elsif warrior.feel.enemy? then
@webcrafts
webcrafts / ruby_warrior4.rb
Created November 5, 2013 12:09
Ruby Warrior Level.4
class Player
def play_turn(warrior)
# cool code goes here
if @health.nil? then
@health = warrior.health
end
if @health > warrior.health then
if warrior.feel.empty? then
warrior.walk!
else
@webcrafts
webcrafts / ruby_warrior3.rb
Created November 5, 2013 11:18
Ruby Warrior Level3
class Player
def play_turn(warrior)
# cool code goes here
if warrior.feel.empty? then
if warrior.health < 20 then
warrior.rest!
else
warrior.walk!
end
else
@webcrafts
webcrafts / ruby_warrior2.rb
Last active December 27, 2015 11:19
Ruby Warrior Level2
class Player
def play_turn(warrior)
# cool code goes here
if warrior.feel.empty? then
warrior.walk!
else
warrior.attack!
end
end
end
@webcrafts
webcrafts / ruby_warrior1.rb
Last active December 27, 2015 11:19
Ruby Warrior Level1
class Player
def play_turn(warrior)
# cool code goes here
warrior.walk!
end
end
@webcrafts
webcrafts / 20130820.rb
Last active December 21, 2015 09:59
ナマケモノ育成ゲーム 2013/08/20 ryukyu.rb 亀島さんのお題 クラスの使い方をまだ勉強会でやっていなかったので、クラスの紹介をしようかと思ったり、ペットを増やせるようにといじりだしたらわかりにくくなってしまったので、また機会があれば修正したい
# encoding: utf-8
HARA = 8
HAPPY = 8
COUNT = 7 * 4
DAY_STAT = ['朝','昼','晩','夜中']
CMD = ['食事','掃除','散歩','睡眠']
day = 0
petnum = 1
game = 0
@webcrafts
webcrafts / gist:5948862
Created July 8, 2013 13:42
今日のお題のじゃんけんゲーム
# coding:utf-8
te = ["","グー","チョキ","パー"]
report = [""]
3.times do |i|
# my_te = gets.to_i
my_te = rand(3)+1
pc_te = rand(3)+1
puts "人間の手は「#{te[my_te]}」、コンピュータの手は「#{te[pc_te]}」"
@webcrafts
webcrafts / gist:5226668
Created March 23, 2013 06:14
第一回ブログハッカソン(沖縄)参加者一覧
<ul>
<li><a href="http://rina0309.hatenablog.com/" target="_blank">りなのキラキラ☆ブログ</a></li>
<li><a href="http://cat.hatenadiary.jp/" target="_blank">(「・ω・)「ニャオー</a></li>
<li><a href="http://junjunmbb.hatenablog.com/" target="_blank">楽~んブログ</a></li>
<li><a href="http://sunnyswedding.ti-da.net/" target="_blank">サニーズウェディング</a></li>
<li><a href="http://repserc.hotcom-web.com/wordpress/" target="_blank">上階の住人はよく物を落とす。</a></li>
<li><a href="http://ochan.lolipop.jp/" target="_blank">沖縄 マインドブロックバスター琉球校大田裕(おーちゃん)</a></li>
<li><a href="http://meiying.jp/" target="_blank">沖縄中国語教室</a></li>
<li><a href="http://ryu9life.com/" target="_blank">沖縄に移住しホームページ制作で頑張る!毎日「沖縄移住生活/琉球ライフ」</a></li>
</ul>
@webcrafts
webcrafts / gist:4975842
Last active December 13, 2015 21:18
この人にわかりやすくって・・・こんな感じでわかるかな? --- 「正の整数を入力し、1から入力した値までの整数の合計値を、ループを利用して求める」プログラムを書きたいのですが何時間も粘ってもできなくて悪戦苦闘中です。 パソコンのルビーと言うソフトを使って、やるのですが、それに詳しいかたいませんか?!ルビーを使ってプログラミングをしている方だったり、他のソフトだけどパソコンのプログラミングには詳しいと言う方いましたら「」のやりかたを教えていただきたいです。お願いします。 https://www.facebook.com/groups/okinawa098/permalink/596215003725674/
# coding:utf-8
num = 0
sum = 0
max = 0
print "整数を入力してください:"
max = gets.to_i
while num < max
num += 1
sum += num
end