login

<     >

2023-11-22 16:41:22 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

bot tweaks

diff --git a/yacht.lua b/yacht.lua
index b8916bb..2c9674b 100644
--- a/yacht.lua
+++ b/yacht.lua
@@ -410,6 +410,25 @@ function Bob:select(sheet, dice, roll)
             round = round + 1
         end
     end
+    local sel = {}
+    if round > 6 then
+        if sheet["little-straight"] ~= nil and sheet["big-straight"] ~= nil then
+            local d
+            for i = 6, 1, -1 do
+                if sheet[i.."s"] == nil and hist[i] == max_count then
+                    d = i
+                    break
+                end
+            end
+            if d ~= nil then
+                for i = 1, 5 do
+                    sel[i] = dice[i] == d
+                end
+                log(d.."s")
+                return sel
+            end
+        end
+    end
     local min_fh, min_st, min_yt, min_rp, min_4k
     if round <= 4 then
         min_fh, min_st, min_yt, min_rp, min_4k = 3, 4, 4, 3, 3
@@ -418,7 +437,6 @@ function Bob:select(sheet, dice, roll)
     else  -- round > 8
         min_fh, min_st, min_yt, min_rp, min_4k = 1, 3, 3, 1, 1
     end
-    local sel = {}
     if sheet["full-house"] == nil then
         local rep = {}
         for i = min_fh, 6 do
@@ -515,10 +533,8 @@ end
 function Bob:pick(sheet, dice, roll)
     local sum, hist, min_count, max_count = calc_data(dice)
     local good_cats = {"yacht", "four-of-a-kind", "full-house", "little-straight", "big-straight"}
-    local good_mins = {1, 16, 17, 1, 1}
     for i, cat in ipairs(good_cats) do
-        local thresh = good_mins[i]
-        if sheet[cat] == nil and calc_points(dice, cat) >= thresh then
+        if sheet[cat] == nil and calc_points(dice, cat) >= 12 then
             log("good match: "..cat)
             return cat
         end
@@ -535,7 +551,7 @@ function Bob:pick(sheet, dice, roll)
         end
     end
     -- no good pick, discard a sane item
-    local bad_cats = {"1s", "2s", "3s", "little-straight", "big-straight"}
+    local bad_cats = {"1s", "2s", "little-straight", "big-straight"}
     for _, cat in ipairs(bad_cats) do
         if sheet[cat] == nil then
             log("discard bad")