Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 01 02 03 04
- 05 06 07 08 1
- 09 10 11 12 уровень
- 13 14 15 16
- 17 18 19 20
- 21 22 23 24 2
- 25 26 27 28 уровень
- 29 30 31 32
- 33 34 35 36
- 37 38 39 40 3
- 41 42 43 44 уровень
- 45 46 47 48
- 49 50 51 52
- 53 54 55 56 4
- 57 58 59 60 уровень
- 61 62 63 64
- ]]
- local tLink = {} -- таблица связей
- for g = 1, 64, 4 do
- table.insert(tLink, {g, g+1, g+2, g+3})
- end
- local tIndex = {} -- таблица индесов комнат
- for f = 1, 64 do
- table.insert(tIndex, f)
- end
- function shuffle(tbl)
- trs = math.random(1, 13)
- for i = 0, trs do
- i = 64
- while i > 1 do
- i = i - 1
- j = math.random(1, i)
- tbl[j], tbl[i] = tbl[i], tbl[j]
- end
- end
- return tbl
- end
- shuffle(tLink)
- local function perm()
- tIndex[4], tIndex[8], tIndex[12], tIndex[16], tIndex[32], tIndex[48], tIndex[64], tIndex[60], tIndex[56], tIndex[52], tIndex[36], tIndex[20] =
- tIndex[16], tIndex[32], tIndex[48], tIndex[64], tIndex[60], tIndex[56], tIndex[52], tIndex[36], tIndex[20], tIndex[4], tIndex[8], tIndex[12]
- tIndex[24], tIndex[28], tIndex[40], tIndex[44] = tIndex[40], tIndex[24], tIndex[44], tIndex[28]
- for sh = 0, 3 do
- tIndex[1+sh], tIndex[2+sh], tIndex[3+sh], tIndex[4+sh],
- tIndex[5+sh], tIndex[6+sh], tIndex[7+sh], tIndex[8+sh],
- tIndex[9+sh], tIndex[10+sh], tIndex[11+sh], tIndex[12+sh],
- tIndex[13+sh], tIndex[14+sh], tIndex[15+sh], tIndex[16+sh] =
- tIndex[5+sh], tIndex[6+sh], tIndex[7+sh], tIndex[8+sh],
- tIndex[9+sh], tIndex[10+sh], tIndex[11+sh], tIndex[12+sh],
- tIndex[13+sh], tIndex[14+sh], tIndex[15+sh], tIndex[16+sh],
- tIndex[1+sh], tIndex[2+sh], tIndex[3+sh], tIndex[4+sh]
- end
- tIndex[1], tIndex[2], tIndex[3], tIndex[4], tIndex[20], tIndex[36], tIndex[52], tIndex[51], tIndex[50], tIndex[49], tIndex[33], tIndex[17] =
- tIndex[4], tIndex[20], tIndex[36], tIndex[52], tIndex[51], tIndex[50], tIndex[49], tIndex[33], tIndex[17], tIndex[1], tIndex[2], tIndex[3]
- tIndex[18], tIndex[19], tIndex[35], tIndex[34] = tIndex[19], tIndex[35], tIndex[34], tIndex[18]
- end
- local component = require('component')
- local data = component.data
- local hsh = data.md5(table.concat(tIndex, ' '))
- local tr = 1
- perm()
- while hsh ~= data.md5(table.concat(tIndex, ' ')) do
- perm()
- tr = tr + 1
- end
- print(tr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement