Skip to content

Commit

Permalink
docs: add Changelog (#2)
Browse files Browse the repository at this point in the history
* docs: add Changelog

* docs: add Changelog
  • Loading branch information
q9f authored Dec 17, 2024
1 parent ffbce1c commit 9c47e51
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Frontier.rb v0.0.1

- Docs: add changelog ([#2](https://github.com/q9f/frontier.rb/pulls/2))
- Ci: enable github actions ([#1](https://github.com/q9f/frontier.rb/pulls/1))
- Examples: add distance script
- Examples: add progress tracking
- Docs: clarify limitations
- Graph: fix edge case for missing vertices
- Gem: add usage example
- Graph: use dijkstra's algorithm for path finding
- Coords: add class to handle 3d coordinates in space
- Frontier: add version 0.0.1
- Coords: Fix coords spec
- Star: add struct for handling star systems
- Coords: add class to handle 3d coordinates in space
- Initial commit for the Frontier library
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Limitations:
- path finding on 24k star systems can hit the limits of Ruby (SystemStackError: stack level too deep), try running shorter queries over less distance and combine the results

## Installation
The gem is not published yet, but yuo can install it locally:
The gem is not published yet, but you can install it locally:

```
git clone https://github.com/q9f/frontier.rb
Expand All @@ -27,21 +27,30 @@ require "frontier"
include Frontier
```

### Shortest path between two star systems
Get the shortest path between `D:S299` and `Y:1SII`.
### Direct distance between two star systems
Get the direct distance between `D:S299` and `Y:1SII`.

```ruby
best_smart_gate_path = UNIVERSE_GRAPH.shortest_path("D:S299", "Y:1SII")
direct_distance = ALL_STARS["D:S299"].distance_ly(ALL_STARS["Y:1SII"])
```

See [examples/](./examples/) for usage and options to fine-tune.

```ruby
```bash
❯ ruby examples/distance.rb "D:S299" "Y:1SII"
1974.926982542737
```

### Shortest jump-path between two star systems
Get the shortest path between `D:S299` and `Y:1SII`.

```ruby
best_smart_gate_path = UNIVERSE_GRAPH.shortest_path("D:S299", "Y:1SII")
```

See [examples/](./examples/) for usage and options to fine-tune.

```bash
❯ ruby examples/pathfinder.rb
Mapping all star systems ... done.
Building universe graph ... done.
Expand All @@ -51,6 +60,16 @@ Building universe graph ... done.
"dist"=>1978.63507044974}
```

### Frontier console

Run the console to make ad-hoc computations on the command line:

```bash
❯ ./bin/console
[1] pry(main)> g = Graph.new
=> #<Frontier::Graph:0x0000791d610ca920 @graph={}, @nodes=#<Set: {}>>
```

## Testing
To run tests, simply use `rspec`.

Expand Down
6 changes: 3 additions & 3 deletions examples/distance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
c_id += 1
end

# Distance between "D:S299" to "Y:1SII"
distance = ALL_STARS["D:S299"].distance_ly(ALL_STARS["Y:1SII"])
pp distance
# Direct distance between "D:S299" to "Y:1SII"
direct_distance = ALL_STARS["D:S299"].distance_ly(ALL_STARS["Y:1SII"])
pp direct_distance
end

0 comments on commit 9c47e51

Please sign in to comment.