Spel54: Crash Model

Vi modellerar (se Scene1 nedan för modell) olika system som kan uppvisa snabb exponentiell tillväxt efter en lång fas med liten tillväxt, som beskriver tex när finans- eller bostadsbubblor plötsligt kollapsar efter lång stadig liten tillväxt.

Jämför med Crash Model på App Store med nedanstående kod:

–Main

parameter.number(“R”,0,10,1)
parameter.number(“d0”,0,10,1)
parameter.number(“v0”,0,10.0,3)
parameter.number(“dt0”,0,10,5)
–icon = readImage(“Dropbox:crashmodel”)
–saveImage(“Project:Icon”,icon)

restart=1
reset=1

— Use this function to perform your initial setup
function setup()
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)
noFill()
noSmooth()
noStroke()
pushStyle()
Scene(“scene0”,Scene0)
Scene(“scene01”,Scene01)
Scene(“scene1”,Scene1)
Scene(“scene2”,Scene2)
Scene(“scene3”,Scene3)
Scene(“scene4”,Scene4)
Scene(“scene5”,Scene5)
Scene(“scene6”,Scene6)
Scene(“scene7”,Scene7)
Scene(“scene8”,Scene8)
Scene(“scene9”,Scene9)
Scene.Change(“scene0”)

end

function touched(touch)

Scene.Touched(touch)

end

function draw()

— background(40, 40, 50)
Scene.Draw()

end

Scene0= class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

local homeButton

function Scene0:init()
moveForwardButton=Button(“Cargo Bot:Play Button”,vec2(590,260))
speech.rate=0.4
speech.pitch=0.1
speech.say(“The Wall Street Crash of 1929, also known as Black Tuesday began on October 24, 1929 and was the most devastating stock market crash in the history of the United States. The crash signaled the beginning of the 10-year Great Depression that affected all Western industrialized countries.”)
speech.say(“Press play button to learn more,”)
end

function Scene0:draw()

background(2, 2, 2, 255)

font(“AmericanTypewriter-Bold”)
fontSize(120)
fill(255, 0, 17, 255)

sprite(“Dropbox:crash1”,515,420,1000)
sprite(“Dropbox:crash2”,270,320,250)
sprite(“Dropbox:crash3”,600,320,400)
— text(“CRASH MODEL”,500,670)
moveForwardButton:draw()

end

function Scene0:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene01”)
end

end

Scene01= class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

local homeButton

function Scene01:init()

modelButton=Button(“Cargo Bot:Command Right”,vec2(200,500))
simulationButton=Button(“Cargo Bot:Command Right”,vec2(600,500))
exampleButton=Button(“Cargo Bot:Command Right”,vec2(200,300))
analysisButton=Button(“Cargo Bot:Command Right”,vec2(600,300))
simulation=0
model=0
end

function Scene01:draw()

background(2, 2, 2, 255)

if simulation==1 then
Scene.Change(“scene2”)
end

if simulation ==0 then

font(“AmericanTypewriter-Bold”)
fontSize(100)
fill(255, 0, 17, 255)

text(“CRASH MODEL”,500,670)
fontSize(50)
fill(0, 9, 255, 255)
text(“Model”,320,500)
text(“Simulation”,770,500)
fill(0, 255, 22, 255)
text(“Examples”,350,300)
text(“Analysis”,750,300)
end

modelButton:draw()
simulationButton:draw()
exampleButton:draw()
analysisButton:draw()

end

function Scene01:touched(touch)
modelButton:touched(touch)
if(modelButton.selected==true) then
Scene.Change(“scene1”)
end
simulationButton:touched(touch)

if(simulationButton.selected==true) then
Scene.Change(“scene3”)
end
exampleButton:touched(touch)
if(exampleButton.selected==true) then
Scene.Change(“scene4”)
end
analysisButton:touched(touch)
if(analysisButton.selected==true) then
Scene.Change(“scene9”)
end

end

Scene1 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene1:init()

menuButton=Button(“Cargo Bot:Menu Game Button”,vec2(950,50))
end

function Scene1:draw()

background(2, 2, 2, 255)

fill(14, 0, 255, 255)
font(“AmericanTypewriter-Bold”)
fontSize(30)
text(“Stock Market Crash”,300,700)
text(“Marriage Crisis”,600,700)
text(“Spread of Infection”,300,650)
text(“Real Estate Bubble”,600,650)
text(“Lemming Year”,260,600)
text(“Political Revolution”,600,600)
text(“Collapse of Construction”,340,550)
text(“You Name It”,640,550)

fill(0, 255, 24, 255)

text(“all can be modeled by the system:”,400,490)
fill(255, 0, 7, 255)
text(“U = U – d*U*dt + R*v*U*dt for t > 0”,440,430)
text(“v = v – 2*d*v*dt + d*U*v*dt for t > 0 “,450,380)
text(“with U(0) = 1 and v(0) given”,390,330)
fill(0, 255, 9, 255)
text(“where”,190,270)
fill(255, 0, 0, 255)
text(“U main factor, v small disturbance factor”,450,210)
text(“d > 0 small damping coeff, R > 0 interaction coeff”,510,160)

menuButton:draw()

end

function Scene1:touched(touch)

menuButton:touched(touch)
if(menuButton.selected==true) then
Scene.Change(“scene01”)
end

end

Scene2 = class()
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

local menuButton,resetButton

function Scene2:init()

menuButton=Button(“Cargo Bot:Menu Game Button”,vec2(730,50))
resetButton=Button(“Cargo Bot:Condition Green”,vec2(400,100))
controlButton=Button(“Dropbox:IconControl”,vec2(20,750))

U=1
v=v0*0.01
d=d0*0.01
dt=dt0*0.01
n=0
t=0

end

function Scene2:draw()

fontSize(20)
fill(255, 255, 255, 255)

text(“reset data”,390,50)

n=n+1

U=U-d*U*dt + R*v*U*dt
v=v-2*d*v*dt+d*v*U*dt
t=t+dt

fill(255, 0, 8, 255)
ellipse(0.1*n+50,U*10+200,5)
fill(36, 255, 0, 255)
ellipse(0.1*n+50,v*1000+200,5)

menuButton:draw()
resetButton:draw()
controlButton:draw()

end

function Scene2:touched(touch)

menuButton:touched(touch)
if(menuButton.selected==true) then
Scene.Change(“scene01”)
end
resetButton:touched(touch)
if(resetButton.selected==true) then
reset=1
Scene.Change(“scene3”)
end
end

Scene3 = class()
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene3:init()

moveForwardButton=Button(“Cargo Bot:Command Right”,vec2(600,100))
controlButton=Button(“Dropbox:IconControl”,vec2(20,750))

end

function Scene3:draw()

background(0, 0, 0, 255)

fill(255, 255, 255, 255)

text(v0*0.01,250,700)
text(dt0*0.01,250,650)
text(d0*0.01,250,600)
text(“v(0) = 0.01*v0 =”,100,700)
text(“dt = 0.01*dt0 =”,100,650)
text(“d = 0.01*d0 = “,100,600)
text(“U (red )and 100*v (green)”,150,425)

fill(255, 0, 47, 255)
ellipse(50,10+200,10)
fill(0, 255, 40, 255)
ellipse(50,10*v0+200,10)
stroke(255, 255, 255, 255)
strokeWidth(3)
line(50,200,50,400)
line(50,200,600,200)

moveForwardButton:draw()
controlButton:draw()

fill(255, 255, 255, 255)

fontSize(20)

text(“start/restart!”,600,50)
text(“test with v(0) = 0.02, 0.03,..”,550,700)
end

function Scene3:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene2”)
end

end
Scene4 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene4:init()

moveForwardButton=Button(“Cargo Bot:Command Right”,vec2(950,50))
moveBackwardButton=Button(“Cargo Bot:Command Left”,vec2(900,50))
end

function Scene4:draw()

background(25, 21, 240, 255)

moveForwardButton:draw()
moveBackwardButton:draw()

sprite(“Dropbox:bubble1”,350,350,300)
sprite(“Dropbox:usrealestate”,500,620,600)
font(“AmericanTypewriter-Bold”)
fontSize(25)
fill(0, 0, 0, 255)
text(“Why did US real estate collapse after precisely 50 years of steady rise?”,500,200)
text(“Because of steady slowly growing instability!”,350,100)

end

function Scene4:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene5”)
end
moveBackwardButton:touched(touch)
if(moveBackwardButton.selected==true) then
Scene.Change(“scene01”)
end
end

Scene5 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene5:init()

moveForwardButton=Button(“Cargo Bot:Command Right”,vec2(950,50))
moveBackwardButton=Button(“Cargo Bot:Command Left”,vec2(900,50))
end

function Scene5:draw()

background(25, 21, 240, 255)

moveForwardButton:draw()
moveBackwardButton:draw()
sprite(“Dropbox:wallstreet1929”,350,350,300)
sprite(“Dropbox:stockslongtime”,500,600,600)
font(“AmericanTypewriter-Bold”)
fontSize(30)
fill(0, 0, 0, 255)
text(“Why did the stock market collapse in 1929”,430,200)
text(“after precisely 10 years of steady rise?”,400,150)
text(“Because of steady slowly growing instability!”,450,100)

end

function Scene5:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene6”)
end
moveBackwardButton:touched(touch)
if(moveBackwardButton.selected==true) then
Scene.Change(“scene4”)
end
end

Scene6 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene6:init()

moveForwardButton=Button(“Cargo Bot:Command Right”,vec2(950,50))
moveBackwardButton=Button(“Cargo Bot:Command Left”,vec2(900,50))
end

function Scene6:draw()

background(25, 21, 240, 255)

moveForwardButton:draw()
moveBackwardButton:draw()

sprite(“Dropbox:divorce1”,350,500,800)
font(“AmericanTypewriter-Bold”)
fontSize(27)
fill(0, 0, 0, 255)
text(“Why did Tom and Mary divorce after precisely”,510,200)
text(“40 years of steady marriage?”,390,150)
text(“Because of steady slowly growing instability!”,500,100)

end

function Scene6:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene7”)
end
moveBackwardButton:touched(touch)
if(moveBackwardButton.selected==true) then
Scene.Change(“scene5”)
end
end

Scene7 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene7:init()

moveForwardButton=Button(“Cargo Bot:Command Right”,vec2(950,50))
moveBackwardButton=Button(“Cargo Bot:Command Left”,vec2(900,50))
end

function Scene7:draw()

background(25, 21, 240, 255)

moveForwardButton:draw()
moveBackwardButton:draw()

sprite(“Dropbox:smoke1”,250,500,500)
font(“AmericanTypewriter-Bold”)
fontSize(20)
fill(0, 0, 0, 255)
text(“Why does the rising smoke go turbulent”,730,700)
text(“after precisely 20 centimeters of laminar flow?”,760,650)
text(“Because of steady slowly growing instability!”,770,550)

end

function Scene7:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene8”)
end
moveBackwardButton:touched(touch)
if(moveBackwardButton.selected==true) then
Scene.Change(“scene6”)
end
end

Scene8 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene8:init()

moveForwardButton=Button(“Cargo Bot:Command Right”,vec2(950,50))
moveBackwardButton=Button(“Cargo Bot:Command Left”,vec2(900,50))
end

function Scene8:draw()

background(255, 0, 3, 255)

moveForwardButton:draw()
moveBackwardButton:draw()
sprite(“Dropbox:soviet89”,500,500,700)
font(“AmericanTypewriter-Bold”)
fontSize(25)
fill(0, 0, 0, 255)
text(“Why did the Soviet Union collapse after precisely 70 years of steady rule?”,500,200)
text(“Because of steady slowly growing instability!”,400,100)

end

function Scene8:touched(touch)
moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene01”)
end
moveBackwardButton:touched(touch)
if(moveBackwardButton.selected==true) then
Scene.Change(“scene7”)
end
end

Scene9 = class()

supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)

function Scene9:init()

menuButton=Button(“Cargo Bot:Menu Game Button”,vec2(950,50))
end

function Scene9:draw()

background(0, 0, 0, 255)
font(“AmericanTypewriter-Bold”)
fontSize(30)
fill(255, 255, 255, 255)

text(“Model:”,200,720)
fontSize(20)
text(“U = U – d*U*dt + R*v*U*dt “,290,650)
text(“v = v – 2*d*v*dt + d*U*v*dt “,300,600)
text(“d > 0 small damping coeff, R > 0 interaction coeff”,380,450)
fontSize(30)
text(“Properties:”,220,520)
fontSize(20)
fill(0, 255, 9, 255)
text(“-d*U*dt means slow decay of main factor U”,350,400)
text(“-2*d*v*dt means slow decay of disturbance v”,350,350)
fill(255, 253, 0, 255)
text(“R*v*U*dt means slow growth of main factor U below threshold”,450,300)
text(“d*U*v*dt means slow growth of disturbance v below threshold”,450,250)
fill(255, 0, 46, 255)
text(“combination of R*v*U*dt and d*U*v*dt means explosive growth above threshold”,550,200)

menuButton:draw()

end

function Scene9:touched(touch)

menuButton:touched(touch)
if(menuButton.selected==true) then
Scene.Change(“scene01”)
end

end

Advertisements

Spel55: Dark Energy

Vi programmerar en modell av ett universum som innehåller både positiv massa och negative massa under gravitation, där massor av lika tecken repellerar varandra och massor av olika tecken repellerar varandra enligt Newton’s gravitationslag. Modellen visar accelererande expansion av positiv massa från ett begynnelsetillstånd av negative massa omgiven av positiv massa motsvarande en perturbation av gravitationspotentialen. Titta på Dark Energy på App Store med nedanstående kod:

–Main
function setup()
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN)
noFill()
noSmooth()
noStroke()
pushStyle()
Scene(“scene0”,Scene0)
Scene(“scene01”,Scene01)
Scene(“scene1”,Scene1)
Scene(“scene2”,Scene2)
Scene(“scene3”,Scene3)
Scene(“scene4”,Scene4)
Scene(“scene5”,Scene5)
Scene(“scene00”,Scene00)
Scene.Change(“scene00”)
— icon = readImage(“Dropbox:IconDarkEnergy”)
— saveImage(“Project:Icon”,icon)
end

function touched(touch)

Scene.Touched(touch)

end

function draw()

— background(40, 40, 50)
Scene.Draw()

end

Scene00 = class()

local homeButton
local moveForwardButton
local Button1,Button2,Button3

function Scene00:init()

music(“A Hero’s Quest:Hero’s Triumph”)

moveForwardButton=Button(“Cargo Bot:Next Button”,vec2(700,150))
homeButton=Button(“Cargo Bot:Menu Game Button”,vec2(700,50))
Button1=Button(“Cargo Bot:Condition Yellow”,vec2(100,500))
Button2=Button(“Cargo Bot:Condition Blue”,vec2(100,400))
Button3=Button(“Dropbox:hawking1”,vec2(100,300))

end

function Scene00:draw()

sprite(“Dropbox:Universe3”,350,500,2000)

if speak==1 then
speech.rate=0.3
speech.pitch=0.1
speech.say(“What is Dark Energy?”)
speech.say(“I don’t know!”)
speech.say(“More precisely, Nobody knows!!”)
speech.pitch=1
speech.rate=0.4
speech.say(“Do you want to explore a possible answer?”)
speech.say(“Then click watch, and then start exploring yourself!!”)
speak=0
end

fill(0, 32, 253, 255)
font(“AmericanTypewriter-Bold”)
fontSize(50)
text(“What is”,370,900)
fill(243, 242, 243, 255)
fontSize(80)
fill(0, 0, 0, 255)
text(“Dark Energy?”,370,750)
fill(0, 11, 255, 255)
fontSize(50)
text(“Watch”,270,500)
text(“Explore Yourself”,400,400)
text(“Listen to me!”,360,300)

Button1:draw()
Button2:draw()
Button3:draw()

end

function Scene00:touched(touch)

Button1:touched(touch)
if(Button1.selected==true) then
Scene.Change(“scene0”)
end
Button2:touched(touch)
if(Button2.selected==true) then
Scene.Change(“scene1”)
end
Button3:touched(touch)
if(Button3.selected==true) then
speak=1
end
end

Scene01 = class()

local homeButton

function Scene01:init()

moveForwardButton=Button(“Cargo Bot:Next Button”,vec2(700,50))
end

function Scene01:draw()
sprite(“Dropbox:Universe2”,350,500,1800)
fontSize(30)
font(“AmericanTypewriter-Bold”)
fill(255, 255, 255, 255)
text(“Start from Newton’s Law of Gravitation:”,350,900)
fontSize(60)
fill(244, 243, 244, 255)
text(“Δφ=ρ”,350,800)
fontSize(30)
fill(255, 255, 255, 255)
text(“Δ is the Laplacian differential operator”,350,700)
text(“φ(x,t) is gravitational potential”,350,650)
text(“ρ(x,t) is mass density”,350,600)
text(“as functions of space x and time t.”,300,550)
fill(255, 255, 255, 255)
fontSize(25)
text(“View φ as primordial perturbation of initial 0 state”,350,450)
text(“resulting in mass distribution ρ=Δφ of variable sign, with “,370,400)
fill(255, 255, 255, 255)
fontSize(40)
text(” ρ = ρ-plus + ρ-minus”,330,300)
fill(0, 255, 12, 255)
text(“ρ-plus>=0”,350,250)
fill(255, 9, 0, 255)
text(“ρ-minus<=0”,350,200)
fill(239, 237, 237, 255)
fontSize(25)
text(“with separation of positive and negative mass.”,310,100)

moveForwardButton:draw()

end

function Scene01:touched(touch)

moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene4”)
end
end

Scene1 = class()

local moveForwardButton
local fastButton
local slowButton
local traceButton
local startButton
local initialButton

displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT_ANY)

local planets={}
local planet
local vels={}
local masses={}
local signs ={}
local vel
local force
local pos
local dt
local trace
local sign
local N
local M
local start
local initial

function Scene1:init()

homeButton=Button(“Cargo Bot:Menu Game Button”,vec2(700,100))
fastButton=Button(“Cargo Bot:Command Right”,vec2(500,100))
slowButton=Button(“Cargo Bot:Command Left”,vec2(450,100))
traceButton=Button(“Cargo Bot:Condition Any”,vec2(350,100))
massButton=Button(“Cargo Bot:Condition Blue”,vec2(250,100))
startButton=Button(“Cargo Bot:Play Button”,vec2(600,100))
initialButton=Button(“Cargo Bot:Condition Yellow”,vec2(150,100))

dt=0.002
trace=1
sign=1
N=5
M=20
start=0
initial=0

music(“Game Music One:Zero”)

end

function Scene1:draw()

if trace==1 then
background(0, 0, 0, 255)
end

homeButton:draw()
fastButton:draw()
slowButton:draw()
traceButton:draw()
massButton:draw()
startButton:draw()
initialButton:draw()

font(“AmericanTypewriter-Bold”)
fontSize(48)
fill(255, 16, 0, 255)
text(“Explore Your Own 2D Universe”,380, 900)
fontSize(30)
font(“AmericanTypewriter-Condensed”)
fill(3, 0, 255, 255)
text(“1. Choose Positive (1) and Negative Mass (-1) by Blue Button.”,390, 800)
fontSize(30)
text(“2. Distribute mass points by touch. “,240, 750)
text(“3. Choose preset distribution by Yellow Button.”,305, 700)
text(“4. Click start!”,300,650)
text(“Orbit”,350,150)
text(“Time step”,470,150)
text(sign,250,150)
text(“Preset”,150,150)
text(“Start”,600,150)
fontSize(40)
stroke(15, 28, 249, 108)
strokeWidth(3)

if initial==1 then

for i=1,N do
for j=1,M do
table.insert(planets,makePlanet(i*10*math.cos(2*math.pi*j/M)+350,i*10*math.sin(2*math.pi*j/M)+400))
table.insert(vels,makePlanetvel(0,0))
table.insert(masses,1)
table.insert(signs,-1)
end
end

for i=N,2*N do
for j=1,M do
table.insert(planets,makePlanet(i*10*math.cos(2*math.pi*j/M)+350,i*10*math.sin(2*math.pi*j/M)+400))
table.insert(vels,makePlanetvel(0,0))
table.insert(masses,1)
table.insert(signs,1)
end
end

initial=0

end

if start==1 then

for i,planet in pairs(planets) do
force=vec2(0,0)
for j,planet in pairs(planets) do
r= (planets[i]-planets[j]):len()
force=force-(1000000/(r+10)^3)*(planets[i]-planets[j])*signs[i]*signs[j]
end
vels[i]=vels[i]+force*dt/masses[i]
planets[i]=planets[i]+vels[i]*dt
end

end
fill(42, 0, 255, 255)
for i,planet in pairs(planets) do
if signs[i]==1 then
fill(18, 255, 0, 255)
ellipse(planets[i].x,planets[i].y,masses[i]*20)
end
if signs[i]==-1 then
fill(255, 0, 1, 255)
ellipse(planets[i].x,planets[i].y,masses[i]*20)
end
end
sprite(“Dropbox:IconNewtonMathGames”,740,990,50)
end

function Scene1:touched(touch)
homeButton:touched(touch)
if(homeButton.selected==true) then
speak=0
Scene.Change(“scene00”)
end

fastButton:touched(touch)
if(fastButton.selected==true) then
dt=dt+0.001
end

slowButton:touched(touch)
if(slowButton.selected==true) then
dt=dt-0.001
end

traceButton:touched(touch)
if(traceButton.selected==true) then
trace=-trace
end

massButton:touched(touch)
if(massButton.selected==true) then
sign=-sign
end

startButton:touched(touch)
if(startButton.selected==true) then
start=1
end

initialButton:touched(touch)
if(initialButton.selected==true) then
initial=1
end

if touch.state == BEGAN then
pos=vec2(CurrentTouch.x,CurrentTouch.y)
elseif touch.state == ENDED then
if pos.y>100 then
table.insert(planets,makePlanet(pos.x,pos.y))
table.insert(vels,makePlanetvel(CurrentTouch.x -pos.x,CurrentTouch.y -pos.y))
table.insert(masses,math.random(1,1))
table.insert(signs,sign)
end
end

end

function makePlanet(x,y)
local planet=vec2()
planet.x=x
planet.y=y
return planet
end

function makePlanetvel(vx,vy)
local vel=vec2()
vel.x=vx
vel.y=vy
return vel
end

 

Scene4 = class()

local moveForwardButton
local x
local v
local I
local N
local h
local t
local dt
function Scene4:init()

x={}
v={}

I=40
N=50
h=1
t=0
dt=0.05
for i=1,I do
x[i]=i*h
v[i]=0
end

moveForwardButton=Button(“Cargo Bot:Next Button”,vec2(700,50))

end

function Scene4:draw()

background(10, 9, 9, 255)

fill(0, 32, 253, 255)
font(“AmericanTypewriter-Bold”)
fontSize(50)
text(“Selfgravitating”,370,900)
fill(243, 242, 243, 255)
fontSize(40)
text(“negative (or positive) mass”,370,850)
fill(0, 11, 255, 255)
text(“Contraction”,370,800)
fontSize(30)
text(“reflection at center”,350,200)
text(“no black hole with mass extinction”,400,150)

for i=1,I do
for j=1,I do
if x[j]<x[i] then
v[i]= v[i]-dt/i^3
end
x[i]=x[i]+v[i]*dt
if x[i]<0.1 then
v[i]=-v[i]
end
end
end

for i=1,I do
— fill(255-20*x[i],0,20*x[i],255)
fill(255-20*x[i],0,0,255)
for n=1,N do
ellipse(x[i]*20*math.cos(2*math.pi*n/N)+350,x[i]*20*math.sin(2*math.pi*n/N)+500,10)
end
end

moveForwardButton:draw()

end

function Scene4:touched(touch)

moveForwardButton:touched(touch)
if(moveForwardButton.selected==true) then
Scene.Change(“scene5”)
end
end