Project

hypatia

0.0
No commit activity in last 3 years
No release in over 3 years
A gem for determining the difficulty of a basic mathematical operation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 10.2.1
~> 3.0.0
 Project Readme

Build Status Code Climate

Hypatia

You can use this gem for calculating the difficulty of a basic mathematical operation.

This gem is part of the app MedMath

Installation

Add this line to your application's Gemfile:

gem 'hypatia'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install hypatia

Usage

To get the difficulty for a basic operation you have to create a Formula. It consists of Operations. An Operation consists of 2 Constants and an Operator.

So for example if you want to know the difficulty of 1 + 2 you write the following code.

operation = Operation.new(:+,
                          Constant.new(1),
                          Constant.new(2))

formula = Formula.new([operation])

difficulty = formula.difficulty

#you can get the result of the formula like this

formula.result #eq 3

A Constant can also contain another operation, that is if you want to chain operations in one Formula. Like (1 + 2) * 5. This works like this:

operations << Operation.new(:+,
                            Constant.new(1),
                            Constant.new(2))

operations << Operation.new(:*,
                            Constant.new(operations.last),
                            Constant.new(5))

formula = Formula.new(operations)

difficulty = formula.difficulty

#you can get the result of the formula like this

formula.result #eq 15

More info is in the wiki

Contributing

We'd love some input on this. First of all the way difficulty is determined can be improved. The algorithm can be extended. Also maybe you're a mathematician and you see we got it all wrong with the assigning difficulty points for certain aspects of a basic operation. So feedback is more than welcome.

So if you want to contribute create a fork and pull request or just create an issue!

Origins

During my thesis i created an adaptive medical math trainer that get's more difficult or easier over time. The code in this gem was extracted from that project.

Team

@marthyn developed the app/gem

@jurre reviewed the code and helped with a lot of architecture and insights

@DefactoSoftware the company at which this was developed