Expanding or collapsing universe?

Miscellaneous Forums/General Discussion/Expanding or collapsing universe?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I guess this is more a question of believe than a quesition of physics, but what will happen to the universe anyway? - Will it expand or will it collapse?

This demonstration should get you thinking:
Graphics 1024, 786, 32, 2
SetBuffer BackBuffer()
SeedRnd MilliSecs()

Type Atom
	Field x#, y#, sx#, sy#, mass#
	Field col
End Type
Global CntAtoms = 0
Const CenterMasses = True ;Wheter to align the mass center to the screen center
Global SPEED = 3

gw2 = GraphicsWidth() / 2
Color 255, 255, 255
Text gw2, 100, "Scientific experiments about the theories of the Big Bang", True
Color 255, 0, 0
Text gw2 - 200, 130, "READ FIRST:"
Color 255, 255, 255
Text gw2 - 200, 150, "Since room is physically defined by a viewpoint, we have to"
Text gw2 - 200, 170, "define a fix one. Here we will use the mass centre of the"
Text gw2 - 200, 190, "universe which will be marked by the crosshair. However, out"
Text gw2 - 200, 210, "of our view this mass centre can move, so it will be aligned"
Text gw2 - 200, 230, "to the screen centre."
Text gw2 - 200, 260, "Atoms seem to be attracted by the screen centre, which symbolizes"
Text gw2 - 200, 280, "our mass centre. It works as follows: Every atom gets attracted by"
Text gw2 - 200, 300, "all other atoms individually depending on their mass."
Text gw2 - 200, 350, "Please select an example by pressing a numeric key:"
Text gw2 - 180, 370, "[1] All atoms have the same mass"
Text gw2 - 180, 390, "[2] Every atom has its unique mass"

Repeat
	If KeyHit(1) Then
		End
	ElseIf KeyHit(2) Then
		Sample = 1
		Exit
	ElseIf KeyHit(3) Then
		Sample = 2
		Exit
	EndIf
Forever

Select Sample
	Case 1
		For x = -15 To 15
			For y = -15 To 15
				If Sqr(x * x + y * y) < 10 Then
					ay# = Rand(0, 360)
					tx# = Cos(Rand(0, 360)) * Rnd(-3, 3)
					ty# = Sin(Rand(0, 360)) * Rnd(-3, 3)
					CreateAtom(GraphicsWidth() / 2 + x, GraphicsHeight() / 2 + y, tx#, ty#, 1)
				EndIf
			Next
		Next
	Case 2
		For x = -15 To 15
			For y = -15 To 15
				If Sqr(x * x + y * y) < 10 Then
					ay# = Rand(0, 360)
					tx# = Cos(Rand(0, 360)) * Rnd(-3, 3)
					ty# = Sin(Rand(0, 360)) * Rnd(-3, 3)
					mass# = Rnd(.5, 1.5) * .5
					CreateAtom(GraphicsWidth() / 2 + x, GraphicsHeight() / 2 + y, tx#, ty#, mass#)
				EndIf
			Next
		Next
End Select

While Not KeyHit(1)
	UpdateUniverse()
	Color 255, 255, 255
	Text 10, 10, "Speed: " + SPEED
	Text 10, 25, "Cursor keys for speed up/down"
	SPEED = SPEED + KeyDown(200) - KeyDown(208)
	If SPEED < 1 Then SPEED = 1
	Flip
	Cls
Wend
End

Function CreateAtom(x, y, sx#, sy#, mass# = 1)
a.Atom = New Atom
a\x# = x
a\y# = y
a\sx# = sx#
a\sy# = sy#
a\mass# = mass# * .000001 * SPEED
a\col = (Rand(0, 255) Shl 16) Or (Rand(0, 255) Shl 8) Or Rand(0, 255)
CntAtoms = CntAtoms + 1
End Function

Function UpdateUniverse()
gw = GraphicsWidth()
gh = GraphicsHeight()
LockBuffer()
cx# = 0
cy# = 0
For a.Atom = Each Atom
	a\x# = a\x# + a\sx# * SPEED
	a\y# = a\y# + a\sy# * SPEED
	For b.Atom = Each Atom
		a\sx# = a\sx# - (a\x# - b\x#) * a\mass#
		a\sy# = a\sy# - (a\y# - b\y#) * a\mass#
	Next
	cx# = cx# + a\x# / CntAtoms
	cy# = cy# + a\y# / CntAtoms
	WritePixel a\x#, a\y#, a\col
Next
If CenterMasses Then
	For a.Atom = Each Atom
		a\x# = a\x# - (cx# - gw / 2)
		a\y# = a\y# - (cy# - gh / 2)
	Next
EndIf
UnlockBuffer()
Color 50, 50, 50
Line 0, cy#, gw, cy#
Line cx#, 0, cx#, gh
End Function

Altough it seems to me more like the universe will neither do both (see the second example)

Feel free to post your comments and opinions here! We will collapse soon or later ;)