Microsoft Small Basic

Program Listing: RVR167

GraphicsWindow.Clear()
GraphicsWindow.PenColor = "black"
GraphicsWindow.BrushColor = "red"
GraphicsWindow.BackgroundColor="white"
GraphicsWindow.Title = "Conway`s Game of Life Introduction"
GraphicsWindow.Width = 535
GraphicsWindow.Height = 390
Controls.ButtonClicked = onButtonClick
GraphicsWindow.MouseDown = OnMouseDown
GraphicsWindow.Show()

intro=0
GraphicsWindow.FontSize=16
GraphicsWindow.DrawText( 5, 20, "Read the rules to understand how Conway´s Game of Life works:" )
GraphicsWindow.BrushColor = "black"
GraphicsWindow.FontSize=12
GraphicsWindow.DrawText( 40, 90, "1. Any live cell with fewer than two live neighbours dies," )
GraphicsWindow.DrawText( 40, 110, " as if caused by under-population." )
GraphicsWindow.DrawText( 40, 135, "2. Any live cell with more than three live neighbours dies," )
GraphicsWindow.DrawText( 40, 155, " as if by overcrowding." )
GraphicsWindow.DrawText( 40, 180, "3. Any live cell with two or three live neighbours lives" )
GraphicsWindow.DrawText( 40, 200, " on to the next generation." )
GraphicsWindow.DrawText( 40, 225, "4. Any dead cell with exactly three live neighbours becomes" )
GraphicsWindow.DrawText( 40, 245, " a live cell, as if by reproduction." )

GraphicsWindow.BrushColor = "red"
GraphicsWindow.DrawText( 40, 280, "More information at:" )

GraphicsWindow.BrushColor = "black"
url1=Controls.AddTextBox(40,300)
url2=Controls.AddTextBox(40,330)
Controls.SetSize(url1, 350,25)
Controls.SetSize(url2, 350,25)
Controls.SetTextBoxText(url1,"http://en.wikipedia.org/wiki/Conway's_Game_of_Life")
Controls.SetTextBoxText(url2,"http://de.wikipedia.org/wiki/Conways_Spiel_des_Lebens")
introbutton=Controls.AddButton("start the Program",40,360)

While intro = 0
endwhile

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
programstart:

size = 15
Feldgröße = 20
GraphicsWindow.Clear()
GraphicsWindow.PenColor = "black"
GraphicsWindow.BrushColor = "red"
GraphicsWindow.BackgroundColor="white"
GraphicsWindow.Title = "Conway`s Game of Life with the rules 23/3"
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
'GraphicsWindow.MouseDown = OnMouseDown
GraphicsWindow.Show()


i=0

start = 0
quit = 0
editor=0
editore=2
ready=0
DrawUI()

'GraphicsWindow.ShowMessage("The Rules of Conways Game of Life: 1.Any live cell with fewer than two live neighbours dies, as if caused by under-population.","Rules")

RunLoop:

Controls.ButtonClicked = onButtonClick

If ready=1 and j = 1 then
Feldausgabe1()
ready = ready+1
GraphicsWindow.PenColor = "black"
endif
If (start = 0 ) Then
Goto RunLoop
EndIf
'If (quit = 1 ) Then
'Goto End
'EndIf
GraphicsWindow.BrushColor = "black"
GraphicsWindow.DrawText( Feldgröße*size + 120, 80, " "+i )
Feldausgabe1()
Nachbarprüfung()
Felderneuerung()
GraphicsWindow.BrushColor = "white"
GraphicsWindow.FillRectangle( Feldgröße*size + 115, 75, 40, 30 )
GraphicsWindow.BrushColor = "black"
i = i + 1
'Program.Delay(10)
Goto RunLoop

Sub Zufallsbelegung1
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y] = 0
If (Math.GetRandomNumber(5) > 3) Then
grid[x][y] = 1
Else
grid[x][y] = 0
EndIf
EndFor
Endfor
EndSub

Sub Feldausgabe1
For x = 1 To Feldgröße
For y = 1 To Feldgröße
If (grid[x][y] = 1) Then

GraphicsWindow.BrushColor = "blue"
GraphicsWindow.FillRectangle(x * size, y * size, size-1, size-1)

buffgrid[x][y] = grid[x][y]
endif
If grid[x][y]=0 and buffgrid[x][y]=1 then

GraphicsWindow.BrushColor = "white"
'GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
GraphicsWindow.FillRectangle(x * size, y * size, size, size)
''GraphicsWindow.DrawRectangle(x * size, y * size, size, size)
buffgrid[x][y]=0
GraphicsWindow.BrushColor = "blue"
endif
EndFor
EndFor
EndSub

Sub Nachbarprüfung
For x = 1 To Feldgröße
For y = 1 To Feldgröße

Zellnachbar = 0

If (grid[x-1][y] = 1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x-1][y-1]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x-1][y+1]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x+1][y]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x+1][y+1]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x+1][y-1]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x][y-1]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
If (grid[x][y+1]=1) Then
Zellnachbar = Zellnachbar + 1
EndIf
'GraphicsWindow.ShowMessage("" + Zellnachbar , "Zellnachbar")
If (grid[x][y]=1) Then
If (Zellnachbar = 3 or Zellnachbar = 2) Then
buffergrid[x][y] = 1
Else
buffergrid[x][y] = 0
EndIf
EndIf
If(grid[x][y]=0) Then
If (Zellnachbar = 3) Then
buffergrid[x][y] = 1
Else
buffergrid[x][y] = 0
EndIf
EndIf
EndFor
EndFor
EndSub

Sub Felderneuerung
For x = 1 To Feldgröße
For y = 1 To Feldgröße

grid[x][y] = buffergrid[x][y]

EndFor
EndFor

EndSub


Sub DrawUI

GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
Controls.GetTextBoxText(textbox1)

GraphicsWindow.BrushColor = "blue"
button1=Controls.AddButton("Start",Feldgröße*size + 40, 12)
button2=Controls.AddButton("Stop ",Feldgröße*size + 40, 42)
button3=Controls.AddButton(" Clear ",Feldgröße*size + 85, 42)
button8=Controls.AddButton("Editor",Feldgröße*size + 145, 12)
buttonrestart=Controls.AddButton("Restart",Feldgröße*size + 85, 12)
GraphicsWindow.BrushColor = "red"
buttonexit=Controls.AddButton(" Exit ",Feldgröße*size + 145, 42)

GraphicsWindow.BrushColor = "black"
GraphicsWindow.DrawLine( Feldgröße*size + 30, 0, Feldgröße*size + 30, Feldgröße*size + 40)

GraphicsWindow.BrushColor = "black"
GraphicsWindow.DrawLine( Feldgröße*size + 30,160, Feldgröße*size + 200, 160)
GraphicsWindow.DrawText( Feldgröße*size + 90, 145, "Presets:" )

GraphicsWindow.DrawText( Feldgröße*size + 40, 80, "Generation:")

GraphicsWindow.DrawText( Feldgröße*size + 40, 100, "grid-size:")
textbox1=Controls.AddTextBox(Feldgröße*size + 40, 115)
GraphicsWindow.DrawText( Feldgröße*size + 140, 100, "now: "+Feldgröße)
Controls.TextTyped = textinput1

GraphicsWindow.BrushColor = "black"
button4=Controls.AddButton("Random",Feldgröße*size + 40, 177)
button5=Controls.AddButton(" Glider1 ",Feldgröße*size + 40, 207)
button51=Controls.AddButton(" Glider2 ",Feldgröße*size + 40, 237)
button7=Controls.AddButton(" Oszillo ",Feldgröße*size + 40, 267)
button6=Controls.AddButton(" 54 Gen ",Feldgröße*size + 40, 297)
button11=Controls.AddButton("f-Pentomino",Feldgröße*size + 105, 177)
button12=Controls.AddButton(" Exploder ",Feldgröße*size + 105, 207)
button13=Controls.AddButton(" Butterfly ",Feldgröße*size + 105, 237)
button14=Controls.AddButton(" Relay ",Feldgröße*size + 105, 267)
EndSub

Sub DrawUI2
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = (Feldgröße) * size + 40

GraphicsWindow.BrushColor = "red"
button9=Controls.AddButton("Ready",Feldgröße*size + 40, 12)
button10=Controls.AddButton(" Close ",Feldgröße*size + 40, 42)
buttonnew=Controls.AddButton("New",Feldgröße*size + 100, 12)

GraphicsWindow.DrawText( Feldgröße*size + 40, 82, "grid-size:")
textbox2=Controls.AddTextBox(Feldgröße*size + 40, 102)
GraphicsWindow.DrawText( Feldgröße*size + 40, 122, "now: "+Feldgröße)
Controls.TextTyped = textinput

GraphicsWindow.BrushColor = "black"
GraphicsWindow.DrawLine( Feldgröße*size + 30,170, Feldgröße*size + 200, 170)
GraphicsWindow.DrawText( Feldgröße*size + 40, 155, "Edit one of the Presets:" )

GraphicsWindow.BrushColor = "black"
button4=Controls.AddButton("Random",Feldgröße*size + 40, 177)
button5=Controls.AddButton(" Glider1 ",Feldgröße*size + 40, 207)
button51=Controls.AddButton(" Glider2 ",Feldgröße*size + 40, 237)
button7=Controls.AddButton(" Oszillo ",Feldgröße*size + 40, 267)
button6=Controls.AddButton(" 54 Gen ",Feldgröße*size + 40, 297)
button11=Controls.AddButton("f-Pentomino",Feldgröße*size + 105, 177)
button12=Controls.AddButton(" Exploder ",Feldgröße*size + 105, 207)
button13=Controls.AddButton(" Butterfly ",Feldgröße*size + 105, 237)
button14=Controls.AddButton(" Relay ",Feldgröße*size + 105, 267)

GraphicsWindow.BrushColor = "black"
GraphicsWindow.DrawLine( Feldgröße*size + 30, 0, Feldgröße*size + 30, Feldgröße*size + 20)
EndSub

Controls.TextTyped = textinput
Controls.ButtonClicked = onButtonClick

Sub textinput
Feldgröße=Controls.GetTextBoxText(textbox2)*10
'Feldgröße=Controls.LastTypedTextBox
editor()
'Goto runloop
endsub
Sub textinput1
If Controls.GetTextBoxText(textbox1)>0 then
Feldgröße=Controls.GetTextBoxText(textbox1)*10
GraphicsWindow.Clear()
DrawUI()
Goto RunLoop

endif
endsub

Sub onButtonClick
If Controls.LastClickedButton = introbutton Then
GraphicsWindow.Clear()
intro=1
'Goto IntroLoop
'GraphicsWindow.ShowMessage("ss","")
Endif
If Controls.LastClickedButton = button1 Then
start = 1
Endif
If Controls.LastClickedButton = button2 Then
start = 0
Endif
If Controls.LastClickedButton = button3 Then
i = 0
start = 0
Clear()
DrawUI()
Endif
If Controls.LastClickedButton = buttonrestart Then
i = 0
start = 0
Clear()
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y] = restartbuffergrid[x][y]
EndFor
EndFor
Feldausgabe1()
DrawUI()

Endif
If Controls.LastClickedButton = buttonexit Then
Program.End()
Endif
If Controls.LastClickedButton = button4 Then
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
start=0
Zufallsbelegung1()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button5 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
Glider()
'Feldausgabe1()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button51 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
Glider2()
'Feldausgabe1()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button6 Then
start = 0
GraphicsWindow.Clear()
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
start = 0
DrawUI()
gen()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif

Endif
If Controls.LastClickedButton = button7 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
start = 0
DrawUI()
Blinker()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button11 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
fPentomino()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button12 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
Exploder()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button13 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
Butterfly()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If Controls.LastClickedButton = button14 Then
start = 0
For x = 1 To 34
For y = 1 To 34
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
Relay()
restartbuffer()
If editor=1 then
editor()
DrawUI2()
else
Feldausgabe1()
DrawUI()
endif
Endif
If editore =2 and Controls.LastClickedButton = button8 Then
editore =2'3
start = 0
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
start = 0
Editor()
Endif
If editor=1 And Controls.LastClickedButton = button9 Then
GraphicsWindow.Clear()
start = 0
editor=0
ready=1
j=1
DrawUI()
restartbuffer()
Goto RunLoop
Endif
If editor=1 And Controls.LastClickedButton = button10 Then
GraphicsWindow.Clear()
start = 0
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
Feldgröße = 20
i = 0
Clear()
DrawUI()
editor=0
Goto programstart
Endif
If editor=1 And Controls.LastClickedButton = buttonnew Then
GraphicsWindow.Clear()
editore =2'3
start = 0
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
GraphicsWindow.Width = Feldgröße * size + 200
GraphicsWindow.Height = Feldgröße * size + 40
GraphicsWindow.Clear()
start = 0
Editor()
Endif
Endsub

Sub OnMouseDown
If editor=1 then
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY
If ( x > 0 And x < Feldgröße*size And y > 0 And y < Feldgröße*size ) Then
gridx = Math.Floor(x/size)'-(size*0.5)
gridy = Math.Floor(y/size)'-(size*0.5)
If grid[gridx][gridy]=1 then
grid[gridx][gridy]=0
Else
grid[gridx][gridy]=1
EndIf
editor()
EndIf
endif
EndSub

Sub Editor
editor=1
GraphicsWindow.Clear()
DrawUI2()
For x = 1 To Feldgröße
For y = 1 To Feldgröße
If (grid[x][y] = 1) Then
GraphicsWindow.BrushColor = "blue"
GraphicsWindow.FillRectangle(x * size, y * size, size, size)
GraphicsWindow.DrawRectangle(x * size, y * size, size, size)
Else
GraphicsWindow.BrushColor = "black"
GraphicsWindow.DrawRectangle(x * size, y * size, size, size)
EndIf
EndFor
Endfor
Endsub

Sub Clear
GraphicsWindow.Clear()
For x = 1 To Feldgröße
For y = 1 To Feldgröße
GraphicsWindow.BrushColor = "white"
GraphicsWindow.FillRectangle(x * size, y * size, size, size)
grid[x][y]=0
EndFor
EndFor
EndSub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''PRESETS:'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub Glider
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[4][2]=1
grid[4][3]=1
grid[4][4]=1
grid[3][4]=1
grid[2][3]=1
EndSub

Sub Glider2
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[2][5]=1
grid[3][5]=1
grid[4][5]=1
grid[5][5]=1
grid[5][4]=1
grid[5][3]=1
grid[4][2]=1
grid[1][4]=1
grid[1][2]=1
EndSub

Sub Blinker
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[10][10]=1
grid[10][11]=1
grid[10][12]=1

grid[5][5]=1
grid[5][6]=1
grid[5][7]=1
grid[6][6]=1
grid[6][7]=1
grid[6][8]=1

grid[13][5]=1
grid[14][5]=1
grid[13][6]=1
grid[14][6]=1
grid[15][7]=1
grid[16][7]=1
grid[15][8]=1
grid[16][8]=1

EndSub

Sub gen
GraphicsWindow.Clear()
If Feldgröße <34 then
Feldgröße = 34
endif
DrawUI()
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[14][18]=1
grid[14][19]=1
grid[14][20]=1
grid[15][18]=1
grid[15][20]=1
grid[16][18]=1
grid[16][20]=1

grid[18][18]=1
grid[18][20]=1
grid[19][18]=1
grid[19][20]=1
grid[20][18]=1
grid[20][19]=1
grid[20][20]=1
EndSub
Sub fPentomino
GraphicsWindow.ShowMessage("if the grid is large enough, the fPentomino can grow 1103 generations long","")
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[Feldgröße/2][Feldgröße/2+1]=1
grid[Feldgröße/2][Feldgröße/2]=1
grid[Feldgröße/2][Feldgröße/2-1]=1
grid[Feldgröße/2+1][Feldgröße/2+1]=1
grid[Feldgröße/2-1][Feldgröße/2]=1
EndSub
Sub Exploder
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[Feldgröße/2-2][Feldgröße/2-2]=1
grid[Feldgröße/2-2][Feldgröße/2-1]=1
grid[Feldgröße/2-2][Feldgröße/2]=1
grid[Feldgröße/2-2][Feldgröße/2+1]=1
grid[Feldgröße/2-2][Feldgröße/2+2]=1

grid[Feldgröße/2+2][Feldgröße/2-2]=1
grid[Feldgröße/2+2][Feldgröße/2-1]=1
grid[Feldgröße/2+2][Feldgröße/2]=1
grid[Feldgröße/2+2][Feldgröße/2+1]=1
grid[Feldgröße/2+2][Feldgröße/2+2]=1

grid[Feldgröße/2][Feldgröße/2-2]=1
grid[Feldgröße/2][Feldgröße/2+2]=1
EndSub

Sub Butterfly
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[Feldgröße/2-1][Feldgröße/2-2]=1
grid[Feldgröße/2-1][Feldgröße/2-1]=1
grid[Feldgröße/2-1][Feldgröße/2]=1

grid[Feldgröße/2][Feldgröße/2+1]=1
grid[Feldgröße/2+1][Feldgröße/2+1]=1
grid[Feldgröße/2+2][Feldgröße/2+1]=1

grid[Feldgröße/2][Feldgröße/2-1]=1
grid[Feldgröße/2+1][Feldgröße/2]=1

EndSub
Sub Relay
Feldgröße=42
For x = 1 To Feldgröße
For y = 1 To Feldgröße
grid[x][y]=0
EndFor
EndFor
grid[Feldgröße/2-1][Feldgröße/2-1]=1
grid[Feldgröße/2][Feldgröße/2-1]=1
grid[Feldgröße/2][Feldgröße/2]=1
grid[Feldgröße/2+1][Feldgröße/2]=1
grid[Feldgröße/2-1][Feldgröße/2+1]=1


grid[Feldgröße/2-8][Feldgröße/2+3]=1
grid[Feldgröße/2-9][Feldgröße/2+3]=1
grid[Feldgröße/2-11][Feldgröße/2+3]=1
grid[Feldgröße/2-12][Feldgröße/2+3]=1
grid[Feldgröße/2-13][Feldgröße/2+3]=1
grid[Feldgröße/2-14][Feldgröße/2+3]=1
grid[Feldgröße/2-16][Feldgröße/2+3]=1
grid[Feldgröße/2-17][Feldgröße/2+3]=1

grid[Feldgröße/2-10][Feldgröße/2+2]=1
grid[Feldgröße/2-10][Feldgröße/2+4]=1
grid[Feldgröße/2-15][Feldgröße/2+2]=1
grid[Feldgröße/2-15][Feldgröße/2+4]=1


grid[Feldgröße/2+8][Feldgröße/2-1]=1
grid[Feldgröße/2+9][Feldgröße/2-1]=1
grid[Feldgröße/2+11][Feldgröße/2-1]=1
grid[Feldgröße/2+12][Feldgröße/2-1]=1
grid[Feldgröße/2+13][Feldgröße/2-1]=1
grid[Feldgröße/2+14][Feldgröße/2-1]=1
grid[Feldgröße/2+16][Feldgröße/2-1]=1
grid[Feldgröße/2+17][Feldgröße/2-1]=1

grid[Feldgröße/2+10][Feldgröße/2]=1
grid[Feldgröße/2+10][Feldgröße/2-2]=1
grid[Feldgröße/2+15][Feldgröße/2]=1
grid[Feldgröße/2+15][Feldgröße/2-2]=1
EndSub

Sub restartbuffer 'for the restartbutton
For x = 1 To Feldgröße
For y = 1 To Feldgröße

restartbuffergrid[x][y] = grid[x][y]

EndFor
EndFor
Endsub