Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cheatID=666
- term.setBackgroundColor(colors.white)
- term.clear()
- paintutils.drawFilledBox(3,3,35,17,colors.lightGray)
- for i=1,12 do
- paintutils.drawBox(i*3,3,i*3,18,colors.black)
- end
- for i=1,6 do
- paintutils.drawBox(3,i*3,36,i*3,colors.black)
- end
- paintutils.drawFilledBox(40,1,51,19,colors.black)
- paintutils.drawBox(45,3,48,4,colors.red)
- paintutils.drawBox(45,5,48,6,colors.blue)
- paintutils.drawBox(45,7,48,8,colors.yellow)
- paintutils.drawBox(45,9,48,10,colors.purple)
- paintutils.drawBox(45,11,48,12,colors.green)
- paintutils.drawBox(45,13,48,14,colors.orange)
- paintutils.drawBox(45,15,48,16,colors.brown)
- paintutils.drawBox(45,17,48,18,colors.white)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(43,1)
- write("confirm")
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(1,1)
- write("hint")
- nTOc={"red","blue","yellow","purple","green","orange","brown","white"}
- sol={}
- sol[1]=nTOc[math.random(1,8)]
- sol[2]=nTOc[math.random(1,8)]
- while sol[1]==sol[2] do
- sol[2]=nTOc[math.random(1,8)]
- end
- sol[3]=nTOc[math.random(1,8)]
- while sol[1]==sol[3] or sol[2]==sol[3] do
- sol[3]=nTOc[math.random(1,8)]
- end
- sol[4]=nTOc[math.random(1,8)]
- while sol[1]==sol[4] or sol[2]==sol[4] or sol[3]==sol[4] do
- sol[4]=nTOc[math.random(1,8)]
- end
- sol[5]=nTOc[math.random(1,8)]
- while sol[1]==sol[5] or sol[2]==sol[5] or sol[3]==sol[5] or sol[4]==sol[5] do
- sol[5]=nTOc[math.random(1,8)]
- end
- rednet.open("top")
- rednet.send(cheatID,sol)
- rednet.close("top")
- guessedFieldX=1
- currentColor="red"
- Field={}
- victory=false
- confirmed=false
- round=0
- while victory==false do
- round=round+1
- confirmed=false
- guessedFieldX=guessedFieldX+3
- while confirmed==false do
- event,n,x,y=os.pullEvent("mouse_click")
- if x>44 and x<49 then
- if y>=3 and y<=4 then
- currentColor="red"
- elseif y>=5 and y<=6 then
- currentColor="blue"
- elseif y>=7 and y<=8 then
- currentColor="yellow"
- elseif y>=9 and y<=10 then
- currentColor="purple"
- elseif y>=11 and y<=12 then
- currentColor="green"
- elseif y>=13 and y<=14 then
- currentColor="orange"
- elseif y>=15 and y<=16 then
- currentColor="brown"
- elseif y>=17 and y<=18 then
- currentColor="white"
- end
- term.setTextColor(colors[currentColor])
- term.setBackgroundColor(colors.black)
- term.setCursorPos(43,1)
- write("confirm")
- end
- if y>=4 and y<=5 and x<=33 then
- guessedFieldY=4
- paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
- Field[(guessedFieldY-1)/3]=currentColor
- elseif y>=7 and y<=8 and x<=33 then
- guessedFieldY=7
- paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
- Field[(guessedFieldY-1)/3]=currentColor
- elseif y>=10 and y<=11 and x<=33 then
- guessedFieldY=10
- paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
- Field[(guessedFieldY-1)/3]=currentColor
- elseif y>=13 and y<=14 and x<=33 then
- guessedFieldY=13
- paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
- Field[(guessedFieldY-1)/3]=currentColor
- elseif y>=16 and y<=17 and x<=33 then
- guessedFieldY=16
- paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
- Field[(guessedFieldY-1)/3]=currentColor
- end
- if y==1 and x>42 and x<49 then
- confirmed=true
- end
- if y==1 and x<8 then
- hintY=math.random(1,5)*3+1
- paintutils.drawBox(guessedFieldX,hintY,guessedFieldX+1,hintY+1,colors[sol[(hintY-1)/3]])
- Field[(hintY-1)/3]=sol[(hintY-1)/3]
- end
- end
- if confirmed then
- gray=0
- lightGray=0
- --GRAY
- for i=1,5 do
- if sol[i]==Field[i] then
- gray=gray+1
- end
- end
- --lightGray
- for i=1,5 do
- for j=1,5 do
- if Field[j]==sol[i] then
- lightGray=lightGray+1
- end
- end
- end
- lightGray=lightGray-gray
- if lightGray<0 then lightGray=0 end
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.blue)
- term.setCursorPos(guessedFieldX,2)
- write(gray)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.blue)
- term.setCursorPos(guessedFieldX+1,2)
- write(lightGray)
- if gray==5 then victory=true
- end
- end
- end
- sleep(2)
- term.setBackgroundColor(colors.green)
- term.clear()
- term.setTextColor(colors.black)
- term.setCursorPos(16,8)
- print("Victory in ",round," turnes")
- sleep(4)
Add Comment
Please, Sign In to add comment