Advertisement
ZNZNCOOP

lotoclient

Oct 31st, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. function draw_matrix(matrix,max_x,max_y,ot,dos)
  2.    startX= 1
  3.    startY= 1
  4.    c= 2
  5.    for y=1,6 do
  6.       for x=1,6 do
  7.          term.setCursorPos(startX,startY)
  8.          if c > ot and c < dos
  9.          then
  10.             write(matrix[c])
  11.              startX=startX+5           
  12.          else
  13.             write(matrix[c])
  14.             startX=startX+4
  15.          end
  16.          c= c+1
  17.       end
  18.       startY= startY+1
  19.       startX= 1
  20.    end
  21. end
  22.  
  23. function add_arrays(arr1,arr2)
  24.    len1= #arr1
  25.    len2= #arr2
  26.    arr3= arr1
  27.    for i=len1,len1+len2 do
  28.    
  29.        arr3[#arr3+1]= arr2[i]
  30.    
  31.    end
  32.    return arr3
  33. end
  34. X,Y= term.getSize()
  35. rednet.open("top")
  36. data= {"start"}
  37. message= textutils.serialize(data)
  38. rednet.send(1,message)
  39. id,message= rednet.receive()
  40. if id == 1
  41. then
  42.    data= textutils.unserialize(message)
  43. end
  44. a= 2
  45. b= 7
  46. numbers={}
  47. while true do
  48.    term.clear()
  49.    draw_matrix(data,X,Y,a,b)
  50.    print()
  51.    print()
  52.    print("Enter numbers ot ",a-1," to ",b-1)
  53.    number= read()
  54.    stat= false
  55.    for i=a,b do
  56.    
  57.       if number+0 == data[i]
  58.       then
  59.          a= b
  60.          b=b+6
  61.          stat= true
  62.       end
  63.    end
  64.    if stat == true
  65.    then
  66.       numbers[#numbers+1]= number
  67.    end
  68.    if b == 43
  69.    then
  70.       break
  71.    end
  72. end
  73. print("Enter your Name :")
  74. name= read()
  75. data= {"finish"}
  76. data[2]= name
  77. data= add_arrays(data,numbers)
  78. message= textutils.serialize(data)
  79. rednet.send(1,message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement