Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gregors/princeton_standard_libraries
https://github.com/gregors/princeton_standard_libraries
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gregors/princeton_standard_libraries
- Owner: gregors
- License: gpl-3.0
- Created: 2018-12-26T20:53:13.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-28T03:52:08.000Z (about 6 years ago)
- Last Synced: 2024-05-29T22:31:25.737Z (7 months ago)
- Language: Ruby
- Size: 206 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Princeton Standard Libraries Jruby wrapper
I was going through the [Algorithms 4th edition](https://algs4.cs.princeton.edu/home/) and wanted to write the algorithms in ruby instead of the default java. The book uses the [Princeton Standard Libraries](https://introcs.cs.princeton.edu/java/stdlib/) to help clarify the code.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'princeton_standard_libraries'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install princeton_standard_libraries
## Usage
require 'princeton_standard_libraries'
n = 50
Java::StdDraw.set_xscale(0,n)
Java::StdDraw.set_yscale(0,n*n)
Java::StdDraw.pen_radius = 0.01
1.upto(n) do |i|
Java::StdDraw.point(i, i)
Java::StdDraw.point(i, i*i)
Java::StdDraw.point(i, i*Math.log(i))
end## License
The gem is available as open source under the terms of the [GNU General Public License, version 3 (GPLv3)](http://www.gnu.org/copyleft/gpl.html).