GithubHelp home page GithubHelp logo

trollcount's Introduction

Trollcount

Trollcount is a simple scala library which simulates the troll numeral system[*] according to the Discworld. It allows it's users to create troll numbers and to add them to each other. Here's an example:

scala> import se.diversify.trollcount.TrollNumber._
import se.diversify.trollcount.TrollNumber._

scala> val one = One
one: se.diversify.trollcount.TrollNumber = One

scala> val three = Three
three: se.diversify.trollcount.TrollNumber = Three

scala> three.value
res0: Int = 3

scala> val five = Many-One
five: se.diversify.trollcount.TrollNumber = Many-One

scala> val ten = five + five
ten: se.diversify.trollcount.TrollNumber = Many-Many-Two

scala> val fourteen = Many-Many-One + Many-One
fourteen: se.diversify.trollcount.TrollNumber = Many-Many-Many-Two

scala> fourteen.value
res1: Int = 14

This library exists in three branches:

  • master - The complete library. Use this branch if you want to see my implementation.
  • tests-only - Only contains tests and no implementation. Use if this branch if you want to implement the whole library logic on your own.
  • tests-and-stubs - Contains stub implementations and failing tests. Use this branch if you want to bootstrap your implementation and add the missing bits.

To get the code, run:

git clone git://github.com/uzilan/trollcount.git

To switch to a different branch, run:

git checkout master

or...

git checkout tests-only

or...

git checkout tests-and-stubs

Want to read more? Why not read the blog post.

[*] the troll numeral system goes like this:

One, Two, Three, Many,
Many-One, Many-Two, Many-Three, Many-Many,
Many-Many-One, Many-Many-Two, Many-Many-Three, Many-Many-Many,
Many-Many-Many-One, Many-Many-Many-Two, Many-Many-Many-Three, Lots

trollcount's People

Contributors

uzilan avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.