mirror of
https://github.com/fmap/muflax65ngodyewp.onion
synced 2024-06-14 08:46:50 +02:00
range_math post
This commit is contained in:
parent
a3ce2f9bbf
commit
8cf2288d2e
|
@ -17,6 +17,9 @@
|
|||
<!-- tweets -->
|
||||
[Twitter pali]: https://twitter.com/#!/muflax/status/66635052242567168
|
||||
|
||||
<!-- comments -->
|
||||
[comment Church]: http://blog.muflax.com/jesus/self-baptism/#comment-513169408
|
||||
|
||||
<!-- software -->
|
||||
[Config]: https://github.com/muflax/config
|
||||
[Github]: https://github.com/muflax/
|
||||
|
@ -29,3 +32,5 @@
|
|||
[fume]: https://github.com/muflax/fume
|
||||
[fumetrap]: https://github.com/muflax/fumetrap
|
||||
[github web history]: https://github.com/muflax/scripts/blob/master/google_web_history.rb
|
||||
[range_math]: https://github.com/muflax/range_math
|
||||
[avg_dmg]: https://github.com/muflax/scripts/blob/master/average_damage.rb
|
||||
|
|
|
@ -77,6 +77,8 @@
|
|||
[Ingram flame]: http://www.dharmaoverground.org/web/guest/discussion/-/message_boards/message/2880527
|
||||
[Rhetological Fallacies]: http://www.informationisbeautiful.net/visualizations/rhetological-fallacies/
|
||||
[Logical Fallacies Poster]: http://yourlogicalfallacyis.com/
|
||||
[SMBC skull-king]: http://www.smbc-comics.com/index.php?db=comics&id=2244#comic
|
||||
[Up and Down the Ladder of Abstraction]: http://worrydream.com/LadderOfAbstraction/
|
||||
|
||||
<!-- LessWrong -->
|
||||
[LW bipolar]: http://lesswrong.com/lw/6nb/ego_syntonic_thoughts_and_values/4igy
|
||||
|
|
|
@ -42,3 +42,4 @@
|
|||
[Stanford Metaethics]: http://www.youtube.com/watch?v=kBdfcR-8hEY
|
||||
[Schopenhauer Lecture]: http://www.youtube.com/watch?feature=player_detailpage&v=aK4pR1Uatqw#t=1084s
|
||||
[Batmobile]: https://www.youtube.com/watch?v=BmjFni_WLrA
|
||||
[Lecher Bitch]: https://www.youtube.com/watch?v=H3_sBoCUlOo
|
||||
|
|
6
content_blog/software/index.mkd
Normal file
6
content_blog/software/index.mkd
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: Software
|
||||
is_category: true
|
||||
---
|
||||
|
||||
<%= category :software %>
|
46
content_blog/software/range_math.mkd
Normal file
46
content_blog/software/range_math.mkd
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: Ruby Math with Ranges
|
||||
date: 2012-04-30
|
||||
techne: :done
|
||||
episteme: :believed
|
||||
---
|
||||
|
||||
You're playing some D&D game, like you always do, and you find two weapons, the Sword of Burnination, 1d8+3 and 1d6 fire damage, and the [Axe of Castigation][Lecher Bitch], 2d6+3. And you're tired of doing this math in your head.
|
||||
|
||||
So you write a Ruby gem to do it for you.
|
||||
|
||||
First, you write a [simple gem][range_math] to do math with ranges. You wanted this since you read [Up and Down the Ladder of Abstraction][]. Now this works:
|
||||
|
||||
~~~
|
||||
#!ruby
|
||||
(1..6) * 3 # => (3..18)
|
||||
(-5..3) + 7 # => (2..10)
|
||||
(1..3) + (2..4) # => (3..7)
|
||||
(4..12) / 2 # => (2.0..6.0)
|
||||
~~~
|
||||
|
||||
You can do quick math in your irb sessions with ranges instead of numbers now. You're happy.
|
||||
|
||||
You do a `gem install range_math` on any system, and put this in your `.zshrc`:
|
||||
|
||||
~~~
|
||||
#!sh
|
||||
alias i="irb -rrange_math"
|
||||
~~~
|
||||
|
||||
Then you write a [simple script][avg_dmg] to convert dice rolls into ranges, put it in your PATH and alias it like this:
|
||||
|
||||
~~~
|
||||
#!sh
|
||||
alias avg="noglob average_damage.rb"
|
||||
~~~
|
||||
|
||||
Now this works:
|
||||
|
||||
~~~
|
||||
#!sh
|
||||
$ avg 1d8+3 + 1d6
|
||||
range: 5..17, average: 11.0
|
||||
~~~
|
||||
|
||||
Suffering ends.
|
Loading…
Reference in a new issue