rsokoban 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.3@rsokoban
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "happymapper"
7
+ gem "ncurses-ruby"
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ gem "awesome_print"
13
+ gem "rspec"
14
+ gem "yard"
15
+ gem "bundler"
16
+ gem "jeweler"
17
+ gem "simplecov"
18
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ awesome_print (1.0.2)
5
+ diff-lcs (1.1.3)
6
+ git (1.2.5)
7
+ happymapper (0.4.0)
8
+ libxml-ruby (~> 2.0)
9
+ jeweler (1.8.3)
10
+ bundler (~> 1.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ rdoc
14
+ json (1.7.3)
15
+ libxml-ruby (2.3.2)
16
+ multi_json (1.3.5)
17
+ ncurses-ruby (1.2.1)
18
+ rake (0.9.2.2)
19
+ rdoc (3.12)
20
+ json (~> 1.4)
21
+ rspec (2.10.0)
22
+ rspec-core (~> 2.10.0)
23
+ rspec-expectations (~> 2.10.0)
24
+ rspec-mocks (~> 2.10.0)
25
+ rspec-core (2.10.0)
26
+ rspec-expectations (2.10.0)
27
+ diff-lcs (~> 1.1.3)
28
+ rspec-mocks (2.10.1)
29
+ simplecov (0.6.4)
30
+ multi_json (~> 1.0)
31
+ simplecov-html (~> 0.5.3)
32
+ simplecov-html (0.5.3)
33
+ yard (0.8.1)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ awesome_print
40
+ bundler
41
+ happymapper
42
+ jeweler
43
+ ncurses-ruby
44
+ rspec
45
+ simplecov
46
+ yard
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Max Thom Stahl
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # rsokoban
2
+
3
+ Really simple Sokoban implementation in Ruby. I wrote it because I'd never written one and 'cause it's a neat game. Don't judge.
4
+
5
+ ## How to play
6
+
7
+ #####
8
+ # #
9
+ # $$####
10
+ # $ $ #
11
+ # # #
12
+ #### ##$ ######
13
+ # @ ## ..#
14
+ ## ..#
15
+ ########### .+#
16
+ ######
17
+
18
+ Legend:
19
+
20
+ * `@` - The player (you)
21
+ * `#` - Wall
22
+ * `$` - Box
23
+ * `.` - Goal
24
+ * `+` - Box on a goal square
25
+
26
+ The following keys work in RSokoban:
27
+
28
+ * `q` - Quit RSokoban
29
+ * `r` - Reset level
30
+ * `WSAD`/arrow keys - Move
31
+ * 'z' - Undo (unlimited)
32
+
33
+ ## Contributing to rsokoban
34
+
35
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
36
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
37
+ * Fork the project.
38
+ * Start a feature/bugfix branch.
39
+ * Commit and push until you are happy with your contribution.
40
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
41
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
42
+
43
+ ## Copyright
44
+
45
+ Copyright (c) 2012 Max Thom Stahl. See LICENSE.txt for
46
+ further details.
47
+
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "rsokoban"
18
+ gem.homepage = "http://github.com/mstahl/rsokoban"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Sokoban, written in Ruby.}
21
+ gem.description = %Q{A Sokoban clone written in Ruby using the ncurses library.}
22
+ gem.email = "max@dangerouscuteness.com"
23
+ gem.authors = ["Max Thom Stahl"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'yard'
42
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
data/bin/rsokoban ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+
5
+ require 'awesome_print'
6
+ require 'ncurses'
7
+
8
+ require 'level'
9
+ require 'rsokoban_game'
10
+
11
+ begin
12
+ window = Ncurses.initscr
13
+ Ncurses.cbreak
14
+ Ncurses.noecho
15
+ Ncurses.curs_set 0
16
+
17
+ Ncurses.keypad(window, true)
18
+
19
+ levels = RSokoban::Level.load(File.join(File.dirname(__FILE__), '..', 'levels', 'default.xml'))
20
+ current_level = 0
21
+
22
+ levels[current_level].draw(window)
23
+
24
+ game = RSokoban::RSokobanGame.new(window)
25
+ levels.each do |level|
26
+ window.clear
27
+ game.play_level(level)
28
+ end
29
+ ensure
30
+ Ncurses.echo
31
+ Ncurses.curs_set 1
32
+ Ncurses.nocbreak
33
+ Ncurses.nl
34
+ Ncurses.endwin
35
+ end