U E D R , A S I H C RSS

정모/2011.4.4/Code Race/김수경

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 마

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 배만 .
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:51
Processing time 0.0132 sec