Skip to content

Commit d422ada

Browse files
committed
some optimisations
1 parent f56d3bc commit d422ada

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/overrides.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,6 @@ function Cryptid.unique_combinations(tbl, sub, min)
20342034
end
20352035
end)
20362036
end
2037-
20382037
get_straight_ref = get_straight
20392038
function get_straight(hand, min_length, skip, wrap)
20402039
local permutations = {}
@@ -2046,7 +2045,7 @@ function get_straight(hand, min_length, skip, wrap)
20462045
if v.config.center.key ~= "m_stone" then
20472046
cards[#cards + 1] = v
20482047
for i, v in pairs(Cryptid.next_ranks(v:get_id(), nil, stones)) do --this means its inaccurate in some situations like K S S S S but its fine there isnt a better way
2049-
ranks[#ranks + 1] = v
2048+
ranks[v] = true
20502049
end
20512050
end
20522051
if v:get_id() >= 11 then
@@ -2057,10 +2056,14 @@ function get_straight(hand, min_length, skip, wrap)
20572056
"Jack",
20582057
10
20592058
}
2060-
for i, v in pairs(new_ranks) do ranks[#ranks+1] = v end
2059+
for i, v in pairs(new_ranks) do ranks[v] = true end
20612060
end
20622061
end
2063-
for i, v in Cryptid.unique_combinations(ranks) do
2062+
local rranks = {}
2063+
for i, v in pairs(ranks) do
2064+
rranks[#rranks+1] = i
2065+
end
2066+
for i, v in Cryptid.unique_combinations(rranks) do
20642067
if #i == stones then
20652068
permutations[#permutations + 1] = i
20662069
end

0 commit comments

Comments
 (0)