potřebovala bych poradit, jak naprogramovat program ve Small Basicu, který mi bude po zadání velikosti okna vykreslí šachovnicovou síť.
Předem děkuji za radu!

Kód: Vybrat vše
rectangle = Shapes.AddRectangle(50,50)
Shapes.Move(rectangle, o kolik se to posunout o x, o y)
Kód: Vybrat vše
GraphicsWindow.Show()
For x = 1 To 8
For i = 1 To 8
GraphicsWindow.DrawRectangle(50 * i,50 * x,50,50)
endFor
EndFor
Kód: Vybrat vše
TextWindow.Write("Zadej velikost strany: ")
strana = TextWindow.Read()
Kód: Vybrat vše
TextWindow.Write("Velikost okna? ")
strana = TextWindow.Read()
GraphicsWindow.Show()
For x = 1 To strana Step 1
For i = 1 To strana step 1
zbytekpox = Math.Remainder(x,2)
zbytekpoi = Math.Remainder(i,2)
If zbytekpoi = 0 And zbytekpox = 1 then
GraphicsWindow.FillRectangle(50 * i,50 * x,50,50)
ElseIf zbytekpoi = 1 And zbytekpox = 0 then
GraphicsWindow.FillRectangle(50 * i,50 * x,50,50)
Else
GraphicsWindow.DrawRectangle(50 * i,50 * x,50,50)
EndIf
endFor
EndFor
GraphicsWindow.Width = (strana + 2) * 50
GraphicsWindow.Height = (strana + 2) * 50
Lucka123 píše:jak to myslíte s tou proměnnou...
Kód: Vybrat vše
GraphicsWindow.BackgroundColor = "Green"
...
...
if (Math.Remainder(x,2) + Math.Remainder(i,2))=1 then
GraphicsWindow.BrushColor = "White"
else
GraphicsWindow.BrushColor = "Black"
endif
Zpět na “Programování a tvorba webu”
Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 5 hostů