warcards 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- warcards (0.0.2)
4
+ warcards (0.0.3)
5
5
  bundler (~> 1.1)
6
6
  querinator
7
7
  rake (~> 0.9.2)
@@ -35,7 +35,8 @@ GEM
35
35
  powerbar (1.0.8)
36
36
  ansi (~> 1.4.0)
37
37
  hashie (>= 1.1.0)
38
- querinator (0.0.1)
38
+ querinator (0.0.2)
39
+ rake (~> 0.9.2)
39
40
  rake (0.9.2.2)
40
41
  rb-fchange (0.0.5)
41
42
  ffi
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
3
 
4
- require 'warcards'
5
-
4
+ #require 'bundler'
5
+ require 'bundler/setup'
6
+ #Bundler.require(:default)
6
7
 
8
+ require 'warcards'
7
9
 
8
- # TODO finish refactoring lib/warcards and implement here
9
10
  Cardgame::Game.new.run
10
11
 
@@ -1,21 +1,61 @@
1
- require 'bundler/setup'
2
- Bundler.require(:default)
3
1
  require_relative 'warcards/gameplay'
4
2
  require 'querinator'
5
3
 
6
4
  module Cardgame
7
5
  class Game
8
6
  def initialize
9
- @questions = Querinator::Game.new.get_questions
10
- @deck = Deck.new
11
- @player = Player.new
12
- @ai = Ai.new
13
- @gameplay = Gameplay.new(:deck => @deck, :player => @player, :ai => @ai)
7
+ @deck = Deck.new
8
+ @player = Player.new
9
+ @ai = Ai.new
10
+ @gameplay = Gameplay.new(:deck => @deck, :player => @player, :ai => @ai)
14
11
  @gameplay.shuffle
15
12
  @gameplay.deal
13
+ @output = Struct.new(:winner, :player_feedback, :ai_feedback, :posed)
14
+
16
15
  end
17
16
 
17
+ ##def output
18
+ ## @output
19
+ ##end
20
+ ##
21
+ ##def rearm?
22
+ ## @gameplay.rearm?
23
+ ##end
24
+ ##
25
+ ##def show_cards
26
+ ## @gameplay.show_cards
27
+ ##end
28
+ ##
29
+ ##def war?
30
+ ## @gameplay.contest
31
+ ##end
32
+ ##
33
+ ##def contest
34
+ ## @gameplay.contest
35
+ ##end
36
+ ##
37
+ ##def discard(result)
38
+ ## @gameplay.discard(result)
39
+ ##end
40
+ ##
41
+ ##def game_over?
42
+ ## @gameplay.game_over?
43
+ ##end
44
+ #
45
+ #def player
46
+ # @player
47
+ #end
48
+ #
49
+ #def ai
50
+ # @ai
51
+ #end
52
+
18
53
  def run
54
+ filename = get_filename
55
+ until File.file? filename
56
+ get_filename
57
+ end
58
+ @questions = Querinator::Game.new.get_questions(filename)
19
59
  loop do
20
60
  @gameplay.game_over?
21
61
  @gameplay.rearm?
@@ -30,6 +70,14 @@ module Cardgame
30
70
  end
31
71
  end
32
72
 
73
+ def get_filename
74
+ puts "What question file?\nfilename: "
75
+ filename = gets.chomp
76
+ file = File.expand_path(filename)
77
+ p file
78
+ file
79
+ end
80
+
33
81
  def continue?
34
82
  puts "go again?\n"
35
83
  next_round = gets
@@ -87,9 +135,9 @@ module Cardgame
87
135
  question.is_correct?(answer.chomp)
88
136
  end
89
137
 
90
- #TODO make this configurable
91
- def test_ai
92
- @ai.difficulty_check?(rand, 0.9)
138
+ def test_ai(difficulty)
139
+ difficulty ||= 0.4
140
+ @ai.difficulty_check?(rand, difficulty)
93
141
  end
94
142
 
95
143
  end
@@ -1,5 +1,5 @@
1
1
  module Cardgame
2
2
 
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
 
5
5
  end
@@ -2,14 +2,14 @@
2
2
  require File.expand_path('../lib/warcards/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Robie Lutsey"]
6
- gem.email = ["robie1373@gmail.com"]
7
- gem.description = %q{An addictive game of War! to help slog through flash-card memorization}
8
- gem.summary = %q{Play a game of War! against the computer. If your card is higher, you get a chance to answer the flash-card question. If you get it correct, you win the round! By the time you win the game, you should really know your stuff!}
9
- gem.homepage = "http://robie1373.github.com/warcards"
5
+ gem.authors = ["Robie Lutsey"]
6
+ gem.email = ["robie1373@gmail.com"]
7
+ gem.description = %q{An addictive game of War! to help slog through flash-card memorization}
8
+ gem.summary = %q{Play a game of War! against the computer. If your card is higher, you get a chance to answer the flash-card question. If you get it correct, you win the round! By the time you win the game, you should really know your stuff!}
9
+ gem.homepage = "http://robie1373.github.com/warcards"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "warcards"
15
15
  gem.require_paths = ["lib"]
@@ -28,4 +28,5 @@ Gem::Specification.new do |gem|
28
28
  gem.add_dependency 'bundler', "~>1.1"
29
29
  gem.add_dependency 'querinator'
30
30
  gem.add_dependency 'rake', '~>0.9.2'
31
+
31
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warcards
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-10 00:00:00.000000000 Z
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-fsevent
16
- requirement: &70228092528620 !ruby/object:Gem::Requirement
16
+ requirement: &70233000726620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.1
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70228092528620
24
+ version_requirements: *70233000726620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest-spec
27
- requirement: &70228092526640 !ruby/object:Gem::Requirement
27
+ requirement: &70233000724600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.0.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70228092526640
35
+ version_requirements: *70233000724600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest-reporters
38
- requirement: &70228092524740 !ruby/object:Gem::Requirement
38
+ requirement: &70233000720920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70228092524740
46
+ version_requirements: *70233000720920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &70228092523220 !ruby/object:Gem::Requirement
49
+ requirement: &70233000719520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.2.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70228092523220
57
+ version_requirements: *70233000719520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-minitest
60
- requirement: &70228092521400 !ruby/object:Gem::Requirement
60
+ requirement: &70233000716640 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.5.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70228092521400
68
+ version_requirements: *70233000716640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: growl
71
- requirement: &70228092519160 !ruby/object:Gem::Requirement
71
+ requirement: &70233000716040 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70228092519160
79
+ version_requirements: *70233000716040
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: turn
82
- requirement: &70228092517300 !ruby/object:Gem::Requirement
82
+ requirement: &70233000715340 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.9.6
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70228092517300
90
+ version_requirements: *70233000715340
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: bundler
93
- requirement: &70228092516240 !ruby/object:Gem::Requirement
93
+ requirement: &70233000713160 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '1.1'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70228092516240
101
+ version_requirements: *70233000713160
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: querinator
104
- requirement: &70228092515120 !ruby/object:Gem::Requirement
104
+ requirement: &70233000711940 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70228092515120
112
+ version_requirements: *70233000711940
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rake
115
- requirement: &70228092513820 !ruby/object:Gem::Requirement
115
+ requirement: &70233000709640 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: 0.9.2
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70228092513820
123
+ version_requirements: *70233000709640
124
124
  description: An addictive game of War! to help slog through flash-card memorization
125
125
  email:
126
126
  - robie1373@gmail.com