- Joined
- Jan 2, 2020
- Messages
- 1,414
Cerberus:
' Calculate the Chlorophyll amount of three leaves, by measuring the greenness using infrared spectroscopy.
' Run and read the answer in the terminal.
Strict
Import mojo2
Function Main:Int()
New myClass
Return 0
End
Class myClass Extends App
Field canvas:Canvas
Method OnCreate:Int()
chlorophyll(0.087,0.043)
chlorophyll(0.084,0.042)
chlorophyll(0.011,0.007)
' By setting the update rate to 0, there will be always an OnRender call after OnUpdate. No matter how long it takes.
SetUpdateRate 0
canvas = New Canvas
Return 0
End
Function chlorophyll:Void(A665:Float, A649:Float)
Local Ca:Float
Local Cb:Float
Local Ctotal:Float
Ca = (12.47 * A665) - (3.62 * A649)
Cb = (25.06 * A649) - (6.50 * A665)
Ctotal = (5.97 * A665) + (21.44*A649)
Print "Ca : "
Print Ca
Print "Cb : "
Print Cb
Print "Ctotal : "
Print Ctotal
End
Method OnRender:Int()
canvas.Clear
canvas.Flush
Return 0
End
End