rtanque 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.md +7 -2
- data/bin/rtanque +11 -5
- data/lib/rtanque/gui/shell.rb +12 -1
- data/lib/rtanque/gui/window.rb +13 -1
- data/lib/rtanque/match.rb +4 -0
- data/lib/rtanque/version.rb +1 -1
- data/rtanque.gemspec +1 -1
- data/spec/rtanque/match_spec.rb +1 -0
- metadata +7 -7
- data/.rvmrc +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5b5b5c762071e699e291d5fb2eee0b3fbde3969
|
4
|
+
data.tar.gz: 7024d13b01047e8e8ed0108419105e4c6ff00580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e61aa1c443deaaba2127306671699c76e2753d06c911073b71e6811fba2a8975a472b9ac66b3a0b24aa20f7c12922dcf6d0af8c85b67d4cb62cecd0a37c4915
|
7
|
+
data.tar.gz: 30d528d916bf3b267bee41bbc6528d8c0ce2666d19dbb0755b83b673c9f138069773b9c9deb495d8be40c976390bc67ff49b7ee457ae85b8052408a7bf4cba88
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
RTanque
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
**What is this?**
|
4
4
|
RTanque is a game for ( *Ruby* ) programmers. Players program the brain of a tank and then send their tank+brain into battle with other tanks. All tanks are otherwise equal.
|
5
5
|
|
6
|
+
[Getting started guide](http://awilliams.github.io/articles/rtanque-getting-started/)
|
7
|
+
|
6
8
|
Rules of the game are simple: Last bot standing wins. Gameplay is also pretty simple. Each tank has a **base**, **turret** and **radar**, each of which rotate independently. The base moves the tank, the turret has a gun mounted to it which can fire at other tanks, and the radar detects other tanks in its field of vision.
|
7
9
|
|
8
10
|
Have fun competing against friends' tanks or the sample ones included. Maybe you'll start a small league at your local Ruby meetup. CLI provides easy way to download bots from gists.
|
@@ -11,8 +13,11 @@ Sound difficult or time consuming? It's not! Check out the included sample tank
|
|
11
13
|
|
12
14
|
This is not an original idea, see [influences](https://github.com/awilliams/RTanque#influences). There's a lot of resources out there around tank design and tactics that could be applied to RTanque.
|
13
15
|
|
14
|
-
How does it look? Here's a
|
15
|
-
|
16
|
+
How does it look? Here's a video of a battle:
|
17
|
+
|
18
|
+
<a href="http://www.youtube.com/watch?feature=player_embedded&v=UPBqwOgGlVY
|
19
|
+
" target="_blank"><img src="http://img.youtube.com/vi/UPBqwOgGlVY/0.jpg"
|
20
|
+
alt="RTanque Demo" width="640" height="480" border="10" /></a>
|
16
21
|
|
17
22
|
#### Influences
|
18
23
|
RTanque is based on the Java project [Robocode](http://robocode.sourceforge.net/) and inspired by other Ruby ports. Thanks and credit go to them both.
|
data/bin/rtanque
CHANGED
@@ -96,10 +96,16 @@ LONGDESC
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def download_gist(gist_id, options)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
client = Octokit::Client.new
|
100
|
+
begin
|
101
|
+
gist = client.gist(gist_id)
|
102
|
+
rescue Octokit::NotFound
|
103
|
+
puts set_color("Error! Gist #{gist_id} not found. Please ensure the gist id is correct.", :red)
|
104
|
+
else
|
105
|
+
gist.files.attrs.each do |name, gist_file|
|
106
|
+
gist_path = "#{BOT_DIR}/#{gist.user.login}.#{gist_id}/#{name}"
|
107
|
+
create_file(gist_path, gist_file.content, options)
|
108
|
+
end
|
103
109
|
end
|
104
110
|
end
|
105
111
|
|
@@ -108,4 +114,4 @@ LONGDESC
|
|
108
114
|
end
|
109
115
|
end
|
110
116
|
|
111
|
-
RTanqueCLI.start
|
117
|
+
RTanqueCLI.start
|
data/lib/rtanque/gui/shell.rb
CHANGED
@@ -5,16 +5,27 @@ module RTanque
|
|
5
5
|
class Shell
|
6
6
|
attr_reader :shell
|
7
7
|
|
8
|
+
DEBUG = ENV["DEBUG_SHELLS"]
|
9
|
+
|
8
10
|
def initialize(window, shell)
|
9
11
|
@window = window
|
10
12
|
@shell = shell
|
13
|
+
@x0 = shell.position.x
|
14
|
+
@y0 = @window.height - shell.position.y
|
11
15
|
@shell_image = Gosu::Image.new(@window, Gui.resource_path("images/bullet.png"))
|
12
16
|
end
|
13
17
|
|
14
18
|
def draw
|
15
19
|
position = [self.shell.position.x, @window.height - self.shell.position.y]
|
16
20
|
@shell_image.draw_rot(position[0], position[1], ZOrder::SHELL, 0, 0.5, 0.5)
|
21
|
+
|
22
|
+
if DEBUG then
|
23
|
+
white = Gosu::Color::WHITE
|
24
|
+
pos = shell.position
|
25
|
+
x1, y1 = pos.x, @window.height - pos.y
|
26
|
+
@window.draw_line @x0, @y0, white, x1, y1, white, ZOrder::SHELL
|
27
|
+
end
|
17
28
|
end
|
18
29
|
end
|
19
30
|
end
|
20
|
-
end
|
31
|
+
end
|
data/lib/rtanque/gui/window.rb
CHANGED
@@ -26,6 +26,8 @@ module RTanque
|
|
26
26
|
super(@arena.width, @arena.height, false, UPDATE_INTERVAL)
|
27
27
|
self.caption = self.class.name.split('::').first
|
28
28
|
@background = Gosu::Image.new(self, Gui.resource_path("images/grass.png"))
|
29
|
+
|
30
|
+
@draw_procs = []
|
29
31
|
end
|
30
32
|
|
31
33
|
def update
|
@@ -46,7 +48,17 @@ module RTanque
|
|
46
48
|
self.gui_bots.draw
|
47
49
|
self.gui_shells.draw
|
48
50
|
self.gui_explosions.draw
|
51
|
+
|
52
|
+
@draw_procs.each do |proc|
|
53
|
+
proc.call self
|
54
|
+
end
|
55
|
+
|
56
|
+
@draw_procs.clear
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_draw_proc &b
|
60
|
+
@draw_procs << b
|
49
61
|
end
|
50
62
|
end
|
51
63
|
end
|
52
|
-
end
|
64
|
+
end
|
data/lib/rtanque/match.rb
CHANGED
data/lib/rtanque/version.rb
CHANGED
data/rtanque.gemspec
CHANGED
@@ -24,7 +24,7 @@ Have fun competing against friends' tanks or the sample ones included. Maybe you
|
|
24
24
|
|
25
25
|
gem.add_dependency 'gosu', '~> 0.7.45'
|
26
26
|
gem.add_dependency 'configuration', '~> 1.3.2'
|
27
|
-
gem.add_dependency 'octokit', '~>
|
27
|
+
gem.add_dependency 'octokit', '~> 2.7.0'
|
28
28
|
gem.add_dependency 'thor', '~> 0.17.0'
|
29
29
|
gem.add_dependency 'texplay'
|
30
30
|
|
data/spec/rtanque/match_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtanque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.7.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: thor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +137,8 @@ extra_rdoc_files: []
|
|
137
137
|
files:
|
138
138
|
- .gitignore
|
139
139
|
- .rspec
|
140
|
-
- .
|
140
|
+
- .ruby-gemset
|
141
|
+
- .ruby-version
|
141
142
|
- .travis.yml
|
142
143
|
- .yardopts
|
143
144
|
- Gemfile
|
@@ -285,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
286
|
version: '0'
|
286
287
|
requirements: []
|
287
288
|
rubyforge_project:
|
288
|
-
rubygems_version: 2.
|
289
|
+
rubygems_version: 2.2.1
|
289
290
|
signing_key:
|
290
291
|
specification_version: 4
|
291
292
|
summary: RTanque is a game for programmers. Players program the brain of a tank and
|
@@ -300,4 +301,3 @@ test_files:
|
|
300
301
|
- spec/rtanque/shell_spec.rb
|
301
302
|
- spec/rtanque_spec.rb
|
302
303
|
- spec/spec_helper.rb
|
303
|
-
has_rdoc:
|
data/.rvmrc
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
-
# Only full ruby name is supported here, for short names use:
|
8
|
-
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
-
environment_id="ruby-2.0.0@RTanque"
|
10
|
-
|
11
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
-
# rvmrc_rvm_version="1.17.2 (stable)" # 1.10.1 seams as a safe start
|
13
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
-
# return 1
|
16
|
-
# }
|
17
|
-
|
18
|
-
# First we attempt to load the desired environment directly from the environment
|
19
|
-
# file. This is very fast and efficient compared to running through the entire
|
20
|
-
# CLI and selector. If you want feedback on which environment was used then
|
21
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
-
then
|
25
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
-
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
-
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
-
else
|
29
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
30
|
-
rvm --create "$environment_id" || {
|
31
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
32
|
-
return 1
|
33
|
-
}
|
34
|
-
fi
|