hangman_letter_letdown 1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Hangman.Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ #
2
+ # DO NOT tamper with this file. It will lead to disqualification.
3
+
4
+ require 'rake'
5
+ require 'spec/rake/spectask'
6
+
7
+ desc "Run all examples with RCov"
8
+ Spec::Rake::SpecTask.new('spec_with_rcov') do |t|
9
+ t.spec_files = FileList['spec/**/*.rb']
10
+ t.rcov = true
11
+ t.rcov_opts = ['-t', '--exclude', 'spec,rcov', '--no-html']
12
+ end
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ require 'rake'
2
+ require 'rake/gempackagetask'
3
+ require 'spec/rake/spectask'
4
+ require 'hangman_tournament/submit'
5
+
6
+ desc "Run all specs"
7
+ Spec::Rake::SpecTask.new('spec') do |t|
8
+ t.spec_files = FileList['spec/**/*.rb']
9
+ t.rcov = false
10
+ end
11
+
12
+ PKG_NAME = "letter_letdown"
13
+ PKG_VERSION = "1.0"
14
+
15
+ spec = Gem::Specification.new do |s|
16
+ s.name = "hangman_#{PKG_NAME}"
17
+ s.version = PKG_VERSION
18
+ s.files = Dir.glob('**/*').reject{ |f| f =~ /pkg/ }
19
+ s.require_path = 'lib'
20
+ s.test_files = Dir.glob('spec/*_spec.rb')
21
+ s.bindir = 'bin'
22
+ s.executables = []
23
+ s.summary = "Hangman Player:Letter Letdown"
24
+ s.rubyforge_project = "sparring"
25
+ s.homepage = "http://sparring.rubyforge.org/"
26
+
27
+ ###########################################
28
+ ##
29
+ ## You are encouraged to modify the following
30
+ ## spec attributes.
31
+ ##
32
+ ###########################################
33
+ s.description = "An aweful hangman player"
34
+ s.author = "Micah Martin"
35
+ s.email = "micah@8thight.com"
36
+ end
37
+
38
+ Rake::GemPackageTask.new(spec) do |pkg|
39
+ pkg.need_zip = false
40
+ pkg.need_tar = false
41
+ end
42
+
43
+ desc "Submit your player"
44
+ task :submit do
45
+ submitter = HangmanTournament::Submit.new("hangman_#{PKG_NAME}")
46
+ submitter.submit
47
+ end
@@ -0,0 +1,52 @@
1
+ module LetterLetdown
2
+ class LetterLetdown
3
+
4
+ # You may initialize you player but the the initialize method must take NO paramters.
5
+ # The player will only be instantiated once, and will play many games.
6
+ def initialize
7
+ end
8
+
9
+ # Before starting a game, this method will be called to inform the player of all the possible words that may be
10
+ # played.
11
+ def word_list=(list)
12
+ end
13
+
14
+ # a new game has started. The number of guesses the player has left is passed in (default 6),
15
+ # in case you want to keep track of it.
16
+ def new_game(guesses_left)
17
+ @left = ('a'..'z').to_a
18
+ end
19
+
20
+ # Each turn your player must make a guess. The word will be a bunch of underscores, one for each letter in the word.
21
+ # after your first turn, correct guesses will appear in the word parameter. If the word was "shoes" and you guessed "s",
22
+ # the word parameter would be "s___s", if you then guess 'o', the next turn it would be "s_o_s", and so on.
23
+ # guesses_left is how many guesses you have left before your player is hung.
24
+ def guess(word, guesses_left)
25
+ @left.shift
26
+ end
27
+
28
+ # notifies you that your last guess was incorrect, and passes your guess back to the method
29
+ def incorrect_guess(guess)
30
+ end
31
+
32
+ # notifies you that your last guess was correct, and passes your guess back to the method
33
+ def correct_guess(guess)
34
+ end
35
+
36
+ # you lost the game. The reason is in the reason parameter
37
+ def fail(reason)
38
+ end
39
+
40
+ # The result of the game, it'll be one of 'win', 'loss', or 'fail'.
41
+ # The spelled out word will be provided regardless of the result.
42
+ def game_result(result, word)
43
+ end
44
+
45
+ # your score for this game.
46
+ # You get 10 points per guess you have left,
47
+ # lose 5 points for each unsolved space in the word
48
+ # and lose 100 points for failing to complete your guesses because of an error in your code.
49
+ def game_score(score)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'letter_letdown/letter_letdown'
3
+
4
+ describe LetterLetdown::LetterLetdown do
5
+
6
+ it "should be instantiable with no paramters" do
7
+
8
+ lambda { LetterLetdown::LetterLetdown.new }.should_not raise_error
9
+
10
+ end
11
+
12
+ end
@@ -0,0 +1,4 @@
1
+ $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
2
+
3
+ require 'rubygems'
4
+ require 'spec'
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hangman_letter_letdown
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.0"
5
+ platform: ruby
6
+ authors:
7
+ - Micah Martin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-17 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: An aweful hangman player
17
+ email: micah@8thight.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - Hangman.Rakefile
26
+ - lib
27
+ - lib/letter_letdown
28
+ - lib/letter_letdown/letter_letdown.rb
29
+ - Rakefile
30
+ - spec
31
+ - spec/letter_letdown
32
+ - spec/letter_letdown/letter_letdown_spec.rb
33
+ - spec/spec_helper.rb
34
+ has_rdoc: false
35
+ homepage: http://sparring.rubyforge.org/
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project: sparring
56
+ rubygems_version: 1.3.1
57
+ signing_key:
58
+ specification_version: 2
59
+ summary: Hangman Player:Letter Letdown
60
+ test_files: []
61
+