Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xwk = 1 -- wspolrzedna kierunek (1-polnoc, 2-wschod, 3-poludnie 4-zachod)
- xwn = 0 -- wspolrzedna pozioma (polnoc-poludnie)
- xww = 0 -- wspolrzedna pozioma (zachod-wschod)
- xwp = 0 -- wspolrzedna pionowa (gora-dol)
- function drukujpolozenie()
- write("wspolrzedna kierunek: ")
- write(xwk)
- print()
- write("wspolrzedna pozioma1: ")
- write(xwn)
- print()
- write("wspolrzedna pozioma2: ")
- write(xww)
- print()
- write("wspolrzedna pionowa: ")
- write(xwp)
- print()
- end
- function obrotwlewo()
- if turtle.turnLeft() then
- xwk=xwk-1
- if xwk==0 then
- xwk=4
- end
- return true
- else
- return false
- end
- end
- function obrotwprawo()
- if turtle.turnRight() then
- xwk=xwk+1
- if xwk==5 then
- xwk=1
- end
- return true
- else
- return false
- end
- end
- function krokdoprzodu()
- if turtle.forward() then
- if xwk==1 then
- xwn=xwn-1
- end
- if xwk==2 then
- xww=xww+1
- end
- if xwk==3 then
- xwn=xwn+1
- end
- if xwk==4 then
- xww=xww-1
- end
- return true
- else return false
- end
- end
- function krokdotylu()
- if turtle.back() then
- if xwk==1 then
- xwn=xwn+1
- end
- if xwk==2 then
- xww=xww-1
- end
- if xwk==3 then
- xwn=xwn-1
- end
- if xwk==4 then
- xww=xww+1
- end
- return true
- else return false
- end
- end
- print(krokdoprzodu())
- drukujpolozenie()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement