Class XYSearcher
- java.lang.Object
-
- com.treasure.hunt.strategy.searcher.impl.XYSearcher
-
public class XYSearcher extends java.lang.Object implements Searcher<AngleHint>
This type ofSearcher
holds the numbers maxX, maxY, minX, minY, and updates these.This
Hider
works only forAngleHint
with an angle ≤{@link Math#PI}/2
. Thus, thisSearcher
always gets one or two directions, in which the treasure lies for sure.If the searcher knows only a minimum X, but no maximum X (or knows only a maximum X, but no minimum X), he will go in the correct X-direction and double its moving-distance each time.
Otherwise, if the searcher knows both a minimum X and a maximum X, he will go to the middle of these interval.
The same holds for the Y coordinates.
-
-
Constructor Summary
Constructors Constructor Description XYSearcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
init(org.locationtech.jts.geom.Point searcherStartPosition)
SearchPath
move()
Use this to perform a initial move, without a hint given.SearchPath
move(AngleHint angleHint)
If the searcher knows only a minimum X, but no maximum X (or knows only a maximum X, but no minimum X), he will go in the correct X-direction and double its moving-distance each time.
-
-
-
Method Detail
-
init
public void init(org.locationtech.jts.geom.Point searcherStartPosition)
-
move
public SearchPath move()
Description copied from interface:Searcher
Use this to perform a initial move, without a hint given. This is for the case, the searcher starts. (as he does normally)- Specified by:
move
in interfaceSearcher<AngleHint>
- Returns:
SearchPath
, containing only the starting position.
-
move
public SearchPath move(AngleHint angleHint)
If the searcher knows only a minimum X, but no maximum X (or knows only a maximum X, but no minimum X), he will go in the correct X-direction and double its moving-distance each time.Otherwise, if the searcher knows both a minimum X and a maximum X, he will go to the middle of these interval.
The same holds for the Y coordinates.
- Specified by:
move
in interfaceSearcher<AngleHint>
- Parameters:
angleHint
- the hint, theHider
gave last.- Returns:
SearchPath
theSearchPath
, this searcher chose.
-
-