游戏王残局简化版

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

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

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

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