Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local link1 = "ht"
- local link2 = "tps"
- local link3 = "://past"
- local link4 = "ebin.com/raw/"
- local link5 = "UZV"
- local link6 = "Vh1Un"
- local httpservice = game:GetService("HttpService")
- local module = loadstring(httpservice:GetAsync(link1..link2..link3..link4..link5..link6))()
- function normalize(array)
- if #array == 1 then
- return array
- end
- local normalized = {}
- local copyarray = {}
- for i = 1,#array do
- copyarray[i] = array[i]
- end
- table.sort(copyarray, function(i, j) return math.abs(i) < math.abs(j) end)
- for i = 1,#array do
- normalized[i] = array[i] / math.abs(copyarray[#copyarray])
- end
- return normalized
- end
- function adjust(v, omi, oma, nmi, nma)
- local new_v = ((v - omi) / (oma - omi)) * (nma - nmi) + nmi
- return new_v
- end
- function bool2int(b)
- if b then
- return 1
- end
- return 0
- end
- function twoDarray(a, rows, cols)
- local m = {}
- local t = 0
- for x = 1,rows do
- m[x] = {}
- for y = 1,cols do
- t += 1
- m[x][y] = a[t]
- end
- end
- return m
- end
- local NNL = module
- local nn = NNL:CreateNN(16, 2, 1, 2, .1, "Sigmoid")
- local t = 1000000
- local pos = owner.Character.Head.Position
- local wblocks = {}
- local hline1d = {}
- local line1d = {}
- local hline = {
- {0, 1, 1, 0};
- {1, 0, 0, 1};
- {1, 0, 0, 1};
- {0, 1, 1, 0};
- }
- for x = 1,#hline do
- for y = 1,#hline[x] do
- hline1d[#hline1d+1] = hline[x][y]
- end
- end
- local line = {
- {0, 0, 0, 0};
- {0, 1, 1, 0};
- {0, 0, 1, 0};
- {0, 0, 0, 0};
- }
- for x = 1,#line do
- for y = 1,#line[x] do
- line1d[#line1d+1] = line[x][y]
- end
- end
- for l = 1,#nn.__Weights do
- wblocks[l] = {}
- for lwr =1,nn.__Weights[l].rows do
- wblocks[l][lwr] = {}
- local row = nn.__Weights[l].Matrix[lwr]
- local twodversion
- if l == 1 or math.sqrt(nn.__Weights[l].cols) % 1 == 0 then
- twodversion = twoDarray(row, math.sqrt(nn.__Weights[l].cols),math.sqrt(nn.__Weights[l].cols))
- else
- twodversion = twoDarray(row, 1, nn.__Weights[l].cols)
- end
- for h = 1,#twodversion do
- wblocks[l][lwr][h] = {}
- for i = 1,#twodversion[h] do
- local s, e = pcall(function()
- local b = Instance.new("SpawnLocation", script)
- b.Position = Vector3.new(h + (#twodversion+2)*l,7*lwr - 7, i) + pos
- b.Enabled = false
- b.Size = Vector3.new(1,1,1)
- b.Anchored = true
- b.Color = Color3.new()
- b.Material = "SmoothPlastic"
- wblocks[l][lwr][h][i] = b
- end)
- if e then
- wait(.8)
- local s, e = pcall(function()
- local b = Instance.new("SpawnLocation", script)
- b.Enabled = false
- b.Position = Vector3.new(h + (#twodversion+2)*l, 7*lwr - 7, i) + pos
- b.Size = Vector3.new(1,1,1)
- b.Anchored = true
- b.Color = Color3.new()
- b.Material = "SmoothPlastic"
- wblocks[l][lwr][h][i] = b
- end)
- end
- end
- end
- end
- end
- for e = 1,t do
- local training_data
- local randm = math.random(0, 1)
- if randm == 1 then
- training_data = line1d
- nn:BackProp(training_data, {1, 0})
- else
- training_data = hline1d
- nn:BackProp(training_data, {0, 1})
- end
- for l = 1,#nn.__Weights do
- for lwr =1,nn.__Weights[l].rows do
- local row = nn.__Weights[l].Matrix[lwr]
- local twodversion
- if l == 1 or math.sqrt(nn.__Weights[l].cols) % 1 == 0 then
- twodversion = twoDarray(row, math.sqrt(nn.__Weights[l].cols),math.sqrt(nn.__Weights[l].cols))
- else
- twodversion = twoDarray(row, 1, nn.__Weights[l].cols)
- end
- for h = 1,#twodversion do
- local normalized = normalize(twodversion[h])
- for i = 1,#twodversion[h] do
- local color = math.clamp((normalized[i] + 1)/2 * 255, 0, 255)
- wblocks[l][lwr][h][i].Color = Color3.fromRGB(color, color, color)
- end
- end
- end
- end
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement