Class Line
- java.lang.Object
-
- com.barrybecker4.game.twoplayer.gomoku.analysis.Line
-
public class Line extends java.lang.ObjectRepresents a run of symbols to be evaluated on the board. All the symbols in the line should be of the same side.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringBuilderlinecontains the symbols in the line (run)
-
Constructor Summary
Constructors Constructor Description Line(LineEvaluator evaluator)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(BoardPosition pos)Extend the line by an additional position.intcomputeValueDifference(int position)We return the difference in value between how the board looked before the move was played (from both points of view) to after the move was played (from both points of view.java.lang.StringtoString()voidworthDebug(java.lang.String dir, int pos, int diff)debugging aid
-
-
-
Constructor Detail
-
Line
public Line(LineEvaluator evaluator)
Constructor- Parameters:
evaluator- used to evaluate the score for the line.
-
-
Method Detail
-
append
public void append(BoardPosition pos)
Extend the line by an additional position.- Parameters:
pos- the position to extend ourselves by.
-
computeValueDifference
public int computeValueDifference(int position)
We return the difference in value between how the board looked before the move was played (from both points of view) to after the move was played (from both points of view. It's important that we look at it from both sides because creating a near win is noticed from the moving players point of view while blocks are noted from the opposing viewpoint.- Parameters:
position- position in the string to compute value difference for.- Returns:
- the difference in worth after making a move compared with before.
-
worthDebug
public void worthDebug(java.lang.String dir, int pos, int diff)debugging aid
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-