River Crossing ¶
- 2011 4 4 교 CodeRace. CodeRace 게 . 고 거 고 갑기 깨길 게 고. 고 고 그 기 겠 3 .
- RubyLanguage
- TDD 개 rake aborted! No Rakefile found. 기. 간 계 겠. 고ㅜㅜㅜㅜㅜㅜ
- 간 ... 곤 .
¶
- A B 간.
¶
- A 과 B .
- 고 깊기 고 .
Step 1 ¶
- 교 A B 간.
class Layton
@location
attr_accessor :location
def initialize
@location = false
end
def crossRiver
@location = true
end
end
layton = Layton.new() layton.crossRiver if !layton.location print "FAIL" end
Step 2 ¶
- 교 고 갈 .
- A -> B
- B -> A
- A -> B
class Layton
@location
attr_accessor :location
def initialize
@location = false
end
def crossRiver
@location = !@location
end
end
class Solver
def run(person)
person.crossRiver
end
end
solver = Solver.new() layton = Layton.new() solver.run(layton) if !layton.location print "FAIL" end
Step 3 ¶
- .
- .
Step 4 ¶
-
- 교 .
- 교 .
Step 5 ¶
- 2 .










