Holger's
Java API

com.antelmann.game.puzzle
Class DiceEquation

java.lang.Object
  extended by com.antelmann.game.puzzle.DiceEquation

public class DiceEquation
extends Object

a tiny game that allows to find certain calculations based on a predefined set of numbers and operators to generate a given number.

Author:
Holger Antelmann

Constructor Summary
DiceEquation(double goal, int... dice)
           
 
Method Summary
 double calculate()
           
 long count()
           
 boolean getAllowRoot()
           
 int[] getDice()
           
 double getGoal()
           
 boolean gotoNext()
           
 boolean isSolution()
           
static void main(String[] args)
           
 boolean nextSolution()
           
 boolean nextSolution(Monitor mon)
          some solutions returned hereby look the same as they falsely distinguish the order of dices; use printPath() to get a unique representatino
 int numberOfSolutions()
          should be performed only directly after construction or reset()
 String printPath()
           
 void reset()
           
 void setAllowRoot(boolean flag)
          should only be set before any other state is changed
static void standardIteration(int goal, Writer writer)
          iterates through all combinations of the standard 5 dices and writes a tab-separated format along with the number of possible solutions for that combination for the given goal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiceEquation

public DiceEquation(double goal,
                    int... dice)
Method Detail

reset

public void reset()

numberOfSolutions

public int numberOfSolutions()
should be performed only directly after construction or reset()


setAllowRoot

public void setAllowRoot(boolean flag)
should only be set before any other state is changed


getAllowRoot

public boolean getAllowRoot()

getGoal

public double getGoal()

getDice

public int[] getDice()

printPath

public String printPath()

isSolution

public boolean isSolution()

calculate

public double calculate()

nextSolution

public boolean nextSolution()

nextSolution

public boolean nextSolution(Monitor mon)
some solutions returned hereby look the same as they falsely distinguish the order of dices; use printPath() to get a unique representatino


count

public long count()

gotoNext

public boolean gotoNext()

standardIteration

public static void standardIteration(int goal,
                                     Writer writer)
                              throws Exception
iterates through all combinations of the standard 5 dices and writes a tab-separated format along with the number of possible solutions for that combination for the given goal.

Throws:
Exception

main

public static void main(String[] args)


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads