View difference between Paste ID: c5vekS62 and vwQwX8En
SHOW: | | - or go back to the newest paste.
1-
term.redirect(peripheral.wrap("back"))
1+
2
rednet.open("top")
3
4-
local ss = fs.open("ss","r")
4+
local stackerscores = fs.open("stackerscores","r")
5-
local data = ss.readAll()
5+
local data = stackerscores.readAll()
6-
ss.close()
6+
stackerscores.close()
7
textutils.unserialise(data)
8
local stacker = {data}
9
print("Stacker:")
10
11
local breakoutscores = fs.open("breakoutscores","r")
12
local data = breakoutscores.readAll()
13
breakoutscores.close()
14
textutils.unserialise(data)
15
local breakout = {data}
16
print("Breakout:")
17
18-
     term.clear()
18+
local flappyscores = fs.open("flappyscores","r")
19-
     print("Stacker:")
19+
local data = flappyscores.readAll()
20-
     table.insert(stacker, message)
20+
flappyscores.close()
21-
     table.sort(stacker, comp)
21+
22-
    local ss = fs.open("ss","w")
22+
local flappy = {data}
23-
    ss.write(table.concat(stacker, '\n'))
23+
print("Flappy:")
24-
    ss.close()
24+
25-
    print(table.concat(stacker,'\n'))
25+
26
    return first > second
27
end
28
29
while true do
30
  senderId, message, protocol = rednet.receive()
31
		if protocol == "stacker" and senderId == 144 then
32
     		
33
    		 print("Stacker:")
34
     		table.insert(stacker, message)
35
     		table.sort(stacker, comp)
36
    		local stackerscores = fs.open("stackerscores","w")
37
   		    stackerscores.write(table.concat(stacker, '\n'))
38
   		    stackerscores.close()
39
    		rednet.send(169, table.concat(stacker,'\n'), "stacker")
40
    
41
42
    
43
		
44
		elseif protocol == "breakout" and senderId == 168 then
45
     		
46
    		 print("Breakout:")
47
     		table.insert(breakout, message)
48
     		table.sort(breakout, comp)
49
    		local breakoutscores = fs.open("breakoutscores","w")
50
   		    breakoutscores.write(table.concat(breakout, '\n'))
51
   		    breakoutscores.close()
52
    		rednet.send(170, table.concat(breakout,'\n'), "breakout")
53
    
54
55
    
56
		
57
		elseif protocol == "flappy" and senderId == 168 then
58
     		
59
    		 print("Flappy:")
60
     		table.insert(flappy, message)
61
     		table.sort(flappy, comp)
62
    		local flappyscores = fs.open("flappyscores","w")
63
   		    flappyscores.write(table.concat(flappy, '\n'))
64
   		    flappyscores.close()
65
    		rednet.send(171, table.concat(flappy,'\n'), "flappy")
66
    
67
68
    
69
		end
70
end
71