View difference between Paste ID: vuEKWaxm and X8VVHKpz
SHOW: | | - or go back to the newest paste.
1-
input, unsort, left, back = colors.white, colors.black, colors.red, colors.yellow
1+
input, unsort = colors.white, colors.black
2
3-
leftSapling = "Silver Lime"
3+
4-
backSapling = "Hill Cherry"
4+
5
6
function sendPulse(color)
7
  local startColor = rs.getBundledOutput("back")
8
  rs.setBundledOutput("back",color+startColor)
9
  os.sleep(0.25)
10
  rs.setBundledOutput("back",startColor)
11-
  rs.setBundledOutput("back",0)
11+
12
13
function setColor(color)
14
  rs.setBundledOutput("back",color)
15
end
16
17
function readySapling()
18
  while ( not analyzer.isTree() ) do
19
    sendPulse(input)
20
    os.sleep(5)
21
  end
22
end
23
24
25
function processSapling()
26
  if ( not analyzer.isTree() ) then return end
27
  
28-
  if      ( species == leftSapling ) then sendPulse(left)
28+
29-
  else if ( species == backSapling ) then sendPulse(back)
29+
30-
  else sendPulse(unsort) end
30+
31
  if      ( species == "Hill Cherry" ) then setColor(colors.cyan)
32
  else if ( species == "Silver Lime" ) then setColor(colors.orange)
33
  else setColor(unsort) end
34
35
end
36
37
while true do
38
  readySapling()
39
  processSapling()
40
end