Package ball.riddler538.ant.taskdefs
Class SolveRiddle20160219Task
- 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.SolveRiddle20160219Task
-
- All Implemented Interfaces:
AnnotatedAntTask,AntTaskLogMethods,AntTaskMixIn,ClasspathDelegateAntTask,ConfigurableAntTask,Cloneable
@AntTask("solve-riddle-2016-02-19") public class SolveRiddle20160219Task extends AbstractSimulationTask
AntTaskto solve Will Someone Be Sitting In Your Seat On The Plane?There's an airplane with 100 seats, and there are 100 ticketed passengers each with an assigned seat. They line up to board in some random order. However, the first person to board is the worst person alive, and just sits in a random seat, without even looking at his boarding pass. Each subsequent passenger sits in his or her own assigned seat if it's empty, but sits in a random open seat if the assigned seat is occupied. What is the probability that you, the hundredth passenger to board, finds your seat unoccupied?
Solution uses the Monte Carlo method.<solve-riddle-2016-02-19 classname="String" classpathref="Reference" count="int" description="String" passengers="int" seats="int" taskname="String"> <classpath .../> </solve-riddle-2016-02-19>
- Author:
- Allen D. Ball
-
-
Field Summary
-
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
-
Constructor Summary
Constructors Constructor Description SolveRiddle20160219Task()
-
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
-
SolveRiddle20160219Task
public SolveRiddle20160219Task()
-
-
Method Detail
-
execute
public void execute() throws BuildException
- Specified by:
executein interfaceAnnotatedAntTask- Overrides:
executein classAbstractTask- Throws:
BuildException
-
-