pathing 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +55 -1
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff3d8c9d22d0eee8f8a4ee996b77e1a41a768339
4
- data.tar.gz: 2086abcafcf1e8f00cd5e0b3b7620129f2192a29
3
+ metadata.gz: afb27fb129cf526ac658ac0df464f094791bb0e0
4
+ data.tar.gz: 8c8efa03a5f7fe2584c58d109520e600c8dcec99
5
5
  SHA512:
6
- metadata.gz: fe8479732bb37702e52c7b4ad9b230ae95a76d9af7ec36b09be5b5b0a6f03259cdfe83dc64ac7724775d4c002d9322cd9bdaa68900e7afe8a3afcf945e2e3aca
7
- data.tar.gz: d14ec4fb8c2ce9fdf604d3f09cfa25cc6458f720dbddc643bcb79775b35e81baba95b42408bcbd3f0ddfca58281e09d472fa8d7ffb735ae6c0d71fcb6a620021
6
+ metadata.gz: 82f0669c363d9566f91ac2966307addda396f275a2d4ef9cfa28454fff74e0b49fa65532cb12a36c90061bec0c6352f9c408550805fa7cfcb5e2d710a2dfc8bd
7
+ data.tar.gz: a4246a43c471472b9b16c7ac6590efcaac80b433c885e5bd76b95d70b971e3099dfc05f2a03d15fd11e3fc8e9516ba601f72129682ca0f006f19399ad9ffbc7e
data/README.md CHANGED
@@ -1,2 +1,56 @@
1
- # pathing
1
+ # pathing v0.1.1
2
+
2
3
  Dijkstra's algorithm pathfinding in Ruby
4
+
5
+ ## Features
6
+
7
+ - **Quick** - written in C as a Ruby extension!
8
+ - **Flexible** - use your own graph interface!
9
+ - **Simple** - describe your graph, call one method, and you have your path!
10
+
11
+ ## Sample Usage
12
+
13
+ The easiest way to download the gem is to use [Bundler](http://bundler.io/) with a Gemfile. In your Gemfile, include the line `gem 'pathing'`. Then you can run `bundle install` to automatically download and compile the gem for your system. To include the gem in a Ruby file, use the line `require 'pathing'`.
14
+
15
+ To do some pathfinding, first set up a graph interface object. This object defines the entire layout of your graph. The following example is one way of achieving a two-dimensional grid with neighbors only in the cardinal directions.
16
+ ```
17
+ class Interface
18
+ SIZE = 32
19
+
20
+ # gets an array of neighbors for the given node key
21
+ # for this example, the node key is passed in as an array like so: [x, y]
22
+ def neighbors_for(node_key)
23
+ x, y = *node_key
24
+ neighbors = []
25
+
26
+ neighbors << [x-1, y] if x > 0
27
+ neighbors << [x, y-1] if y > 0
28
+ neighbors << [x+1, y] if x < SIZE-1
29
+ neighbors << [x, y+1] if y < SIZE-1
30
+
31
+ neighbors
32
+ end
33
+
34
+ # gets the cost for moving from node1 to node2
35
+ def edge_cost_between(node1_key, node2_key)
36
+ 1
37
+ end
38
+ end
39
+ ```
40
+
41
+ Now, create a `Graph` object referencing your interface object.
42
+ ```
43
+ graph = Pathing::Graph.new(Interface.new)
44
+ ```
45
+
46
+ You're all set. Simply call
47
+ ```
48
+ graph.path([0,0], [15, 20])
49
+ ```
50
+ to get your optimized path!
51
+
52
+ ## Credits
53
+
54
+ Copyright (c) 2015 [Nick Lowery](https://github.com/ClockVapor)
55
+
56
+ View LICENSE for full license.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pathing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Lowery
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: Dijkstra's algorithm pathfinding
27
+ description: Quick and flexible Dijkstra's algorithm pathfinding
28
28
  email: nick.a.lowery@gmail.com
29
29
  executables: []
30
30
  extensions:
@@ -42,7 +42,7 @@ files:
42
42
  - ext/pathing/pathing.c
43
43
  - ext/pathing/pathing.h
44
44
  - ext/pathing/util.h
45
- homepage: https://github.com/ClockVapor/pathing
45
+ homepage: ''
46
46
  licenses:
47
47
  - MIT
48
48
  metadata: {}
@@ -65,5 +65,5 @@ rubyforge_project:
65
65
  rubygems_version: 2.4.3
66
66
  signing_key:
67
67
  specification_version: 4
68
- summary: Dijkstra's algorithm pathfinding
68
+ summary: Quick and flexible Dijkstra's algorithm pathfinding
69
69
  test_files: []