Skip to content

Instantly share code, notes, and snippets.

View webcrafts's full-sized avatar
💭
最近視力が落ちました

Takamasa Suzuki webcrafts

💭
最近視力が落ちました
View GitHub Profile
@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 / 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 / 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 / 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_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_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_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 / 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