Программирование на smart BASIC. Урок 4

Tantrixx
Posts: 119
Joined: Sun Nov 22, 2015 11:24 am
My devices: iPhone 5

Re: Программирование на smart BASIC. Урок 4

Post by Tantrixx »

Добрый день.
Мой вариант задания.
graphics
graphics clear
shadow on
randomize
line1:
get orientation p

if p=1 or p=3 then
maxx=screen_width ()
maxy=screen_height ()

pause 0.1
x1=rnd(maxx)
x2=rnd(maxx)
y1=rnd(maxy)
y2=rnd(maxy)
a=rnd(250)
s=rnd(250)
d=rnd(250)
draw color a/250,s/250,d/250
draw line x1,x2 to y1,y2

else
mx=screen_width ()
my=screen_height ()
pause 0.1
x=rnd(mx)
y=rnd(my)
a=rnd(250)
s=rnd(250)
d=rnd(250)
draw color a/250,s/250,d/250
draw circle x,y size rnd (50)
end if
goto line1

Flower
Posts: 59
Joined: Sat Feb 07, 2015 12:33 pm
My devices: iPad 3 - у сына,
IPhone 4s,
iPad Air - моя игрушка,
Iwatch 2 - мечтаю ;), может куплю.

Re: Программирование на smart BASIC. Урок 4

Post by Flower »

Моя версия:

graphics
ll:
a=screen_height()
b=screen_width()
randomize

x2=rnd(a)
x1=rnd(b)
x3=rnd(a/4+b/4)

if a < b then
draw circle x1,x2 size x3
else
draw line x1,x2 to 3*x3,x2
end if
pause 0.5
goto ll

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Программирование на smart BASIC. Урок 4

Post by Mr. Kibernetik »

Flower wrote:Моя версия:

graphics
ll:
a=screen_height()
b=screen_width()
randomize

x2=rnd(a)
x1=rnd(b)
x3=rnd(a/4+b/4)

if a < b then
draw circle x1,x2 size x3
else
draw line x1,x2 to 3*x3,x2
end if
pause 0.5
goto ll
Команду RANDOMIZE нет надобности включать внутрь цикла.

Post Reply