SHOW:
|
|
- or go back to the newest paste.
| 1 | -- FUNCTIONS | |
| 2 | function signal() | |
| 3 | rs.setOutput("back",true)
| |
| 4 | sleep(1) | |
| 5 | rs.setOutput("back",false)
| |
| 6 | end | |
| 7 | ||
| 8 | function checkWater() | |
| 9 | rednet.open('bottom')
| |
| 10 | rednet.broadcast('check_water')
| |
| 11 | id, result = rednet.receive() | |
| 12 | rednet.close() | |
| 13 | return result | |
| 14 | end | |
| 15 | ||
| 16 | function slitVodu() | |
| 17 | - | if checkWater() |
| 17 | + | if checkWater() then |
| 18 | signal() | |
| 19 | print('Voda slita')
| |
| 20 | else | |
| 21 | print('Voda uzhe slita')
| |
| 22 | end | |
| 23 | end | |
| 24 | function haletVodu() | |
| 25 | if checkWater() then | |
| 26 | ||
| 27 | print('Bada y ga haleta')
| |
| 28 | ||
| 29 | else | |
| 30 | signal() | |
| 31 | print('haleBaey')
| |
| 32 | end | |
| 33 | end | |
| 34 | ||
| 35 | -- PROGRAM | |
| 36 | print ("Dobro pozhalovat")
| |
| 37 | print ("1 - slit' vodu ")
| |
| 38 | print ("2 - napolnit' vodoy ")
| |
| 39 | ||
| 40 | text = read() | |
| 41 | if text == '1' then | |
| 42 | slitVodu() | |
| 43 | elseif text == '2' then | |
| 44 | -- | |
| 45 | else | |
| 46 | print('Nepravilnaya komanda')
| |
| 47 | end | |
| 48 | ||
| 49 | ||
| 50 |