Mathhammer

A framework for determining the probabilities and statistics of the game of Warhammer 40,000 (8th and 9th Editions)

License

License

GroupId

GroupId

com.cogpunk
ArtifactId

ArtifactId

mathhammer
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Mathhammer
A framework for determining the probabilities and statistics of the game of Warhammer 40,000 (8th and 9th Editions)
Project URL

Project URL

https://github.com/cogpunk/mathhammer
Source Code Management

Source Code Management

https://github.com/cogpunk/math

Download mathhammer

How to add to project

<!-- https://jarcasting.com/artifacts/com.cogpunk/mathhammer/ -->
<dependency>
    <groupId>com.cogpunk</groupId>
    <artifactId>mathhammer</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.cogpunk/mathhammer/
implementation 'com.cogpunk:mathhammer:1.0.0'
// https://jarcasting.com/artifacts/com.cogpunk/mathhammer/
implementation ("com.cogpunk:mathhammer:1.0.0")
'com.cogpunk:mathhammer:jar:1.0.0'
<dependency org="com.cogpunk" name="mathhammer" rev="1.0.0">
  <artifact name="mathhammer" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.cogpunk', module='mathhammer', version='1.0.0')
)
libraryDependencies += "com.cogpunk" % "mathhammer" % "1.0.0"
[com.cogpunk/mathhammer "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.cogpunk : cogpunk-math jar 1.0.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

Cogpunk Math

Cogpunk Math is a set of mathematical utilities for general use

Build Status Quality Gate Status Coverage Maintainability Rating Reliability Rating Security Rating Apache License, Version 2.0 Cogpunk Math

Building from source

The build requires a Java 6 JDK (or higher) and uses Maven

mvn install

Adding as a dependency

<dependency>
	<groupId>com.cogpunk</groupId>
	<artifactId>cogpunk-math</artifactId>
	<version>1.0.1</version>
</dependency>

License

Code is under the Apache Licence v2.

Example

Determine the probability profile of adding 3 six-sided dice together

// Create a profile for a 6-sided dice

Fraction prob = new Fraction(1, 6);

Map<Integer, Fraction> map = new TreeMap<Integer, Fraction>();

for (int n = 1; n <= 6; n++) {
	map.put(n, prob);
}

ComparableEventProbabilityProfileImpl<Integer, Fraction> dice 
	= new ComparableEventProbabilityProfileImpl<Integer, Fraction>(
		map, new FractionOperator());

// Determine the probabilities of all possible results of adding the dice values together 
// using the EventProbabilityProfileAdditionAggregationStrategy

EventProbabilityProfileAggregator<Integer, Integer, Fraction> aggregator 
	= new EventProbabilityProfileAggregator<Integer, Integer, Fraction>(
		new EventProbabilityProfileAdditionAggregationStrategy<Integer>(
			new IntegerOperator()), new FractionOperator(), dice, dice, dice);

// Print out the results to the console

System.out.println(aggregator);

Versions

Version
1.0.0