Module: ScoreRound
- Included in:
- Game
- Defined in:
- lib/prisoners-dilemma/score-round.rb
Instance Method Summary collapse
- #both_cooperate ⇒ Object
- #green_screws_red ⇒ Object
- #neither_cooperate ⇒ Object
- #red_screws_green ⇒ Object
Instance Method Details
#both_cooperate ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/prisoners-dilemma/score-round.rb', line 2 def both_cooperate @score[0] += 3 @score[1] += 3 round = [true, true, @score] @red.log << round @green.log << round puts "\tBoth Cooperate" end |
#green_screws_red ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/prisoners-dilemma/score-round.rb', line 37 def green_screws_red @score[1] += 5 round = [true, false, @score] @red.log << round @green.log << round puts "\tGreen Screws Red" end |
#neither_cooperate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/prisoners-dilemma/score-round.rb', line 14 def neither_cooperate @score[0] += 1 @score[1] += 1 round = [false, false, @score] @red.log << round @green.log << round puts "\tNeither Cooperate" end |
#red_screws_green ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/prisoners-dilemma/score-round.rb', line 26 def red_screws_green @score[0] += 5 round = [false, true, @score] @red.log << round @green.log << round puts "\tRed Screws Green" end |