Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add Changelog #2

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading