Divination (from Latin divinare "to foresee, to be inspired by a god", related to divinus, divine) is the attempt to gain insight into a question or situation by way of an occultic, standardized process or ritual. Used in various forms throughout history, diviners ascertain their interpretations of how a querent should proceed by reading signs, events, or omens, or through alleged contact with a supernatural agency.
Divination, Wikipedia
Sortilege is a library for predicting the future.
Sortilege currently supports five divination methods:
Each of these has types and methods that allow users to make predictions, and work with the results.
scala> sortilege.IChing.yarrow.display
res0: String = the clinging fire ䷝ becoming abundance ䷶
scala> sortilege.Runes.random.display
res1: String = algiz ᛉ
scala> sortilege.Ogham.choose(3).map(_.display)
res2: scala.collection.immutable.Vector[String] = Vector(Onn ᚑ, Sail ᚄ, Dair ᚇ)
scala> println(sortilege.Tarot.celticCross.display)
1. present: temperance (inverted)
2. challenge: five of swords (inverted)
3. past: king of pentacles (inverted)
4. future: two of pentacles (inverted)
5. above: eight of swords
6. below: knight of cups (inverted)
--------
7. advice: the fool (inverted)
8. influences: ten of swords
9. emotions: knight of swords (inverted)
10. outcome: the moon
scala> sortilege.Eightball.random
res4: sortilege.Phrase = Phrase(cannot predict now,unknown)
Sortilege supports Scala 2.10, 2.11, and 2.12. If you use SBT, you can
include Sortilege via the following build.sbt
snippet:
libraryDependencies += org.spire-math %% "sortilege" % "0.4.0"
Sortilege is currently using a Complementary-multiply-with-carry random number generator provided by Spire. Users may wish to manually seed the generator with information derived from the querant, such as the location and time, the question being asked, other background information, etc.
Currently Sortilege is most concerned with representing and implementing the divination method correctly, without worrying about interpretation. Users will need to understand how to interpret the results given, using pattern matching or other strategies.
When used improperly, these methods may fail to predict the future. It is up to the user to determine if and when various prediction methods should be used.
In addition, there are numerous issues with localization and canonicalization, to say nothing of competing standards and authorities.
More divination methods could be added.
A high-level query interface is needed, where users can ask questions
and indicate the desired type for an answer value. Type classes can be
used to provide flexible mapping between the low-level return types of
particular divination methods and the high-level types desired
(e.g. Boolean
, StockTrade
, etc.).
Better support for operating on divination result types; possibly a "divination monad"?
Include text, images, and commentary as resources in the JAR file, especially for the I Ching and Tarot.
The random number generator should be pluggable.
It would be interesting to provide randomized physical simulations of divination methods (including dice rolling, coin flipping, and so on).
If we can find (or generate) accurate data about the historical motion of heavenly bodies it would be possible to support various kinds of Astrology.
All code is available to you under the MIT license, available at http://opensource.org/licenses/mit-license.php and also in the COPYING file.
Copyright Erik Osheim, 2014-2018.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.