berlin-ai 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ai/map.rb CHANGED
@@ -37,10 +37,10 @@ module Berlin
37
37
  end
38
38
  end
39
39
 
40
- # By checking node.player_id, we are able to know if we own the node or not.
40
+ # Returns an array of all owned nodes
41
41
  def owned_nodes
42
42
  @nodes.select do |id, node|
43
- node.player_id == player_id
43
+ node.owned_by? player_id
44
44
  end.values
45
45
  end
46
46
 
data/lib/berlin-ai.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'optparse'
1
2
  require 'sinatra'
2
3
  require 'yajl/json_gem'
3
4
 
@@ -5,7 +6,14 @@ require 'yajl/json_gem'
5
6
  require File.expand_path( File.dirname( __FILE__ ) ) + "/ai/#{file}"
6
7
  end
7
8
 
8
- # Tell Sinatra to use ai file as root file
9
+ # Parse options
10
+ OptionParser.new do |opts|
11
+ opts.on("-p N", Integer, "Set running port to N") do |p|
12
+ set :port, p
13
+ end
14
+ end.parse!
15
+
16
+ # Sinatra options
9
17
  set :app_file, $0
10
18
 
11
19
  post '/' do
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Berlin
2
2
  module AI
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- BUILD = 8
5
+ BUILD = 9
6
6
 
7
7
  VERSION = "#{MAJOR}.#{MINOR}.#{BUILD}"
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berlin-ai
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Blais