Class SolveRiddle20160304Task
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- ball.riddler538.ant.taskdefs.AbstractTask
-
- ball.riddler538.ant.taskdefs.AbstractSimulationTask
-
- ball.riddler538.ant.taskdefs.SolveRiddle20160304Task
-
- All Implemented Interfaces:
AnnotatedAntTask,AntTaskLogMethods,AntTaskMixIn,ClasspathDelegateAntTask,ConfigurableAntTask,Cloneable
@AntTask("solve-riddle-2016-03-04") public class SolveRiddle20160304Task extends AbstractSimulationTask
AntTaskto solve Can You Win This Hot New Game Show?Two players go on a hot new game show "Higher Number Wins." The two go into separate booths, and each presses a button, and a random number between zero and one appears on a screen. (At this point, neither knows the s number, but they do know the numbers are chosen from a standard uniform distribution.) They can choose to keep that first number, or to press the button again to discard the first number and get a second random number, which they must keep. Then, they come out of their booths and see the final number for each player on the wall. The lavish grand prize -- a case full of bullion gold -- is awarded to the player who kept the higher number. Which number is the optimal cutoff for players to discard their first number and choose another? Put another way, within which range should they choose to keep the first number, and within which range should they reject it and try their luck with a second number?
Solution uses the Monte Carlo method.<solve-riddle-2016-03-04 classname="String" classpathref="Reference" count="int" description="String" taskname="String"> <classpath .../> </solve-riddle-2016-03-04>
- Author:
- Allen D. Ball
-
-
Field Summary
-
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
-
Constructor Summary
Constructors Constructor Description SolveRiddle20160304Task()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()-
Methods inherited from class ball.riddler538.ant.taskdefs.AbstractSimulationTask
asPercent
-
Methods inherited from class ball.riddler538.ant.taskdefs.AbstractTask
init
-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ball.util.ant.taskdefs.AnnotatedAntTask
getAntTaskName
-
Methods inherited from interface ball.util.ant.taskdefs.AntTaskLogMethods
log, log, log, log, log, log, log, log, log, log, log
-
Methods inherited from interface ball.util.ant.taskdefs.ClasspathDelegateAntTask
createClasspath, delegate, delegate, getClassForName, getClassLoader, setClassname, setClasspathref
-
Methods inherited from interface ball.util.ant.taskdefs.ConfigurableAntTask
configure
-
-
-
-
Constructor Detail
-
SolveRiddle20160304Task
public SolveRiddle20160304Task()
-
-
Method Detail
-
execute
public void execute() throws BuildException
- Specified by:
executein interfaceAnnotatedAntTask- Overrides:
executein classAbstractTask- Throws:
BuildException
-
-