Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chat = peripheral.wrap("front")
- rednet.open("right")
- local commandNum
- local commandNumTwo
- local commandNumThree
- local function seewinUser(moves)
- checkWin = (commandNum+commandNumTwo+commandNumThree)%3
- if checkWin == 0 then
- chat.say("You have won and finally figured this out!")
- elseif checkWin ~= 0 then
- chat.say("no win")
- end
- end
- win = {
- {1,2,3},--6
- {1,6,11},--18
- {1,7,13},--21
- {2,7,12},--21
- {2,8,14},--24
- {2,3,4},--9
- {3,7,11},--21
- {3,8,13},--24
- {3,4,5},--12
- {3,9,15},--27
- {4,9,14},--27
- {4,8,12},--24
- {5,10,15},--30
- {5,9,13},--27
- {6,7,8},--21
- {6,11,16},--33
- {6,12,18},--36
- {7,8,9},--24
- {7,12,17},--36
- {7,13,19},--39
- {8,13,18},--39
- {8,14,20},--42
- {8,12,16},--36
- {8,9,10},--27
- {9,14,19},--42
- {9,13,17},--39
- {10,14,18},--42
- {10,15,20},--45
- {11,12,13},--36
- {11,16,21},--48
- {11,17,23},--51
- {12,13,14},--39
- {12,17,22},--51
- {12,18,24},--54
- {13,14,15},--42
- {13,18,23},--54
- {13,19,25},--57
- {14,19,24},--57
- {14,28,24},--66
- {15,20,25},--60
- {15,19,23},--57
- {16,17,18},--51
- {17,18,19},--54
- {18,19,20},--57
- {21,22,23},--66
- {22,23,24},--69
- {23,24,25},--72
- }
- a = math.random(1,5)
- local function doCommand(a)
- if a == 1 then
- redstone.setOutput("back", true)
- elseif a==2 then
- redstone.setOutput("top", true)
- elseif a == 3 then
- redstone.setOutput("left", true)
- elseif a == 4 then
- redstone.setOutput("bottom", true)
- elseif a == 5 then
- rednet.send(52, "redstone5", "redstone5")
- elseif a == 6 then
- rednet.send(51, "redstone6", "redstone6")
- elseif a == 7 then
- rednet.send(53, "redstone7","redstone7")
- elseif a == 8 then
- rednet.send(55, "redstone", "redstone8")
- elseif a == 9 then
- rednet.send(54, "redstone", "redstone9")
- elseif a == 10 then
- rednet.send(56, "redstone", "redstone10")
- elseif a == 11 then
- rednet.send(61, "redstone", "redstone11")
- elseif a== 12 then
- rednet.send(60, "redstone12", "redstone12")
- elseif a == 13 then
- rednet.send(59, "redstone13", "redstone13")
- elseif a == 14 then
- rednet.send(58, "redstone14", "redstone14")
- elseif a == 15 then
- rednet.send(57, "redstone15", "redstone15")
- elseif a == 16 then
- rednet.send(65, "redstone16", "redstone16")
- elseif a == 17 then
- rednet.send(67, "redstone17", "redstone17")
- elseif a == 18 then
- rednet.send(68, "redstone18", "redstone18")
- elseif a == 19 then
- rednet.send(69, "redstone19", "redstone19")
- elseif a == 20 then
- rednet.send(70, "redstone20", "redstone20")
- elseif a == 21 then
- rednet.send(66, "redstone21", "redstone21")
- elseif a == 22 then
- rednet.send(71, "redstone22", "redstone22")
- else if a == 23 then
- rednet.send(72, "redstone23", "redstone23")
- elseif a == 24 then
- rednet.send(73, "redstone24", "redstone24")
- elseif a == 25 then
- rednet.send(74, "redstone25", "redstone25")
- end
- end
- end
- sleep(2)
- chat.say("Ok, I'm going in spot "..a)
- doCommand(a)
- moves = 0
- moves = moves + 1
- sleep(2)
- chat.say("What space would you like to go to?")
- repeat
- local player, event, command= os.pullEvent("chat")
- commandNum = tonumber(command:match("%d+"))
- until commandNum and commandNum> 0 and commandNum<12
- sleep(2)
- doCommand(commandNum)
- sleep(2)
- topBottom = math.random(1,2)
- print("This is top bottom: "..topBottom)
- chat.say("Alright, my turn again.")
- if topBottom == 1 then
- repeat
- aa = math.random(1,5)
- until aa~= a and aa ~= command
- sleep(2)
- chat.say("I will go to spot "..aa)
- elseif topBottom == 2 then
- if commandNum == a +5 then
- aa = commandNum +5
- sleep(2)
- chat.say("I will go to spot "..aa)
- elseif commandNum ~= a+5 then
- aa = a+5
- sleep(2)
- chat.say("I will go to spot "..aa)
- end
- end
- doCommand(aa)
- sleep(2)
- chat.say("Ok, your turn again!Where would you like to go?")
- repeat
- player, event, commandTwo = os.pullEvent("chat")
- commandNumTwo = tonumber(commandTwo:match("%d+"))
- until commandNumTwo and commandNumTwo > 0 and commandNumTwo <21
- sleep(2)
- doCommand(commandNumTwo)
- topBottom2 = math.random(1,2)
- chat.say("Time for me to go again.")
- if topBottom2 == 1 then
- repeat
- ab = math.random(1,5)
- until ab~= a and ab~=commandNum and ab~=aa and ab ~= commandNumTwo
- sleep(2)
- chat.say("I will got to spot "..ab)
- elseif topBottom2 == 2 then
- sleep(2)
- if commandNumTwo == commandNum + 5 then
- ab = commandNumTwo+ 5
- chat.say("I will go to spot "..ab)
- sleep(2)
- elseif commandNumTwo ~= aa + 5 then
- ab = aa+5
- chat.say("I will go to spot "..ab)
- end
- end
- doCommand(ab)
- sleep(2)
- chat.say("Ok, Your turn again!Where would you like to go?")
- repeat
- player, event, commandThree = os.pullEvent("chat")
- commandNumThree = tonumber(commandThree:match("%d+"))
- until commandNumThree and commandNumThree > 0 and commandNumThree<25
- sleep(2)
- doCommand(commandNumThree)
- seewinUser(moves)
- sleep(2)
- chat.say("Would you like to play again?")
- sleep(2)
- player, event, reboot = os.pullEvent("chat")
- if string.match(reboot, "yes") then
- rednet.send(52, "redstone5r", "redstone5r")
- rednet.send(51, "redstone6r", "redstone6r")
- rednet.send(53, "redstone7r", "redstone7r")
- rednet.send(55, "redstone8r", "redstone8r")
- rednet.send(54, "redstone9r", "redstone9r")
- rednet.send(56, "redstone10r", "redstone10r")
- rednet.send(61, "redstone11r", "redstone11r")
- rednet.send(60, "redstone12r", "redstone12r")
- rednet.send(59, "redstone13r", "redstone13r")
- rednet.send(58, "redstone14r", "redstone14r")
- rednet.send(57, "redstone15r", "redstone15r")
- rednet.send(65, "redstone16r", "redstone16r")
- rednet.send(67, "redstone17r", "redstone17r")
- rednet.send(68, "redstone18r", "redstone18r")
- rednet.send(69, "redstone19r", "redstone19r")
- rednet.send(70, "redstone20r", "redstone20r")
- rednet.send(66, "redstone21r", "redstone21r")
- rednet.send(71, "redstone22r", "redstone22r")
- rednet.send(72, "redstone23r", "redstone23r")
- rednet.send(73, "redstone24r", "redstone24r")
- rednet.send(74, "redstone25r", "redstone25r")
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment