Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgrade to latest pry and move console setup into ConsoleStrategy

  • Loading branch information...
commit 8c0d32ada5f8239f0040fcc08fc94dad2bc3a72c 1 parent 12a31b2
Carter Thaxton authored
Showing with 23 additions and 13 deletions.
  1. +7 −12 Gemfile.lock
  2. +15 −0 lib/console_strategy.rb
  3. +1 −1  play
19 Gemfile.lock
View
@@ -1,19 +1,14 @@
GEM
remote: http://rubygems.org/
specs:
- coderay (0.9.8)
- method_source (0.6.6)
- ruby_parser (~> 2.0.5)
- pry (0.9.6.2)
- coderay (~> 0.9.8)
- method_source (~> 0.6.5)
- ruby_parser (~> 2.0.5)
- slop (~> 2.1.0)
+ coderay (1.0.7)
+ method_source (0.8)
+ pry (0.9.10)
+ coderay (~> 1.0.5)
+ method_source (~> 0.8)
+ slop (~> 3.3.1)
rake (0.9.2.2)
- ruby_parser (2.0.6)
- sexp_processor (~> 3.0)
- sexp_processor (3.0.7)
- slop (2.1.0)
+ slop (3.3.2)
PLATFORMS
ruby
15 lib/console_strategy.rb
View
@@ -6,6 +6,21 @@ class ConsoleStrategy
@@fiber = nil
@@waiting_for_response = false
+ def self.start_new_game
+ g = Game.new :strategy => :console
+ p1 = g.players[0]
+ p2 = g.players[1]
+ f = Fiber.new do
+ puts "Welcome to Dominion\n g - game\n p1 - player 1\n p2 - player 2\n"
+ Pry.quiet = true
+ Pry.prompt = proc { '> ' }
+ Pry.start binding
+ puts "Bye!"
+ exit
+ end
+ f.resume
+ end
+
def choose(player, options)
puts "#{player}: #{player.card_in_play} - #{options[:message]}"
@@waiting_for_response = true
2  play
View
@@ -1 +1 @@
-pry -Ilib -rdominion -e 'g = Game.new :strategy => :console; p1 = g.players[0]; p2 = g.players[1]; f = Fiber.new do; puts "Welcome to Dominion\n g - game\n p1 - player 1\n p2 - player 2\n"; binding.pry; puts "Bye!"; exit; end; f.resume;'
+pry -I lib -r dominion -e 'ConsoleStrategy.start_new_game;'
Please sign in to comment.
Something went wrong with that request. Please try again.