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 탈 .