游戏王残局简化版

Annotation For 残局文料/残局荐名.lua
Login

Annotation For 残局文料/残局荐名.lua

Origin for each line in 残局文料/残局荐名.lua from check-in 77f6e5c564:

c4461ce231 2024-02-05    1: package.path = [[.\lua_lib\?.lua;]] .. package.path
c4461ce231 2024-02-05    2: package.cpath = [[.\lua_lib\?.dll;]] .. package.cpath
c4461ce231 2024-02-05    3: local 字集码互转库 = require("u8_to_a")
77f6e5c564 2024-02-08    4: local 字集库 = require("u8_to_a")
c4461ce231 2024-02-05    5: local u8 = 字集码互转库.u8_to_a
c4461ce231 2024-02-05    6: local f = require(u8("常用库"))
c4461ce231 2024-02-05    7: local 字段名对 = require(u8("字段名"))
c4461ce231 2024-02-05    8: local 简文件库 = require("lfs")
c4461ce231 2024-02-05    9: local 简数据库库 = require("lsqlite3")
77f6e5c564 2024-02-08   10: local 基算库 = require(字集库.u8_to_a("算机_程语_月_基类_数_基算"))
77f6e5c564 2024-02-08   11: local 位算库 = require(字集库.u8_to_a("算机_程语_月_基类_数_位算"))
77f6e5c564 2024-02-08   12: local 前缀库 = require(字集库.u8_to_a("算机_程语_月_基类_文_前缀"))
77f6e5c564 2024-02-08   13: local 后缀库 = require(字集库.u8_to_a("算机_程语_月_基类_文_后缀"))
77f6e5c564 2024-02-08   14: local 历排库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_排_取全"))
77f6e5c564 2024-02-08   15: local 历对库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_对_取全"))
77f6e5c564 2024-02-08   16: local 历文库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_文_取全"))
77f6e5c564 2024-02-08   17: local 历排取一库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_排_取一"))
77f6e5c564 2024-02-08   18: local 基类库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_基类"))
77f6e5c564 2024-02-08   19: local 历对取一库 = require(字集库.u8_to_a("算机_程语_月_基类_能_传能_历_基类_表_对_取一"))
77f6e5c564 2024-02-08   20: local 筛卡库 = require(字集库.u8_to_a("游戏王_YGOPro_残局_卡_全筛_有效果卡"))
77f6e5c564 2024-02-08   21: local 对库 = require(字集库.u8_to_a("算机_程语_月_基类_表_对"))
c4461ce231 2024-02-05   22: local d = {}
c4461ce231 2024-02-05   23: --~ 各文件的卡对排
c4461ce231 2024-02-05   24: function d.筛有效果卡_一维(o1_0)
77f6e5c564 2024-02-08   25:   return 历排库.历排(o1_0, 筛卡库.筛有效果卡)
c4461ce231 2024-02-05   26:   end
c4461ce231 2024-02-05   27: --~ 各文件的卡编排
c4461ce231 2024-02-05   28: function d.取卡对_一维(o1_0)
77f6e5c564 2024-02-08   29:   return 历排库.历排(o1_0, d.取卡对)
c4461ce231 2024-02-05   30:   end
c4461ce231 2024-02-05   31: --~ 卡编
c4461ce231 2024-02-05   32: function d.取卡对(o1)
c4461ce231 2024-02-05   33:   local k1_0, k2_0
c4461ce231 2024-02-05   34:   --~ 卡文对
c4461ce231 2024-02-05   35:   k1_0 = d.取卡文(o1)
c4461ce231 2024-02-05   36:   --~ 卡数据对
c4461ce231 2024-02-05   37:   k2_0 = d.取卡数据(o1)
77f6e5c564 2024-02-08   38:   return 对库.连两对(k1_0, k2_0)
c4461ce231 2024-02-05   39:   end
c4461ce231 2024-02-05   40: --~ 卡编
c4461ce231 2024-02-05   41: function d.取卡文(o1)
c4461ce231 2024-02-05   42:   for o1_4 in 数据库:nrows("select * from texts where id = " .. o1) do
c4461ce231 2024-02-05   43:     return o1_4
c4461ce231 2024-02-05   44:     end
c4461ce231 2024-02-05   45:   end
c4461ce231 2024-02-05   46: --~ 卡编
c4461ce231 2024-02-05   47: function d.取卡数据(o1)
c4461ce231 2024-02-05   48:   for o1_4 in 数据库:nrows("select * from datas where id = " .. o1) do
c4461ce231 2024-02-05   49:     return o1_4
c4461ce231 2024-02-05   50:     end
c4461ce231 2024-02-05   51:   end
c4461ce231 2024-02-05   52: --~ 文
c4461ce231 2024-02-05   53: function d.局筛卡编(o1)
c4461ce231 2024-02-05   54:   local k1_0
c4461ce231 2024-02-05   55:   --~ 卡编排
77f6e5c564 2024-02-08   56:   k1_0 = 历文库.历文(o1, string.gmatch, "[^\n]+")
77f6e5c564 2024-02-08   57:   k1_0 = 历排库.历排(k1_0, string.match, "Debug%.AddCard.+")
77f6e5c564 2024-02-08   58:   return 历排库.历排(k1_0, string.match, "[0-9]+")
c4461ce231 2024-02-05   59:   end
c4461ce231 2024-02-05   60: --~ 文
c4461ce231 2024-02-05   61: function d.局筛则数(o1)
c4461ce231 2024-02-05   62:   local k1
c4461ce231 2024-02-05   63:   local k1_0
c4461ce231 2024-02-05   64:   --~ 则数排
77f6e5c564 2024-02-08   65:   k1_0 = 历文库.历文(o1, string.gmatch, "[^\n]+")
77f6e5c564 2024-02-08   66:   k1_0 = 历排库.历排(k1_0, 前缀库.全筛前缀, "Debug.ReloadFieldBegin")
c4461ce231 2024-02-05   67:   --~ 则数
c4461ce231 2024-02-05   68:   k1 = string.match(k1_0[1], "[0-9]")
c4461ce231 2024-02-05   69:   return k1 or 3
c4461ce231 2024-02-05   70:   end
c4461ce231 2024-02-05   71: --~ 卡对排
c4461ce231 2024-02-05   72: function d.荐名(o1_0)
c4461ce231 2024-02-05   73:   local k1
c4461ce231 2024-02-05   74:   --~ 名
c4461ce231 2024-02-05   75:   k1 = d.荐字段名(o1_0)
c4461ce231 2024-02-05   76:   if k1 then
c4461ce231 2024-02-05   77:   else
c4461ce231 2024-02-05   78:     k1 = d.荐卡名(o1_0)
c4461ce231 2024-02-05   79:     end
c4461ce231 2024-02-05   80:   if k1 then
c4461ce231 2024-02-05   81:     return k1
c4461ce231 2024-02-05   82:   else
c4461ce231 2024-02-05   83:     return "请便"
c4461ce231 2024-02-05   84:     end
c4461ce231 2024-02-05   85:   end
77f6e5c564 2024-02-08   86: --~ 卡对排
c4461ce231 2024-02-05   87: function d.荐卡名(o1_0)
c4461ce231 2024-02-05   88:   local k1_0
c4461ce231 2024-02-05   89:   --~ 卡名排
77f6e5c564 2024-02-08   90:   k1_0 = 历排库.历排(o1_0, d.取卡名)
77f6e5c564 2024-02-08   91:   return 历排取一库.筛最短文(k1_0)
77f6e5c564 2024-02-08   92:   end
77f6e5c564 2024-02-08   93: --~ 卡对
77f6e5c564 2024-02-08   94: function d.取卡名(o1_0)
77f6e5c564 2024-02-08   95:   return o1_0.name
c4461ce231 2024-02-05   96:   end
c4461ce231 2024-02-05   97: --~ 卡对排
c4461ce231 2024-02-05   98: function d.取字段对(o1_0)
c4461ce231 2024-02-05   99:   local k1, k2, k3, k4
c4461ce231 2024-02-05  100:   local k1_0
c4461ce231 2024-02-05  101:   --~ 字段对
c4461ce231 2024-02-05  102:   k1_0 = {}
c4461ce231 2024-02-05  103:   for o1 = 1, #o1_0 do
c4461ce231 2024-02-05  104:     --~ 字段数
c4461ce231 2024-02-05  105:     k1 = f.to_uint64(o1_0[o1].setcode)
77f6e5c564 2024-02-08  106:     if k1 < 1 then
77f6e5c564 2024-02-08  107:     else
77f6e5c564 2024-02-08  108:       if k1 > 0xffffFFFFffff then
77f6e5c564 2024-02-08  109:         k1 = k1 - 1
77f6e5c564 2024-02-08  110:       else
77f6e5c564 2024-02-08  111:         for o2 = 1, 11112222 do
77f6e5c564 2024-02-08  112:           if k1 < 1 then
77f6e5c564 2024-02-08  113:             break
77f6e5c564 2024-02-08  114:           else
77f6e5c564 2024-02-08  115:             --~ 大字段号
77f6e5c564 2024-02-08  116:             k2 = 位算库.位和(k1, 0xffff)
77f6e5c564 2024-02-08  117:             k1 = 位算库.位右移(k1, 基算库.乘法(4, 4))
77f6e5c564 2024-02-08  118:             --~ 字段名
77f6e5c564 2024-02-08  119:             k3 = 字段名对[tonumber(k2)]
77f6e5c564 2024-02-08  120:             if k3 then
77f6e5c564 2024-02-08  121:               if k1_0[k3] then
77f6e5c564 2024-02-08  122:                 k1_0[k3] = 基算库.加法(k1_0[k3], 1)
77f6e5c564 2024-02-08  123:               else
77f6e5c564 2024-02-08  124:                 k1_0[k3] = 1
77f6e5c564 2024-02-08  125:                 end
77f6e5c564 2024-02-08  126:               if k2 > 0xfff then
77f6e5c564 2024-02-08  127:                 --~ 小字段号
77f6e5c564 2024-02-08  128:                 k4 = 位算库.位和(k2, 0xfff)
77f6e5c564 2024-02-08  129:                 k3 = 字段名对[tonumber(k4)]
77f6e5c564 2024-02-08  130:                 if k3 then
77f6e5c564 2024-02-08  131:                   if k1_0[k3] then
77f6e5c564 2024-02-08  132:                     k1_0[k3] = 基算库.加法(k1_0[k3], 1)
77f6e5c564 2024-02-08  133:                   else
77f6e5c564 2024-02-08  134:                     k1_0[k3] = 1
77f6e5c564 2024-02-08  135:                     end
77f6e5c564 2024-02-08  136:                 else
c4461ce231 2024-02-05  137:                   end
c4461ce231 2024-02-05  138:               else
c4461ce231 2024-02-05  139:                 end
c4461ce231 2024-02-05  140:             else
c4461ce231 2024-02-05  141:               end
c4461ce231 2024-02-05  142:             end
c4461ce231 2024-02-05  143:           end
c4461ce231 2024-02-05  144:         end
c4461ce231 2024-02-05  145:       end
c4461ce231 2024-02-05  146:     end
c4461ce231 2024-02-05  147:   return k1_0
c4461ce231 2024-02-05  148:   end
c4461ce231 2024-02-05  149: --~ 卡对排
c4461ce231 2024-02-05  150: function d.荐字段名(o1_0)
abd9f389ae 2024-02-05  151:   local k1
c4461ce231 2024-02-05  152:   local k1_0
c4461ce231 2024-02-05  153:   --~ 字段对
c4461ce231 2024-02-05  154:   k1_0 = d.取字段对(o1_0)
c4461ce231 2024-02-05  155:   --~ 最大的字段名数量
77f6e5c564 2024-02-08  156:   _, k1 = 历对取一库.筛最大值(k1_0)
c4461ce231 2024-02-05  157:   --~ 最高频字段名对
77f6e5c564 2024-02-08  158:   k2_0 = 历对库.历对(k1_0, f.全等筛对中值, k1)
77f6e5c564 2024-02-08  159:   return 历对取一库.筛最短键(k2_0)
c4461ce231 2024-02-05  160:   end
c4461ce231 2024-02-05  161: --~ 目对
1b8a66c38a 2024-02-05  162: function d.残局荐名(o1_0)
c4461ce231 2024-02-05  163:   local k1_0, k2_0, k3_0, k4_0, k5_0, k6_0, k7_0, k8_0
c4461ce231 2024-02-05  164:   --~ 文件名排
77f6e5c564 2024-02-08  165:   k1_0 = 历文库.历文(o1_0.文件目, 简文件库.dir)
77f6e5c564 2024-02-08  166:   k1_0 = 历排库.历排(k1_0, 后缀库.全筛后缀, ".lua")
c4461ce231 2024-02-05  167:   --~ 文件排
77f6e5c564 2024-02-08  168:   k2_0 = 历排库.历排(k1_0, 后缀库.全筛后缀, ".lua")
c4461ce231 2024-02-05  169:   for o1 = 1, #k2_0 do
77f6e5c564 2024-02-08  170:     k2_0[o1] = 前缀库.加前缀(k2_0[o1], o1_0.文件目)
c4461ce231 2024-02-05  171:     k2_0[o1] = f.读文件(k2_0[o1])
c4461ce231 2024-02-05  172:     k2_0[o1] = string.gsub(k2_0[o1], "%-%-" .. "%[(=*)%[" .. ".-" .. "%]%1%]", "")
c4461ce231 2024-02-05  173:     k2_0[o1] = string.gsub(k2_0[o1], "%-%-" .. "[^\n]*", "")
c4461ce231 2024-02-05  174:     end
c4461ce231 2024-02-05  175:   --~ 则数排
77f6e5c564 2024-02-08  176:   k3_0 = 历排库.历排(k2_0, d.局筛则数)
c4461ce231 2024-02-05  177:   --~ 各文件的卡编排
77f6e5c564 2024-02-08  178:   k4_0 = 历排库.历排(k2_0, d.局筛卡编)
77f6e5c564 2024-02-08  179:   --~ 卡片库
c4461ce231 2024-02-05  180:   _G.数据库 = 简数据库库.open(o1_0.数据库路)
c4461ce231 2024-02-05  181:   --~ 各文件的卡对排
77f6e5c564 2024-02-08  182:   k5_0 = 历排库.历排(k4_0, d.取卡对_一维)
c4461ce231 2024-02-05  183:   --~ 有效果卡的卡对排
77f6e5c564 2024-02-08  184:   k6_0 = 历排库.历排(k5_0, d.筛有效果卡_一维)
c4461ce231 2024-02-05  185:   --~ 有效果卡的张数排
77f6e5c564 2024-02-08  186:   k7_0 = 历排库.历排(k6_0, table.maxn)
c4461ce231 2024-02-05  187:   --~ 荐名排
77f6e5c564 2024-02-08  188:   k8_0 = 历排库.历排(k6_0, d.荐名)
c4461ce231 2024-02-05  189:   for o1 = 1, #k1_0 do
77f6e5c564 2024-02-08  190:     print(字集库.a_to_u8(k1_0[o1]), k3_0[o1], k7_0[o1], k8_0[o1])
c4461ce231 2024-02-05  191:     end
c4461ce231 2024-02-05  192:   end
c4461ce231 2024-02-05  193: d.目对 = {
c4461ce231 2024-02-05  194:   ["文件目"] = "../single/"
c4461ce231 2024-02-05  195:   , ["数据库路"] = [[D:\install\YGOPro\cards.cdb]]
c4461ce231 2024-02-05  196:   }
c4461ce231 2024-02-05  197: for o1, o2 in pairs(d.目对) do
77f6e5c564 2024-02-08  198:   d.目对[o1] = 基类库.操类(o2, "string", 字集库.u8_to_a)
c4461ce231 2024-02-05  199:   end
1b8a66c38a 2024-02-05  200: d.残局荐名(d.目对)