Advertisement
Guest User

Apps--MasterMind

a guest
Jan 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. term.setBackgroundColor(colors.white)
  2. term.clear()
  3.  
  4.  
  5. for i=1,12 do
  6. paintutils.drawBox(i*3,3,i*3,18,colors.black)
  7. end
  8.  
  9. for i=1,6 do
  10. paintutils.drawBox(3,i*3,36,i*3,colors.black)
  11. end
  12.  
  13. paintutils.drawFilledBox(40,1,51,19,colors.black)
  14.  
  15. paintutils.drawBox(45,4,48,5,colors.red)
  16. paintutils.drawBox(45,6,48,7,colors.blue)
  17. paintutils.drawBox(45,8,48,9,colors.yellow)
  18. paintutils.drawBox(45,10,48,11,colors.purple)
  19. paintutils.drawBox(45,12,48,13,colors.green)
  20. paintutils.drawBox(45,14,48,15,colors.orange)
  21. paintutils.drawBox(45,16,48,17,colors.brown)
  22.  
  23.  
  24.  
  25.  
  26. nTOc={1="red",2="blue",3="yellow",4="purple",5="green",6="orange",7="brown"}
  27. guessedFieldX=4
  28.  
  29. while true do
  30. event,n,x,y=os.pullEvent("mouse_Click")
  31.  
  32. if x>44 and x<49 then
  33. if y=>4 and y<=5 then
  34. currentColor="red"
  35. elseif y=>6 and y<=7 then
  36. currentColor="blue"
  37. elseif y=>8 and y<=9 then
  38. currentColor="yellow"
  39. elseif y=>10 and y<=11 then
  40. currentColor="purple"
  41. elseif y=>12 and y<=13 then
  42. currentColor="green"
  43. elseif y=>14 and y<=15 then
  44. currentColor="orange"
  45. elseif y=>16 and y<=17 then
  46. currentColor="brown"
  47. end
  48.  
  49. end
  50.  
  51. if y>=4 and y<=5 and x<=33 then
  52. guessedFieldY=4
  53. paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
  54. Field[guessedFieldY]=currentColor
  55.  
  56. elseif y>=7 and y<=8 then
  57. guessedFieldY=7
  58. paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
  59. Field[guessedFieldY]=currentColor
  60.  
  61. elseif y>=10 and y<=11 then
  62. guessedFieldY=10
  63. paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
  64. Field[guessedFieldY]=currentColor
  65.  
  66. elseif y>=13 and y<=14 then
  67. guessedFieldY=13
  68. paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
  69. Field[guessedFieldY]=currentColor
  70.  
  71. elseif y>=16 and y<=17 then
  72. guessedFieldY=16
  73. paintutils.drawBox(guessedFieldX,guessedFieldY,guessedFieldX+1,guessedFieldY+1,colors[currentColor])
  74. Field[guessedFieldY]=currentColor
  75. end
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement