diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-02 11:02:25 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-02 11:02:25 +0200 |
commit | 0493903c234bffcb181c441316ba5afcf961dcf4 (patch) | |
tree | f1fd5cb354bd7f35535f2b08e6857729dbebf545 /core/src/ch/asynk | |
parent | bf449f3459d17c83be3f8e82edaec72da0865c32 (diff) | |
download | RustAndDust-0493903c234bffcb181c441316ba5afcf961dcf4.zip RustAndDust-0493903c234bffcb181c441316ba5afcf961dcf4.tar.gz |
Board: improve findBestEntry to chose NORTH or SOUTH if possible
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/Board.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Board.java b/core/src/ch/asynk/rustanddust/engine/Board.java index f1e1583..1bc11c9 100644 --- a/core/src/ch/asynk/rustanddust/engine/Board.java +++ b/core/src/ch/asynk/rustanddust/engine/Board.java @@ -385,7 +385,17 @@ public abstract class Board implements Disposable, Animation o = o.opposite(); boolean r = to.roadFrom(o); int c = to.costFrom(pawn, o); - if ((c < cost) || (r && (c == cost))) { + if ( + // cheaper or same cost and ... + (c < cost) || ((c == cost) && ( + // now road or same and ... + (!road && r) || ((road == r) && ( + // nicer looking move + (o == Orientation.SOUTH || o == Orientation.NORTH) + )) + )) + ) + { entry = o; cost = c; road = r; |