2019-07-07 07:45:46 UNSELECTED

Unknown type code

Copy Copied! Full
--簡略化 local STAT = vci.state local ASET = vci.assets --Unityの駒の名称 local CUBE_STR = { "hu1", "hu2", "hu3", "hu4", "hu5", "hu6", "hu7", "hu8", "hu9", "hu10", "hu11", "hu12", "hu13", "hu14", "hu15", "hu16", "hu17", "hu18", "hisya1", "hisya2", "kaku1", "kaku2", "kyou1", "kyou2", "kyou3", "kyou4", "kei1", "kei2", "kei3", "kei4", "gin1", "gin2", "gin3", "gin4", "kin1", "kin2", "kin3", "kin4", "gyoku1", "ou1" } local CUBE_STR_SUBITEM = { "hu1", "hu2", "hu3", "hu4", "hu5", "hu6", "hu7", "hu8", "hu9", "hu10", "hu11", "hu12", "hu13", "hu14", "hu15", "hu16", "hu17", "hu18", "hisya1", "hisya2", "kaku1", "kaku2", "kyou1", "kyou2", "kyou3", "kyou4", "kei1", "kei2", "kei3", "kei4", "gin1", "gin2", "gin3", "gin4", "kin1", "kin2", "kin3", "kin4", "gyoku1", "ou1" } for i = 1, #CUBE_STR_SUBITEM do CUBE_STR_SUBITEM[i] = ASET.GetSubItem(CUBE_STR[i]) end --Unityの補助駒の名称 local CUBE_STR2 = { "hu0", "hisya0", "kaku0", "kyou0", "kei0", "gin0", "kin0", "gyoku0", "ou0" } local CUBE_STR2_SUBITEM = { "hu0", "hisya0", "kaku0", "kyou0", "kei0", "gin0", "kin0", "gyoku0", "ou0" } for i = 1, #CUBE_STR2_SUBITEM do CUBE_STR2_SUBITEM[i] = ASET.GetSubItem(CUBE_STR2[i]) end --盤面のどこに何の駒があるか local BOARD_NUM = { 23, 27, 31, 35, 39, 36, 32, 28, 24, 0, 21, 0, 0, 0, 0, 0, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 20, 0, 0, 0, 0, 0, 22, 0, 26, 30, 34, 38, 40, 37, 33, 29, 25 } --初期化用 local BOARD_NUM_CPY = { 23, 27, 31, 35, 39, 36, 32, 28, 24, 0, 21, 0, 0, 0, 0, 0, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 20, 0, 0, 0, 0, 0, 22, 0, 26, 30, 34, 38, 40, 37, 33, 29, 25 } --駒の移動可能位置の計算値保持 local BOARD_POSSIBLE = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } --どの方向向いてるか local ANG_NUM = { 90, 90, 90, 90, 90, 90, 90, 90, 90, 270, 270, 270, 270, 270, 270, 270, 270, 270, 90, 270, 90, 270, 90, 90, 270, 270, 90, 90, 270, 270, 90, 90, 270, 270, 90, 90, 270, 270, 90, 270 } --初期化用 local ANG_NUM_CPY = { 90, 90, 90, 90, 90, 90, 90, 90, 90, 270, 270, 270, 270, 270, 270, 270, 270, 270, 90, 270, 90, 270, 90, 90, 270, 270, 90, 90, 270, 270, 90, 90, 270, 270, 90, 90, 270, 270, 90, 270 } --成っているか local URA_FLG = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } --初期化用 local URA_FLG_CPY = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } local FIRST_FLG = true --初期化 local TARG_NUM = 0 --掴んだ番号 local GRIP_FLG = false --グリップ local USE_FLG = false --使用 local BORD_NUM = 0 --盤上の番号 local GAMEEND_FLG = false --全初期化 local NARU_FLG = false --成るかのフラグ local FIRST_FLG_FLG = false --全初期化 local min = 0 --移動位置 local count = 0 local Mine = false local BOARD_SUBITEM = ASET.GetSubItem("Board") local min_loc = 0 local flg = false ---アイテムを生成したユーザーで毎フレーム呼ばれる function update() Mine = true TARG_NUM = STAT.Get("TARG_NUM") BORD_NUM = STAT.Get("BORD_NUM") if (GAMEEND_FLG == false) or (STAT.Get("GAMEEND_FLG") == false) then --握っている if (GRIP_FLG or STAT.Get("GRIP_FLG")) and (TARG_NUM > 0) and (BORD_NUM >= 0) then min = 0 --移動位置 min_loc = 0.06 --最近傍距離 --盤に置いてある駒だったらtrue:とった駒の配置ならばfalse flg = false for i = 1, #BOARD_NUM do if BOARD_NUM[i] == BOARD_NUM[BORD_NUM] then flg = true end end --移動可能位置初期化 for i = 1, #BOARD_POSSIBLE do BOARD_POSSIBLE[i] = 0 end Koma() --駒計算 --補助駒配置位置決定 for i = 1, #BOARD_NUM do if flg == false then --駒の置いてあるとこ以外に補助駒配置 if BOARD_NUM[i] == 0 then Hozyo(i) end else --移動可能なところに補助駒配置 if BOARD_POSSIBLE[i] == 1 then Hozyo(i) end end end --補助駒配置位置 if min > 0 then local OBJ = BOARD_SUBITEM local POS = OBJ.GetPosition() local ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end local sho = (-4 + math.floor((min - 1) / 9)) / 9 local ama = (-4 + (min - 1) % 9) / 9 if TARG_NUM < 19 then OBJ = CUBE_STR2_SUBITEM[1] elseif TARG_NUM < 21 then OBJ = CUBE_STR2_SUBITEM[2] elseif TARG_NUM < 23 then OBJ = CUBE_STR2_SUBITEM[3] elseif TARG_NUM < 27 then OBJ = CUBE_STR2_SUBITEM[4] elseif TARG_NUM < 31 then OBJ = CUBE_STR2_SUBITEM[5] elseif TARG_NUM < 35 then OBJ = CUBE_STR2_SUBITEM[6] elseif TARG_NUM < 39 then OBJ = CUBE_STR2_SUBITEM[7] elseif TARG_NUM < 40 then OBJ = CUBE_STR2_SUBITEM[8] elseif TARG_NUM < 41 then OBJ = CUBE_STR2_SUBITEM[9] end local ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end local pow1 = sho * sho local pow2 = ama * ama OBJ.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.11, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJ.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[TARG_NUM], URA_FLG[TARG_NUM])) end --使用した if USE_FLG or STAT.Get("USE_FLG") then USE_FLG = false GRIP_FLG = false STAT.Set("GRIP_FLG", GRIP_FLG) STAT.Set("USE_FLG", USE_FLG) --駒の番号ある if TARG_NUM > 0 then --盤上の駒である if flg then --最近傍位置がある if min > 0 then --BOARD_NUM[min]=0だった if ANG_NUM[BOARD_NUM[min]] == nil then BOARD_NUM[min] = BOARD_NUM[BORD_NUM] BOARD_NUM[BORD_NUM] = 0 else --相手の駒をとる if not (ANG_NUM[BOARD_NUM[min]] == ANG_NUM[BOARD_NUM[BORD_NUM]]) then ANG_NUM[BOARD_NUM[min]] = ANG_NUM[BOARD_NUM[BORD_NUM]] URA_FLG[BOARD_NUM[min]] = 0 BOARD_NUM[min] = BOARD_NUM[BORD_NUM] BOARD_NUM[BORD_NUM] = 0 end end --成るかどうか if (ANG_NUM[BOARD_NUM[min]] == 90) and (min > 54) and (NARU_FLG or STAT.Get("NARU_FLG")) then URA_FLG[BOARD_NUM[min]] = 180 elseif (ANG_NUM[BOARD_NUM[min]] == 270) and (min < 28) and (NARU_FLG or STAT.Get("NARU_FLG")) then URA_FLG[BOARD_NUM[min]] = 180 end end else --盤外のものを盤上に if min > 0 then BOARD_NUM[min] = TARG_NUM end end end end else local OBJ = BOARD_SUBITEM for i = 1, #CUBE_STR2_SUBITEM do OBJ = CUBE_STR2_SUBITEM[i] OBJ.SetPosition(Vector3.__new(0, -10, 0)) end end end if GAMEEND_FLG ~= STAT.Get("GAMEEND_FLG") then STAT.Set("GAMEEND_FLG", GAMEEND_FLG) end for i = 1, #BOARD_NUM do if BOARD_NUM[i] ~= STAT.Get(tostring(i)) then STAT.Set(tostring(i), BOARD_NUM[i]) end end for i = 1, #ANG_NUM do if ANG_NUM[i] ~= STAT.Get(tostring(i + 100)) then STAT.Set(tostring(i + 100), ANG_NUM[i]) end end for i = 1, #URA_FLG do if URA_FLG[i] ~= STAT.Get(tostring(i + 200)) then STAT.Set(tostring(i + 200), URA_FLG[i]) end end end ---アイテムを生成したユーザーで毎フレーム呼ばれる function updateAll() if Mine then else for i = 1, #BOARD_NUM do if not (STAT.Get(tostring(i)) == nil) then BOARD_NUM[i] = STAT.Get(tostring(i)) end end for i = 1, #ANG_NUM do if not (STAT.Get(tostring(i)) == nil) then ANG_NUM[i] = STAT.Get(tostring(i + 100)) end end for i = 1, #URA_FLG do if not (STAT.Get(tostring(i)) == nil) then URA_FLG[i] = STAT.Get(tostring(i + 200)) end end end if FIRST_FLG or STAT.Get("FIRST_FLG") then FIRST_FLG = false --駒の位置初期化 if (FIRST_FLG_FLG == false) or (STAT.Get("FIRST_FLG_FLG") == false) then if Mine then for i = 1, #BOARD_NUM do BOARD_NUM[i] = BOARD_NUM_CPY[i] end for i = 1, #ANG_NUM do ANG_NUM[i] = ANG_NUM_CPY[i] URA_FLG[i] = URA_FLG_CPY[i] end FIRST_FLG_FLG = true STAT.Set("FIRST_FLG_FLG", FIRST_FLG_FLG) end end Move_STROBJ() STAT.Set("FIRST_FLG", FIRST_FLG) end end function onCollisionExit(it, h) Velo_Ang_Zero(it) Velo_Ang_Zero(h) FIRST_FLG = true STAT.Set("FIRST_FLG", FIRST_FLG) end function onTriggerExit(item, hit) end function onUse(use) if use == "Capsule" then FIRST_FLG = true STAT.Set("FIRST_FLG", FIRST_FLG) FIRST_FLG_FLG = false STAT.Set("FIRST_FLG_FLG", FIRST_FLG_FLG) end --駒を掴み使用したら for i = 1, #CUBE_STR do if use == CUBE_STR[i] then USE_FLG = true STAT.Set("USE_FLG", USE_FLG) FIRST_FLG = true STAT.Set("FIRST_FLG", FIRST_FLG) end end end function onGrab(tar) --駒握った処理 for i = 1, #CUBE_STR do if tar == CUBE_STR[i] then TARG_NUM = i GRIP_FLG = true STAT.Set("TARG_NUM", TARG_NUM) STAT.Set("GRIP_FLG", GRIP_FLG) for i2 = 1, #BOARD_NUM do BORD_NUM = 0 if i == BOARD_NUM[i2] then BORD_NUM = i2 end STAT.Set("BORD_NUM", BORD_NUM) if BORD_NUM > 0 then break end end break end end --成る処理 if tar == "Permission" then NARU_FLG = true STAT.Set("NARU_FLG", NARU_FLG) end FIRST_FLG = true STAT.Set("FIRST_FLG", FIRST_FLG) end function onUngrab(tar) for i = 1, #CUBE_STR do if tar == CUBE_STR[i] then TARG_NUM = 0 GRIP_FLG = false STAT.Set("TARG_NUM", TARG_NUM) STAT.Set("GRIP_FLG", GRIP_FLG) BORD_NUM = 0 STAT.Set("BORD_NUM", BORD_NUM) break end end if tar == "Permission" then NARU_FLG = false STAT.Set("NARU_FLG", NARU_FLG) end Velo_Ang_Zero(tar) FIRST_FLG = true STAT.Set("FIRST_FLG", FIRST_FLG) end --角度と力0 function Velo_Ang_Zero(item) local OBJ = ASET.GetSubItem(item) if OBJ ~= nil then OBJ.SetVelocity(Vector3.__new(0, 0, 0)) OBJ.SetAngularVelocity(Vector3.__new(0, 0, 0)) if item == "Board" then local ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end OBJ.SetRotation(Quaternion.Euler(0, ANG, 0)) end FIRST_FLG = true STAT.Set("FIRST_FLG", FIRST_FLG) end end --駒をBOARD_NUMに従い配置 function Move_STROBJ() local OBJ = ASET.GetSubItem("Board") local OBJS = 0 local POS = OBJ.GetPosition() local ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) local sho = 0 local ama = 0 local ANG2 = 0 local pow1 = 0 local pow2 = 0 if OBJ.GetForward().x < 0 then ANG = -1 * ANG end for i = 1, #BOARD_NUM do if BOARD_NUM[i] > 0 then OBJS = ASET.GetSubItem(CUBE_STR[BOARD_NUM[i]]) if OBJS.IsMine then sho = (-4 + math.floor((i - 1) / 9)) / 9 ama = (-4 + (i - 1) % 9) / 9 ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end pow1 = sho * sho pow2 = ama * ama OBJS.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.08, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJS.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[BOARD_NUM[i]], URA_FLG[BOARD_NUM[i]])) end end end --補助駒 for i = 1, #CUBE_STR2 do OBJS = ASET.GetSubItem(CUBE_STR2[i]) OBJS.SetPosition(Vector3.__new(POS.x, 0, POS.z)) end local num1 = 1 local num2 = 1 for i = 1, #CUBE_STR do --盤に配置されて入ればfalse local flg = true for i2 = 1, #BOARD_NUM do if BOARD_NUM[i2] == i then flg = false break end end --盤外の駒を並べる if flg then if ANG_NUM[i] == 90 then OBJ = ASET.GetSubItem("Board") POS = OBJ.GetPosition() ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end OBJS = ASET.GetSubItem(CUBE_STR[i]) if OBJS.IsMine then sho = (-4 + math.floor((num1 - 18 - 1) / 9)) / 9 ama = (-4 + (num1 - 18 - 1) % 9) / 9 ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end pow1 = sho * sho pow2 = ama * ama OBJS.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.06, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJS.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[i], URA_FLG[i])) end num1 = num1 + 1 else OBJ = ASET.GetSubItem("Board") POS = OBJ.GetPosition() ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end OBJS = ASET.GetSubItem(CUBE_STR[i]) if OBJS.IsMine then sho = (-4 + math.floor((num2 + #BOARD_NUM + 9 - 1) / 9)) / 9 ama = (-4 + (num2 + #BOARD_NUM + 9 - 1) % 9) / 9 ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end pow1 = sho * sho pow2 = ama * ama OBJS.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.08, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJS.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[i], URA_FLG[i])) end num2 = num2 + 1 end end end end --補助駒計算 function Hozyo(i) local OBJ = ASET.GetSubItem("Board") local POS = OBJ.GetPosition() local ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end local sho = (-4 + math.floor((i - 1) / 9)) / 9 local ama = (-4 + (i - 1) % 9) / 9 OBJ = ASET.GetSubItem(CUBE_STR[TARG_NUM]) local ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end local pow1 = sho * sho local pow2 = ama * ama local POS2 = POS POS2.Set( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.06, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) POS = OBJ.GetPosition() local loc = math.sqrt((POS.x - POS2.x) * (POS.x - POS2.x) + (POS.z - POS2.z) * (POS.z - POS2.z)) if min_loc > loc then min_loc = loc min = i end end --駒処理 function Koma() --盤に置いてある駒だったらtrue:とった駒の配置ならばfalse if flg then local hosei = 0 --歩 if TARG_NUM < 19 then --飛車 if URA_FLG[TARG_NUM] == 0 then if ANG_NUM[TARG_NUM] == 90 then hosei = 9 else hosei = -9 end if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end else if ANG_NUM[TARG_NUM] == 90 then for i = 1, 4 do if i == 1 then hosei = 7 for i2 = 1, 3 do if ((BORD_NUM + hosei + i2) <= #BOARD_NUM) and ((BORD_NUM + hosei + i2) > 0) and (math.floor(1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei + i2) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei + i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei + i2]] then BOARD_POSSIBLE[BORD_NUM + hosei + i2] = 0 end end end elseif i == 2 then hosei = -1 if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end elseif i == 3 then hosei = 1 if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end elseif i == 4 then hosei = -9 if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) and (math.floor(-1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end end end else for i = 1, 4 do if i == 1 then hosei = 7 for i2 = 1, 3 do if ((BORD_NUM - hosei - i2) <= #BOARD_NUM) and ((BORD_NUM - hosei - i2) > 0) and (math.floor(-1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei - i2) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei - i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei - i2]] then BOARD_POSSIBLE[BORD_NUM - hosei - i2] = 0 end end end elseif i == 2 then hosei = -1 if ((BORD_NUM - hosei) <= #BOARD_NUM) and ((BORD_NUM - hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei]] then BOARD_POSSIBLE[BORD_NUM - hosei] = 0 end end elseif i == 3 then hosei = 1 if ((BORD_NUM - hosei) <= #BOARD_NUM) and ((BORD_NUM - hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei]] then BOARD_POSSIBLE[BORD_NUM - hosei] = 0 end end elseif i == 4 then hosei = -9 if ((BORD_NUM - hosei) <= #BOARD_NUM) and ((BORD_NUM - hosei) > 0) and (math.floor(1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei]] then BOARD_POSSIBLE[BORD_NUM - hosei] = 0 end end end end end end BOARD_POSSIBLE[BORD_NUM] = 1