From 89331e122024bb383ba31076d3a85ed1e1b6ad43 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Sat, 2 Dec 2023 19:49:22 -0800 Subject: [PATCH] Adjust weights and pips calculation --- board.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/board.go b/board.go index c2c1acd..4f979c2 100644 --- a/board.go +++ b/board.go @@ -8,9 +8,9 @@ import ( ) var ( - WeightBlot = 2.0 - WeightHit = -2.0 - WeightOppScore = -1.0 + WeightBlot = 1.5 + WeightHit = -1.5 + WeightOppScore = -0.25 ) const ( @@ -292,16 +292,12 @@ func (b Board) Past(player int) bool { func (b Board) Pips(player int) int { var pips int if player == 1 { - pips += int(b.Checkers(player, SpaceBarPlayer)) * (25 + 12) + pips += int(b.Checkers(player, SpaceBarPlayer)) * (50 + 12) } else { - pips += int(b.Checkers(player, SpaceBarOpponent)) * (25 + 12) + pips += int(b.Checkers(player, SpaceBarOpponent)) * (50 + 12) } for space := 1; space < 25; space++ { - v := spaceValue(player, space) + 6 - if (player == 1 && space > 6) || (player == 2 && space < 19) { - v += 6 - } - pips += int(b.Checkers(player, space)) * v + pips += int(b.Checkers(player, space)) * pseudoPips(player, space) } return pips } @@ -314,7 +310,7 @@ func (b Board) Blots(player int) int { if checkers != 1 { continue } - pips += int(checkers) * spaceValue(o, space) + pips += int(checkers) * pseudoPips(o, space) } return pips } @@ -373,7 +369,7 @@ func queueAnalysis(a *Analysis, w *sync.WaitGroup, b Board, player int, availabl checkers := b.Checkers(o, move[1]) hs := startingHitScore if checkers == 1 { - hs += spaceValue(o, move[1]) + hs += pseudoPips(o, move[1]) } a := &Analysis{ @@ -512,6 +508,14 @@ func spaceValue(player int, space int) int { } } +func pseudoPips(player int, space int) int { + v := spaceValue(player, space)*2 + 6 + if (player == 1 && space > 6) || (player == 2 && space < 19) { + v += 6 + } + return v +} + func spaceDiff(from int, to int) int { if from < 0 || from > 27 || to < 0 || to > 27 { return 0