Start>BBG711.sb< LineEnd = Text.GetCharacter(13) + Text.GetCharacter(10) sbcode[1] = "Wh = 100 " + LineEnd sbcode[2] = "Ww = 150 " + LineEnd sbcode[3] = "GraphicsWindow.Show()" + LineEnd path = "E:\Programmierung\SmallBasic\SB Programme\LitDev\" fullpath = path + "Testlinenumber.sb" TextWindow.WriteLine(" ") TextWindow.WriteLine(fullpath) For i = 1 To 3 TextWindow.Write(sbcode[i]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(fullpath, i, sbcode[i]) EndFor End>BBG711.sb< Start>BBL935.sb< ' Puzzle - How many triangles? ' Copyright © 2017 Nonki Takahashi. The MIT License. ' Last update 2017-06-04 ' Challenge 2017-06 title = "Puzzle" GraphicsWindow.Title = title debug = "False" extra = "False" Not = "False=True;True=False;" LF = Text.GetCharacter(10) alpha = "1=A;2=B;3=C;4=D;5=E;6=F;7=G;8=H;9=I;10=J;" alpha = alpha + "11=K;12=L;13=M;14=N;15=O;16=P;17=Q;18=R;" alpha = alpha + "19=S;20=T;21=U;22=V;23=W;24=X;25=Y;26=Z;" If extra Then alpha = alpha + "27=α;28=β;29=γ;30=δ;31=ε;32=ζ;" alpha = alpha + "33=η;34=θ;35=ι;36=κ;37=λ;38=μ;" EndIf delay = 300 gw = GraphicsWindow.Width gh = GraphicsWindow.Height Puzzle() Intersection() UpdateLine() If debug Then For i = 1 TO nl i1 = Text.GetSubText(l[i], 1, Text.GetIndexOf(l[i], "-") - 1) i2 = Text.GetSubTextToEnd(l[i], Text.GetIndexOf(l[i], "-") + 1) TextWindow.WriteLine("l[" + i + "]=" + alpha[i1] + "-" + alpha[i2]) EndFor EndIf Triangle() Sub Intersection For i = 1 To nl - 1 pi = li[i] ni = Array.GetItemCount(pi) i1 = Text.GetSubText(l[i], 1, Text.GetIndexOf(l[i], "-") - 1) i2 = Text.GetSubTextToEnd(l[i], Text.GetIndexOf(l[i], "-") + 1) p1 = p[i1] ni = ni + 1 pi[ni] = i1 p2 = p[i2] ni = ni + 1 pi[ni] = i2 If p2["x"] <> p1["x"] Then s12 = (p2["y"] - p1["y"]) / (p2["x"] - p1["x"]) Else s12 = "∞" EndIf For j = i + 1 To nl pj = li[j] nj = Array.GetItemCount(pj) p3 = p[Text.GetSubText(l[j], 1, Text.GetIndexOf(l[j], "-") - 1)] p4 = p[Text.GetSubTextToEnd(l[j], Text.GetIndexOf(l[j], "-") + 1)] If p4["x"] <> p3["x"] Then s34 = (p4["y"] - p3["y"]) / (p4["x"] - p3["x"]) Else s34 = "∞" EndIf If s12 <> s34 Then p13["x"] = p3["x"] - p1["x"] p13["y"] = p3["y"] - p1["y"] denominator = (p2["x"] - p1["x"]) * (p4["y"] - p3["y"]) - (p2["y"] - p1["y"]) * (p4["x"] - p3["x"]) r12 = ((p4["y"] - p3["y"]) * p13["x"] - (p4["x"] - p3["x"]) * p13["y"]) / denominator r34 = ((p2["y"] - p1["y"]) * p13["x"] - (p2["x"] - p1["x"]) * p13["y"]) / denominator If 0 <= r12 And r12 <= 1 And 0 <= r34 And r34 <= 1 Then p5["x"] = p1["x"] + Math.Floor(r12 * (p2["x"] - p1["x"]) * 100) / 100 p5["y"] = p1["y"] + Math.Floor(r12 * (p2["y"] - p1["y"]) * 100) / 100 If Array.ContainsValue(p, p5) Then ip = 0 For k = 1 To np If p[k] = p5 Then ip = k k = np EndIf EndFor Else np = np + 1 ip = np p[np] = p5 GraphicsWindow.DrawText(px + p5["x"] + 2, py + p5["y"] + 2, alpha[np]) EndIf ni = ni + 1 pi[ni] = ip nj = nj + 1 pj[nj] = ip EndIf EndIf li[j] = pj EndFor li[i] = pi EndFor EndSub Sub Puzzle px = 20 ' padding py = 10 p[1] = "x=0;y=0;" p[2] = "x=200;y=0;" p[3] = "x=400;y=0;" p[4] = "x=0;y=200;" p[5] = "x=400;y=200;" p[6] = "x=0;y=400;" p[7] = "x=200;y=400;" p[8] = "x=400;y=400;" If extra Then ex = "" Else ex = "2-4,2-5,4-7,5-7" EndIf np = Array.GetItemCount(p) GraphicsWindow.PenColor = "#999" For i = 1 To np - 1 p1 = p[i] For j = i + 1 To np If Not[Text.IsSubText(ex, Text.Append(i, "-") + j)] Then p2 = p[j] GraphicsWindow.DrawLine(px + p1["x"], py + p1["y"], px + p2["x"], py + p2["y"]) nl = nl + 1 l[nl] = Text.Append(i, "-") + j EndIf EndFor EndFor GraphicsWindow.BrushColor = "#000" For i = 1 To np p1 = p[i] GraphicsWindow.DrawText(px + p1["x"] + 2, py + p1["y"] + 2, alpha[i]) EndFor EndSub Sub Triangle tbox = Controls.AddMultiLineTextBox(450, 10) Controls.SetSize(tbox, gw - 460, gh - 20) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "#99FF0000" tr = "" nt = 0 For i = 1 To np - 2 p1 = p[i] For j = i + 1 To np - 1 If Array.ContainsValue(l, Text.Append(i, "-") + j) Then p2 = p[j] For k = j + 1 To np If Array.ContainsValue(l, Text.Append(i, "-") + k) And Array.ContainsValue(l, Text.Append(j, "-") + k) Then p3 = p[k] l12 = Math.Floor(Math.SquareRoot(Math.Power(p2["x"] - p1["x"], 2) + Math.Power(p2["y"] - p1["y"], 2)) * 100) / 100 l23 = Math.Floor(Math.SquareRoot(Math.Power(p3["x"] - p2["x"], 2) + Math.Power(p3["y"] - p2["y"], 2)) * 100) / 100 l31 = Math.Floor(Math.SquareRoot(Math.Power(p1["x"] - p3["x"], 2) + Math.Power(p1["y"] - p3["y"], 2)) * 100) / 100 If (l12 < l23 + l31) And (l23 < l31 + l12) And (l31 < l12 + l23) Then nt = nt + 1 GraphicsWindow.Title = title + " - " + nt + " triangles" tr = tr + nt + " ∆ " + alpha[i] + alpha[j] + alpha[k] + LF ts = Shapes.AddTriangle(px + p1["x"], py + p1["y"], px + p2["x"], py + p2["y"], px + p3["x"], py + p3["y"]) Controls.SetTextBoxText(tbox, tr) Program.Delay(delay) Shapes.Remove(ts) EndIf EndIf EndFor EndIf EndFor EndFor EndSub Sub UpdateLine For il = 1 To nl pi = li[il] ni = Array.GetItemCount(pi) For ii = 1 To ni - 1 For ij = ii + 1 To ni If pi[ii] < pi[ij] Then pi1 = pi[ii] pi2 = pi[ij] Else pi1 = pi[ij] pi2 = pi[ii] EndIf If (pi1 <> pi2) And Not[Array.ContainsValue(l, Text.Append(pi1, "-") + pi2)] Then nl = nl + 1 l[nl] = Text.Append(pi1, "-") + pi2 EndIf EndFor EndFor EndFor EndSub End>BBL935.sb< Start>BBM021-0.sb< 'Code Copyright Noah Buscher 2012 'Image Copyright Mojang 'Thank You to Mojang for Images 'This Game and/or Noah Buscher is Not Affliated with Minecraft Nor Mojang in Any Way 'http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/e5fe83d6-8150-41a9-92b0-a48816e9b293 'BBM021-0 'Sets Up Board to Play GraphicsWindow.Title = "MineTag" GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "Green" GraphicsWindow.BrushColor = "White" GraphicsWindow.FontName = "Neuropol" GraphicsWindow.FontSize = "24" GraphicsWindow.Width = 500 GraphicsWindow.Height = 500 gw = GraphicsWindow.Width gh = GraphicsWindow.Height scoreDisp = Shapes.AddText("0.000") PlayerImg = ImageList.LoadImage("http://i47.TinyPic.com/nx2h4w.jpg") ZombieImg = ImageList.LoadImage("http://i49.TinyPic.com/2gvsk6r.jpg") Player = Shapes.AddImage(PlayerImg) Zombie = Shapes.AddImage(ZombieImg) incP = 10 incM = 13 size = 64 range = size / 4 int = 2 / 1000 delay = 80 offset = 10 'Displays Score Every 2% of a Second and Checks for Collision: Timer.Interval = int * 10000 Timer.Tick = Tock GraphicsWindow.KeyDown = PlayerMove Restart: mex = gw-size - offset mey = offset ox = offset oy = gh-size - offset score = 0 isFleeing = "True" Timer.Resume() 'Main Loop: While isFleeing 'Player's Screen Limit: If mex < 0 Then mex = gw ElseIf mex > gw Then mex = 0 EndIf If mey < 0 Then mey = gh ElseIf mey > gh Then mey = 0 EndIf 'Enemy's Chasing: If ox < mex Then ox = ox + incM Else ox = ox - incM EndIf If oy < mey Then oy = oy + incM Else oy = oy - incM EndIf Shapes.Move(Player mex,mey) Shapes.Move(Zombie ox,oy) If ox > mex-range And ox < mex+range And oy > mey-range And oy < mey+range Then Timer.Pause() isFleeing = "False" EndIf Program.Delay(delay) EndWhile 'Game Over: Sound.PlayMusic("T180 O2P2P8 L8GGG L2E- P24P8 L8FFF L2D R") record = Math.Max(record score) GraphicsWindow.Title = "MineTag --- Record: " + record GraphicsWindow.ShowMessage("Your Score Was " + score , "You Lost!") Goto Restart Sub Tock score = score + int Shapes.SetText(scoreDisp score) EndSub Sub PlayerMove key = GraphicsWindow.LastKey If key = "A" Or key = "Left" Then mex = mex - incP ElseIf key = "D" Or key = "Right" Then mex = mex + incP ElseIf key = "W" Or key = "Up" Then mey = mey - incP ElseIf key = "S" Or key = "Down" Then mey = mey + incP ElseIf key = "Return" Then GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() ElseIf key = "Escape" Then Sound.PlayClickAndWait() Program.End() EndIf EndSub End>BBM021-0.sb< Start>BBM021-1.sb< '____________________________________________________________' 'Code Copyright Noah Buscher 2012 'Image Copyright Mojang 'Thanks to Mojang for images 'This game and/or Noah Buscher are not affliated with Minecraft 'Nor Mojang in any way 'http://social.msdn.microsoft.com/Forums/en-US/smallbasic '/thread/e5fe83d6-8150-41a9-92b0-a48816e9b293 'BBM021-1 '____________________________________________________________' 'Sets up board to play: GraphicsWindow.Title = "MineTag" GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "Green" GraphicsWindow.BrushColor = "White" GraphicsWindow.FontName = "Neuropol" GraphicsWindow.FontSize = "24" GraphicsWindow.Width = 500 GraphicsWindow.Height = 500 gw = GraphicsWindow.Width gh = GraphicsWindow.Height scoreDisplay = Shapes.AddText("") ' <-- Creates score display path = Program.Directory + "\" isLocal = "False" If isLocal Then PlayerImg = ImageList.LoadImage(path + "nx2h4w.jpg") ZombieImg = ImageList.LoadImage(path + "2gvsk6r.jpg") Else PlayerImg = ImageList.LoadImage("http://i47.TinyPic.com/nx2h4w.jpg") ZombieImg = ImageList.LoadImage("http://i49.TinyPic.com/2gvsk6r.jpg") EndIf Player = Shapes.AddImage(PlayerImg) Zombie = Shapes.AddImage(ZombieImg) spdP = 10 spdZ = 15 nitro = 10 size = 64 szH = size / 2 szQ = size / 4 counter = 5 / 1000 delay = 100 offset = 10 GraphicsWindow.KeyDown = PlayerMove GraphicsWindow.KeyUp = PlayerStop 'Displays score every 5% of a second: Timer.Interval = counter * 10000 Timer.Tick = Score '____________________________________________________________' Restart: px = gw-size - offset py = offset zx = offset zy = gh-size - offset score = "0.000" isFleeing = "True" Timer.Resume() '____________________________________________________________' 'Main Loop: While isFleeing 'Player's Movement: px = px + moveH py = py + moveV 'Player's Screen Limit Check: If px < -szH Then px = gw-szH ElseIf px > gw-szH Then px = -szH EndIf If py < -szH Then py = gh-szH ElseIf py > gh-szH Then py = -szH EndIf boost = spdZ + Math.GetRandomNumber(nitro) 'Enemy's Chasing: If zx < px Then zx = zx + boost Else zx = zx - boost EndIf If zy < py Then zy = zy + boost Else zy = zy - boost EndIf Shapes.Move(Player px,py) Shapes.Move(Zombie zx,zy) If zx > px-szQ And zx < px+szQ And zy > py-szQ And zy < py+szQ Then Timer.Pause() isFleeing = "False" EndIf Program.Delay(delay) EndWhile '____________________________________________________________' 'Game Over: Sound.PlayMusic("T180 O2P2P8 L8GGG L2E- P24P8 L8FFF L2D R") GraphicsWindow.ShowMessage("Your Score Was " + score , "You Lost!") record = Math.Max(record score) GraphicsWindow.Title = "MineTag --- Record: " + record Goto Restart '____________________________________________________________' Sub Score score = score + counter Shapes.SetText(scoreDisplay score) EndSub '____________________________________________________________' Sub PlayerMove key = GraphicsWindow.LastKey If key = "A" Or key = "Left" Then moveH = -spdP ElseIf key = "D" Or key = "Right" Then moveH = spdP ElseIf key = "W" Or key = "Up" Then moveV = -spdP ElseIf key = "S" Or key = "Down" Then moveV = spdP ElseIf key = "Tab" Then GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() ElseIf key = "Escape" Then Sound.PlayClickAndWait() Program.End() EndIf EndSub '____________________________________________________________' Sub PlayerStop key = GraphicsWindow.LastKey If moveH < 0 And (key = "A" Or key = "Left") Then moveH = 0 ElseIf moveH > 0 And (key = "D" Or key = "Right") Then moveH = 0 ElseIf moveV < 0 And (key = "W" Or key = "Up") Then moveV = 0 ElseIf moveV > 0 And (key = "S" Or key = "Down") Then moveV = 0 EndIf EndSub '____________________________________________________________' End>BBM021-1.sb< Start>BBM021.sb< 'Code Copyright Noah Buscher 2012 'Image Copyright Mojang 'Thank You to Mojang for Images 'This Game and/or Noah Buscher is Not Affliated with Minecraft or Mojang in Any Way 'Sets Up Board to Play GraphicsWindow.title = "MineTag" GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "Green" GraphicsWindow.Height = 500 GraphicsWindow.Width = 500 GraphicsWindow.FontName = "Neuropol" GraphicsWindow.FontSize = "24" GraphicsWindow.BrushColor = "White" touch = "False" score = 0 mex = 430 mey = 10 ox = 10 oy = 430 Player = Shapes.AddImage("http://i47.tinypic.com/nx2h4w.jpg") Shapes.Move(Player, mex, mey) Zombie = Shapes.AddImage("http://i49.tinypic.com/2gvsk6r.jpg") Shapes.Move(Zombie, ox, oy) scoreDisp = Shapes.AddText(score) 'Refreshes the Screen every .0020 seconds and Checks for Touch Timer.interval = 20 Timer.resume() Timer.Tick = Tock Sub Tock score = score + 0.0020 Shapes.SetText(scoreDisp, score) If ox = mex And oy = mey Then Shapes.Remove(Player) Sound.PlayClick() Timer.pause() touch = "True" GraphicsWindow.ShowMessage("Your Score Was " + score , "You Lost") Program.End() EndIf EndSub 'This Sub Controls How the Human Player Moves GraphicsWindow.TextInput = PlayerMove Sub PlayerMove If GraphicsWindow.LastText = "w" Then mey = mey - 10 Shapes.Move(Player, mex, mey) EndIf If GraphicsWindow.LastText = "a" Then mex = mex - 10 Shapes.Move(Player, mex, mey) EndIf If GraphicsWindow.LastText= "s" Then mey = mey + 10 Shapes.Move(Player, mex, mey) EndIf If GraphicsWindow.LastText = "d" Then mex = mex + 10 Shapes.Move(Player, mex, mey) EndIf 'Makes the Board Inf. If mex > 500 Then mex = 0 endif If mey > 500 Then mey = 0 EndIf If mex < 0 Then mex = 500 endif If mey < 0 Then mey = 500 EndIf EndSub 'Controls AI Movement While touch = "False" If ox < mex Then ox = ox + 10 Shapes.Move(Zombie, ox, oy) Program.Delay(80) endif If ox > mex Then ox = ox - 10 Shapes.Move(Zombie, ox, oy) Program.Delay(80) endif If oy < mey Then oy = oy + 10 Shapes.Move(Zombie, ox, oy) Program.Delay(80) endif If oy > mey Then oy = oy - 10 Shapes.Move(Zombie, ox, oy) Program.Delay(80) endif EndWhile End>BBM021.sb< Start>BBN507.sb< 'program by Yled , June 24th 2016 '. image1=ImageList.LoadImage("https://www.nasa.gov/sites/default/files/thumbnails/image/pia16869.jpg") GraphicsWindow.Title = "Juno" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height = 700 GraphicsWindow.Width = 1041 GraphicsWindow.BackgroundColor="black" GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawresizedImage(image1,0,0,1041,927) GraphicsWindow.DrawBoundText (300,600,1000,"This artist's rendering shows NASA's Juno spacecraft above the north pole of Jupiter") GraphicsWindow.DrawBoundText (300,620,1000,"Photo credit: NASA") GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawBoundText(800, 20, 500, "Juno Mission") GraphicsWindow.BrushColor="yellow" GraphicsWindow.FontSize = 20 GraphicsWindow.DrawBoundText(60,120,100, "Days") GraphicsWindow.BrushColor="blue" GraphicsWindow.FontSize = 17 GraphicsWindow.DrawBoundText(150, 120, 100, "Hours") GraphicsWindow.FontSize = 14 GraphicsWindow.DrawBoundText(250, 120, 100, "Minutes") GraphicsWindow.FontSize = 11 GraphicsWindow.DrawBoundText(350, 120, 100, "Seconds") GraphicsWindow.FontSize = 55 GraphicsWindow.BrushColor = "lightgray" date = Shapes.AddText("") Shapes.Move(date,50, 50) Timer.Interval = 100 Timer.Tick = OnTick Sub OnTick days_left=LDDateTime.Subtract("2016/07/04 22:30:00",LDDateTime.Now()) days = math.Floor(days_left) hours_left = (days_left-days)*24 hours = math.Floor(hours_left) mins_left = (hours_left-hours)*60 mins = math.Floor(mins_left) secs_left = (mins_left-mins)*60 secs = math.Floor(secs_left) Shapes.SetText(date,days+":"+hours+":"+mins+":"+secs) EndSub End>BBN507.sb< Start>BBT384-0.sb< ' January 4th 2017 ' orbit drawing ' using Newton's law ' program no: ' by yled suggested by litdev GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.height=700 GraphicsWindow.width=1200 GraphicsWindow.backgroundcolor="#000000" GraphicsWindow.brushcolor="yellow" sun=shapes.AddEllipse(20,20) GraphicsWindow.brushcolor="blue" earth=shapes.AddEllipse(10,10) ' orbital period 365.24 days a=200 b=150 ' v=1/Math.SquareRoot(r) ' (center,625,325) Cx=625 Cy=325 F=Math.SquareRoot((a*a)-(b*b)) Shapes.Move(sun, Cx-F-10,Cy-10) While 1=1 ' get the correct speed effect by updating θ proportionally by 1/(r.sqrt(r)) each time step θ=θ+v x=Cx+a*(math.Cos(θ)) y=Cy+b*(math.sin(θ)) dx = Cx-F-x dy = Cy-y r=Math.SquareRoot(dx*dx+dy*dy) ' update r distance sun-earth orbit v=50/r/Math.SquareRoot(r) TextWindow.WriteLine(r+" : "+v) ' to test output value is v , yes it increase near the sun and then decrease Shapes.Move(earth,x-5,y-5) GraphicsWindow.SetPixel(x,y,"lightgray") Program.Delay(20) EndWhile End>BBT384-0.sb< Start>BCC798.sb< pi="31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157959847035622262934860034158722980534989650226291748788202734209222245339856264766914905562842503912757710284027998066365825488926488025456610172967026640765590429099456815065265305371829412703369313785178609040708667114965583434347693385781711386455873678123014587687126603489139095620099393610310291616152881384379099042317473363948045759314931405297634757481193567091101377517210080315590248530906692037671922033229094334676851422144773793937517034436619910403375111735471918550464490263655128162288244625759163330391072253837421821408835086573917715096828874782656995995744906617583441375223970968340800535598491754173818839994469748676265516582765848358845314277568790029095170283529716344562129640435231176006651012412006597558512761785838292041974844236080071930457618932349229279650198751872127267507981255470958904556357921221033346697499235630254947802490114195212382815309114079073860251522742995818072471625916685451333123948049470791191532673430282441860414263639548000448002670496248201792896476697583183271314251702969234889627668440323260927524960357996469256504936818360900323809293459588970695365349406034021665443755890045632882250545255640564482465151875471196218443965825337543885690941130315095261793780029741207665147939425902989695946995565761218656196733786236256125216320862869222103274889218654364802296780705765615144632046927906821207388377814233562823608963208068222468012248261177185896381409183903673672220888321513755600372798394004152970028783076670944474560134556417254370906979396122571429894671543578468788614445812314593571984922528471605049221242470141214780573455105008019086996033027634787081081754501193071412233908663938339529425786905076431006383519834389341596131854347546495569781038293097164651438407007073604112373599843452251610507027056235266012764848308407611830130527932054274628654036036745328651057065874882256981579367897669742205750596834408697350201410206723585020072452256326513410559240190274216248439140359989535394590944070469120914093870012645600162374288021092764579310657922955249887275846101264836999892256959688159205600101655256375679 rr=490 GraphicsWindow.Title ="PI netlace GraphicsWindow.Width=1200 GraphicsWindow.Height =1000 GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.PenWidth =1 ss=.2 ff=.9994 For x=1 to 10000 ss=ss+.00005 rr=rr*ff n=text.GetSubText (pi x 1) nx=LDMath.cos(n*36+m)*rr+600 ny=LDMath.sin(n*36+m)*rr+510 m=m+.0015 If x>1 then GraphicsWindow.PenColor =LDColours.HSLtoRGB (Math.Remainder (x/100 360) 1 ss) GraphicsWindow.DrawLine (ox oy nx ny) endif ox=nx oy=ny EndFor End>BCC798.sb< Start>BCD026.sb< ll="` Vis.fortran;MS Dos;TurboPascal;0815;11l;360 Assembly;4D;4DOS Batch;6502 Assembly;6800 Assembly;68000 Assembly;8 1/2;80386 Assembly;8051 Assembly;8080 Assembly;8086 Assembly;8th;A+;ABAP;ACL2;Action!;ActionScript;Ada;Agda;Agda2;Agena;Aikido;Aime;Algae;ALGOL;ALGOL 60;ALGOL 68;ALGOL W;ALGOL-M;Alice ML;Alore;AmbientTalk;AmigaE;AMPL;AngelScript;ANT;ANTLR;Anyways;Apex;APL;App Inventor;AppleScript;Applesoft BASIC;Application Master;Apricot;Arbre;Arc;Arendelle;Argile;ARM Assembly;{ArnoldC;AsciiDots;ASP;ASP.Net;{AspectC++;AspectJ;Astro;Asymptote;ATS;AutoHotkey;AutoIt;AutoLISP;AWK;Axe;Axiom;Axum;B;B4J;Babel;BaCon;BASIC;Basic Casio;BASIC256;Batch File;Battlestar;BBC BASIC;Bc;BCPL;Beeswax;Befunge;Beta;Biferno;Binary Lambda Calculus;Blast;BlitzMax;Blz;BML;Boo;Bori;Brace;Bracmat;Brainf***;Brat;Brlcad;Burlesque;{C;{C#;{C Shell;{C++;{C++/CLI;C0H;C1R;Caché ObjectScript;CafeOBJ;Caml;Cat;CB80;Cduce;Cecil;Ceylon;Chapel;Chef;CHR;ChucK;Cilk;Cilk++;Clarion;Clay;Clean;Clio;Clipper;Clipper/XBase++;CLIPS;Clojure;CMake;COBOL;Cobra;Coco;CoffeeScript;ColdFusion;Comal;Comefrom0x10;Commodore BASIC;Common Lisp;Component Pascal;Computer/zero Assembly;Coq;Crack;Crystal;Cubescript;Curry;D;Dafny;Dao;Dart;Datalog;Dc;DCL;DDNC;> Delphi;Deluge;DeviousYarn;Diesel;DIV Games Studio;DM;DMS;Dodo0;DUP;DWScript;Dylan;Dylan.NET;Déjà Vu;E;EC;EchoLisp;ECL;EDSAC order code;Eero;Efene;Egel;Egison;EGL;EhBASIC;Eiffel;Ela;Elan;{ElastiC;Elena;Elisa;Elixir;ELLA;Elm;Emacs Lisp;Emojicode;Epigram;Erlang;ERRE;Es;ESQL;Euler;Euphoria;Ezhil;F;F# ;Factor;Falcon;FALSE;Fan;Fancy;Fantom;FAUST;FBSL;{FeatureC++;Felix;Ferite;Fexl;Fish;FLORA-2;Florid;FOCAL;formulaOne;forth;` fortran;fortress;FP;FPI;Free Pascal;FreeBASIC;FreeMat;Frege;Friendly interactive shell;Frink;FRISC Assembly;FunL;Futhark;FutureBasic;FUZE BASIC;formulæ;Gambas;GAP;Gastona;Gecho;Gema;Gentee;Genyris;GEORGE;GFA Basic;Glagol;GLBasic;Glee;Global Script;GlovePIE;GLSL;GML;Gnuplot;Go;Go!;Golfscript;Golo;Goo;Gosu;Gri;Groovy;GUISS;GW-BASIC;Hack;Halon;Harbour;Haskell;Haxe;Heron;HicEst;HLA;{HolyC;Hoon;Hope;HPPPL;HQ9+;Huginn;Hy;HyperTalk;I;Icon;IDL;Idris;Inform 6;Inform 7;Informix 4GL;Integer BASIC;Intercal;Io;Ioke;Iptscrae;IS-BASIC;IWBASIC;J;Jabaco;Jack;Jacquard Loom;JAMES II/Rule-based Cellular Automata;Java;JavaFX Script;JavaScript;JCL;JoCaml;JOVIAL;Joy;Jq;JScript.NET;JudoScript;Julia;K;Kabap;Kamailio Script;Kaya;KeyList Databasing;Kite;Kitten;Klong;KonsolScript;Kotlin;L++;L.in.oleum;LabVIEW;Lambda Prolog;Lambdatalk;Lang5;Lasso;LaTeX;LC2200 Assembly;LC3 Assembly;Leon;LFE;Lhogho;Liberty BASIC;LibreOffice Basic;Lily;Lilypond;Limbo;Lingo;Lisaac;Lisp;LiveCode;Livecode;LiveScript;LLP;LLVM;Lobster;Locomotive Basic;Loglan82;Logo;Logtalk;LOLCODE;Lolli;Lotus123 MacroScript;LotusScript;Lout;LSE64;LSL;Lua;Lucid;Luck;Luna;Lush;Lygon;M2000 Interpreter;M4;M680x0;Make;Malbolge;Maple;MAPPER;MathCortex;Mathematica;Mathprog;MATLAB;Maude;Maxima;MAXScript;MBS;MDL;ME10 macro;MEL;Mercury;Metafont;Metapost;MGS;MS Small Basic;MINIL;MIPS Assembly;Mirah;MIRC Scripting Lang.;Mirelle;ML;ML/I;MLite;MMIX;Modula-2;Modula-3;Mond;Monicelli;Monkey;Monte;MontiLang;MOO;MoonScript;Morfa;MSX Basic;MUF;MUMPS;Myrddin;MyrtleScript;MySQL;Mython;Mythryl;MC++;MK-61/52;N/t/roff;Nanoquery;NASL;Neat;Neko;Nemerle;NESL;NetLogo;NetRexx;NewLISP;NewtonScript;NGS;Nial;Nice;Nickle;Nim;Nit;Niue;Nix;NQP;NSIS;OASYS;OASYS assembler;Oberon-2;Objeck;Object Pascal;ObjectIcon;{Objective-C;OCaml;Occam;Octave;` Oforth;Ol;Omega;Onyx;OOC;OOCalc;OoRexx;Opa;{OpenC++;OpenEdge/Progress;OpenLisp;Openscad;OPL;Order;OxygenBasic;Oxygene;Oz;Panda;Panoramic;Pare;PARI/GP;Pascal;PASM;PDP-11 Assembly;Peloton;Pentium Assembly;PeopleCode;Perl;Perl 6;Perl5i;Phix;PHL;PHP;Picat;PicoLisp;Pict;Piet;Pike;PILOT;PIR;PL/B;PL/I;PL/M;PL/pgSQL;PL/SQL;PlainTeX;Plan;PLUS;PLZ/SYS;Pony;Pop11;PostScript;Potion;POV-Ray;PowerBASIC;Powerbuilder;# PowerShell;PPC Assembly;PPL;{Processing;ProDOS;Prolog;PSQL;Pure;Pure Data;PureBasic;Purity;Pyret;Python;Q;QBasic;Qi;Qore;{QuakeC;Quill;Quite BASIC;QL Basic;R;Ra;Racket;RapidQ;Rapira;Rascal;Raven;REALbasic;Reason;REBOL;Red;Reduce;Refal;Retro;REXX;Rhope;Ring;RLaB;RLSL;Robotic;Rockstar;RPG;RPGIV;RPL;RPL/2;RTL/2;RTSL;Ruby;Rubylog;Run BASIC;Rust;S BASIC;S-lang;Sage;Salmon;SAS;SASL;Sass/SCSS;Sather;Scala;Scheme;Scilab;Scratch;Script Basic;Script3D;Sed;Seed7;Self;SequenceL;Set lang;SETL;Setl4;SheerPower 4GL;Shen;Shiny;Sidef;SimpleLang;SIMPOL;Simula;Sinc.ZX81 BASIC;Sisal;SkookumScript;Slate;Smalltalk;Smart BASIC;SMEQL;SmileBASIC;Snobol;SNOBOL4;SNUSP;Soar;SoneKing Assembly;SPAD;SPARC Assembly;SPARK;Sparkling;Spin;SPL;SQL;SQL PL;Squirrel;SSEM;Standard ML;Star;Stata;StreamIt;Suneido;Superbase BASIC;SuperCollider;Supernova;SuperTalk;Swift;Symsyn;SystemVerilog;TAL;Tbas;Tcl;TechBASIC;Teco;TeLa;Terra;TestML;Thistle;Thyrd;TI-83 BASIC;TI-83 Hex Assembly;TI-89 BASIC;TIScript;ToffeeScript;Toka;TorqueScript;TPP;Transact-SQL;` TransforTH;Trith;True BASIC;TSE SAL;Turing;TUSCRIPT;Twelf;TXR;TypeScript;UC++;Unicon;Uniface;UNIX Shell;UnixPipes;Unlambda;Ursa;Ursala;UScript;UserRPL;UTFool;V;Vala;VAX Assembly;' VB6;' VBA;VBScript;Vedit macro language;Verbexx;Verilog;VHDL;Vim Script;Visual Basic;Visual Basic .NET;Visual FoxPro;Visual Objects;Visual Prolog;Viua VM assembly;Vorpal;Vox;VRML;Wart;WDTE;WebAssembly;Whenever;Whitespace;WML;Wolfram Language;Wollok;Wortel;Wrapl;Wren;X10;X86 64 Assembly;X86 Assembly;Xanadu;XBase;XEec;XL;XLISP;Xojo;XPath 2.0;XPL0;XProc;XQuery;XS;XSLT;XSLT 1.0;XSLT 2.0;XTalk;XUL;Ya;Yabasic;Yacas;Yorick;Z80 Assembly;ZED;Zig;Zkl;Zonnon;ZPL;ZX Spectrum Basic GraphicsWindow.Title="Programing/scripting Languages lng=LDText.Split(ll ";") for f=1 To Array.GetItemCount(lng) If Text.IsSubText(text.ConvertToLowerCase( lng[f]) "basic") Then lng[f]="' "+lng[f] EndIf Endfor ls=LDList.CreateFromValues(lng) LDList.SortByText(ls) GraphicsWindow.FontSize=12 GraphicsWindow.FontName="lucida console GraphicsWindow.FontBold="false GraphicsWindow.Width=1000 GraphicsWindow.Height=720 GraphicsWindow.Left=5 GraphicsWindow.Top=5 GraphicsWindow.BackgroundColor="tan GraphicsWindow.BrushColor="darkblue aa=LDList.ToArray(ls) for f=1 To 50 aa[f]=Text.GetSubTextToEnd(aa[f] 3) Endfor b="" for x=1 To 45 t=Shapes.AddText(aa[x]) Shapes.Move(t 250-ldShapes.Width(t) x*14.5) LDShapes.SetShapeEvent(t) Endfor LDShapes.ShapeEvent=see desc() Sub see ls=LDShapes.LastEventShape lt=LDShapes.LastEventType If lt="MouseEnter" Then LDShapes.BrushColour(ls "red") GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(260 0 1000 800) GraphicsWindow.BrushColor="darkblue GraphicsWindow.FontName="Calibri GraphicsWindow.FontSize=14 GraphicsWindow.FontItalic="true GraphicsWindow.FontBold="false GraphicsWindow.DrawBoundText(300,20 650 ttx[ls]) ElseIf lt="MouseLeave" Then LDShapes.BrushColour(ls "transparent") EndIf EndSub Sub desc ttx["text1"]="Applesoft ~B was a ~d of ~B supplied with ` Apple II series of ~cs. It superseded Integer ~B & was ` ~B in ROM in all Apple II series ~cs after ` original Apple II model. ||FOR I = 1 TO 5 : FOR J = 1 TO I : PRINT ''*''; : NEXT J : PRINT : NEXT ttx["text2"]="~B is ` Beginner's All-purpose Symbolic In~tion Code. John G. Kemeny & Thomas E. Kurtz invented ~B at Dartmouth College during 1963 & 1964. (`ir implementation evolved into True ~B.)|~B became popular, with many different implementations for various ~cs. As ` decades passed, ` many ~ds of ~B diverged from ` original ~l. Though an ANSI st&ard exists for ~B, it is irrelevant to most ~B ~pmers, who only target one implementation of ~B. ttx["text3"]="~B Casio is ` high-level ~l used on Casio calculators. It is available on all Casio calculators despite some differences between versions. ~B Casio is designed To be simple & easy To learn for students. Its major drawback is its slowness especially when using graphical functions. ~B Casio is not affiliated with ~B & is not as similar To it as ` name would suggest. ~B Casio is equivalent To TI-~B on TI calculators. ttx["text4"]="~B-256 is an easy To use version of ~B designed To teach anybody (especially middle & high-school students) ` ~Bs of ~c ~pming. It uses traditional control ~tures like gosub, for/next, & Goto, which helps kids easily see how ~p flow-control works. It has a built-in graphics mode which lets `m draw pictures on screen in minutes, & a set of detailed, easy-To-follow tutorials that introduce ~pming concepts through fun exercises. ttx["text5"]="BBC ~B is a version of ` ~B ~pming ~l. It is notable for being one of ` few modern ~ds that makes no attempt to be compatible to any great degree with MS ~Bs.|BBC ~B was originally written for ` BBC Micro~c as part of ` BBC ~c Literacy Project under ` direction of ` British Broadcasting Corporation (thus ` name), but now runs on most modern, popular operating systems (& several older &/or less-popular ones). ttx["text6"]="Commodore ~B is ` collective name for ` various versions of ~B developed by MS for Commodore 8-bit ~cs, starting with ` PET in 1977. `re were several versions.|Commodore ~B is notable for its lack of integer arithmetic; all operations were carried out in floating-point, which made ` interpreter slower than some of its peers.|~ps were tokenized into bytecode, although many characters were left intact To facilitate printing ` source code back out in original form; it's one of ` few ~Bs of ` time that preserved whitespace (though not leading whitespace). Unlike some contemporary ~Bs, it supported arrays of strings, & arrays could have thous&s of elements as long as `re was sufficient memory for `m (but strings were limited to 255 bytes).|` most well-known version is 2.0, which came with ` VIC-20 & Commodore 64. Despite ` impressive sound & graphics capabilities of ` machines, ` ~l had no support for `m; machine code was required to take advantage of those features. Later ~B versions added support, but ` later machines that came with those versions never came close to ` popularity of ` 64.|In addition to ` sound & graphic statements, ` later versions also introduced ~tured ~pming con~ts: DO...LOOP, which supported both pre- & post-evaluated conditions (DO WHILE/UNTIL ... LOOP & DO ... LOOP WHILE/UNTIL) as well as unconditional loop exit (EXIT) & BEGIN...BEND code blocks, which allowed multi-line conditional clauses. However, o`r limitations remained: variables were still all global & limited to 2-letter names, user-defined functions were restricted to a single expression with a single argument, etc. ttx["text7"]="eh~B is a ~B variant designed for ` 6502. It is supposedly extremely portable & has a very clean simple syntax.|` author is Lee Davison. ttx["text8"]="Free~B is a free/open source (GPL), 32-bit ~B ~mer for MS ~w, protected-mode DOS (via a DOS extender), & Linux, with unofficial ports To Mac OS & FreeBSD.|Free~B makes use of ` GNU Binutils ~pming tools as backends, & can produce console, Quick~B-compatible graphical & GUI executables, along with dynamic & static libraries. A GCC frontend is under development, which will enable ~mation for many more operating systems than currently supported.|Currently, software libraries like GTK+, GSL, SDL, Allegro, Lua & OpenGL can be used directly (no wrappers, only function & ~ture prototypes), & more are being added on every new release. A complete set of ` ~w API headers is also ~ied.|` ~mer, & its nearly 90,000 lines of code, was, & still is, ~med by itself (in o`r words, Free~B is a self-hosting ~mer). ` first version of Free~B was written in Visual ~B for DOS for that purpose. ttx["text9"]="Future~B began life as Z~B, a commercial variant of ~B for ` early Macintoshes, but has grown far beyond that into a mature freeware IDE that, through its FBtoC translator, can be used To ~me C & ~oive-C ~o-oriented code using ` clang ~mer ~ied with an Xcode installation. It is excellent as a educational tool & for fast prototyping -- especially in ~oive-C (Cocoa) by those who prefer ~pmatic code over ` overhead of Xcode. Among its enthusiasts are commercial developers, engineers, professors, doctors, musicians, writers & a host of amateurs who ~p with FB for ` sheer joy of it. ttx["text10"]="FUZE ~B is ~ied, pre-configured & ready-To-run on ` FUZE, a ~c based on ` Raspberry Pi, but can also be installed, free of charge on a st&ard Raspberry Pi with some minor limitations due To a lack of on-board sensors which are added To ` FUZE hardware. ttx["text11"]="GFA ~B was a popular form of ~B for ` Atari ST ~c. It provided an integrated editor & interpreter, & ` ability To ~me code into st&alone ~ps. Full access was provided To ` Atari operating system (TOS, VDI & AES).GFA ~B for ` Atari ST can be used through an emulator; GFA ~B also runs on ` Atari-compatible Firebee. ttx["text12"]="STDOUT ''Hello world!'' ttx["text13"]="GW-~B is a ~d of ` ~pming ~l ~B that was supplied with some versions of MSDOS. It replaced ~BA & was in turn replaced by Q~B. ttx["text14"]="Integer ~B, written by Steve Wozniak, was ` ~B interpreter of ` Apple I & original Apple II ~cs. Originally available on cassette, `n ~ied in ROM on ` original Apple II ~c at release in 1977. ttx["text15"]="IS-~B is ` ~d of ~B resident in ROM on ` Enterprise-64 & Enterprise-128 home ~c. It was developed by Intelligent Software in 1984. IS-~B adheres To ` ANSI ~B st&ard. It is a fully ~tured ~l whose wide set of control ~tures ~ies multi-line If...`N...Else, SELECT...CASE, DO...LOOP with While & UNTIL conditions at ` begin &/or end of ` loop & EXIT LOOP statement. Procedures & functions can have both reference & value parameters, & local variables. Errors & o`r exceptions are h&led with exception h&lers. IS-~B has ` unique ability To run multiple ~ps simultaneously in memory. Each ~p has a separate set of global variables & line numbers, but ` CHAIN statement makes it possible To call one ~p from ano`r & pass parameters between `m. Peripherals can be controlled directly from ~B, so `re is rarely a need To use POKE & PEEK statements. IS-~B has ` usual comm&s for drawing dots, lines, circles & ellipses & for filling areas, & supports Logo-style turtle graphics. Sound comm&s can be entered into a queue, & executed in ` background While ` ~p execution continues. ttx["text16"]="IW~B is a 32-bit ~B ~mer from Ionic Wind Software featuring an integrated development environment with syntax similar To ` ~B ~pming ~l. ttx["text17"]="Liberty ~B is a procedural ~pming ~l for ~w PCs, created by Shoptalk Systems. It was intended as a simple way To create professional ~ps, with full GUI ability, While still keeping a very simple ~B syntax. While ` current version only supports ~w, ` next major release will support Mac OS X & Linux as well. Liberty ~B runs under Wine on Linux at present. ttx["text18"]="` LibreOffice ~B (once called OpenOffice.org ~B) ~pming ~l has been developed especially for LibreOffice & is firmly integrated in ` LibreOffice package.|As ` name suggests, OpenOffice.org ~B is a ~pming ~l from ` ~B family. Anyone who has previously worked with o`r ~B ~ls — in particular with Visual ~B or Visual ~B for Applications (VBA) from MS — will quickly become accustomed To LibreOffice ~B. Large sections of ` ~B con~ts of LibreOffice ~B are compatible with Visual ~B. ttx["text19"]="Locomotive ~B is a variant of ~B that is built into ` ROM of ` Amstrad CPC series of Z80-based home ~cs introduced in 1984. In ` 1980s, CPCs were a popular, slightly more expensive alternative To ` Commodore C64/C128 & were not just suited for games but also office work because of `ir high resolution displays & CP/M support. `y came with a built-in cassette deck (CPC 464) or 3' disk drive (CPC 664 & 6128) as storage devices & a ''green screen'' or color monitor which also housed ` power supply. Sales were particularly strong in ` UK, Germany, France, & Spain. Today, Locomotive ~B can be used via CPC emulators such as WinAPE or JavaCPC—which is perfectly legal because Amstrad has given `ir permission for distributing CPC ROM images with emulators. ttx["text20"]="MS Small ~B (not To be confused with Small~B) is a ~B ~mer for ` .Net Framework, largely aimed at absolute beginners. It is an extremely simplified variant of ` ~B ~l, & can be thought of as a sort of Q~B.Net. In fact, its creator has called it a modern-day Q~B. But it is a ~l & not an implementation because it has its own syntax. ttx["text21"]="MSX ~B is ` ~B built into ` ROM of ` MSX compatible ~cs.|MSX ~B is a ~d of ` ~B ~pming ~l. It is an extended version of MS St&ard ~B Version 4.5, & ~ies support for graphic, music, & various peripherals attached To MSX Personal ~cs. Generally, MSX-~B is designed To follow GW-~B. ttx["text22"]="Oxygen~B is a ~mable ~l in ` ~B genre supporting ~o-oriented ~pming, & containing features of C. Its earliest origins was as a macro Assembly code ~l in 2009, but subsequently acquired all ` features of a high-level ~l.|` philosophy underlying Oxygen~B is to facilitate clean coding, with low syntax noise & few coding restrictions. ` core ~l & ~mer size are kept to a minimum. ttx["text23"]="Power~B is a small family of ~mers for DOS & ~w by Power~B, Inc. Its main selling point is ` efficiency of ` ~mer & its ease of use. ` ''easy'' part is debatable: working with ~w is not as easy as Visual ~B, but `n, almost nothing is. ttx["text24"]="Pure~B is a high-level ~pming ~l by Fantaisie Software based on ~B rules. Pure~B has been created for beginners & experts alike.|Pure~B is a portable ~pming ~l with current up-To-date implementations on ~w, Linux, & MacOS. ` same code can be ~med & run natively on each OS. An older version for ` Amiga platform is also available, but no longer maintained. ttx["text25"]="Q~B is a ~B that was written by MS & normally executes under ~w. ttx["text26"]="QL ~B known as Super~B is an advanced variant of ` ~B ~pming ~l with many ~tured ~pming additions. It was developed at Sinclair Research by Jan Jones during ` early 1980s. Originally Super~B was intended for a home ~c, code-named SuperSpectrum, `n under development. This project was later cancelled; however, Super~B was subsequently ~ied in ` ROM firmware of ` Sinclair QL micro~c (announced in January 1984), also serving as ` comm& line interpreter for ` QL's Qdos operating system. It is notable for being ` first second-generation ~B to be integrated into a micro~c's operating system, so making ` latter user-extendable—as exemplified by Linus Torvalds in his formative years. ttx["text27"]="Quite ~B was written by Nikko Strom as a hobby, however it is now a website, a web application, educational resource, & application development tool for classic ~B. ttx["text28"]="REAL~B (or RB) is a ~B ~mer for ~w, Mac OS, & Linux, made by Xojo, Inc. It has its own IDE, & projects are saved To a proprietary binary format. Unlike most ~Bs, REAL~B is heavily ~o-oriented.|As of June 2013, ` ~l, IDE, & company have been re-br&ed as Xojo.|REAL~B is not compatible with o`r ~Bs, for ` most part; examples from o`r ~Bs usually have To be completely rewritten To work in RB. ttx["text29"]="Run ~B is a web application server, based on Liberty ~B.|Run ~B serves a similar purpose To o`r ~ls like ASP, Perl, & PHP; unlike those ~ls, however, it is not an add-on module To web servers, instead ~iing its own HTTP server. Web pages are generated dynamically by ` ~p. High-level comm&s automatically generate HTML, colors, fonts, backgrounds, & Cascading Style Sheets (CSS). If needed, JavaScript can also be injected into a page. Graphics can be drawn & rendered via code. Files can be fetched from o`r web sites using GET & POST, & a built-in XML parser can be used To extract data.|Database capability is ~ied via ` SQLite database engine. ttx["text30"]="S-~B (` S st&s for ''~tured'') was a native-code ~mer for an ALGOL-like ~d of ` ~B ~pming ~l, & ran on 8-bit micro~cs using ` Z80 CPU & ` CP/M operating system. (`re are a number of CP/M or Z80 emulators that will allow ` ~mer To run on ~w or Linux systems.) ` ~l & ` ~mer were developed during ` period 1979-1981 by Gilbert Ohnysty, who saw a need for a true native-code ~mer & a ~l implementation that preserved ~B's ease of use & straight-forward syntax, while incorporating ` syntactic & control-flow features associated with modern ~pming ~ls. ttx["text31"]="Script~B is an interpreted ~B suitable for general purpose terminal mode application ~pming & common gateway interface scripting. ttx["text32"]="Sinclair ZX81 ~B is ` ~d of ~B resident in ROM on ` ZX81 home ~c (1981) & compatibles (Timex Sinclair 1000, Lambda 8300, & many o`rs). It was developed by John Grant & Steve Vickers. Around 1.5 million ZX81s & 'official' compatibles were sold, toge`r with a substantial number of clones (unofficial compatibles) manufactured in Brazil, Hong Kong, & elsewhere.|ZX81 ~B is almost a subset of ZX Spectrum ~B, but not quite: ` exponentiation operator is spelled ** ra`r than ↑ (mapped to ASCII ^), ` jump & subroutine call keywords are spelled GOTO & GOSUB ra`r than GO TO & GO SUB, etc. Note also that ` ZX81 uses an idiosyncratic (non-ASCII) character set, so that ` CODE & CHR$ functions do not return ` same values as `y would on ` Spectrum. Floating point operations, some string h&ling, & low-resolution graphics are supported; colour, sound, user-defined functions, ` READ, DATA, & RESTORE keywords, & assorted o`r features are not. ttx["text33"]="Smart ~B is an extension of ` very popular ~B ~pming ~l originally developed by Dartmouth College way back in 1964. With Smart ~B you can write ~B ~ps directly on iOS devices.|Using Apple's Xcode platform along with ` freely provided smart ~B SDK, you can actually ~p in ~B within Xcode, test your code in iOS simulators or your own iOS device, & even build st&-alone apps for submission to ` App Store to sell, with no royalty issues. ttx["text34"]="Smile~B demo:|PRINT ''Hello world!'' ttx["text43"]="With Visual ~B, you can create applications for ~w, ` Web, mobile devices, & Office on ` .NET Framework. Visual ~B .NET makes it easy To create ~w form applications quickly & efficiently. ` ~l is ~o-oriented & has unique features To speed development & deployment.|Visual ~B .NET, like C# & o`r .NET ~ls, runs on ` MS Common ~l Runtime VM.|Not To be confused with Visual ~B, ` original pre-.NET, implementation, which has only a passing resemblance To VB.NET. ttx["text45"]="ZX Spectrum Basic is the BASIC built into the ROM of the ZX Spectrum Computer.Features:|>> Language is interpreted, line numbers are required. >> Line numbers must be no longer than four digits, no named locations. >> No support for scoped & struct variables. >> No command line parameters, no support for environment. >> No direct support for error handling. >> Can read keystrokes using INKEY$. >> No support for multiple line IF conditionals. >> Variables have to be defined before use. >> The GO TO command has a space in the middle. >> VAL & INPUT interprets expressions. for x= 1 To 45 q="text"+x ttx[q]=LDText.Replace(ttx[q] "|" Text.GetCharacter(10)+Text.GetCharacter(10)) ttx[q]=LDText.Replace(ttx[q] "`" "the") ttx[q]=LDText.Replace(ttx[q] "~B" "Basic") ttx[q]=LDText.Replace(ttx[q] "~p" "program") ttx[q]=LDText.Replace(ttx[q] "~c" "computer") ttx[q]=LDText.Replace(ttx[q] "~l" "language") ttx[q]=LDText.Replace(ttx[q] "~t" "struct") ttx[q]=LDText.Replace(ttx[q] "~w" "Windows") ttx[q]=LDText.Replace(ttx[q] "~d" "dialect") ttx[q]=LDText.Replace(ttx[q] "&" "and") ttx[q]=LDText.Replace(ttx[q] "~o" "object") ttx[q]=LDText.Replace(ttx[q] "~m" "compil") ttx[q]=LDText.Replace(ttx[q] "~i" "includ") ttx[q]=LDText.Replace(ttx[q] ". " "."+Text.GetCharacter(10)) Endfor EndSub End>BCD026.sb< Start>BCD721.sb< GraphicsWindow.Width = Desktop.Width - 10 GraphicsWindow.Height = Desktop.Height - 10 GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Title = "Computer Rendition of Spirograph [By Amir CPS]" minX = 20 maxX = 290 gww = GraphicsWindow.Width gwh = GraphicsWindow.Height GraphicsWindow.MouseDown = doWork GraphicsWindow.MouseMove = onMove clearandredraw() Sub draw If r2 = 0 Then r2 = 10 EndIf li = 4 * Math.Tan(1) If (r1/r2) = r1/r2 Then rot = 1 Else rot = Math.Abs(r2/r1) If (r2/10) <> r2 / 10 Then rot = 10 * rot EndIf EndIf For i = 0 To rot For j = 0 To 2*li Step li/(4*360) t = i * 2 * li + j x = (r1+r2) * Math.Cos(t) - (r2+r)*Math.Cos(((r1+r2)/r2*t)) y = (r1+r2) * Math.sin(t) - (r2+r)*Math.Sin(((r1+r2)/r2*t)) GraphicsWindow.SetPixel(graphicswindow.Width/2+x,graphicswindow.Height/2+y,"Black") EndFor EndFor EndSub Sub clearandredraw GraphicsWindow.Clear() GraphicsWindow.BrushColor = "Black" track1 = Shapes.AddLine(10,10,300,10) track2 = Shapes.AddLine(10,40,300,40) track3 = Shapes.AddLine(10,70,300,70) GraphicsWindow.DrawText(310,2,"Inner Radius") GraphicsWindow.DrawText(310,32,"Outer Radius") GraphicsWindow.DrawText(310,62,"Inner Offset") r1slider = Shapes.AddRectangle(20,15) r2slider = Shapes.AddRectangle(20,15) rslider = Shapes.AddRectangle(20,15) Shapes.Move(r1slider,10,10-7.5) Shapes.Move(r2slider,147,40-7.5) Shapes.Move(rslider,10,70-7.5) Shapes.SetOpacity(r1slider,70) Shapes.SetOpacity(r2slider,70) Shapes.SetOpacity(rslider,70) Shapes.SetOpacity(track1,20) Shapes.SetOpacity(track2,20) Shapes.SetOpacity(track3,20) r1pop = Shapes.AddText(0) r2pop = Shapes.AddText(0) rpop = Shapes.AddText(0) GraphicsWindow.DrawRectangle(10,95,50,20) GraphicsWindow.DrawText(18,97,"Draw") GraphicsWindow.DrawRectangle(70,95,50,20) GraphicsWindow.DrawText(80,97,"Clear") EndSub Sub onMove x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If x < minX Then x = minX ElseIf x > maxX Then x = maxX EndIf If Mouse.IsLeftButtonDown Then If y > 2 And y < 17 Then Shapes.ShowShape(r1pop) Shapes.Move(r1pop,X+20,20) r1val = Math.Round((Shapes.GetLeft(r1slider)-10)*0.833) Shapes.SetText(r1pop,r1val) Shapes.Move(r1slider,X-10,10-7.5) EndIf If y > 32 And y < 47 Then Shapes.ShowShape(r2pop) Shapes.Move(r2pop,X+20,50) r2val = Math.Round((Shapes.GetLeft(r2slider)-10)*0.89) If r2val < 120 Then r2val = r2val - 120 ElseIf r2val > 120 Then r2val = Math.Abs(120 - r2val) ElseIf r2val = 120 Then r2val = 0 EndIf Shapes.SetText(r2pop,r2val) Shapes.Move(r2slider,X-10,40-7.5) EndIf If y > 62 And y < 77 Then Shapes.ShowShape(rpop) Shapes.Move(rpop,X+20,80) rval = Math.Round((Shapes.GetLeft(rslider)-10)*0.333) Shapes.SetText(rpop,rval) Shapes.Move(rslider,X-10,70-7.5) EndIf Else Shapes.HideShape(r1pop) Shapes.HideShape(r2pop) Shapes.HideShape(rpop) EndIf r1 = r1val r2 = r2val r = rval EndSub Sub doWork x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If x > 10 And x < 60 And y > 95 And y < 115 Then draw() onMove() ElseIf x > 70 And x < 120 And y > 95 And y < 115 Then clearandredraw() EndIf EndSub End>BCD721.sb< Start>BCH342.sb< 'created by aabproducoes.peperonity.com 'Antonio Augusto Barbaro 'aabproducoes.cwap.me 'aabproducoes.mywapblog.com (SB) 'facebook.com/antonio.augusto.9444023 'aaugusto444@gmail.com GraphicsWindow.Title="Ilusion Black and White v0.1" GraphicsWindow.Top=(Desktop.Height-GraphicsWindow.Height)/2 'center x GraphicsWindow.Left=(Desktop.Width-GraphicsWindow.Width)/2 'center y GraphicsWindow.CanResize=0 gw= GraphicsWindow.Width gh= GraphicsWindow.Height cx= gw/2 cy= gh/2 bw= 50 nang=200 supang= gw/bw/2+2 GraphicsWindow.PenWidth=0 colour="1=White;2=Black;" For j=1 To supang Step 2 nang=nang+bw For i=1 To nang angle= i*Math.Pi/(nang/2)-Math.Pi/2 If Math.Remainder(i,2)=0 Then GraphicsWindow.BrushColor=colour[1] Else GraphicsWindow.BrushColor=colour[2] EndIf px= cx+((bw-3)*j)*Math.Cos(angle) py= cy+((bw-3)*j)*Math.Sin(angle) ell[i]= Shapes.AddEllipse(bw,bw) Shapes.Move(ell[i],px-(bw/2),py-(bw/2)) EndFor For i=nang To 1 Step -1 angle= i*Math.Pi/(nang/2)-Math.Pi/2 If Math.Remainder(i,2)=0 Then GraphicsWindow.BrushColor=colour[1] Else GraphicsWindow.BrushColor=colour[2] EndIf px= cx+((bw-3)*(j+1))*Math.Cos(angle) py= cy+((bw-3)*(j+1))*Math.Sin(angle) ell[i]= Shapes.AddEllipse(bw,bw) Shapes.Move(ell[i],px-(bw/2),py-(bw/2)) EndFor EndFor End>BCH342.sb< Start>BCK921.sb< 'Initialise TextWindow.WriteLine("Loading...") TextWindow.WriteLine("Use arrow keys to turn, accelerate and brake.") TextWindow.WriteLine("Use mouse right click or to exit.") TextWindow.WriteLine("Designed for screen resolution 1280 x 800.") Init() TextWindow.Hide() 'Main program While ("true") If (Left) Then steer = steer-0.01 steer = Math.Max(-pi/2,steer) ElseIf (Right) Then steer = steer+0.01 steer = Math.Min(pi/2,steer) EndIf engine() showDial() turnWheel() showRoad() checkCrash() Program.Delay(1) EndWhile 'Initialise graphics window Sub Init GraphicsWindow.Hide() InitGW() InitVar() 'Speed Dial cx = xSpeed cy = ySpeed ct = "MPH" cm = speedMax Dial() 'Rev Dial cx = xRev cy = yRev ct = "RPM (1000)" cm = revMax Dial() 'Dashboard Dash() 'Road Road() GraphicsWindow.Show() GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 1 InitEvents() turnWheel() showDial() EndSub 'Initialise graphics window Sub InitGW gw = Desktop.Width-20 gh = Desktop.Height-100 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Top = 8 GraphicsWindow.Left = 8 GraphicsWindow.Title = "Driving game" GraphicsWindow.CanResize = "false" GraphicsWindow.BackgroundColor = "lightGray" EndSub 'Initialise Variables Sub InitVar pi = 3.14159 needleLen = 80 'Timings and distance scale = 10 distance = 0 miles = 0 milesLast = -1 timeLast = 0 timingLast = "" 'Speed speed = 0 speedMax = 200 xSpeed = 200 ySpeed = gh-100 'Revs rev = 1 revMax = 12 xRev = gw-200 yRev = gh-100 'Gears gear = 1 'keyboard controls Left = "false" Right = "false" Up = "false" Down = "false" EndSub 'Setup Events - using timer is very CPU intensive and severely affects performance hence I use while loop with delay Sub InitEvents Timer.Interval = 10 Timer.Tick = OnTick Timer.Pause() GraphicsWindow.MouseDown = OnMouseDown 'Use keyUp and Down since the keboard repeat frequency is too slow to be reactive GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp EndSub 'Timer event - not used - too slow Sub OnTick Timer.Pause() showDial() turnWheel() Timer.Resume() EndSub 'Mouse click event Sub OnMouseDown If (Mouse.IsRightButtonDown) Then Program.End() EndIf EndSub 'Key down events Sub OnKeyDown key = GraphicsWindow.LastKey If (key = "Left") Then Left = "true" ElseIf (key = "Right") Then Right = "true" ElseIf (key = "Up") Then Up = "true" ElseIf (key = "Down") Then Down = "true" ElseIf (key = "Escape") Then Program.End() EndIf EndSub Sub OnKeyUp key = GraphicsWindow.LastKey If (key = "Left") Then Left = "false" ElseIf (key = "Right") Then Right = "false" ElseIf (key = "Up") Then Up = "false" ElseIf (key = "Down") Then Down = "false" EndIf EndSub Sub Dial GraphicsWindow.BrushColor = "#556655" len = 30+needleLen GraphicsWindow.FillEllipse(cx-len,cy-len,2*len,2*len) GraphicsWindow.BrushColor = "#ddffff" len = needleLen-10 GraphicsWindow.FillEllipse(cx-len,cy-len,2*len,2*len) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(cx-4*Text.GetLength(ct),cy+10,ct) GraphicsWindow.BrushColor = "#88bbff" len = 10+needleLen For i = 0 To 10 ang = pi*i/10 x = cx-len*Math.Cos(ang)-4*Text.GetLength(cm) y = cy-len*Math.Sin(ang)-12 GraphicsWindow.DrawText(x,y,Math.Floor(i/10*cm)) EndFor EndSub Sub Dash 'Dash GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FillRectangle(0,ySpeed+30,gw,gh) GraphicsWindow.BrushColor = "#555566" GraphicsWindow.FillRectangle(20,ySpeed+30,gw-40,50) 'Steering Wheel SWrad = gw/3.5 SWx = gw/2 SWy = gw-SWrad steer = 0 GraphicsWindow.PenColor = "#556655" GraphicsWindow.PenWidth = 50 GraphicsWindow.DrawEllipse(SWx-SWrad,SWy-SWrad,2*SWrad,2*SWrad) For i = 0 To 24 If (i = 6) Then GraphicsWindow.PenColor = "#883333" Else GraphicsWindow.PenColor = "#333388" EndIf dot = Shapes.AddRectangle(10,10) Array.SetValue("dots",i,dot) EndFor 'Viewing Window xv = 80 yv = 20 dxv = gw-160 dyv = gh-260 GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(xv,yv,dxv,dyv) 'pic = Flickr.GetRandomPicture("car race") 'pic = ImageList.LoadImage("http://revandy.files.wordpress.com/2009/01/desert1_opt.jpg") 'pic = ImageList.LoadImage("http://static.howstuffworks.com/gif/desert-survival-1.jpg") pic = ImageList.LoadImage("http://imagecache.allposters.com/images/pic/EUR/1700-9951%7EPoppy-Meadow-c-1907-Posters.jpg") GraphicsWindow.DrawResizedImage(pic,xv,yv,dxv,dyv) 'GraphicsWindow.BrushColor = "#88000000" 'GraphicsWindow.FillRectangle(xv,yv,dxv,dyv) GraphicsWindow.BrushColor = "#aaff00ff" GraphicsWindow.FillRectangle(xv+0.45*dxv,yv+0.95*dyv,dxv*0.1,dyv*0.05) GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawRectangle(xv,yv,dxv,dyv) 'Dial needles GraphicsWindow.PenColor = "#ddee5500" needleSpeed = Shapes.AddRectangle(needleLen,3) needleRev = Shapes.AddRectangle(needleLen,3) 'Gear Indicator xG = gw-255 yG = gh-50 GraphicsWindow.BrushColor="White" For i = 1 To 5 GraphicsWindow.FillRectangle(xG+i*17,yG,15,15) EndFor GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 1 gearshift = Shapes.AddRectangle(13,13) EndSub Sub Road nside = 10 Xcenter = 0.5 tree = ImageList.LoadImage("http://www.iconarchive.com/icons/fasticon/nature/Tree-48x48.png") Xtree = ImageList.GetWidthOfImage(tree)/2 Ytree = ImageList.GetHeightOfImage(tree)/2 For i = 1 To nside 'GraphicsWindow.PenColor = "#99555555" 'GraphicsWindow.BrushColor = "#bbff00ff" side = Shapes.AddImage(tree) Array.SetValue("Lsides",i,side) 'GraphicsWindow.PenColor = "#99555555" 'GraphicsWindow.BrushColor = "#bbff00ff" side = Shapes.AddImage(tree) Array.SetValue("Rsides",i,side) Array.SetValue("Ysides",i,(i-0.5)/nside) GraphicsWindow.PenColor = "#dd000000" GraphicsWindow.BrushColor = "#ddffff00" side = Shapes.AddEllipse(12,12) Array.SetValue("Csides",i,side) EndFor EndSub ' ' Active event updating - Don't share variables or set GW colours using timer in more than 1 sub etc as they are event driven and can clash since all vairables are static ' Sub turnWheel For i = 0 To 24 angW = 2*pi*i/24+steer xW = SWx-SWrad*Math.Cos(angW) yW = SWy-SWrad*Math.Sin(angW) dot = Array.GetValue("dots",i) Shapes.Move(dot,xW-5,yW-5) EndFor EndSub Sub showDial angS = pi*speed/speedMax xS = xSpeed-needleLen/2*(1+Math.Cos(angS)) yS = ySpeed-needleLen/2*Math.Sin(angS)-6 Shapes.Move(needleSpeed,xS,yS) Shapes.Rotate(needleSpeed,180/pi*angS) angR = pi*rev/revMax xR = xRev-needleLen/2*(1+Math.Cos(angR)) yR = yRev-needleLen/2*Math.Sin(angR)-6 Shapes.Move(needleRev,xR,yR) Shapes.Rotate(needleRev,180/pi*angR) Shapes.Move(gearshift,xG+1+gear*17,yG+1) If (miles > milesLast) Then GraphicsWindow.BrushColor = "#ddffff" GraphicsWindow.FillRectangle(xSpeed-50,ySpeed-40,100,20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(xSpeed-3.3*Text.GetLength(miles+" miles"),ySpeed-40,miles+" miles") milesLast = miles EndIf timing = Clock.Time If (timing <> timingLast) Then timingLast = timing GraphicsWindow.BrushColor = "#ddffff" GraphicsWindow.FillRectangle(xRev-50,yRev-40,100,20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(xRev-3.5*Text.GetLength(timing),yRev-40,timing) EndIf EndSub Sub engine If (Up) Then rev = rev+0.7/rev/gear rev = Math.Min(revMax,rev) ElseIf (Down) Then rev = rev-0.1 rev = Math.Max(1,rev) EndIf If (rev > 0.9*revMax And gear < 5) Then gear = gear+1 rev = rev*0.7 EndIf If (rev < 0.5*revMax And gear > 1) Then gear = gear-1 rev = rev/0.7 EndIf speed = speedMax/(revMax-1)*(rev-1)*Math.Power(0.7,5-gear) EndSub Sub showRoad time = Clock.Millisecond/1000 If (time < timeLast) Then timeLast = timeLast-1 EndIf dt = (time-timeLast)/60/60*scale distance = distance+speed*dt miles = Math.Floor(distance/scale*10)/10 timeLast = time Xcenter = Xcenter-dt*steer*speed Xcenter = Math.Min(0.9,Math.Max(0.1,Xcenter)) For i = 1 To nside Lside = Array.GetValue("Lsides",i) Rside = Array.GetValue("Rsides",i) Yside = Array.GetValue("Ysides",i) Cside = Array.GetValue("Csides",i) dist = Yside + dt*speed dist = dist-Math.Floor(dist) Array.SetValue("Ysides",i,dist) Yside = dist*dist y = yv+Yside*dyv position = distance+(1-dist) track() xc = Xcenter+0.3*ctrack x = xv+(xc-0.1-0.1*Yside)*dxv Shapes.Move(Lside,x-Xtree,y-Ytree) x = xv+(xc+0.1+0.1*Yside)*dxv Shapes.Move(Rside,x-Xtree,y-Ytree) x = xv+(xc)*dxv Shapes.Move(Cside,x-6,y-6) EndFor position = distance track() centre = Xcenter+0.3*ctrack EndSub 'ctrack is normalised [-1,1] centre position of track at position Sub track ctrack = Math.Sin(position)*Math.Sin(position/7)*Math.Sin(pi*position) EndSub Sub checkCrash If (centre < 0.35 Or centre > 0.65) Then rev = rev-0.1 rev = Math.Max(1,rev) EndIf EndSub End>BCK921.sb< Start>BCL138.sb< ' program by yled ' substractive color theory ' Nov 6th 2016 ' program no: GraphicsWindow.width=1366 GraphicsWindow.height=650 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.title="Subtractive color" GraphicsWindow.BackgroundColor="black" GraphicsWindow.brushcolor="white" GraphicsWindow.FontName="comic sans ms" GraphicsWindow.fontsize=35 GraphicsWindow.DrawBoundText(50,20,400,"Subtractive color") ' COMPLEMENTARY COLORS ' YELLOW Y=GraphicsWindow.GetColorFromRGB(255,255,0) GraphicsWindow.BrushColor=Y GraphicsWindow.DrawRectangle(500,0,400,400) GraphicsWindow.FillRectangle(500,0,400,400) GraphicsWindow.brushcolor="black" GraphicsWindow.DrawBoundText(800,50,200,"Y") ' MAGENTA M=GraphicsWindow.GetColorFromRGB(255,0,255) GraphicsWindow.BrushColor=M GraphicsWindow.DrawRectangle(350,150,400,400) GraphicsWindow.FillRectangle(350,150,400,400) GraphicsWindow.brushcolor="black" GraphicsWindow.DrawBoundText(400,450,200,"M") ' CYAN C=GraphicsWindow.GetColorFromRGB(0,255,255) GraphicsWindow.BrushColor=C GraphicsWindow.DrawRectangle(650,250,400,400) GraphicsWindow.FillRectangle(650,250,400,400) GraphicsWindow.brushcolor="black" GraphicsWindow.DrawBoundText(900,550,200,"C") ' PRIMARY COLORS ' RED R=GraphicsWindow.GetColorFromRGB(255,0,0) GraphicsWindow.BrushColor=R GraphicsWindow.DrawRectangle(500,150,250,250) GraphicsWindow.FillRectangle(500,150,250,250) GraphicsWindow.brushcolor="black" GraphicsWindow.DrawBoundText(550,200,200,"R") ' GREEN G=GraphicsWindow.GetColorFromRGB(0,255,0) GraphicsWindow.BrushColor=G GraphicsWindow.DrawRectangle(650,250,250,150) GraphicsWindow.FillRectangle(650,250,250,150) GraphicsWindow.brushcolor="black" GraphicsWindow.DrawBoundText(800,300,200,"G") ' BLUE B=GraphicsWindow.GetColorFromRGB(0,0,255) GraphicsWindow.BrushColor=B GraphicsWindow.DrawRectangle(650,300,100,250) GraphicsWindow.FillRectangle(650,300,100,250) GraphicsWindow.brushcolor="black" GraphicsWindow.DrawBoundText(675,450,200,"B") ' BLACK N=GraphicsWindow.GetColorFromRGB(0,0,0) GraphicsWindow.BrushColor=N GraphicsWindow.DrawRectangle(650,250,100,150) GraphicsWindow.FillRectangle(650,250,100,150) GraphicsWindow.brushcolor="white" GraphicsWindow.fontsize=20 GraphicsWindow.DrawBoundText(675,325,200,"Black") GraphicsWindow.brushcolor="gray" GraphicsWindow.FontName="comic sans ms" GraphicsWindow.fontsize=15 GraphicsWindow.DrawBoundText(50,80,400,"https://en.wikipedia.org/wiki/Subtractive_color") GraphicsWindow.DrawBoundText(1100,550,400,"Program by yled @ 2016") End>BCL138.sb< Start>BCL208-2.sb< 'SBJump - A cheap knock off of Doodle Jump written in SmallBasic 'Original Concept and Programming by Zock - Import Code: PGR013 'Current version by codingCat aka Matthew L. Parets 'As the game progresses the platforms get smaller. 'After a round at 15 pixels they reset to fifty and the game speeds up. 'Controls = Left, Right and Up keys 'Initial Setup lineCnt = 7 linesize = 50 start = "True" multiplier = 2 delay = 13 'Setup the window GraphicsWindow.Width = 700 GraphicsWindow.Height = 400 GraphicsWindow.Title = "SBJump" GraphicsWindow.Width = (20*10) + (linesize + 10) GraphicsWindow.BackgroundColor = "blue" GraphicsWindow.Top = Desktop.Height / 2 - GraphicsWindow.Height / 2 GraphicsWindow.left = Desktop.Width / 2 - GraphicsWindow.Width / 2 GraphicsWindow.BrushColor = "black" GraphicsWindow.fillRectangle(0,GraphicsWindow.Height-3,GraphicsWindow.Width,3) x = GraphicsWindow.Width / 2 'Top of the main Program Loop top: gameOver = "False" GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor = "red" ball = Shapes.AddEllipse(10,10) GraphicsWindow.PenWidth = 2 dy = -3.2 'First platform copied from top platform after first level If start = "False" then lastx = linex[1] endif 'Randomly generate the platforms. platlevl = 75 For ii = 1 to lineCnt linex[ii] = (Math.GetRandomNumber(20) * 10) liney[ii] = platlevl + ((Math.GetRandomNumber(2) * 10) - 10) platlevl = platlevl + 50 endfor If start = "False" then linex[lineCnt] = lastx endif For i = 1 to lineCnt GraphicsWindow.DrawLine(linex[i],liney[i],linex[i]+linesize,liney[i]) endfor 'Start at the bottom y = GraphicsWindow.Height - 1 'Main game loop Sound.PlayChimes() While y > -5 And gameOver <> "True" Program.Delay(delay) key = GraphicsWindow.LastKey 'Update the location of the ball x = x + dx y = y + dy Shapes.Move(ball, x,y) 'Check for bottom of window, bounce if new game, otherwise game over dy = dy + 0.05 If (y > GraphicsWindow.height) Then If (start = "True") then dY = -3.2 Sound.PlayClick() Else 'Sound.PlayBellRing() gameOver = "True" EndIf EndIf 'Check to see if a bounce at a platform has occured If dy > 0 Then For ii = 1 To lineCnt If (x+5 > linex[ii] and x < linex[ii]+(linesize-5)) and (y+5 > liney[ii]-(dy/2) And y+5 < liney[ii]+(dy/2)) then dy = -3.2 Sound.PlayClick() score = score + 400 start = "False" EndIf EndFor EndIf 'Check for changes based on user controls If (key = "Right") Then dx = 1 EndIf If (key = "Left") Then dx = -1 EndIf If (key = "Up") Then dx = 0 EndIf 'Wrap past the edges If x > GraphicsWindow.Width Then x = 0 EndIf If x < 0 Then x = GraphicsWindow.Width EndIf 'Update the score If Math.Remainder(score,100) = 0 then GraphicsWindow.Title = "Score = " + score EndIf score = score - 1 If score < 0 Then score = 0 EndIf endwhile 'If game loop exited with GameOver if y > GraphicsWindow.Height then 'Scroll the credits GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 30 goSh = Shapes.AddText("Game Over") stSh = Shapes.AddText("Score") scSh = Shapes.AddText(score) GraphicsWindow.FontSize = 15 tiSh = Shapes.AddText("SBJump") idSh = Shapes.AddText("Idea by Zock") ptSh = Shapes.AddText("Programming by") nmSh = Shapes.AddText("codingCat and Zock") cpSh = Shapes.AddText("Product Parets Programming") riSh = Shapes.AddText("No Rights Reserved ;-)") cnSh = Shapes.AddText("Press for New Game") goy = -50 While GraphicsWindow.LastKey <> "Return" goy = goy + 1 If goy > GraphicsWindow.Height + 550 Then goy = -50 EndIf Shapes.Move(tiSh, 25, goy - 525) Shapes.Move(idSh, 25, goy - 500) Shapes.Move(ptSh, 25, goy - 475) Shapes.Move(nmSh, 25, goy - 450) Shapes.Move(cpSh, 25, goy - 425) Shapes.Move(riSh, 25, goy - 400) Shapes.Move(cnSh, 25, goy - 375) Shapes.Move(goSh, 50, goy - 100) Shapes.Move(stSh, 50, goy - 50) Shapes.Move(scSh, 50, goy) Program.Delay(15) EndWhile else 'Set up for next level score = score * multiplier 'Shrink the platform size If linesize > 15 then linesize = linesize - 5 Else 'Speed the game up linesize = 50 If delay > 1 then delay = delay - 2 endif endif 'Continue with next level GraphicsWindow.Clear() Goto top endif 'reset a bunch of stuff for a new game linesize = 50 GraphicsWindow.Clear() GraphicsWindow.BrushColor = "black" GraphicsWindow.fillRectangle(0,GraphicsWindow.Height-3,GraphicsWindow.Width,3) delay = 13 start = "True" score = 0 GraphicsWindow.Title = "SBJump" x = GraphicsWindow.Width / 2 dx = 0 Goto top End>BCL208-2.sb< Start>BCL208-3.sb< 'SBJump - A cheap knock off of Doodle Jump written in SmallBasic 'Original Concept and Programming by Zock - Import Code: PGR013 'Current version by codingCat aka Matthew L. Parets 'As the game progresses the platforms get smaller. 'After a round at 15 pixels they reset to fifty and the game speeds up. 'Controls = Left, Right and Up keys flag = 0 Initialize() SetupTitleCrawl() 'Main Program Loop While exiting <> "True" LevelSet() GeneratePlatforms() frameStart = Clock.ElapsedMilliseconds 'Game Loop While gameOver <> "True" OpeningTitleCrawl() MoveBall() Bounce() KeyCheck() UpdateScore() 'Reached the top - Next Level If y <= -5 Then LevelUp() LevelSet() GeneratePlatforms() EndIf FrameDelay() endwhile CreditCrawl() Initialize() endwhile Program.End() '---------------------------------------------------------------------------------- 'Subroutines '---------------------------------------------------------------------------------- '---------------------------------------------------------------------------------- Sub FrameDelay 'Loop will continue until delay has been reached. Because frameStart 'is set at the end of the last frame delay, the frames should be constantly 'the same regardless of the processing in each individual frame. '(ie shorter delays when more pressing is done) While Clock.ElapsedMilliseconds - frameStart < delay EndWhile frameStart = Clock.ElapsedMilliseconds EndSub '---------------------------------------------------------------------------------- Sub Bounce 'Check for bottom of window, bounce if new game, otherwise game over If (y > GraphicsWindow.height) Then If (start = "True") then dY = -3.2 Sound.PlayClick() Else Sound.PlayBellRing() gameOver = "True" EndIf EndIf 'Check to see if a bounce at a platform has occured If dy > 0 Then 'If moving downward (allows passing through platform on the way up. For ii = 1 To lineCnt 'check each platform 'if... in the middle of a platform (left to right), AND on a platform (up and down) - adjusted for speed If (x+5 > linex[ii] and x < linex[ii]+(linesize-5)) and (y+5 > liney[ii]-(dy/2) And y+5 < liney[ii]+(dy/2)) then dy = -3.2 'Reverse the direction Sound.PlayClick() score = score + 130 GraphicsWindow.Title = "L: " + level + " S: " + score start = "False" 'Once a platform is hit, the bottom of off limits EndIf EndFor EndIf EndSub '---------------------------------------------------------------------------------- Sub KeyCheck 'Check for changes based on user controls key = GraphicsWindow.LastKey If (key = "Right") Then flag = 1 dx = 1 ElseIf (key = "Left") Then flag = 1 dx = -1 ElseIf (key = "Up") Then flag = 1 dx = 0 ElseIf key = "Escape" then gameOver = "True" exiting = "True" EndIf EndSub '---------------------------------------------------------------------------------- Sub Initialize GraphicsWindow.Clear() 'Initial Setup lineCnt = 11 linesize = 50 start = "True" multiplier = 2 delay = 15 score = 0 level = 1 msgCnt = 0 dx = 0 'Setup the window GraphicsWindow.Height = 600 GraphicsWindow.Title = "SBJump" GraphicsWindow.Width = (20*10) + (linesize + 10) GraphicsWindow.BackgroundColor = "blue" GraphicsWindow.Top = Desktop.Height / 2 - GraphicsWindow.Height / 2 - 50 GraphicsWindow.left = Desktop.Width / 2 - GraphicsWindow.Width / 2 GraphicsWindow.BrushColor = "black" GraphicsWindow.fillRectangle(0,GraphicsWindow.Height-3,GraphicsWindow.Width,3) x = GraphicsWindow.Width / 2 EndSub '---------------------------------------------------------------------------------- Sub GeneratePlatforms 'First platform copied from top platform after first level If start = "False" then lastx = linex[1] lasty = liney[1] endif 'Randomly generate the platforms. platlevl = 75 For ii = 1 to lineCnt linex[ii] = (Math.GetRandomNumber(20) * 10) liney[ii] = platlevl + ((Math.GetRandomNumber(2) * 10) - 10) platlevl = platlevl + 50 endfor 'Start at the bottom If start = "False" then 'top becomes bottom linex[lineCnt] = lastx y = GraphicsWindow.Height - (GraphicsWindow.Height - liney[lineCnt]) Else y = GraphicsWindow.Height - 1 endif For i = 1 to lineCnt GraphicsWindow.DrawLine(linex[i],liney[i],linex[i]+linesize,liney[i]) endfor Sound.PlayChimes() EndSub '---------------------------------------------------------------------------------- Sub LevelSet 'Setup for the start of a new level gameOver = "False" GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor = "red" ball = Shapes.AddEllipse(10,10) GraphicsWindow.PenWidth = 2 dy = -3.2 EndSub '---------------------------------------------------------------------------------- Sub LevelUp 'Set up for next level 'Multiply score, decrese the platform size, increase the speed score = score * multiplier level = level + 1 GraphicsWindow.Title = "L: " + level + " S: " + score 'Shrink the platform size If linesize > 15 then linesize = linesize - 5 Else 'Speed the game up linesize = 50 If delay > 1 then delay = delay - 2 endif endif GraphicsWindow.Clear() EndSub '---------------------------------------------------------------------------------- Sub MoveBall 'Update the location of the ball based on user input and 'current volocity x = x + dx y = y + dy Shapes.Move(ball, x,y) 'Wrap past the edges If x > GraphicsWindow.Width Then x = 0 EndIf If x < 0 Then x = GraphicsWindow.Width EndIf dy = dy + 0.05 'Increase the downward speed EndSub '---------------------------------------------------------------------------------- Sub UpdateScore 'Update the score If Math.Remainder(score,100) = 0 then GraphicsWindow.Title = "L: " + level + " S: " + score EndIf score = score - 1 If score < 0 Then score = 0 EndIf EndSub '---------------------------------------------------------------------------------- Sub CreditCrawl 'A WAY overly complicated way of creating the score and credit crawl 'because smallbasic lacks the option of multiple statements on one line, 'or brace notation for loading arrays. 'I hate lots of lines doing nothing but loading array indices. :-) GraphicsWindow.BackgroundColor = "White" msgCnt = 0 GraphicsWindow.BrushColor = "white" msgPos = 1 messages = "Score`30`Level Reached`30`Game Over`39`Press for New Game``No Rights Reserved ;-)``Product Parets Programming``codingCat and Zock``Programming by``Idea by Zock``SBJump``" While msgPos < Text.GetLength(messages) msgCnt = msgCnt + 1 If msgCnt = 1 or msgCnt = 3 then msgCnt = msgCnt + 1 endif messages = Text.GetSubTextToEnd(messages,msgPos) msgPos = Text.GetIndexOf(messages,"`") msgNxt = Text.GetSubText(messages,1,msgPos - 1) If Text.GetSubText(messages,msgPos+1,1) <> "`" then GraphicsWindow.FontSize = Text.GetSubText(messages,msgPos+1,2) msgPos = msgPos + 2 Else GraphicsWindow.FontSize = 15 EndIf msgPos = msgPos + 2 shps[msgCnt] = Shapes.AddText(msgNxt) EndWhile GraphicsWindow.FontSize = 30 shps[3] = Shapes.AddText(level) 'This games max level shps[1] = Shapes.AddText(score) 'This games score 'Initial Credit Locations goy = msgCnt * -50 For i = 1 To msgCnt Shapes.Move(shps[i], 25, goy) goy = goy + 50 EndFor 'flash the background to make the white to hide the shape build seem on purpose For i = 1 To 10 GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Program.Delay(50) EndFor GraphicsWindow.BackgroundColor = "blue" 'Crawl the Scores and Credits While GraphicsWindow.LastKey <> "Return" And GraphicsWindow.LastKey <> "Escape" goy = goy + 1 'Wrap at the edge of the screen If goy > GraphicsWindow.Height + (GraphicsWindow.Height + (5 * 50)) Then goy = 0 EndIf For i = 1 To msgCnt shpy = 20 shpyOff = GraphicsWindow.Height If i < 6 Then shpy = 50 shpyOff = 0 EndIf Shapes.Move(shps[i], 25, goy - (i * shpy) - shpyOff) EndFor Program.Delay(15) EndWhile If GraphicsWindow.LastKey = "Escape" Then exiting = "True" EndIf EndSub '---------------------------------------------------------------------------------- Sub SetupTitleCrawl 'A slightly simplified version of the credit clawl GraphicsWindow.BackgroundColor = "White" msgCnt = 0 GraphicsWindow.BrushColor = "white" msgPos = 1 messages = "Keys: Left, Right, Up -- to exit`10`SBJump`50'" While msgPos < Text.GetLength(messages) msgCnt = msgCnt + 1 messages = Text.GetSubTextToEnd(messages,msgPos) msgPos = Text.GetIndexOf(messages,"`") msgNxt = Text.GetSubText(messages,1,msgPos - 1) GraphicsWindow.FontSize = Text.GetSubText(messages,msgPos+1,2) msgPos = msgPos + 4 shps[msgCnt] = Shapes.AddText(msgNxt) EndWhile 'Initial Credit Locations goy = msgCnt * -65 For i = 1 To msgCnt Shapes.Move(shps[i], 25, goy) goy = goy + 65 EndFor 'flash the background to make the white to hide the shape build seem on purpose For i = 1 To 10 GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Program.Delay(5) EndFor GraphicsWindow.BackgroundColor = "blue" EndSub '---------------------------------------------------------------------------------- Sub OpeningTitleCrawl If flag = 0 then 'Crawl the Scores and Credits goy = goy + 1 'Wrap at the edge of the screen If goy > GraphicsWindow.Height + (msgCnt * 50) + 50 Then goy = 0 EndIf For i = 1 To msgCnt shpy = 65 shpyOff = 0 Shapes.Move(shps[i], 25, goy - (i * shpy) - shpyOff) EndFor Else If flag = 1 Then For i = 1 To msgCnt Shapes.HideShape(shps[i]) EndFor EndIf EndIf EndSub End>BCL208-3.sb< Start>BCL208-4.sb< 'SBJump - A cheap knock off of Doodle Jump written in SmallBasic 'Original Concept and Programming by Zock - Import Code: PGR013 'Current version by codingCat aka Matthew L. Parets '*** To enable to leader board system the file commands at the bottom '*** of the program will need to be uncommented 'As the game progresses the platforms get smaller. 'After a round at 15 pixels they reset to fifty and the game speeds up. 'Controls = Left, Right and Up keys 'importCode: BCL208-3 flag = 0 LoadHighScore() Initialize() SetupTitleCrawl() 'Main Program Loop While exiting <> "True" LevelSet() GeneratePlatforms() frameStart = Clock.ElapsedMilliseconds 'Game Loop While gameOver <> "True" OpeningTitleCrawl() MoveBall() Bounce() KeyCheck() UpdateScore() 'Reached the top - Next Level If y <= -5 Then LevelUp() LevelSet() GeneratePlatforms() EndIf FrameDelay() endwhile UpdateHighScore() CreditCrawl() Initialize() endwhile Program.End() '---------------------------------------------------------------------------------- 'Subroutines '---------------------------------------------------------------------------------- '---------------------------------------------------------------------------------- Sub FrameDelay 'Loop will continue until delay has been reached. Because frameStart 'is set at the end of the last frame delay, the frames should be constantly 'the same regardless of the processing in each individual frame. '(ie shorter delays when more pressing is done) While Clock.ElapsedMilliseconds - frameStart < delay EndWhile frameStart = Clock.ElapsedMilliseconds EndSub '---------------------------------------------------------------------------------- Sub Bounce 'Check for bottom of window, bounce if new game, otherwise game over If (y > GraphicsWindow.height) Then If (start = "True") then dY = -3.2 Sound.PlayClick() Else Sound.PlayBellRing() gameOver = "True" EndIf EndIf 'Check to see if a bounce at a platform has occured If dy > 0 Then 'If moving downward (allows passing through platform on the way up. For ii = 1 To lineCnt 'check each platform 'if... in the middle of a platform (left to right), AND on a platform (up and down) - adjusted for speed If (x+5 > linex[ii] and x < linex[ii]+(linesize-5)) and (y+5 > liney[ii]-(dy/2) And y+5 < liney[ii]+(dy/2)) then dy = -3.2 'Reverse the direction Sound.PlayClick() score = score + 130 GraphicsWindow.Title = "L: " + level + " S: " + score start = "False" 'Once a platform is hit, the bottom of off limits EndIf EndFor EndIf EndSub '---------------------------------------------------------------------------------- Sub KeyCheck 'Check for changes based on user controls If pressed = "True" Then key = GraphicsWindow.LastKey If (key = "Right") Then flag = 1 'Disable the title crawl dx = 1 ElseIf (key = "Left") Then flag = 1 dx = -1 ElseIf (key = "Up") Then flag = 1 dx = 0 ElseIf key = "Escape" then gameOver = "True" exiting = "True" EndIf pressed = "False" EndIf EndSub '---------------------------------------------------------------------------------- Sub Initialize GraphicsWindow.Clear() 'Initial Setup lineCnt = 11 linesize = 50 start = "True" multiplier = 1.5 delay = 15 score = 0 level = 1 msgCnt = 0 dx = 0 'Setup the window GraphicsWindow.Height = 600 GraphicsWindow.Title = "SBJump" GraphicsWindow.Width = (20*10) + (linesize + 10) GraphicsWindow.BackgroundColor = "blue" GraphicsWindow.Top = Desktop.Height / 2 - GraphicsWindow.Height / 2 - 50 GraphicsWindow.left = Desktop.Width / 2 - GraphicsWindow.Width / 2 GraphicsWindow.BrushColor = "black" GraphicsWindow.fillRectangle(0,GraphicsWindow.Height-3,GraphicsWindow.Width,3) x = GraphicsWindow.Width / 2 'Set key event GraphicsWindow.KeyDown = OnKeyDown EndSub '---------------------------------------------------------------------------------- Sub GeneratePlatforms 'First platform copied from top platform after first level If start = "False" then lastx = linex[1] lasty = liney[1] endif 'Randomly generate the platforms. platlevl = 75 'Top platform just in range of the top of the screen For ii = 1 to lineCnt linex[ii] = (Math.GetRandomNumber(20) * 10) liney[ii] = platlevl + ((Math.GetRandomNumber(2) * 10) - 10) platlevl = platlevl + 50 endfor 'Start at the bottom If start = "False" then 'top becomes bottom linex[lineCnt] = lastx y = GraphicsWindow.Height - (GraphicsWindow.Height - liney[lineCnt]) Else y = GraphicsWindow.Height - 1 endif For i = 1 to lineCnt 'Display the new platforms GraphicsWindow.DrawLine(linex[i],liney[i],linex[i]+linesize,liney[i]) endfor Sound.PlayChimes() EndSub '---------------------------------------------------------------------------------- Sub LevelSet 'Setup for the start of a new level gameOver = "False" GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "red" GraphicsWindow.FontName = "Tahoma" ball = Shapes.AddEllipse(10,10) GraphicsWindow.PenWidth = 2 dy = -3.2 EndSub '---------------------------------------------------------------------------------- Sub LevelUp 'Set up for next level 'Multiply score, decrese the platform size, increase the speed score = math.Round(score * multiplier) level = level + 1 GraphicsWindow.Title = "L: " + level + " S: " + score 'Shrink the platform size If linesize > 15 then linesize = linesize - 5 Else 'Speed the game up linesize = 50 If delay > 1 then delay = delay - 2 endif endif GraphicsWindow.Clear() EndSub '---------------------------------------------------------------------------------- Sub MoveBall 'Update the location of the ball based on user input and 'current volocity x = x + dx y = y + dy Shapes.Move(ball, x,y) 'Wrap past the edges If x > GraphicsWindow.Width Then x = 0 EndIf If x < 0 Then x = GraphicsWindow.Width EndIf dy = dy + 0.05 'Increase the downward speed EndSub '---------------------------------------------------------------------------------- Sub UpdateScore 'Update the score If Math.Remainder(score,100) = 0 then GraphicsWindow.Title = "L: " + level + " S: " + score EndIf score = score - 1 If score < 0 Then score = 0 EndIf EndSub '---------------------------------------------------------------------------------- Sub CreditCrawl 'A WAY overly complicated way of creating the score and credit crawl 'because smallbasic lacks the option of multiple statements on one line, 'or brace notation for loading arrays. 'I hate lots of lines doing nothing but loading array indices. :-) GraphicsWindow.BackgroundColor = "White" scrloc = 0 msgCnt = 0 GraphicsWindow.FontName = "Tahoma" GraphicsWindow.BrushColor = "white" msgPos = 1 messages = " ``Score`30` ``Level Reached`30` ``High Score`30`Game Over`42`------------------------------------``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``------------------------------------``Leader Board`20`Press for New Game``No Rights Reserved ;-)``Product Parets Programming``codingCat and Zock``Programming by``Idea by Zock``SBJump``" While msgPos < Text.GetLength(messages) msgCnt = msgCnt + 1 messages = Text.GetSubTextToEnd(messages,msgPos) msgPos = Text.GetIndexOf(messages,"`") msgNxt = Text.GetSubText(messages,1,msgPos - 1) If Text.GetSubText(messages,msgPos+1,1) <> "`" then GraphicsWindow.FontSize = Text.GetSubText(messages,msgPos+1,2) msgPos = msgPos + 2 Else GraphicsWindow.FontSize = 15 EndIf msgPos = msgPos + 2 If msgNxt = "-lb-" Then msgNxt = (9-scrloc) + ") " + highname[10-scrloc] + Text.GetCharacter(9657) + highlevel[10-scrloc] + Text.GetCharacter(9657) + highscore[10-scrloc] scrloc = scrloc + 1 EndIf shps[msgCnt] = Shapes.AddText(msgNxt) EndWhile GraphicsWindow.FontSize = 20 shps[5] = Shapes.AddText(highname[1] + Text.GetCharacter(9657) + highlevel[1] + Text.GetCharacter(9657) + highscore[1]) 'All time High Score GraphicsWindow.FontSize = 30 shps[3] = Shapes.AddText(level) 'This games max level shps[1] = Shapes.AddText(score) 'This games score 'Initial Credit Locations goy = msgCnt * -50 For i = 1 To msgCnt Shapes.Move(shps[i], 25, goy) goy = goy + 50 EndFor FlashBackGround() 'Crawl the Scores and Credits key = "" While Key <> "Return" And key <> "Escape" And exiting <> "True" If pressed = "True" Then key = GraphicsWindow.LastKey pressed = "False" EndIf goy = goy + 1 'Wrap at the edge of the screen If goy > (GraphicsWindow.Height * 2) + (GraphicsWindow.Height + (7 * 50) + 200) Then goy = 0 EndIf For i = 1 To msgCnt shpy = 20 shpyOff = GraphicsWindow.Height * 2 If i < 8 Then 'Different offsets for different parts of the credits shpy = 50 shpyOff = 0 ElseIf i < 21 then shpyOff = GraphicsWindow.Height EndIf Shapes.Move(shps[i], 15, goy - (i * shpy) - shpyOff) EndFor Program.Delay(15) EndWhile If key = "Escape" Then exiting = "True" EndIf EndSub '---------------------------------------------------------------------------------- Sub SetupTitleCrawl 'A slightly simplified version of the credit clawl GraphicsWindow.BackgroundColor = "White" msgCnt = 0 GraphicsWindow.BrushColor = "white" msgPos = 1 messages = "Keys: Left, Right, Up -- to exit`10`SBJump`50'" While msgPos < Text.GetLength(messages) msgCnt = msgCnt + 1 messages = Text.GetSubTextToEnd(messages,msgPos) msgPos = Text.GetIndexOf(messages,"`") msgNxt = Text.GetSubText(messages,1,msgPos - 1) GraphicsWindow.FontSize = Text.GetSubText(messages,msgPos+1,2) msgPos = msgPos + 4 shps[msgCnt] = Shapes.AddText(msgNxt) EndWhile 'Initial Credit Locations goy = msgCnt * -65 For i = 1 To msgCnt Shapes.Move(shps[i], 25, goy) goy = goy + 65 EndFor FlashBackGround() tdy = 0 tdx = 0.25 EndSub '---------------------------------------------------------------------------------- Sub OpeningTitleCrawl 'Only do this on power up. If flag = 0 then 'Bonce the title down the screen tdy = tdy + 0.05 If tdy > 3.2 Then tdy = -1.6 EndIf goy = goy + tdy If gox > 55 Or gox < 0 Then tdx=tdx * -1 EndIf gox = gox + tdx 'Wrap at the edge of the screen If goy > GraphicsWindow.Height + (msgCnt * 50) + 50 Then goy = 0 EndIf For i = 1 To msgCnt shpy = 65 shpyOff = 0 Shapes.Move(shps[i], gox, goy - (i * shpy) - shpyOff) EndFor Else If flag = 1 Then For i = 1 To msgCnt Shapes.HideShape(shps[i]) EndFor EndIf EndIf EndSub '---------------------------------------------------------------------------------- Sub EnterInitials 'Prompt for initials when a high score has been earned If exiting <> "True" then initials = "" curWid = 50 curHei = 65 promptx = (GraphicsWindow.Width / 2) - (((curWid + 5) * 3) / 2) prompty = (GraphicsWindow.Height / 2) - 100 'Shapes used for consistantcy. Could easily have switch to drawtext. GraphicsWindow.BackgroundColor = "white" GraphicsWindow.FontName = "Tahoma" GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 20 titleinitials1 = Shapes.AddText("Enter initials for the") GraphicsWindow.FontSize = 30 titleinitials2 = Shapes.AddText("Leader Board") Shapes.Move(titleinitials1, 25, prompty - 100) Shapes.Move(titleinitials2, 25, prompty - 75) FlashBackGround() 'Create the cursors. Overly complicated to avoid repeating code with only color changing. cclrString = "cyan;magenta;yellow;" ccpos = Text.GetIndexOf(cclrString,";") curcnt = 0 While ccpos > 0 cclrnam = Text.GetSubText(cclrString,1,ccpos-1) cclrString = Text.GetSubTextToEnd(cclrString,ccpos+1) ccpos = Text.GetIndexOf(cclrString,";") GraphicsWindow.PenColor = cclrnam GraphicsWindow.BrushColor = cclrnam curcnt = curcnt + 1 cursor[curcnt] = Shapes.AddRectangle(curWid,curHei) Shapes.HideShape(cursor[curcnt]) EndWhile GraphicsWindow.FontName = "Courier New" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 70 cur = 1 pressed = "False" pos = 0 InitEntry = "true" While InitEntry = "True" Shapes.HideShape(cursor[cur]) cur = cur + 1 If cur > curcnt Then cur = 1 EndIf If pressed = "True" Then key = GraphicsWindow.LastKey If key = "Return" then InitEntry = "False" EndIf If key = "Space" then key = " " endif If Text.GetLength(key) = 2 and Text.GetSubText(key,1,1) = "D" then key = Text.GetSubTextToEnd(key,2) endif If (key = "Back" Or key = "Left") and pos > 0 then Shapes.HideShape(initialsShapes[pos]) Shapes.HideShape(initialsShadows[pos]) initials = Text.GetSubText(initials,1,Text.GetLength(initials)-1) pos = pos - 1 ElseIf pos < 3 then If Text.GetLength(key) = 1 then keycode = Text.GetCharacterCode(key) If keycode >= 97 And keycode <= 122 then keycode = keycode - 32 EndIf If keycode = 32 or (keycode >= 65 and keycode <= 90) or (keycode >= 48 and keycode < 57) then key = Text.GetCharacter(keycode) initials = initials + key GraphicsWindow.BrushColor = "darkgray" initialsShadows[pos+1] = Shapes.AddText(key) GraphicsWindow.BrushColor = "white" initialsShapes[pos+1] = Shapes.AddText(key) Shapes.Move(initialsShapes[pos+1],promptx + (((curWid + 5) * pos+1)) + 2,prompty) Shapes.Move(initialsShadows[pos+1],promptx + (((curWid + 5) * pos+1)) + 2 + 2,prompty + 2) pos = pos + 1 endif EndIf endif pressed = "False" EndIf Shapes.Move(cursor[cur],promptx + ((curWid + 5) * pos),prompty+5) Shapes.ShowShape(cursor[cur]) Program.Delay(50) EndWhile For ii = 1 To Text.GetLength(initials) Shapes.HideShape(initialsShapes[ii]) Shapes.HideShape(initialsShadows[ii]) EndFor For ii = 1 To curcnt Shapes.HideShape(cursor[ii]) EndFor Shapes.HideShape(titleinitials1) Shapes.HideShape(titleinitials2) EndIf endsub '---------------------------------------------------------------------------------- Sub SortScores 'Once a new score has been added to the leader board, 'place it in its correct location For si = 1 To 10 'a simple bubble sort For sj = 1 To 10 If highscore[si] > highscore[sj] Then holdscore = highscore[si] holdlevel = highlevel[si] holdname = highname[si] highscore[si] = highscore[sj] highlevel[si] = highlevel[sj] highname[si] = highname[sj] highscore[sj] = holdscore highlevel[sj] = holdlevel highname[sj] = holdname EndIf EndFor EndFor EndSub Sub FlashBackGround 'flash the background to make the white to hide the shape build seem on purpose For i = 1 To 10 GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Program.Delay(25) EndFor GraphicsWindow.BackgroundColor = "blue" EndSub '---------------------------------------------------------------------------------- Sub LoadHighScore 'Load high score from file. If no file present, go with codingCat's high scores. filename = Program.Directory + "\SBJumpScores.txt" ' The following line could be harmful and has been automatically commented. ' highname[1] = File.ReadLine(filename,1) ' The following line could be harmful and has been automatically commented. ' highscore[1] = File.ReadLine(filename,2) ' The following line could be harmful and has been automatically commented. ' highlevel[1] = File.ReadLine(filename,3) If highscore[1] <= 0 Or highlevel[1] <=0 Then 'Gotta beat codingCat for the top spot :-) highname[1] = "cC" highscore[1] = 3617783 highlevel[1] = 22 For ih = 2 To 10 highname[ih] = "cC" highscore[ih] = 0 highlevel[ih] = 0 EndFor Else For ih = 2 To 10 ' The following line could be harmful and has been automatically commented. ' highname[ih] = File.ReadLine(filename,((ih-1)*3)+1) ' The following line could be harmful and has been automatically commented. ' highscore[ih] = File.ReadLine(filename,((ih-1)*3)+2) ' The following line could be harmful and has been automatically commented. ' highlevel[ih] = File.ReadLine(filename,((ih-1)*3)+3) EndFor EndIf EndSub '---------------------------------------------------------------------------------- Sub UpdateHighScore 'If the current score beats the best, update the high score file If score > highscore[10] Then EnterInitials() highname[10] = initials highscore[10] = score highlevel[10] = level SortScores() filename = Program.Directory + "\SBJumpScores.txt" For ih = 0 To 9 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename,(ih*3) + 1,highname[ih+1]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename,(ih*3) + 2,highscore[ih+1]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename,(ih*3) + 3,highlevel[ih+1]) endfor EndIf EndSub '---------------------------------------------------------------------------------- '---------------------------------------------------------------------------------- 'Event Subroutines '---------------------------------------------------------------------------------- Sub OnKeyDown 'Take note of the fact that a key has been pressed pressed = "True" EndSub End>BCL208-4.sb< Start>BCL208-6.sb< 'SBJump - A cheap knock off of Doodle Jump written in SmallBasic 'Original Concept and Programming by Zock - Import Code: PGR013 'Current version by codingCat aka Matthew L. Parets '*** To enable to leader board system the file commands at the bottom '*** of the program will need to be uncommented 'As the game progresses the platforms get smaller. 'After a round at 15 pixels they reset to fifty and the game speeds up. 'Controls = Left, Right and Up keys flag = 0 LoadHighScore() Initialize() SetupTitleCrawl() 'Main Program Loop While exiting <> "True" LevelSet() GeneratePlatforms() frameStart = Clock.ElapsedMilliseconds 'Game Loop While gameOver <> "True" OpeningTitleCrawl() MoveBall() Bounce() KeyCheck() UpdateScore() 'Reached the top - Next Level If y <= -5 Then LevelUp() LevelSet() GeneratePlatforms() EndIf FrameDelay() endwhile UpdateHighScore() CreditCrawl() Initialize() endwhile Program.End() '---------------------------------------------------------------------------------- 'Subroutines '---------------------------------------------------------------------------------- '---------------------------------------------------------------------------------- Sub FrameDelay 'Loop will continue until delay has been reached. Because frameStart 'is set at the end of the last frame delay, the frames should be constantly 'the same regardless of the processing in each individual frame. '(ie shorter delays when more pressing is done) While Clock.ElapsedMilliseconds - frameStart < delay EndWhile frameStart = Clock.ElapsedMilliseconds EndSub '---------------------------------------------------------------------------------- Sub Bounce 'Check for bottom of window, bounce if new game, otherwise game over If (y > GraphicsWindow.height) Then If (start = "True") then dY = -3.2 Sound.PlayClick() Else Sound.PlayBellRing() gameOver = "True" EndIf EndIf 'Check to see if a bounce at a platform has occured If dy > 0 Then 'If moving downward (allows passing through platform on the way up. For ii = 1 To lineCnt 'check each platform 'if... in the middle of a platform (left to right), AND on a platform (up and down) - adjusted for speed If (x+5 > linex[ii] and x < linex[ii]+(linesize-5)) and (y+5 > liney[ii]-(dy/2) And y+5 < liney[ii]+(dy/2)) then dy = -3.2 'Reverse the direction Sound.PlayClick() score = score + 130 GraphicsWindow.Title = "L: " + level + " S: " + score start = "False" 'Once a platform is hit, the bottom of off limits EndIf EndFor EndIf EndSub '---------------------------------------------------------------------------------- Sub KeyCheck 'Check for changes based on user controls If pressed = "True" Then key = GraphicsWindow.LastKey If (key = "Right") Then flag = 1 'Disable the title crawl dx = 1 ElseIf (key = "Left") Then flag = 1 dx = -1 ElseIf (key = "Up") Then flag = 1 dx = 0 ElseIf key = "Escape" then gameOver = "True" exiting = "True" EndIf pressed = "False" EndIf EndSub '---------------------------------------------------------------------------------- Sub Initialize GraphicsWindow.Clear() 'Initial Setup lineCnt = 11 linesize = 50 start = "True" multiplier = 1.5 delay = 15 score = 0 level = 1 msgCnt = 0 dx = 0 'Setup the window GraphicsWindow.Height = 600 GraphicsWindow.Title = "SBJump" GraphicsWindow.Width = (20*10) + (linesize + 10) GraphicsWindow.BackgroundColor = "blue" GraphicsWindow.Top = Desktop.Height / 2 - GraphicsWindow.Height / 2 - 50 GraphicsWindow.left = Desktop.Width / 2 - GraphicsWindow.Width / 2 GraphicsWindow.BrushColor = "black" GraphicsWindow.fillRectangle(0,GraphicsWindow.Height-3,GraphicsWindow.Width,3) x = GraphicsWindow.Width / 2 'Set key event GraphicsWindow.KeyDown = OnKeyDown EndSub '---------------------------------------------------------------------------------- Sub GeneratePlatforms 'First platform copied from top platform after first level If start = "False" then lastx = linex[1] lasty = liney[1] endif 'Randomly generate the platforms. platlevl = 75 'Top platform just in range of the top of the screen For ii = 1 to lineCnt linex[ii] = (Math.GetRandomNumber(20) * 10) liney[ii] = platlevl + ((Math.GetRandomNumber(2) * 10) - 10) platlevl = platlevl + 50 endfor 'Start at the bottom If start = "False" then 'top becomes bottom linex[lineCnt] = lastx y = GraphicsWindow.Height - (GraphicsWindow.Height - liney[lineCnt]) Else y = GraphicsWindow.Height - 1 endif For i = 1 to lineCnt 'Display the new platforms GraphicsWindow.DrawLine(linex[i],liney[i],linex[i]+linesize,liney[i]) endfor Sound.PlayChimes() EndSub '---------------------------------------------------------------------------------- Sub LevelSet 'Setup for the start of a new level gameOver = "False" GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "red" GraphicsWindow.FontName = "Tahoma" ball = Shapes.AddEllipse(10,10) GraphicsWindow.PenWidth = 2 dy = -3.2 EndSub '---------------------------------------------------------------------------------- Sub LevelUp 'Set up for next level 'Multiply score, decrese the platform size, increase the speed score = math.Round(score * multiplier) level = level + 1 GraphicsWindow.Title = "L: " + level + " S: " + score 'Shrink the platform size If linesize > 15 then linesize = linesize - 5 Else 'Speed the game up linesize = 50 If delay > 1 then delay = delay - 2 endif endif GraphicsWindow.Clear() EndSub '---------------------------------------------------------------------------------- Sub MoveBall 'Update the location of the ball based on user input and 'current volocity x = x + dx y = y + dy Shapes.Move(ball, x,y) 'Wrap past the edges If x > GraphicsWindow.Width Then x = 0 EndIf If x < 0 Then x = GraphicsWindow.Width EndIf dy = dy + 0.05 'Increase the downward speed EndSub '---------------------------------------------------------------------------------- Sub UpdateScore 'Update the score If Math.Remainder(score,100) = 0 then GraphicsWindow.Title = "L: " + level + " S: " + score EndIf score = score - 1 If score < 0 Then score = 0 EndIf EndSub '---------------------------------------------------------------------------------- Sub CreditCrawl 'A WAY overly complicated way of creating the score and credit crawl 'because smallbasic lacks the option of multiple statements on one line, 'or brace notation for loading arrays. 'I hate lots of lines doing nothing but loading array indices. :-) GraphicsWindow.BackgroundColor = "White" scrloc = 0 msgCnt = 0 GraphicsWindow.FontName = "Tahoma" GraphicsWindow.BrushColor = "white" msgPos = 1 messages = " ``Score`30` ``Level Reached`30` ``Position`30` ``High Score`30`Game Over`42`------------------------------------``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``-lb-``------------------------------------``Leader Board`20`Press for New Game``No Rights Reserved ;-)``Product Parets Programming``codingCat and Zock``Programming by``Idea by Zock``SBJump``" While msgPos < Text.GetLength(messages) msgCnt = msgCnt + 1 messages = Text.GetSubTextToEnd(messages,msgPos) msgPos = Text.GetIndexOf(messages,"`") msgNxt = Text.GetSubText(messages,1,msgPos - 1) If Text.GetSubText(messages,msgPos+1,1) <> "`" then GraphicsWindow.FontSize = Text.GetSubText(messages,msgPos+1,2) msgPos = msgPos + 2 Else GraphicsWindow.FontSize = 15 EndIf msgPos = msgPos + 2 If msgNxt = "-lb-" Then msgNxt = (9-scrloc) + ") " + highname[10-scrloc] + Text.GetCharacter(9657) + highlevel[10-scrloc] + Text.GetCharacter(9657) + highscore[10-scrloc] scrloc = scrloc + 1 EndIf shps[msgCnt] = Shapes.AddText(msgNxt) EndWhile GraphicsWindow.FontSize = 20 shps[7] = Shapes.AddText(highname[1] + Text.GetCharacter(9657) + highlevel[1] + Text.GetCharacter(9657) + highscore[1]) 'All time High Score GraphicsWindow.FontSize = 30 shps[5] = Shapes.AddText(fndPos + " of " + extraCount) shps[3] = Shapes.AddText(level) 'This games max level shps[1] = Shapes.AddText(score) 'This games score 'Initial Credit Locations goy = msgCnt * -50 For i = 1 To msgCnt Shapes.Move(shps[i], 25, goy) goy = goy + 50 EndFor FlashBackGround() 'Crawl the Scores and Credits crawlspeed = 15 crawlstep = 1 key = "" While Key <> "Return" And key <> "Escape" And exiting <> "True" If pressed = "True" Then key = GraphicsWindow.LastKey If key = "Up" then If crawlstep = 1 then crawlspeed = crawlspeed + 5 Else crawlstep = crawlstep - 1 EndIf ElseIf key = "Down" then crawlspeed = crawlspeed - 5 If crawlspeed < 0 then crawlspeed = 0 crawlstep = crawlstep + 1 endif endif pressed = "False" EndIf goy = goy + crawlstep 'Wrap at the edge of the screen If goy > (GraphicsWindow.Height * 2) + (GraphicsWindow.Height + (7 * 50) + 200) Then goy = 0 EndIf For i = 1 To msgCnt shpy = 20 shpyOff = GraphicsWindow.Height * 2 If i < 10 Then 'Different offsets for different parts of the credits shpy = 50 shpyOff = 0 ElseIf i < 23 then shpyOff = GraphicsWindow.Height EndIf Shapes.Move(shps[i], 15, goy - (i * shpy) - shpyOff) EndFor Program.Delay(crawlspeed) EndWhile If key = "Escape" Then exiting = "True" EndIf EndSub '---------------------------------------------------------------------------------- Sub SetupTitleCrawl 'A slightly simplified version of the credit clawl GraphicsWindow.BackgroundColor = "White" msgCnt = 0 GraphicsWindow.BrushColor = "white" msgPos = 1 messages = "Keys: Left, Right, Up -- to exit`10`SBJump`50'" While msgPos < Text.GetLength(messages) msgCnt = msgCnt + 1 messages = Text.GetSubTextToEnd(messages,msgPos) msgPos = Text.GetIndexOf(messages,"`") msgNxt = Text.GetSubText(messages,1,msgPos - 1) GraphicsWindow.FontSize = Text.GetSubText(messages,msgPos+1,2) msgPos = msgPos + 4 shps[msgCnt] = Shapes.AddText(msgNxt) EndWhile 'Initial Credit Locations goy = msgCnt * -65 For i = 1 To msgCnt Shapes.Move(shps[i], 25, goy) goy = goy + 65 EndFor FlashBackGround() tdy = 0 tdx = 0.25 EndSub '---------------------------------------------------------------------------------- Sub OpeningTitleCrawl 'Only do this on power up. If flag = 0 then 'Bonce the title down the screen tdy = tdy + 0.05 If tdy > 3.2 Then tdy = -1.6 EndIf goy = goy + tdy If gox > 55 Or gox < 0 Then tdx=tdx * -1 EndIf gox = gox + tdx 'Wrap at the edge of the screen If goy > GraphicsWindow.Height + (msgCnt * 50) + 50 Then goy = 0 EndIf For i = 1 To msgCnt shpy = 65 shpyOff = 0 Shapes.Move(shps[i], gox, goy - (i * shpy) - shpyOff) EndFor Else If flag = 1 Then For i = 1 To msgCnt Shapes.HideShape(shps[i]) EndFor EndIf EndIf EndSub '---------------------------------------------------------------------------------- Sub EnterInitials 'Prompt for initials when a high score has been earned If exiting <> "True" then initials = "" curWid = 50 curHei = 65 promptx = (GraphicsWindow.Width / 2) - (((curWid + 5) * 3) / 2) prompty = (GraphicsWindow.Height / 2) - 100 'Shapes used for consistantcy. Could easily have switch to drawtext. GraphicsWindow.BackgroundColor = "white" GraphicsWindow.FontName = "Tahoma" GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize = 20 titleinitials1 = Shapes.AddText("Enter initials for the") GraphicsWindow.FontSize = 30 titleinitials2 = Shapes.AddText("Leader Board") Shapes.Move(titleinitials1, 25, prompty - 100) Shapes.Move(titleinitials2, 25, prompty - 75) FlashBackGround() 'Create the cursors. Overly complicated to avoid repeating code with only color changing. cclrString = "cyan;magenta;yellow;" ccpos = Text.GetIndexOf(cclrString,";") curcnt = 0 While ccpos > 0 cclrnam = Text.GetSubText(cclrString,1,ccpos-1) cclrString = Text.GetSubTextToEnd(cclrString,ccpos+1) ccpos = Text.GetIndexOf(cclrString,";") GraphicsWindow.PenColor = cclrnam GraphicsWindow.BrushColor = cclrnam curcnt = curcnt + 1 cursor[curcnt] = Shapes.AddRectangle(curWid,curHei) Shapes.HideShape(cursor[curcnt]) EndWhile GraphicsWindow.FontName = "Courier New" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 70 cur = 1 pressed = "False" pos = 0 InitEntry = "true" While InitEntry = "True" Shapes.HideShape(cursor[cur]) cur = cur + 1 If cur > curcnt Then cur = 1 EndIf If pressed = "True" Then key = GraphicsWindow.LastKey If key = "Return" then InitEntry = "False" EndIf If key = "Space" then key = " " endif If Text.GetLength(key) = 2 and Text.GetSubText(key,1,1) = "D" then key = Text.GetSubTextToEnd(key,2) endif If (key = "Back" Or key = "Left") and pos > 0 then Shapes.HideShape(initialsShapes[pos]) Shapes.HideShape(initialsShadows[pos]) initials = Text.GetSubText(initials,1,Text.GetLength(initials)-1) pos = pos - 1 ElseIf pos < 3 then If Text.GetLength(key) = 1 then keycode = Text.GetCharacterCode(key) If keycode >= 97 And keycode <= 122 then keycode = keycode - 32 EndIf If keycode = 32 or (keycode >= 65 and keycode <= 90) or (keycode >= 48 and keycode < 57) then key = Text.GetCharacter(keycode) initials = initials + key GraphicsWindow.BrushColor = "darkgray" initialsShadows[pos+1] = Shapes.AddText(key) GraphicsWindow.BrushColor = "white" initialsShapes[pos+1] = Shapes.AddText(key) Shapes.Move(initialsShapes[pos+1],promptx + (((curWid + 5) * pos+1)) + 2,prompty) Shapes.Move(initialsShadows[pos+1],promptx + (((curWid + 5) * pos+1)) + 2 + 2,prompty + 2) pos = pos + 1 endif EndIf endif pressed = "False" EndIf Shapes.Move(cursor[cur],promptx + ((curWid + 5) * pos),prompty+5) Shapes.ShowShape(cursor[cur]) Program.Delay(50) EndWhile For ii = 1 To Text.GetLength(initials) Shapes.HideShape(initialsShapes[ii]) Shapes.HideShape(initialsShadows[ii]) EndFor For ii = 1 To curcnt Shapes.HideShape(cursor[ii]) EndFor Shapes.HideShape(titleinitials1) Shapes.HideShape(titleinitials2) EndIf endsub '---------------------------------------------------------------------------------- Sub SortScores 'Once a new score has been added to the leader board, 'place it in its correct location For si = 1 To 10 'a simple bubble sort For sj = 1 To 10 If highscore[si] > highscore[sj] Then holdscore = highscore[si] holdlevel = highlevel[si] holdname = highname[si] highscore[si] = highscore[sj] highlevel[si] = highlevel[sj] highname[si] = highname[sj] highscore[sj] = holdscore highlevel[sj] = holdlevel highname[sj] = holdname EndIf EndFor EndFor EndSub Sub FlashBackGround 'flash the background to make the white to hide the shape build seem on purpose For i = 1 To 10 GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() Program.Delay(25) EndFor GraphicsWindow.BackgroundColor = "blue" EndSub '---------------------------------------------------------------------------------- Sub UpdateExtraScores spos = 0 fndPos = -1 found = "False" While spos < extraCount And fndPos = -1 spos = spos + 1 If extraScore[spos] = score Then fndPos = spos found = "True" EndIf If score > extraScore[spos] Then fndPos = spos EndIf EndWhile If found = "False" Then extraCount = extraCount + 1 If fndPos <> -1 Then For sei = extraCount To fndPos + 1 Step - 1 extraScore[sei] = extraScore[sei - 1] EndFor extraScore[spos] = score Else extraScore[extraCount] = score fndPos = extraCount EndIf EndIf EndSub '---------------------------------------------------------------------------------- Sub LoadHighScore 'Load high score from file. If no file present, go with codingCat's high scores. filename = Program.Directory + "\SBJumpScores.txt" ' The following line could be harmful and has been automatically commented. ' highname[1] = File.ReadLine(filename,1) ' The following line could be harmful and has been automatically commented. ' highscore[1] = File.ReadLine(filename,2) extraScore[1] = highscore[1] ' The following line could be harmful and has been automatically commented. ' highlevel[1] = File.ReadLine(filename,3) If highscore[1] <= 0 Or highlevel[1] <=0 Then 'Gotta beat codingCat for the top spot :-) highname[1] = "cC" highscore[1] = 2453721060 highlevel[1] = 38 For ih = 2 To 10 highname[ih] = "cC" highscore[ih] = 0 extraScore[ih] = 0 highlevel[ih] = 0 EndFor extraCount = 10 Else For ih = 2 To 10 ' The following line could be harmful and has been automatically commented. ' highname[ih] = File.ReadLine(filename,((ih-1)*3)+1) ' The following line could be harmful and has been automatically commented. ' highscore[ih] = File.ReadLine(filename,((ih-1)*3)+2) extraScore[ih] = highscore[ih] ' The following line could be harmful and has been automatically commented. ' highlevel[ih] = File.ReadLine(filename,((ih-1)*3)+3) EndFor ' The following line could be harmful and has been automatically commented. ' extraCount = File.ReadLine(filename,31) For ih = 11 To extraCount ' The following line could be harmful and has been automatically commented. ' extraScore[ih] = File.ReadLine(filename,31 - 10 + ih) EndFor EndIf EndSub '---------------------------------------------------------------------------------- Sub UpdateHighScore 'If the current score beats the best, update the high score file If score > highscore[10] Then EnterInitials() highname[10] = initials highscore[10] = score highlevel[10] = level SortScores() EndIf UpdateExtraScores() filename = Program.Directory + "\SBJumpScores.txt" For ih = 0 To 9 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename,(ih*3) + 1,highname[ih+1]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename,(ih*3) + 2,highscore[ih+1]) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename,(ih*3) + 3,highlevel[ih+1]) endfor ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename, 31, extraCount) For ih = 11 To extraCount + 10 ' The following line could be harmful and has been automatically commented. ' File.WriteLine(filename, 31 - 10 + ih, extraScore[ih]) EndFor EndSub '---------------------------------------------------------------------------------- '---------------------------------------------------------------------------------- 'Event Subroutines '---------------------------------------------------------------------------------- Sub OnKeyDown 'Take note of the fact that a key has been pressed pressed = "True" EndSub End>BCL208-6.sb< Start>BCM679-0.sb< Color="1=Blue;2=White;3=Yellow;4=Orange;5=Red" Size = 3 'TextWindow.ReadNumber() PosX="" PosY="" If Size = 3 Then GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Height = 800 GraphicsWindow.Width = 1400 For i=1 To 75 Retry: x = Math.GetRandomNumber(1350) y = Math.GetRandomNumber(750) s = Math.GetRandomNumber(30) If i>1 Then For j=1 To i-1 DR=Math.SquareRoot((x+s/2-PosX[j]-ss[j]/2)*(x+s/2-PosX[j]-ss[j]/2)+(y+s/2-PosY[j]-ss[j]/2)*(y+s/2-PosY[j]-ss[j]/2)) If DR<(ss[j]+s)/2 Then j=i-1 Goto Retry EndIf EndFor EndIf ss[i]=s PosX=PosX+i+"="+x+";" PosY=PosY+i+"="+Y+";" If s < 6 Then GraphicsWindow.BrushColor = "White" ElseIf s>=6 then c = Math.GetRandomNumber(5) GraphicsWindow.BrushColor=Color[c] EndIf GraphicsWindow.FillEllipse(x, y, s, s) EndFor EndIf End>BCM679-0.sb< Start>BCM679-1.sb< Color="1=Blue;2=White;3=Yellow;4=Orange;5=Red" Size = 3 'TextWindow.ReadNumber() PosX="" PosY="" If Size = 3 Then GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Height = 800 GraphicsWindow.Width = 1400 For i=1 To 75 Retry: x = Math.GetRandomNumber(1350) y = Math.GetRandomNumber(750) s = Math.GetRandomNumber(30) If i>1 Then For n=1 To i-1 DR=Math.SquareRoot((x+s/2-PosX[n]-ss[n]/2)*(x+s/2-PosX[n]-ss[n]/2)+(y+s/2-PosY[n]-ss[n]/2)*(y+s/2-PosY[n]-ss[n]/2)) If DR<(ss[n]+s)/2 Then n=i-1 Goto Retry EndIf EndFor EndIf ss[i]=s PosX[i]=x PosY[i]=Y If s < 6 Then GraphicsWindow.BrushColor = "White" ElseIf s>=6 then c = Math.GetRandomNumber(5) GraphicsWindow.BrushColor=Color[c] EndIf GraphicsWindow.FillEllipse(x, y, s, s) EndFor EndIf End>BCM679-1.sb< Start>BCM679.sb< Size = TextWindow.ReadNumber() If Size = 3 Then GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Height = 800 GraphicsWindow.Width = 1400 l = 75 Begin: While(l > 0) x = Math.GetRandomNumber(1350) y = Math.GetRandomNumber(750) s = Math.GetRandomNumber(30) If s < 6 Then GraphicsWindow.BrushColor = "White" ElseIf s > 5 Then c = Math.GetRandomNumber(5) If c = 1 Then GraphicsWindow.BrushColor = "Blue" EndIf If c = 2 Then GraphicsWindow.BrushColor = "White" EndIf If c = 3 Then GraphicsWindow.BrushColor = "Yellow EndIf If c = 4 Then GraphicsWindow.BrushColor = "Orange" EndIf If c = 5 Then GraphicsWindow.BrushColor = "Red" EndIf EndIf GraphicsWindow.FillEllipse(x, y, s, s) l = l - 1 EndWhile If(l < 1) Then Goto Begin EndIf EndIf End>BCM679.sb< Start>BCR563.sb< 'Draw Clock Face and digits GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Width = 800 GraphicsWindow.Height = 800 GW = GraphicsWindow.Width GH = GraphicsWindow.Height Radius = 300 X = GW/2 Y = GH/2 R0 = 270 R1 = 255 R2 = 240 GraphicsWindow.PenColor = "White" GraphicsWindow.PenWidth = 8 GraphicsWindow.DrawEllipse(55, 55, 685, 685) GraphicsWindow.Fontsize = 24 GraphicsWindow.DrawText (320,10, "Decimal Clock") Sides = 10 Angle = 360 / Sides 'Pi = 3.14159265359 'Radangle=angle / (2 * Math.Pi) RadAngle=Angle / 6.36619781 Increment=RadAngle 'Draw divisions around edge of ClockFace. Every fifth division is double length. For i =1 to 100 k = X-(R0*(Math.Sin(Radangle))) l = Y-(R0*(Math.Cos(Radangle))) GraphicsWindow.DrawLine(X,Y,k,l) RadAngle=(RadAngle+Increment) EndFor For i = 1 to 100 m = X-(R1*(Math.Sin(RadAngle/10))) n = Y-(R1*(Math.Cos(RadAngle/10))) GraphicsWindow.DrawLine(X,Y,m,n) RadAngle=(RadAngle+Increment) EndFor For i =1 to 20 p = X-(R0*(Math.Sin(RadAngle/2))) q = Y-(R0*(Math.Cos(RadAngle/2))) GraphicsWindow.DrawLine(X,Y,p,q) RadAngle=(RadAngle+Increment) EndFor 'Draw numerals 100 to 900 around outside of ClockFace GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(165, 165, 470, 470) GraphicsWindow.BrushColor = "Red" 'Add Numeral Zero to top of Clockface i=0 ClockNum[0] = Shapes.AddText(0) Shapes.Move(ClockNum[i],k-6,l-48) GraphicsWindow.PenColor = "Red" For i = 1 To 9 Step 1 Radians = Math.GetRadians(-i * 36 + 90) ClockNum[i] = Shapes.AddText(i*100) Shapes.Move(ClockNum[i],X-24+Radius*Math.Cos(Radians),Y-15-Radius*Math.Sin(Radians)) EndFor RadAngle = 0 'Home postion of both hands (Midnight) While 1=1 Update() Sound.PlayClick() Program.Delay(864) ' Never change this EndWhile ' Draw and move Hands according to specific time Sub Update 'Draw GreenHand Centre GraphicsWindow.Fontsize = 24 GraphicsWindow.BrushColor = "Green" GraphicsWindow.FillEllipse (X-10, Y-10, 20, 20) GraphicsWindow.Fontsize = 22 ' Get Julian date, Millidays expired since Midnight and write on the window DRadAngle=Angle / 6.36619781 JD = Clock.ElapsedMilliseconds / 1000 / 3600 / 24 + 2415020.0 GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawText (390,763,JDDisplay) JDDisplay = Math.Floor(1000000*JD) / 1000000 JDInteger = Math.Floor (JD) JDDecimal = JD-JDInteger Millidays = 1000*(JDDecimal) Microdays = 1000000*(JDDecimal) 'Millidays = Math.Ceiling (Millidays) 'Microdays = Math.Ceiling (Microdays) GraphicsWindow.BrushColor = "Turquoise" GraphicsWindow.DrawText (230,763, "Julian Day :") GraphicsWindow.DrawText (390,763,JDDisplay) Day = 1000000 * Microdays 'DeciDay = Day / 10 'CentiDay = Day / 100 MilliDay = Day / 1000 If MilliDay <> GreenValue Then Shapes.Remove(GreenHand) GreenValue = MilliDay / 10000000 DRadAngle=Angle / 10 GreenRadAngle = DRadAngle * GreenValue 'Current postion of GreenHand GraphicsWindow.PenColor = "Green" GraphicsWindow.PenWidth = 14 GreenHand = Shapes.AddLine(X,Y,X+Radius / 1.45 * Math.Cos(Math.GetRadians(GreenRadAngle-90)),Y+Radius / 1.5 * Math.Sin(Math.GetRadians(GreenRadAngle - 90))) GreenValue = GreenValue + 1 EndIf If MilliDay <> MagentaValue Then Shapes.Remove(MagentaHand) MagentaValue = MilliDay / 1000000 DRadAngle=Angle / 10 MagentaRadAngle = DRadAngle * MagentaValue 'Current postion of MagentaHand GraphicsWindow.PenColor = "Magenta" GraphicsWindow.PenWidth = 10 MagentaHand = Shapes.AddLine(X,Y,X+Radius / 1.40 * Math.Cos(Math.GetRadians(MagentaRadAngle-90)),Y+Radius / 1.40 * Math.Sin(Math.GetRadians(MagentaRadAngle - 90))) MagentaValue = MagentaValue + 1 EndIf If MilliDay <> RedValue Then Shapes.Remove(RedHand) RedValue = MilliDay / 100000 DRadAngle=Angle / 10 RedRadAngle = DRadAngle * RedValue 'Current postion of RedHand GraphicsWindow.PenColor = "Red" GraphicsWindow.PenWidth = 6 RedHand = Shapes.AddLine(X,Y,X+Radius / 1.35 * Math.Cos(Math.GetRadians(RedRadAngle - 90)),Y+Radius / 1.35 * Math.Sin(Math.GetRadians(RedRadAngle - 90))) RedValue = RedValue + 1 EndIf If MilliDay <> CyanValue Then Shapes.Remove(CyanHand) CyanValue = MilliDay / 10000 DRadAngle=Angle / 10 CyanRadAngle = DRadAngle * CyanValue 'Current postion of CyanHand GraphicsWindow.PenColor = "Cyan" GraphicsWindow.PenWidth = 2 CyanHand = Shapes.AddLine(X,Y,X+Radius / 1.28 * Math.Cos(Math.GetRadians(CyanRadAngle-90)),Y+Radius / 1.28 * Math.Sin(Math.GetRadians(CyanRadAngle-90))) CyanValue = CyanValue + 1 EndIf EndSub End>BCR563.sb< Start>BCV978.sb< GraphicsWindow.Left=1 GraphicsWindow.Top =1 GraphicsWindow.Width =1500 GraphicsWindow.Height=890 Ii= ImageList.LoadImage("e:\f1.png") 'LDImage.EffectGamma (Ii 0.9) aa=LDImage.SplitImage (Ii 13 12) i=1 zs=shapes.AddEllipse (90 60) Shapes.Zoom (zs 3 3) Shapes.Move (zs, -150,-200) LDEffect.DropShaddow (zs "color=darkblue") LDShapes.PenColour (zs "gold") For y=1 To 12 For x=1 to 13 fl[i]=aa[x][y] i=i+1 EndFor endfor ' 40 45 fa=ldtext.Split("0 64 10 43 127 12 71 129 25 40 141 79 57 145 38 0 0 0 70 44 149 0 0 0 0 0 17 124 0 119 79 0 0 63 2 98 9 144 1 13 108 51 51 63 42 0 0 0 0 0 0 0 0 110 92 128 3 3 130 0 " " ") cx=750 cy=450 zz=1 os=0 args=0 si=0 Sub stext si=si+1 stt[si]=Shapes.AddText(args[3]) shapes.Move (stt[si] args[1] args[2]) ff=ldtext.Split (args[4] ";") LDShapes.Font (stt[si] ff[1] ff[2] ff[3] ff[4]) LDShapes.PenColour (stt[si] ff[5]) If ff[6]="true" Then LDEffect.DropShaddow (stt[si] ff[7]) endif EndSub sttx=ldtext.Split (" ,Switzerland#(CH)#Conf.Helvetica ,Austria#(A/EU)#Österreich ,Czech R.#(CZ/EU) ,Polland#(PL/EU) ,Slovakia#(SK/EU) ,Hungary#(HU) ,Romania#(RO/EU) ,Bulgary#(BG/EU) ,Croatia#(HR/EU)#Hrvatska , Slovenia#(SI/EU),Italy#(IT/EU)#Italia ,France#(FR/EU) , Spain#(ES/EU), Portugal#(PO/EU) , , , ,Germany#(DE/EU)#Deutschland ,Denmark#(DK/EU) , , , , , , ,Belgium#(BE/EU)#Belgique ,The Netherlands#(NL/EU)#Holland, ,30 , , , , , , , ,Serbia#(RS), ,Bosnia&Herzegovina#(BA)#Bosna i Hercegovina (BIH) , , , , ,Cypar#(CY/EU) ," ",") sttx[34]="Greece#(GR)#Ελληνική Δημοκρατία#131 957 sttx[35]="Albania#(AL)#Republika e Shqipërisë#28 748 sttx[44]="Crete#(GR)#Κρήτη sttx[41]="Moldova#(MO)#Republica Moldova#33 846 sttx[43]="Ukraine#(UA)#Україна#603 628 sttx[42]=sttx[43] sttx[54]="K. of Morocco#(MA)#ⵍⵎⵖⵔⵉⴱ#710 850 sttx[55]="Algeria#(DZ)#ⵜⴰⵣⵣⴰⵢⵔⵉⵜ#2 381 741 sttx[56]="Republic of Tunisia#(TN)#الجمهورية التونسية#g 163,610 sttx[57]="Turkey#(TK)#Türkiye#783 356 sttx[58]=sttx[57] sttx[59]="Russia#(RU)#Росси́я#17 075 200 GraphicsWindow.BackgroundColor ="#00cccc Ii= ImageList.LoadImage("e:\euu.png") LDEvents.MouseWheel=mww wm="0=1\=1\\\=-165.0\\\;2\\\=1147.5\\\;\;2\=1\\\=-125.0\\\;2\\\=1062.5\\\;\;3\=1\\\=-37.5\\\;2\\\=1065.0\\\;\;4\=1\\\=45.0\\\;2\\\=1077.5\\\;\;5\=1\\\=150.0\\\;2\\\=1027.5\\\;\;6\=1\\\=162.5\\\;2\\\=907.5\\\;\;7\=1\\\=315.0\\\;2\\\=882.5\\\;\;8\=1\\\=342.5\\\;2\\\=792.5\\\;\;9\=1\\\=427.5\\\;2\\\=770.0\\\;\;10\=1\\\=485.0\\\;2\\\=832.5\\\;\;11\=1\\\=605.0\\\;2\\\=755.0\\\;\;12\=1\\\=785.0\\\;2\\\=692.5\\\;\;13\=1\\\=1047.5\\\;2\\\=877.5\\\;\;14\=1\\\=1070.0\\\;2\\\=987.5\\\;\;15\=1\\\=1185.0\\\;2\\\=957.5\\\;\;16\=1\\\=1330.0\\\;2\\\=932.5\\\;\;17\=1\\\=1372.5\\\;2\\\=815.0\\\;\;18\=1\\\=1460.0\\\;2\\\=537.5\\\;\;19\=1\\\=1600.0\\\;2\\\=547.5\\\;\;20\=1\\\=1677.5\\\;2\\\=457.5\\\;\;21\=1\\\=1775.0\\\;2\\\=407.5\\\;\;22\=1\\\=1762.5\\\;2\\\=540.0\\\;\;23\=1\\\=1755.0\\\;2\\\=582.5\\\;\;24\=1\\\=1837.5\\\;2\\\=600.0\\\;\;25\=1\\\=1837.5\\\;2\\\=797.5\\\;\;26\=1\\\=1612.5\\\;2\\\=887.5\\\;\;27\=1\\\=1442.5\\\;2\\\=1000.0\\\;\;28\=1\\\=1487.5\\\;2\\\=1147.5\\\;\;29\=1\\\=1585.0\\\;2\\\=1167.5\\\;\;30\=1\\\=1632.5\\\;2\\\=1107.5\\\;\;31\=1\\\=1727.5\\\;2\\\=1120.0\\\;\;32\=1\\\=1812.5\\\;2\\\=1065.0\\\;\;33\=1\\\=1852.5\\\;2\\\=1070.0\\\;\;34\=1\\\=1837.5\\\;2\\\=1330.0\\\;\;35\=1\\\=652.5\\\;2\\\=1332.5\\\;\;36\=1\\\=575.0\\\;2\\\=1232.5\\\;\;37\=1\\\=-55.0\\\;2\\\=1217.5\\\;\;38\=1\\\=-150.0\\\;2\\\=1177.5\\\;\;;1=1\=1\\\=501.1\\\;2\\\=660.6\\\;\;2\=1\\\=548.3\\\;2\\\=602.2\\\;\;3\=1\\\=645.6\\\;2\\\=608.3\\\;\;4\=1\\\=640.6\\\;2\\\=632.8\\\;\;5\=1\\\=674.4\\\;2\\\=646.7\\\;\;6\=1\\\=672.8\\\;2\\\=665.0\\\;\;7\=1\\\=660.0\\\;2\\\=681.1\\\;\;8\=1\\\=632.2\\\;2\\\=666.7\\\;\;9\=1\\\=612.8\\\;2\\\=697.2\\\;\;10\=1\\\=592.2\\\;2\\\=665.0\\\;\;11\=1\\\=569.4\\\;2\\\=690.6\\\;\;12\=1\\\=528.9\\\;2\\\=674.4\\\;\;13\=1\\\=529.4\\\;2\\\=655.6\\\;\;;2=1\=1\\\=644.8\\\;2\\\=607.6\\\;\;2\=1\\\=639.2\\\;2\\\=631.6\\\;\;3\=1\\\=674.0\\\;2\\\=646.0\\\;\;4\=1\\\=698.4\\\;2\\\=654.0\\\;\;5\=1\\\=742.0\\\;2\\\=641.2\\\;\;6\=1\\\=752.4\\\;2\\\=662.8\\\;\;7\=1\\\=831.6\\\;2\\\=682.8\\\;\;8\=1\\\=888.0\\\;2\\\=663.6\\\;\;9\=1\\\=932.8\\\;2\\\=590.0\\\;\;10\=1\\\=915.6\\\;2\\\=546.4\\\;\;11\=1\\\=855.2\\\;2\\\=540.0\\\;\;12\=1\\\=824.8\\\;2\\\=560.8\\\;\;13\=1\\\=806.8\\\;2\\\=552.4\\\;\;14\=1\\\=771.2\\\;2\\\=581.6\\\;\;15\=1\\\=776.8\\\;2\\\=614.0\\\;\;;3=1\=1\\\=805.7\\\;2\\\=552.4\\\;\;2\=1\\\=751.4\\\;2\\\=470.5\\\;\;3\=1\\\=850.5\\\;2\\\=423.3\\\;\;4\=1\\\=989.5\\\;2\\\=497.6\\\;\;5\=1\\\=919.5\\\;2\\\=556.2\\\;\;6\=1\\\=913.8\\\;2\\\=544.8\\\;\;7\=1\\\=854.8\\\;2\\\=538.6\\\;\;8\=1\\\=823.3\\\;2\\\=559.0\\\;\;;4=1\=1\\\=849.2\\\;2\\\=420.8\\\;\;2\=1\\\=840.0\\\;2\\\=277.7\\\;\;3\=1\\\=890.8\\\;2\\\=247.7\\\;\;4\=1\\\=906.2\\\;2\\\=230.0\\\;\;5\=1\\\=966.2\\\;2\\\=213.8\\\;\;6\=1\\\=972.3\\\;2\\\=238.5\\\;\;7\=1\\\=1103.1\\\;2\\\=220.8\\\;\;8\=1\\\=1120.0\\\;2\\\=232.3\\\;\;9\=1\\\=1149.2\\\;2\\\=308.5\\\;\;10\=1\\\=1146.2\\\;2\\\=384.6\\\;\;11\=1\\\=1169.2\\\;2\\\=424.6\\\;\;12\=1\\\=1125.4\\\;2\\\=515.4\\\;\;13\=1\\\=1068.5\\\;2\\\=500.0\\\;\;14\=1\\\=1027.7\\\;2\\\=516.2\\\;\;15\=1\\\=987.7\\\;2\\\=495.4\\\;\;;5=1\=1\\\=919.4\\\;2\\\=556.5\\\;\;2\=1\\\=989.4\\\;2\\\=495.3\\\;\;3\=1\\\=1026.5\\\;2\\\=515.3\\\;\;4\=1\\\=1067.6\\\;2\\\=498.2\\\;\;5\=1\\\=1123.5\\\;2\\\=512.9\\\;\;6\=1\\\=1120.0\\\;2\\\=554.7\\\;\;7\=1\\\=1069.4\\\;2\\\=548.8\\\;\;8\=1\\\=991.8\\\;2\\\=587.1\\\;\;9\=1\\\=994.1\\\;2\\\=599.4\\\;\;10\=1\\\=957.1\\\;2\\\=600.6\\\;\;11\=1\\\=931.2\\\;2\\\=588.8\\\;\;;6=1\=1\\\=896.5\\\;2\\\=649.4\\\;\;2\=1\\\=912.4\\\;2\\\=674.7\\\;\;3\=1\\\=963.5\\\;2\\\=715.3\\\;\;4\=1\\\=988.2\\\;2\\\=717.1\\\;\;5\=1\\\=1032.9\\\;2\\\=691.2\\\;\;6\=1\\\=1060.6\\\;2\\\=689.4\\\;\;7\=1\\\=1097.1\\\;2\\\=662.4\\\;\;8\=1\\\=1147.6\\\;2\\\=576.5\\\;\;9\=1\\\=1119.4\\\;2\\\=554.1\\\;\;10\=1\\\=1070.0\\\;2\\\=548.8\\\;\;11\=1\\\=992.9\\\;2\\\=585.9\\\;\;12\=1\\\=992.4\\\;2\\\=598.2\\\;\;13\=1\\\=956.5\\\;2\\\=600.6\\\;\;14\=1\\\=930.0\\\;2\\\=588.8\\\;\;;7=1\=1\\\=1059.0\\\;2\\\=690.0\\\;\;2\=1\\\=1111.8\\\;2\\\=738.0\\\;\;3\=1\\\=1121.4\\\;2\\\=768.0\\\;\;4\=1\\\=1170.6\\\;2\\\=784.2\\\;\;5\=1\\\=1283.4\\\;2\\\=802.8\\\;\;6\=1\\\=1370.4\\\;2\\\=762.0\\\;\;7\=1\\\=1419.0\\\;2\\\=768.0\\\;\;8\=1\\\=1423.8\\\;2\\\=705.0\\\;\;9\=1\\\=1448.4\\\;2\\\=693.6\\\;\;10\=1\\\=1449.0\\\;2\\\=681.6\\\;\;11\=1\\\=1432.8\\\;2\\\=666.6\\\;\;12\=1\\\=1388.4\\\;2\\\=684.0\\\;\;13\=1\\\=1360.8\\\;2\\\=634.2\\\;\;14\=1\\\=1367.4\\\;2\\\=618.0\\\;\;15\=1\\\=1289.4\\\;2\\\=531.6\\\;\;16\=1\\\=1223.4\\\;2\\\=573.0\\\;\;17\=1\\\=1146.0\\\;2\\\=573.6\\\;\;18\=1\\\=1095.0\\\;2\\\=661.2\\\;\;;8=1\=1\\\=1169.4\\\;2\\\=786.0\\\;\;2\=1\\\=1156.8\\\;2\\\=810.0\\\;\;3\=1\\\=1191.0\\\;2\\\=842.4\\\;\;4\=1\\\=1171.2\\\;2\\\=869.4\\\;\;5\=1\\\=1171.8\\\;2\\\=899.4\\\;\;6\=1\\\=1189.2\\\;2\\\=911.4\\\;\;7\=1\\\=1203.6\\\;2\\\=927.0\\\;\;8\=1\\\=1197.0\\\;2\\\=951.0\\\;\;9\=1\\\=1340.4\\\;2\\\=923.4\\\;\;10\=1\\\=1349.4\\\;2\\\=902.4\\\;\;11\=1\\\=1384.2\\\;2\\\=871.8\\\;\;12\=1\\\=1421.4\\\;2\\\=872.4\\\;\;13\=1\\\=1397.4\\\;2\\\=844.8\\\;\;14\=1\\\=1410.6\\\;2\\\=831.0\\\;\;15\=1\\\=1406.4\\\;2\\\=799.8\\\;\;16\=1\\\=1428.0\\\;2\\\=780.0\\\;\;17\=1\\\=1417.8\\\;2\\\=765.0\\\;\;18\=1\\\=1369.8\\\;2\\\=760.8\\\;\;19\=1\\\=1281.6\\\;2\\\=802.2\\\;\;;9=1\=1\\\=984.6\\\;2\\\=894.0\\\;\;2\=1\\\=964.2\\\;2\\\=879.0\\\;\;3\=1\\\=929.4\\\;2\\\=879.6\\\;\;4\=1\\\=962.4\\\;2\\\=869.4\\\;\;5\=1\\\=947.4\\\;2\\\=859.2\\\;\;6\=1\\\=919.8\\\;2\\\=846.0\\\;\;7\=1\\\=903.0\\\;2\\\=848.4\\\;\;8\=1\\\=861.0\\\;2\\\=806.4\\\;\;9\=1\\\=876.0\\\;2\\\=799.2\\\;\;10\=1\\\=858.6\\\;2\\\=780.0\\\;\;11\=1\\\=855.0\\\;2\\\=756.0\\\;\;12\=1\\\=832.8\\\;2\\\=742.2\\\;\;13\=1\\\=815.4\\\;2\\\=772.2\\\;\;14\=1\\\=805.8\\\;2\\\=760.2\\\;\;15\=1\\\=801.0\\\;2\\\=734.4\\\;\;16\=1\\\=832.2\\\;2\\\=730.2\\\;\;17\=1\\\=859.2\\\;2\\\=738.0\\\;\;18\=1\\\=867.6\\\;2\\\=727.2\\\;\;19\=1\\\=881.4\\\;2\\\=693.6\\\;\;20\=1\\\=913.2\\\;2\\\=672.6\\\;\;21\=1\\\=961.8\\\;2\\\=712.8\\\;\;22\=1\\\=986.4\\\;2\\\=716.4\\\;\;23\=1\\\=1003.8\\\;2\\\=705.6\\\;\;24\=1\\\=1016.4\\\;2\\\=758.4\\\;\;25\=1\\\=936.6\\\;2\\\=744.6\\\;\;26\=1\\\=903.6\\\;2\\\=761.4\\\;\;27\=1\\\=883.2\\\;2\\\=750.0\\\;\;28\=1\\\=882.6\\\;2\\\=776.4\\\;\;29\=1\\\=898.2\\\;2\\\=789.0\\\;\;30\=1\\\=904.8\\\;2\\\=810.0\\\;\;31\=1\\\=948.6\\\;2\\\=844.8\\\;\;32\=1\\\=948.6\\\;2\\\=856.8\\\;\;33\=1\\\=966.0\\\;2\\\=868.2\\\;\;34\=1\\\=987.0\\\;2\\\=887.4\\\;\;;10=1\=1\\\=797.4\\\;2\\\=730.8\\\;\;2\=1\\\=804.0\\\;2\\\=721.2\\\;\;3\=1\\\=789.0\\\;2\\\=690.6\\\;\;4\=1\\\=804.0\\\;2\\\=675.6\\\;\;5\=1\\\=832.2\\\;2\\\=682.8\\\;\;6\=1\\\=886.2\\\;2\\\=663.0\\\;\;7\=1\\\=895.2\\\;2\\\=645.6\\\;\;8\=1\\\=909.6\\\;2\\\=673.2\\\;\;9\=1\\\=880.2\\\;2\\\=691.8\\\;\;10\=1\\\=858.0\\\;2\\\=733.8\\\;\;11\=1\\\=834.6\\\;2\\\=728.4\\\;\;;11=1\=1\\\=543.6\\\;2\\\=808.2\\\;\;2\=1\\\=519.0\\\;2\\\=768.0\\\;\;3\=1\\\=541.2\\\;2\\\=678.6\\\;\;4\=1\\\=565.8\\\;2\\\=687.6\\\;\;5\=1\\\=592.2\\\;2\\\=664.2\\\;\;6\=1\\\=611.4\\\;2\\\=693.6\\\;\;7\=1\\\=632.4\\\;2\\\=666.6\\\;\;8\=1\\\=660.0\\\;2\\\=676.2\\\;\;9\=1\\\=670.8\\\;2\\\=661.8\\\;\;10\=1\\\=673.8\\\;2\\\=643.8\\\;\;11\=1\\\=699.0\\\;2\\\=654.0\\\;\;12\=1\\\=741.6\\\;2\\\=641.4\\\;\;13\=1\\\=749.4\\\;2\\\=661.8\\\;\;14\=1\\\=803.4\\\;2\\\=673.8\\\;\;15\=1\\\=789.0\\\;2\\\=688.8\\\;\;16\=1\\\=800.4\\\;2\\\=718.8\\\;\;17\=1\\\=751.2\\\;2\\\=733.8\\\;\;18\=1\\\=754.8\\\;2\\\=766.8\\\;\;19\=1\\\=746.4\\\;2\\\=779.4\\\;\;20\=1\\\=749.4\\\;2\\\=804.0\\\;\;21\=1\\\=801.6\\\;2\\\=844.8\\\;\;22\=1\\\=818.4\\\;2\\\=896.4\\\;\;23\=1\\\=840.0\\\;2\\\=925.2\\\;\;24\=1\\\=912.0\\\;2\\\=942.0\\\;\;25\=1\\\=900.0\\\;2\\\=959.4\\\;\;26\=1\\\=1015.2\\\;2\\\=1027.2\\\;\;27\=1\\\=1020.0\\\;2\\\=1040.4\\\;\;28\=1\\\=1010.4\\\;2\\\=1057.2\\\;\;29\=1\\\=998.4\\\;2\\\=1054.2\\\;\;30\=1\\\=993.0\\\;2\\\=1035.0\\\;\;31\=1\\\=958.2\\\;2\\\=1026.6\\\;\;32\=1\\\=931.2\\\;2\\\=1064.4\\\;\;33\=1\\\=945.0\\\;2\\\=1071.0\\\;\;34\=1\\\=958.8\\\;2\\\=1084.8\\\;\;35\=1\\\=962.4\\\;2\\\=1112.4\\\;\;36\=1\\\=941.4\\\;2\\\=1118.4\\\;\;37\=1\\\=931.8\\\;2\\\=1145.4\\\;\;38\=1\\\=910.2\\\;2\\\=1174.2\\\;\;39\=1\\\=890.4\\\;2\\\=1173.6\\\;\;40\=1\\\=892.2\\\;2\\\=1158.6\\\;\;41\=1\\\=915.6\\\;2\\\=1119.0\\\;\;42\=1\\\=887.4\\\;2\\\=1050.6\\\;\;43\=1\\\=854.4\\\;2\\\=1035.6\\\;\;44\=1\\\=801.0\\\;2\\\=980.4\\\;\;45\=1\\\=755.4\\\;2\\\=969.6\\\;\;46\=1\\\=668.4\\\;2\\\=873.0\\\;\;47\=1\\\=657.0\\\;2\\\=808.8\\\;\;48\=1\\\=599.4\\\;2\\\=777.0\\\;\;49\=1\\\=570.6\\\;2\\\=807.0\\\;\;;12=1\=1\\\=540.0\\\;2\\\=804.4\\\;\;2\=1\\\=487.5\\\;2\\\=844.7\\\;\;3\=1\\\=406.9\\\;2\\\=800.6\\\;\;4\=1\\\=354.4\\\;2\\\=816.6\\\;\;5\=1\\\=351.6\\\;2\\\=861.6\\\;\;6\=1\\\=283.1\\\;2\\\=840.0\\\;\;7\=1\\\=285.0\\\;2\\\=825.9\\\;\;8\=1\\\=273.8\\\;2\\\=828.8\\\;\;9\=1\\\=211.9\\\;2\\\=802.5\\\;\;10\=1\\\=157.5\\\;2\\\=747.2\\\;\;11\=1\\\=177.2\\\;2\\\=739.7\\\;\;12\=1\\\=227.8\\\;2\\\=608.4\\\;\;13\=1\\\=200.6\\\;2\\\=518.4\\\;\;14\=1\\\=139.7\\\;2\\\=465.0\\\;\;15\=1\\\=150.0\\\;2\\\=429.4\\\;\;16\=1\\\=211.9\\\;2\\\=454.7\\\;\;17\=1\\\=256.9\\\;2\\\=464.1\\\;\;18\=1\\\=263.4\\\;2\\\=429.4\\\;\;19\=1\\\=255.0\\\;2\\\=403.1\\\;\;20\=1\\\=285.9\\\;2\\\=429.4\\\;\;21\=1\\\=304.7\\\;2\\\=445.3\\\;\;22\=1\\\=382.5\\\;2\\\=407.8\\\;\;23\=1\\\=397.5\\\;2\\\=381.6\\\;\;24\=1\\\=421.9\\\;2\\\=375.0\\\;\;25\=1\\\=494.1\\\;2\\\=460.3\\\;\;26\=1\\\=522.2\\\;2\\\=478.1\\\;\;27\=1\\\=542.8\\\;2\\\=490.3\\\;\;28\=1\\\=598.1\\\;2\\\=523.1\\\;\;29\=1\\\=569.1\\\;2\\\=601.9\\\;\;30\=1\\\=546.6\\\;2\\\=601.9\\\;\;31\=1\\\=504.4\\\;2\\\=657.2\\\;\;32\=1\\\=524.1\\\;2\\\=654.4\\\;\;33\=1\\\=528.8\\\;2\\\=666.6\\\;\;34\=1\\\=538.1\\\;2\\\=679.7\\\;\;35\=1\\\=519.4\\\;2\\\=769.7\\\;\;;13=1\=1\\\=346.9\\\;2\\\=862.5\\\;\;2\=1\\\=338.4\\\;2\\\=898.1\\\;\;3\=1\\\=232.5\\\;2\\\=915.0\\\;\;4\=1\\\=154.7\\\;2\\\=991.9\\\;\;5\=1\\\=169.7\\\;2\\\=1035.0\\\;\;6\=1\\\=106.9\\\;2\\\=1088.4\\\;\;7\=1\\\=26.2\\\;2\\\=1124.1\\\;\;8\=1\\\=-79.7\\\;2\\\=1089.4\\\;\;9\=1\\\=-141.6\\\;2\\\=1110.0\\\;\;10\=1\\\=-177.2\\\;2\\\=1029.4\\\;\;11\=1\\\=-217.5\\\;2\\\=1013.4\\\;\;12\=1\\\=-151.9\\\;2\\\=919.7\\\;\;13\=1\\\=-156.6\\\;2\\\=870.0\\\;\;14\=1\\\=-139.7\\\;2\\\=881.2\\\;\;15\=1\\\=-80.6\\\;2\\\=799.7\\\;\;16\=1\\\=-55.3\\\;2\\\=787.5\\\;\;17\=1\\\=-75.0\\\;2\\\=776.2\\\;\;18\=1\\\=-74.1\\\;2\\\=759.4\\\;\;19\=1\\\=-156.6\\\;2\\\=726.6\\\;\;20\=1\\\=-122.8\\\;2\\\=649.7\\\;\;21\=1\\\=-71.2\\\;2\\\=643.1\\\;\;22\=1\\\=101.2\\\;2\\\=735.9\\\;\;23\=1\\\=155.6\\\;2\\\=748.1\\\;\;24\=1\\\=210.9\\\;2\\\=801.6\\\;\;25\=1\\\=273.8\\\;2\\\=825.9\\\;\;26\=1\\\=269.1\\\;2\\\=834.4\\\;\;27\=1\\\=274.7\\\;2\\\=840.9\\\;\;28\=1\\\=283.1\\\;2\\\=837.2\\\;\;;14=1\=1\\\=-218.4\\\;2\\\=1009.7\\\;\;2\=1\\\=-283.1\\\;2\\\=984.4\\\;\;3\=1\\\=-237.2\\\;2\\\=911.2\\\;\;4\=1\\\=-255.0\\\;2\\\=874.7\\\;\;5\=1\\\=-162.2\\\;2\\\=771.6\\\;\;6\=1\\\=-158.4\\\;2\\\=726.6\\\;\;7\=1\\\=-75.9\\\;2\\\=758.4\\\;\;8\=1\\\=-76.9\\\;2\\\=774.4\\\;\;9\=1\\\=-59.1\\\;2\\\=785.6\\\;\;10\=1\\\=-79.7\\\;2\\\=795.9\\\;\;11\=1\\\=-138.8\\\;2\\\=878.4\\\;\;12\=1\\\=-160.3\\\;2\\\=866.2\\\;\;13\=1\\\=-153.8\\\;2\\\=915.0\\\;\;;15=1\=1\\\=390.0\\\;2\\\=362.6\\\;\;2\=1\\\=345.3\\\;2\\\=376.6\\\;\;3\=1\\\=317.9\\\;2\\\=361.3\\\;\;4\=1\\\=227.9\\\;2\\\=343.4\\\;\;5\=1\\\=205.5\\\;2\\\=360.6\\\;\;6\=1\\\=144.9\\\;2\\\=346.0\\\;\;7\=1\\\=208.1\\\;2\\\=305.1\\\;\;8\=1\\\=237.4\\\;2\\\=314.7\\\;\;9\=1\\\=275.1\\\;2\\\=292.3\\\;\;10\=1\\\=236.8\\\;2\\\=300.0\\\;\;11\=1\\\=183.2\\\;2\\\=258.5\\\;\;12\=1\\\=224.7\\\;2\\\=241.9\\\;\;13\=1\\\=240.6\\\;2\\\=216.4\\\;\;14\=1\\\=236.8\\\;2\\\=182.6\\\;\;15\=1\\\=280.2\\\;2\\\=200.4\\\;\;16\=1\\\=302.6\\\;2\\\=159.6\\\;\;17\=1\\\=282.8\\\;2\\\=133.4\\\;\;18\=1\\\=299.4\\\;2\\\=113.6\\\;\;19\=1\\\=245.1\\\;2\\\=107.9\\\;\;20\=1\\\=275.1\\\;2\\\=74.0\\\;\;21\=1\\\=263.0\\\;2\\\=42.1\\\;\;22\=1\\\=266.2\\\;2\\\=5.7\\\;\;23\=1\\\=282.1\\\;2\\\=-49.8\\\;\;24\=1\\\=369.6\\\;2\\\=-70.2\\\;\;25\=1\\\=358.7\\\;2\\\=-50.4\\\;\;26\=1\\\=334.5\\\;2\\\=-35.7\\\;\;27\=1\\\=330.0\\\;2\\\=-21.7\\\;\;28\=1\\\=391.9\\\;2\\\=-5.7\\\;\;29\=1\\\=343.4\\\;2\\\=45.3\\\;\;30\=1\\\=345.3\\\;2\\\=58.1\\\;\;31\=1\\\=315.3\\\;2\\\=62.6\\\;\;32\=1\\\=352.3\\\;2\\\=83.0\\\;\;33\=1\\\=360.6\\\;2\\\=104.7\\\;\;34\=1\\\=358.1\\\;2\\\=144.9\\\;\;35\=1\\\=388.7\\\;2\\\=236.2\\\;\;36\=1\\\=372.1\\\;2\\\=253.4\\\;\;37\=1\\\=378.5\\\;2\\\=265.5\\\;\;38\=1\\\=390.6\\\;2\\\=254.0\\\;\;39\=1\\\=417.4\\\;2\\\=266.8\\\;\;40\=1\\\=424.5\\\;2\\\=287.2\\\;\;41\=1\\\=409.1\\\;2\\\=315.3\\\;\;42\=1\\\=370.2\\\;2\\\=336.4\\\;\;43\=1\\\=375.3\\\;2\\\=345.3\\\;\;44\=1\\\=395.7\\\;2\\\=349.8\\\;\;;16=1\=1\\\=189.6\\\;2\\\=134.7\\\;\;2\=1\\\=185.7\\\;2\\\=178.1\\\;\;3\=1\\\=162.1\\\;2\\\=215.7\\\;\;4\=1\\\=160.2\\\;2\\\=226.0\\\;\;5\=1\\\=119.4\\\;2\\\=210.0\\\;\;6\=1\\\=46.0\\\;2\\\=219.6\\\;\;7\=1\\\=31.3\\\;2\\\=172.3\\\;\;8\=1\\\=61.3\\\;2\\\=166.0\\\;\;9\=1\\\=97.0\\\;2\\\=136.6\\\;\;10\=1\\\=74.7\\\;2\\\=107.9\\\;\;11\=1\\\=92.6\\\;2\\\=98.3\\\;\;12\=1\\\=91.3\\\;2\\\=75.3\\\;\;13\=1\\\=127.7\\\;2\\\=94.5\\\;\;14\=1\\\=147.4\\\;2\\\=81.1\\\;\;15\=1\\\=133.4\\\;2\\\=67.7\\\;\;16\=1\\\=156.4\\\;2\\\=58.1\\\;\;17\=1\\\=178.1\\\;2\\\=53.6\\\;\;18\=1\\\=178.7\\\;2\\\=70.2\\\;\;19\=1\\\=165.3\\\;2\\\=81.7\\\;\;20\=1\\\=151.3\\\;2\\\=83.0\\\;\;21\=1\\\=151.9\\\;2\\\=93.8\\\;\;22\=1\\\=137.9\\\;2\\\=95.7\\\;\;23\=1\\\=141.7\\\;2\\\=110.4\\\;\;24\=1\\\=163.4\\\;2\\\=118.1\\\;\;25\=1\\\=175.5\\\;2\\\=106.0\\\;\;26\=1\\\=181.3\\\;2\\\=130.2\\\;\;;17=1\=1\\\=190.9\\\;2\\\=134.0\\\;\;2\=1\\\=219.6\\\;2\\\=130.2\\\;\;3\=1\\\=231.7\\\;2\\\=108.5\\\;\;4\=1\\\=223.4\\\;2\\\=90.6\\\;\;5\=1\\\=221.5\\\;2\\\=74.0\\\;\;6\=1\\\=199.8\\\;2\\\=68.3\\\;\;7\=1\\\=190.2\\\;2\\\=53.6\\\;\;8\=1\\\=178.7\\\;2\\\=52.3\\\;\;9\=1\\\=178.1\\\;2\\\=70.2\\\;\;10\=1\\\=164.7\\\;2\\\=81.1\\\;\;11\=1\\\=152.6\\\;2\\\=82.3\\\;\;12\=1\\\=149.4\\\;2\\\=91.3\\\;\;13\=1\\\=139.1\\\;2\\\=96.4\\\;\;14\=1\\\=141.1\\\;2\\\=108.5\\\;\;15\=1\\\=159.6\\\;2\\\=114.3\\\;\;16\=1\\\=174.3\\\;2\\\=104.7\\\;\;17\=1\\\=180.0\\\;2\\\=129.6\\\;\;;18=1\=1\\\=840.7\\\;2\\\=280.2\\\;\;2\=1\\\=850.2\\\;2\\\=421.5\\\;\;3\=1\\\=751.5\\\;2\\\=466.1\\\;\;4\=1\\\=802.7\\\;2\\\=549.5\\\;\;5\=1\\\=770.5\\\;2\\\=582.4\\\;\;6\=1\\\=771.2\\\;2\\\=612.4\\\;\;7\=1\\\=567.8\\\;2\\\=602.2\\\;\;8\=1\\\=597.1\\\;2\\\=525.4\\\;\;9\=1\\\=542.9\\\;2\\\=488.0\\\;\;10\=1\\\=546.6\\\;2\\\=466.1\\\;\;11\=1\\\=535.6\\\;2\\\=454.4\\\;\;12\=1\\\=542.9\\\;2\\\=439.0\\\;\;13\=1\\\=548.8\\\;2\\\=421.5\\\;\;14\=1\\\=538.5\\\;2\\\=407.6\\\;\;15\=1\\\=548.8\\\;2\\\=384.9\\\;\;16\=1\\\=546.6\\\;2\\\=357.8\\\;\;17\=1\\\=574.4\\\;2\\\=349.0\\\;\;18\=1\\\=600.7\\\;2\\\=281.0\\\;\;19\=1\\\=611.7\\\;2\\\=259.0\\\;\;20\=1\\\=677.6\\\;2\\\=262.0\\\;\;21\=1\\\=660.7\\\;2\\\=201.2\\\;\;22\=1\\\=695.9\\\;2\\\=213.7\\\;\;23\=1\\\=706.1\\\;2\\\=228.3\\\;\;24\=1\\\=735.4\\\;2\\\=236.3\\\;\;25\=1\\\=732.4\\\;2\\\=251.0\\\;\;26\=1\\\=758.0\\\;2\\\=248.8\\\;\;27\=1\\\=787.3\\\;2\\\=236.3\\\;\;28\=1\\\=810.0\\\;2\\\=223.9\\\;\;29\=1\\\=817.3\\\;2\\\=242.2\\\;\;30\=1\\\=804.1\\\;2\\\=248.0\\\;\;31\=1\\\=807.8\\\;2\\\=253.2\\\;\;32\=1\\\=823.2\\\;2\\\=250.2\\\;\;;19=1\=1\\\=660.7\\\;2\\\=199.0\\\;\;2\=1\\\=673.2\\\;2\\\=175.6\\\;\;3\=1\\\=657.8\\\;2\\\=147.1\\\;\;4\=1\\\=663.7\\\;2\\\=103.9\\\;\;5\=1\\\=678.3\\\;2\\\=78.3\\\;\;6\=1\\\=698.8\\\;2\\\=79.8\\\;\;7\=1\\\=717.8\\\;2\\\=62.9\\\;\;8\=1\\\=736.8\\\;2\\\=57.1\\\;\;9\=1\\\=733.2\\\;2\\\=66.6\\\;\;10\=1\\\=731.5\\\;2\\\=83.1\\\;\;11\=1\\\=720.6\\\;2\\\=94.0\\\;\;12\=1\\\=720.6\\\;2\\\=108.5\\\;\;13\=1\\\=720.0\\\;2\\\=116.5\\\;\;14\=1\\\=739.0\\\;2\\\=120.6\\\;\;15\=1\\\=731.5\\\;2\\\=139.0\\\;\;16\=1\\\=716.5\\\;2\\\=139.6\\\;\;17\=1\\\=711.9\\\;2\\\=152.9\\\;\;18\=1\\\=709.0\\\;2\\\=161.5\\\;\;19\=1\\\=723.5\\\;2\\\=169.6\\\;\;20\=1\\\=729.8\\\;2\\\=180.6\\\;\;21\=1\\\=729.8\\\;2\\\=189.2\\\;\;22\=1\\\=726.9\\\;2\\\=200.2\\\;\;23\=1\\\=706.7\\\;2\\\=193.3\\\;\;24\=1\\\=697.5\\\;2\\\=176.5\\\;\;25\=1\\\=693.5\\\;2\\\=188.1\\\;\;26\=1\\\=701.5\\\;2\\\=197.3\\\;\;27\=1\\\=696.3\\\;2\\\=213.5\\\;\;;20=1\=1\\\=793.8\\\;2\\\=184.9\\\;\;2\=1\\\=797.0\\\;2\\\=163.8\\\;\;3\=1\\\=792.2\\\;2\\\=111.1\\\;\;4\=1\\\=758.9\\\;2\\\=-6.5\\\;\;5\=1\\\=767.8\\\;2\\\=-51.9\\\;\;6\=1\\\=793.0\\\;2\\\=-77.8\\\;\;7\=1\\\=783.2\\\;2\\\=-243.2\\\;\;8\=1\\\=809.2\\\;2\\\=-270.0\\\;\;9\=1\\\=827.0\\\;2\\\=-268.4\\\;\;10\=1\\\=830.3\\\;2\\\=-287.8\\\;\;11\=1\\\=824.6\\\;2\\\=-295.9\\\;\;12\=1\\\=842.4\\\;2\\\=-340.5\\\;\;13\=1\\\=841.6\\\;2\\\=-373.0\\\;\;14\=1\\\=861.1\\\;2\\\=-384.3\\\;\;15\=1\\\=875.7\\\;2\\\=-428.1\\\;\;16\=1\\\=868.4\\\;2\\\=-459.7\\\;\;17\=1\\\=917.8\\\;2\\\=-521.4\\\;\;18\=1\\\=990.8\\\;2\\\=-529.5\\\;\;19\=1\\\=1023.2\\\;2\\\=-446.8\\\;\;20\=1\\\=1029.7\\\;2\\\=-401.4\\\;\;21\=1\\\=1044.3\\\;2\\\=-377.0\\\;\;22\=1\\\=1013.5\\\;2\\\=-361.6\\\;\;23\=1\\\=998.9\\\;2\\\=-330.0\\\;\;24\=1\\\=1005.4\\\;2\\\=-295.9\\\;\;25\=1\\\=978.6\\\;2\\\=-257.8\\\;\;26\=1\\\=915.4\\\;2\\\=-168.6\\\;\;27\=1\\\=921.1\\\;2\\\=-98.1\\\;\;28\=1\\\=943.8\\\;2\\\=-82.7\\\;\;29\=1\\\=964.9\\\;2\\\=-58.4\\\;\;30\=1\\\=938.9\\\;2\\\=0.0\\\;\;31\=1\\\=906.5\\\;2\\\=17.0\\\;\;32\=1\\\=904.9\\\;2\\\=55.9\\\;\;33\=1\\\=900.8\\\;2\\\=112.7\\\;\;34\=1\\\=921.1\\\;2\\\=81.1\\\;\;35\=1\\\=904.1\\\;2\\\=141.9\\\;\;36\=1\\\=894.3\\\;2\\\=119.2\\\;\;37\=1\\\=883.8\\\;2\\\=143.5\\\;\;38\=1\\\=848.1\\\;2\\\=140.3\\\;\;39\=1\\\=840.8\\\;2\\\=158.1\\\;\;40\=1\\\=840.8\\\;2\\\=176.8\\\;\;41\=1\\\=830.3\\\;2\\\=184.1\\\;\;;21=1\=1\\\=1035.8\\\;2\\\=133.5\\\;\;2\=1\\\=1092.0\\\;2\\\=117.0\\\;\;3\=1\\\=1130.2\\\;2\\\=120.8\\\;\;4\=1\\\=1149.0\\\;2\\\=104.2\\\;\;5\=1\\\=1157.2\\\;2\\\=119.2\\\;\;6\=1\\\=1176.0\\\;2\\\=120.0\\\;\;7\=1\\\=1198.5\\\;2\\\=135.8\\\;\;8\=1\\\=1212.8\\\;2\\\=159.8\\\;\;9\=1\\\=1188.8\\\;2\\\=183.8\\\;\;10\=1\\\=1186.5\\\;2\\\=210.8\\\;\;11\=1\\\=1152.0\\\;2\\\=239.2\\\;\;12\=1\\\=1125.8\\\;2\\\=243.0\\\;\;13\=1\\\=1121.2\\\;2\\\=232.5\\\;\;14\=1\\\=1101.8\\\;2\\\=221.2\\\;\;15\=1\\\=1091.2\\\;2\\\=220.5\\\;\;16\=1\\\=1095.8\\\;2\\\=204.8\\\;\;17\=1\\\=1086.0\\\;2\\\=191.2\\\;\;18\=1\\\=1069.5\\\;2\\\=194.2\\\;\;19\=1\\\=1046.2\\\;2\\\=180.0\\\;\;20\=1\\\=1045.5\\\;2\\\=157.5\\\;\;;22=1\=1\\\=1035.8\\\;2\\\=129.8\\\;\;2\=1\\\=1038.8\\\;2\\\=97.5\\\;\;3\=1\\\=1047.8\\\;2\\\=84.0\\\;\;4\=1\\\=1043.2\\\;2\\\=64.5\\\;\;5\=1\\\=1074.0\\\;2\\\=45.8\\\;\;6\=1\\\=1102.5\\\;2\\\=81.8\\\;\;7\=1\\\=1114.5\\\;2\\\=81.8\\\;\;8\=1\\\=1129.5\\\;2\\\=60.8\\\;\;9\=1\\\=1123.5\\\;2\\\=24.8\\\;\;10\=1\\\=1145.2\\\;2\\\=17.2\\\;\;11\=1\\\=1168.5\\\;2\\\=27.8\\\;\;12\=1\\\=1177.5\\\;2\\\=40.5\\\;\;13\=1\\\=1205.2\\\;2\\\=36.0\\\;\;14\=1\\\=1220.2\\\;2\\\=64.5\\\;\;15\=1\\\=1241.2\\\;2\\\=99.8\\\;\;16\=1\\\=1233.0\\\;2\\\=120.0\\\;\;17\=1\\\=1201.5\\\;2\\\=135.0\\\;\;18\=1\\\=1177.5\\\;2\\\=117.8\\\;\;19\=1\\\=1154.2\\\;2\\\=117.0\\\;\;20\=1\\\=1149.8\\\;2\\\=104.2\\\;\;21\=1\\\=1127.2\\\;2\\\=120.0\\\;\;22\=1\\\=1092.8\\\;2\\\=114.8\\\;\;;23=1\=1\\\=1122.0\\\;2\\\=21.8\\\;\;2\=1\\\=1123.5\\\;2\\\=7.5\\\;\;3\=1\\\=1111.5\\\;2\\\=6.0\\\;\;4\=1\\\=1085.2\\\;2\\\=-30.8\\\;\;5\=1\\\=1124.2\\\;2\\\=-57.0\\\;\;6\=1\\\=1171.5\\\;2\\\=-66.0\\\;\;7\=1\\\=1203.8\\\;2\\\=-69.0\\\;\;8\=1\\\=1190.2\\\;2\\\=-32.2\\\;\;9\=1\\\=1194.8\\\;2\\\=-6.8\\\;\;10\=1\\\=1205.2\\\;2\\\=9.8\\\;\;11\=1\\\=1202.2\\\;2\\\=33.0\\\;\;12\=1\\\=1174.5\\\;2\\\=38.2\\\;\;13\=1\\\=1167.0\\\;2\\\=27.8\\\;\;14\=1\\\=1146.0\\\;2\\\=14.2\\\;\;;24=1\=1\\\=1071.8\\\;2\\\=-69.8\\\;\;2\=1\\\=1178.2\\\;2\\\=-123.0\\\;\;3\=1\\\=1239.8\\\;2\\\=-270.8\\\;\;4\=1\\\=1188.8\\\;2\\\=-297.0\\\;\;5\=1\\\=1199.2\\\;2\\\=-321.8\\\;\;6\=1\\\=1162.5\\\;2\\\=-374.2\\\;\;7\=1\\\=1162.5\\\;2\\\=-399.0\\\;\;8\=1\\\=1128.8\\\;2\\\=-452.2\\\;\;9\=1\\\=1047.8\\\;2\\\=-526.5\\\;\;10\=1\\\=989.2\\\;2\\\=-530.2\\\;\;11\=1\\\=1021.5\\\;2\\\=-444.8\\\;\;12\=1\\\=1026.8\\\;2\\\=-403.5\\\;\;13\=1\\\=1041.0\\\;2\\\=-377.2\\\;\;14\=1\\\=1071.0\\\;2\\\=-369.0\\\;\;15\=1\\\=1084.5\\\;2\\\=-337.5\\\;\;16\=1\\\=1070.2\\\;2\\\=-333.0\\\;\;17\=1\\\=1023.0\\\;2\\\=-237.8\\\;\;18\=1\\\=1000.5\\\;2\\\=-203.2\\\;\;19\=1\\\=1019.2\\\;2\\\=-187.5\\\;\;20\=1\\\=1015.5\\\;2\\\=-169.5\\\;\;21\=1\\\=1027.5\\\;2\\\=-155.2\\\;\;22\=1\\\=1019.2\\\;2\\\=-102.0\\\;\;23\=1\\\=1052.2\\\;2\\\=-90.8\\\;\;24\=1\\\=1047.0\\\;2\\\=-73.5\\\;\;;25=1\=1\\\=541.5\\\;2\\\=489.4\\\;\;2\=1\\\=546.4\\\;2\\\=466.1\\\;\;3\=1\\\=535.9\\\;2\\\=454.5\\\;\;4\=1\\\=537.8\\\;2\\\=447.8\\\;\;5\=1\\\=531.8\\\;2\\\=446.6\\\;\;6\=1\\\=519.8\\\;2\\\=458.2\\\;\;7\=1\\\=523.9\\\;2\\\=468.8\\\;\;8\=1\\\=520.5\\\;2\\\=478.1\\\;\;;26=1\=1\\\=421.1\\\;2\\\=374.6\\\;\;2\=1\\\=455.2\\\;2\\\=364.9\\\;\;3\=1\\\=456.4\\\;2\\\=370.5\\\;\;4\=1\\\=477.0\\\;2\\\=375.4\\\;\;5\=1\\\=495.8\\\;2\\\=365.6\\\;\;6\=1\\\=535.5\\\;2\\\=390.8\\\;\;7\=1\\\=526.9\\\;2\\\=408.4\\\;\;8\=1\\\=545.2\\\;2\\\=424.5\\\;\;9\=1\\\=536.6\\\;2\\\=446.6\\\;\;10\=1\\\=530.2\\\;2\\\=447.4\\\;\;11\=1\\\=519.0\\\;2\\\=457.5\\\;\;12\=1\\\=522.0\\\;2\\\=466.1\\\;\;13\=1\\\=519.4\\\;2\\\=476.6\\\;\;14\=1\\\=492.4\\\;2\\\=460.9\\\;\;;27=1\=1\\\=455.2\\\;2\\\=363.0\\\;\;2\=1\\\=479.6\\\;2\\\=346.1\\\;\;3\=1\\\=501.4\\\;2\\\=325.9\\\;\;4\=1\\\=517.9\\\;2\\\=296.6\\\;\;5\=1\\\=527.6\\\;2\\\=270.8\\\;\;6\=1\\\=531.8\\\;2\\\=290.6\\\;\;7\=1\\\=536.6\\\;2\\\=300.4\\\;\;8\=1\\\=535.9\\\;2\\\=306.8\\\;\;9\=1\\\=526.5\\\;2\\\=311.2\\\;\;10\=1\\\=528.8\\\;2\\\=323.2\\\;\;11\=1\\\=548.6\\\;2\\\=310.5\\\;\;12\=1\\\=550.1\\\;2\\\=297.8\\\;\;13\=1\\\=542.2\\\;2\\\=292.1\\\;\;14\=1\\\=546.8\\\;2\\\=277.5\\\;\;15\=1\\\=561.0\\\;2\\\=267.4\\\;\;16\=1\\\=592.5\\\;2\\\=269.6\\\;\;17\=1\\\=600.8\\\;2\\\=280.5\\\;\;18\=1\\\=572.6\\\;2\\\=348.4\\\;\;19\=1\\\=547.1\\\;2\\\=357.8\\\;\;20\=1\\\=549.8\\\;2\\\=382.1\\\;\;21\=1\\\=538.5\\\;2\\\=407.2\\\;\;22\=1\\\=546.0\\\;2\\\=418.9\\\;\;23\=1\\\=544.1\\\;2\\\=423.4\\\;\;24\=1\\\=526.1\\\;2\\\=407.6\\\;\;25\=1\\\=535.1\\\;2\\\=390.8\\\;\;26\=1\\\=495.4\\\;2\\\=363.8\\\;\;27\=1\\\=477.4\\\;2\\\=374.2\\\;\;28\=1\\\=456.8\\\;2\\\=369.4\\\;\;;28=1\=1\\\=1145.3\\\;2\\\=366.7\\\;\;2\=1\\\=1160.0\\\;2\\\=364.7\\\;\;3\=1\\\=1173.3\\\;2\\\=346.0\\\;\;4\=1\\\=1264.7\\\;2\\\=340.0\\\;\;5\=1\\\=1274.7\\\;2\\\=348.7\\\;\;6\=1\\\=1384.0\\\;2\\\=334.0\\\;\;7\=1\\\=1378.0\\\;2\\\=319.3\\\;\;8\=1\\\=1386.7\\\;2\\\=290.0\\\;\;9\=1\\\=1412.7\\\;2\\\=285.3\\\;\;10\=1\\\=1395.3\\\;2\\\=249.3\\\;\;11\=1\\\=1379.3\\\;2\\\=243.3\\\;\;12\=1\\\=1380.7\\\;2\\\=226.7\\\;\;13\=1\\\=1397.3\\\;2\\\=230.7\\\;\;14\=1\\\=1417.3\\\;2\\\=208.7\\\;\;15\=1\\\=1335.3\\\;2\\\=152.7\\\;\;16\=1\\\=1329.3\\\;2\\\=111.3\\\;\;17\=1\\\=1239.3\\\;2\\\=100.0\\\;\;18\=1\\\=1232.7\\\;2\\\=118.0\\\;\;19\=1\\\=1202.0\\\;2\\\=133.3\\\;\;20\=1\\\=1207.3\\\;2\\\=151.3\\\;\;21\=1\\\=1214.7\\\;2\\\=159.3\\\;\;22\=1\\\=1211.3\\\;2\\\=164.0\\\;\;23\=1\\\=1188.6\\\;2\\\=180.9\\\;\;24\=1\\\=1187.3\\\;2\\\=209.5\\\;\;25\=1\\\=1152.7\\\;2\\\=238.6\\\;\;26\=1\\\=1122.3\\\;2\\\=243.2\\\;\;27\=1\\\=1150.5\\\;2\\\=307.7\\\;\;;29=1\=1\\\=758.4\\\;2\\\=-14.7\\\;\;2\=1\\\=729.1\\\;2\\\=-23.7\\\;\;3\=1\\\=669.8\\\;2\\\=23.0\\\;\;4\=1\\\=641.9\\\;2\\\=30.7\\\;\;5\=1\\\=597.2\\\;2\\\=-19.5\\\;\;6\=1\\\=616.7\\\;2\\\=-26.5\\\;\;7\=1\\\=609.8\\\;2\\\=-164.7\\\;\;8\=1\\\=646.7\\\;2\\\=-198.1\\\;\;9\=1\\\=731.2\\\;2\\\=-260.2\\\;\;10\=1\\\=789.8\\\;2\\\=-320.2\\\;\;11\=1\\\=833.0\\\;2\\\=-417.9\\\;\;12\=1\\\=867.2\\\;2\\\=-466.7\\\;\;13\=1\\\=874.2\\\;2\\\=-434.7\\\;\;14\=1\\\=858.1\\\;2\\\=-385.8\\\;\;15\=1\\\=840.7\\\;2\\\=-372.6\\\;\;16\=1\\\=840.7\\\;2\\\=-339.1\\\;\;17\=1\\\=821.9\\\;2\\\=-294.4\\\;\;18\=1\\\=828.8\\\;2\\\=-293.7\\\;\;19\=1\\\=826.7\\\;2\\\=-272.1\\\;\;20\=1\\\=809.3\\\;2\\\=-270.0\\\;\;21\=1\\\=782.1\\\;2\\\=-244.2\\\;\;22\=1\\\=792.6\\\;2\\\=-78.1\\\;\;23\=1\\\=768.1\\\;2\\\=-53.0\\\;\;;30=1\=1\\\=735.5\\\;2\\\=1172.1\\\;\;2\=1\\\=745.9\\\;2\\\=1196.9\\\;\;3\=1\\\=763.4\\\;2\\\=1196.9\\\;\;4\=1\\\=826.6\\\;2\\\=1227.9\\\;\;5\=1\\\=830.7\\\;2\\\=1247.6\\\;\;6\=1\\\=862.8\\\;2\\\=1251.7\\\;\;7\=1\\\=875.2\\\;2\\\=1234.1\\\;\;8\=1\\\=863.8\\\;2\\\=1211.4\\\;\;9\=1\\\=883.4\\\;2\\\=1155.5\\\;\;10\=1\\\=830.7\\\;2\\\=1172.1\\\;\;11\=1\\\=797.6\\\;2\\\=1167.9\\\;\;12\=1\\\=776.9\\\;2\\\=1156.6\\\;\;13\=1\\\=760.3\\\;2\\\=1166.9\\\;\;14\=1\\\=753.1\\\;2\\\=1157.6\\\;\;;31=1\=1\\\=562.8\\\;2\\\=1102.8\\\;\;2\=1\\\=601.0\\\;2\\\=1093.4\\\;\;3\=1\\\=619.7\\\;2\\\=1049.0\\\;\;4\=1\\\=614.5\\\;2\\\=1021.0\\\;\;5\=1\\\=629.0\\\;2\\\=1011.7\\\;\;6\=1\\\=606.2\\\;2\\\=962.1\\\;\;7\=1\\\=565.9\\\;2\\\=985.9\\\;\;8\=1\\\=553.4\\\;2\\\=978.6\\\;\;9\=1\\\=554.5\\\;2\\\=998.3\\\;\;10\=1\\\=557.6\\\;2\\\=1017.9\\\;\;11\=1\\\=548.3\\\;2\\\=1092.4\\\;\;;32=1\=1\\\=600.0\\\;2\\\=950.7\\\;\;2\=1\\\=617.6\\\;2\\\=915.5\\\;\;3\=1\\\=619.7\\\;2\\\=864.8\\\;\;4\=1\\\=604.1\\\;2\\\=881.4\\\;\;5\=1\\\=584.5\\\;2\\\=886.6\\\;\;6\=1\\\=581.4\\\;2\\\=932.1\\\;\;7\=1\\\=586.6\\\;2\\\=947.6\\\;\;;33=1\=1\\\=1095.0\\\;2\\\=1062.1\\\;\;2\=1\\\=1119.8\\\;2\\\=1017.1\\\;\;3\=1\\\=1118.7\\\;2\\\=985.4\\\;\;4\=1\\\=1142.3\\\;2\\\=979.6\\\;\;5\=1\\\=1167.7\\\;2\\\=963.5\\\;\;6\=1\\\=1194.2\\\;2\\\=964.0\\\;\;7\=1\\\=1198.3\\\;2\\\=947.3\\\;\;8\=1\\\=1340.8\\\;2\\\=920.2\\\;\;9\=1\\\=1347.7\\\;2\\\=907.5\\\;\;10\=1\\\=1360.4\\\;2\\\=909.2\\\;\;11\=1\\\=1361.5\\\;2\\\=921.3\\\;\;12\=1\\\=1352.3\\\;2\\\=932.3\\\;\;13\=1\\\=1356.3\\\;2\\\=945.6\\\;\;14\=1\\\=1347.1\\\;2\\\=962.9\\\;\;15\=1\\\=1251.9\\\;2\\\=976.7\\\;\;16\=1\\\=1261.2\\\;2\\\=994.0\\\;\;17\=1\\\=1238.1\\\;2\\\=1012.5\\\;\;18\=1\\\=1211.0\\\;2\\\=998.1\\\;\;19\=1\\\=1205.2\\\;2\\\=1010.2\\\;\;20\=1\\\=1206.3\\\;2\\\=1031.5\\\;\;21\=1\\\=1247.9\\\;2\\\=1070.8\\\;\;22\=1\\\=1246.2\\\;2\\\=1081.2\\\;\;23\=1\\\=1262.3\\\;2\\\=1097.9\\\;\;24\=1\\\=1281.3\\\;2\\\=1099.0\\\;\;25\=1\\\=1301.5\\\;2\\\=1125.6\\\;\;26\=1\\\=1312.5\\\;2\\\=1124.4\\\;\;27\=1\\\=1309.6\\\;2\\\=1138.3\\\;\;28\=1\\\=1292.3\\\;2\\\=1130.8\\\;\;29\=1\\\=1289.4\\\;2\\\=1137.7\\\;\;30\=1\\\=1293.5\\\;2\\\=1146.9\\\;\;31\=1\\\=1291.7\\\;2\\\=1153.8\\\;\;32\=1\\\=1263.5\\\;2\\\=1141.2\\\;\;33\=1\\\=1245.0\\\;2\\\=1152.7\\\;\;34\=1\\\=1262.9\\\;2\\\=1167.1\\\;\;35\=1\\\=1260.6\\\;2\\\=1183.3\\\;\;36\=1\\\=1240.4\\\;2\\\=1190.2\\\;\;37\=1\\\=1259.4\\\;2\\\=1220.8\\\;\;38\=1\\\=1257.1\\\;2\\\=1234.0\\\;\;39\=1\\\=1188.5\\\;2\\\=1223.7\\\;\;40\=1\\\=1179.2\\\;2\\\=1193.7\\\;\;41\=1\\\=1153.8\\\;2\\\=1162.5\\\;\;42\=1\\\=1162.5\\\;2\\\=1144.0\\\;\;43\=1\\\=1186.7\\\;2\\\=1131.9\\\;\;44\=1\\\=1223.7\\\;2\\\=1145.2\\\;\;45\=1\\\=1236.3\\\;2\\\=1146.9\\\;\;46\=1\\\=1250.2\\\;2\\\=1131.9\\\;\;47\=1\\\=1195.4\\\;2\\\=1126.2\\\;\;48\=1\\\=1179.8\\\;2\\\=1128.5\\\;\;49\=1\\\=1163.7\\\;2\\\=1133.1\\\;\;50\=1\\\=1146.3\\\;2\\\=1136.0\\\;\;51\=1\\\=1134.8\\\;2\\\=1114.0\\\;\;52\=1\\\=1125.6\\\;2\\\=1124.4\\\;\;53\=1\\\=1118.1\\\;2\\\=1117.5\\\;\;54\=1\\\=1124.4\\\;2\\\=1101.3\\\;\;55\=1\\\=1106.0\\\;2\\\=1080.0\\\;\;;34=1\=1\\\=1092.9\\\;2\\\=1059.0\\\;\;2\=1\\\=1054.7\\\;2\\\=1023.4\\\;\;3\=1\\\=1051.7\\\;2\\\=996.0\\\;\;4\=1\\\=1062.0\\\;2\\\=944.1\\\;\;5\=1\\\=1042.3\\\;2\\\=924.0\\\;\;6\=1\\\=1052.6\\\;2\\\=888.4\\\;\;7\=1\\\=1062.4\\\;2\\\=896.1\\\;\;8\=1\\\=1069.7\\\;2\\\=895.7\\\;\;9\=1\\\=1078.3\\\;2\\\=907.7\\\;\;10\=1\\\=1092.0\\\;2\\\=912.0\\\;\;11\=1\\\=1098.4\\\;2\\\=927.9\\\;\;12\=1\\\=1091.6\\\;2\\\=937.3\\\;\;13\=1\\\=1096.7\\\;2\\\=947.1\\\;\;14\=1\\\=1097.6\\\;2\\\=970.3\\\;\;15\=1\\\=1108.3\\\;2\\\=986.6\\\;\;16\=1\\\=1119.4\\\;2\\\=988.3\\\;\;17\=1\\\=1119.4\\\;2\\\=1015.7\\\;\;;35=1\=1\\\=1097.5\\\;2\\\=926.5\\\;\;2\=1\\\=1118.2\\\;2\\\=907.4\\\;\;3\=1\\\=1121.7\\\;2\\\=913.6\\\;\;4\=1\\\=1129.9\\\;2\\\=901.9\\\;\;5\=1\\\=1170.4\\\;2\\\=894.2\\\;\;6\=1\\\=1171.2\\\;2\\\=899.6\\\;\;7\=1\\\=1187.5\\\;2\\\=909.0\\\;\;8\=1\\\=1201.9\\\;2\\\=926.5\\\;\;9\=1\\\=1193.8\\\;2\\\=963.5\\\;\;10\=1\\\=1167.3\\\;2\\\=963.9\\\;\;11\=1\\\=1143.1\\\;2\\\=979.1\\\;\;12\=1\\\=1116.6\\\;2\\\=986.5\\\;\;13\=1\\\=1106.5\\\;2\\\=984.2\\\;\;14\=1\\\=1096.8\\\;2\\\=969.4\\\;\;15\=1\\\=1096.8\\\;2\\\=946.4\\\;\;16\=1\\\=1091.7\\\;2\\\=936.6\\\;\;17\=1\\\=1097.1\\\;2\\\=931.2\\\;\;;36=1\=1\\\=1134.9\\\;2\\\=899.2\\\;\;2\=1\\\=1131.8\\\;2\\\=883.2\\\;\;3\=1\\\=1115.1\\\;2\\\=870.8\\\;\;4\=1\\\=1110.4\\\;2\\\=859.1\\\;\;5\=1\\\=1078.1\\\;2\\\=874.7\\\;\;6\=1\\\=1066.0\\\;2\\\=883.2\\\;\;7\=1\\\=1069.5\\\;2\\\=896.1\\\;\;8\=1\\\=1076.5\\\;2\\\=906.6\\\;\;9\=1\\\=1090.9\\\;2\\\=910.9\\\;\;10\=1\\\=1096.4\\\;2\\\=924.9\\\;\;11\=1\\\=1117.4\\\;2\\\=906.2\\\;\;12\=1\\\=1120.1\\\;2\\\=912.9\\\;\;13\=1\\\=1129.1\\\;2\\\=901.6\\\;\;;37=1\=1\\\=1136.2\\\;2\\\=899.0\\\;\;2\=1\\\=1170.5\\\;2\\\=895.7\\\;\;3\=1\\\=1169.5\\\;2\\\=866.2\\\;\;4\=1\\\=1191.4\\\;2\\\=840.0\\\;\;5\=1\\\=1156.2\\\;2\\\=808.6\\\;\;6\=1\\\=1169.0\\\;2\\\=786.2\\\;\;7\=1\\\=1121.0\\\;2\\\=767.1\\\;\;8\=1\\\=1109.0\\\;2\\\=737.6\\\;\;9\=1\\\=1057.1\\\;2\\\=688.6\\\;\;10\=1\\\=1034.3\\\;2\\\=689.5\\\;\;11\=1\\\=1001.9\\\;2\\\=707.6\\\;\;12\=1\\\=1012.4\\\;2\\\=755.7\\\;\;13\=1\\\=1027.6\\\;2\\\=763.8\\\;\;14\=1\\\=1022.9\\\;2\\\=788.6\\\;\;15\=1\\\=1043.8\\\;2\\\=812.4\\\;\;16\=1\\\=1029.5\\\;2\\\=839.5\\\;\;17\=1\\\=1049.0\\\;2\\\=858.1\\\;\;18\=1\\\=1063.8\\\;2\\\=862.4\\\;\;19\=1\\\=1076.2\\\;2\\\=874.3\\\;\;20\=1\\\=1109.5\\\;2\\\=858.1\\\;\;;38=1\=1\\\=1040.5\\\;2\\\=922.4\\\;\;2\=1\\\=1051.4\\\;2\\\=886.7\\\;\;3\=1\\\=1061.4\\\;2\\\=896.7\\\;\;4\=1\\\=1069.5\\\;2\\\=895.2\\\;\;5\=1\\\=1064.8\\\;2\\\=880.0\\\;\;6\=1\\\=1076.2\\\;2\\\=875.2\\\;\;7\=1\\\=1061.0\\\;2\\\=861.4\\\;\;8\=1\\\=1046.2\\\;2\\\=858.1\\\;\;9\=1\\\=1027.6\\\;2\\\=839.0\\\;\;10\=1\\\=1016.2\\\;2\\\=852.4\\\;\;11\=1\\\=1009.0\\\;2\\\=855.2\\\;\;12\=1\\\=1007.6\\\;2\\\=868.6\\\;\;13\=1\\\=1000.0\\\;2\\\=880.0\\\;\;14\=1\\\=1004.3\\\;2\\\=890.0\\\;\;15\=1\\\=1000.0\\\;2\\\=897.6\\\;\;16\=1\\\=990.0\\\;2\\\=890.5\\\;\;17\=1\\\=987.6\\\;2\\\=892.9\\\;\;18\=1\\\=1006.7\\\;2\\\=904.3\\\;\;19\=1\\\=1016.2\\\;2\\\=901.0\\\;\;20\=1\\\=1020.0\\\;2\\\=903.8\\\;\;21\=1\\\=1015.2\\\;2\\\=908.6\\\;\;22\=1\\\=1029.5\\\;2\\\=912.9\\\;\;23\=1\\\=1035.7\\\;2\\\=921.0\\\;\;;39=1\=1\\\=883.8\\\;2\\\=748.1\\\;\;2\=1\\\=881.9\\\;2\\\=775.7\\\;\;3\=1\\\=898.6\\\;2\\\=788.1\\\;\;4\=1\\\=903.8\\\;2\\\=809.5\\\;\;5\=1\\\=947.6\\\;2\\\=842.9\\\;\;6\=1\\\=947.1\\\;2\\\=854.8\\\;\;7\=1\\\=960.0\\\;2\\\=863.3\\\;\;8\=1\\\=985.7\\\;2\\\=886.2\\\;\;9\=1\\\=986.2\\\;2\\\=889.5\\\;\;10\=1\\\=990.0\\\;2\\\=888.6\\\;\;11\=1\\\=998.6\\\;2\\\=896.2\\\;\;12\=1\\\=1002.9\\\;2\\\=889.0\\\;\;13\=1\\\=998.6\\\;2\\\=880.5\\\;\;14\=1\\\=1007.6\\\;2\\\=870.0\\\;\;15\=1\\\=1007.6\\\;2\\\=856.7\\\;\;16\=1\\\=1015.2\\\;2\\\=850.0\\\;\;17\=1\\\=1029.0\\\;2\\\=838.6\\\;\;18\=1\\\=1041.4\\\;2\\\=812.4\\\;\;19\=1\\\=1021.0\\\;2\\\=788.1\\\;\;20\=1\\\=1026.2\\\;2\\\=763.8\\\;\;21\=1\\\=1011.9\\\;2\\\=756.2\\\;\;22\=1\\\=933.3\\\;2\\\=744.8\\\;\;23\=1\\\=903.3\\\;2\\\=761.0\\\;\;;40=1\=1\\\=1376.4\\\;2\\\=658.8\\\;\;2\=1\\\=1396.8\\\;2\\\=630.0\\\;\;3\=1\\\=1390.8\\\;2\\\=608.4\\\;\;4\=1\\\=1435.2\\\;2\\\=596.4\\\;\;5\=1\\\=1392.0\\\;2\\\=555.6\\\;\;6\=1\\\=1380.0\\\;2\\\=529.2\\\;\;7\=1\\\=1312.8\\\;2\\\=514.8\\\;\;8\=1\\\=1288.8\\\;2\\\=530.4\\\;\;9\=1\\\=1365.6\\\;2\\\=612.0\\\;\;10\=1\\\=1359.6\\\;2\\\=628.8\\\;\;;41=1\=1\\\=1430.4\\\;2\\\=600.0\\\;\;2\=1\\\=1459.2\\\;2\\\=612.0\\\;\;3\=1\\\=1459.2\\\;2\\\=630.0\\\;\;4\=1\\\=1443.6\\\;2\\\=656.4\\\;\;5\=1\\\=1447.2\\\;2\\\=679.2\\\;\;6\=1\\\=1432.8\\\;2\\\=666.0\\\;\;7\=1\\\=1384.8\\\;2\\\=679.2\\\;\;8\=1\\\=1378.8\\\;2\\\=662.4\\\;\;9\=1\\\=1396.8\\\;2\\\=626.4\\\;\;10\=1\\\=1393.2\\\;2\\\=609.6\\\;\;;42=1\=1\\\=1720.8\\\;2\\\=457.2\\\;\;2\=1\\\=1724.4\\\;2\\\=414.0\\\;\;3\=1\\\=1761.6\\\;2\\\=406.8\\\;\;4\=1\\\=1728.0\\\;2\\\=303.6\\\;\;5\=1\\\=1569.6\\\;2\\\=324.0\\\;\;6\=1\\\=1542.0\\\;2\\\=297.6\\\;\;7\=1\\\=1506.0\\\;2\\\=301.2\\\;\;8\=1\\\=1466.4\\\;2\\\=253.2\\\;\;9\=1\\\=1410.0\\\;2\\\=284.4\\\;\;10\=1\\\=1387.2\\\;2\\\=290.4\\\;\;11\=1\\\=1376.4\\\;2\\\=316.8\\\;\;12\=1\\\=1382.4\\\;2\\\=337.2\\\;\;13\=1\\\=1274.4\\\;2\\\=344.4\\\;\;14\=1\\\=1263.6\\\;2\\\=342.0\\\;\;15\=1\\\=1174.8\\\;2\\\=340.8\\\;\;16\=1\\\=1161.6\\\;2\\\=361.2\\\;\;17\=1\\\=1141.2\\\;2\\\=369.6\\\;\;18\=1\\\=1146.0\\\;2\\\=382.8\\\;\;19\=1\\\=1166.4\\\;2\\\=424.8\\\;\;20\=1\\\=1125.6\\\;2\\\=513.6\\\;\;21\=1\\\=1120.8\\\;2\\\=553.2\\\;\;22\=1\\\=1148.4\\\;2\\\=567.6\\\;\;23\=1\\\=1221.6\\\;2\\\=573.6\\\;\;24\=1\\\=1292.4\\\;2\\\=531.6\\\;\;25\=1\\\=1312.8\\\;2\\\=514.8\\\;\;26\=1\\\=1378.8\\\;2\\\=530.4\\\;\;27\=1\\\=1390.8\\\;2\\\=553.2\\\;\;28\=1\\\=1435.2\\\;2\\\=594.0\\\;\;29\=1\\\=1456.8\\\;2\\\=615.6\\\;\;30\=1\\\=1465.2\\\;2\\\=592.8\\\;\;31\=1\\\=1473.6\\\;2\\\=571.2\\\;\;32\=1\\\=1510.8\\\;2\\\=571.2\\\;\;33\=1\\\=1519.2\\\;2\\\=591.6\\\;\;34\=1\\\=1567.2\\\;2\\\=583.2\\\;\;35\=1\\\=1588.8\\\;2\\\=584.4\\\;\;36\=1\\\=1556.4\\\;2\\\=628.8\\\;\;37\=1\\\=1596.0\\\;2\\\=634.8\\\;\;38\=1\\\=1610.4\\\;2\\\=670.8\\\;\;39\=1\\\=1647.6\\\;2\\\=634.8\\\;\;40\=1\\\=1671.6\\\;2\\\=603.6\\\;\;41\=1\\\=1704.0\\\;2\\\=595.2\\\;\;42\=1\\\=1702.8\\\;2\\\=574.8\\\;\;43\=1\\\=1668.0\\\;2\\\=590.4\\\;\;44\=1\\\=1627.2\\\;2\\\=565.2\\\;\;45\=1\\\=1647.6\\\;2\\\=528.0\\\;\;46\=1\\\=1684.8\\\;2\\\=500.4\\\;\;47\=1\\\=1710.0\\\;2\\\=465.6\\\;\;;43=1\=1\\\=1290.0\\\;2\\\=1291.4\\\;\;2\=1\\\=1297.1\\\;2\\\=1302.9\\\;\;3\=1\\\=1347.1\\\;2\\\=1300.0\\\;\;4\=1\\\=1352.9\\\;2\\\=1314.3\\\;\;5\=1\\\=1402.9\\\;2\\\=1300.0\\\;\;6\=1\\\=1427.1\\\;2\\\=1300.0\\\;\;7\=1\\\=1428.6\\\;2\\\=1280.0\\\;\;8\=1\\\=1404.3\\\;2\\\=1288.6\\\;\;9\=1\\\=1357.1\\\;2\\\=1284.3\\\;\;10\=1\\\=1325.7\\\;2\\\=1290.0\\\;\;11\=1\\\=1304.3\\\;2\\\=1287.1\\\;\;;44=1\=1\\\=1735.7\\\;2\\\=1238.6\\\;\;2\=1\\\=1762.9\\\;2\\\=1234.3\\\;\;3\=1\\\=1782.9\\\;2\\\=1224.3\\\;\;4\=1\\\=1797.1\\\;2\\\=1214.3\\\;\;5\=1\\\=1788.6\\\;2\\\=1202.9\\\;\;6\=1\\\=1818.6\\\;2\\\=1192.9\\\;\;7\=1\\\=1798.6\\\;2\\\=1187.1\\\;\;8\=1\\\=1817.1\\\;2\\\=1144.3\\\;\;9\=1\\\=1790.0\\\;2\\\=1180.0\\\;\;10\=1\\\=1751.4\\\;2\\\=1191.4\\\;\;11\=1\\\=1751.4\\\;2\\\=1207.1\\\;\;12\=1\\\=1728.6\\\;2\\\=1220.0\\\;\;;45=1\=1\\\=1006.9\\\;2\\\=230.0\\\;\;2\=1\\\=1024.6\\\;2\\\=213.8\\\;\;3\=1\\\=1012.3\\\;2\\\=200.8\\\;\;4\=1\\\=1029.2\\\;2\\\=196.2\\\;\;5\=1\\\=1045.4\\\;2\\\=201.5\\\;\;6\=1\\\=1051.5\\\;2\\\=186.2\\\;\;7\=1\\\=1066.9\\\;2\\\=194.6\\\;\;8\=1\\\=1085.4\\\;2\\\=189.2\\\;\;9\=1\\\=1093.8\\\;2\\\=199.2\\\;\;10\=1\\\=1089.2\\\;2\\\=218.5\\\;\;;46=1\=1\\\=753.5\\\;2\\\=150.5\\\;\;2\=1\\\=739.0\\\;2\\\=163.5\\\;\;3\=1\\\=744.5\\\;2\\\=187.5\\\;\;4\=1\\\=763.5\\\;2\\\=189.5\\\;\;5\=1\\\=760.5\\\;2\\\=201.0\\\;\;6\=1\\\=760.0\\\;2\\\=209.5\\\;\;7\=1\\\=737.5\\\;2\\\=204.0\\\;\;8\=1\\\=732.5\\\;2\\\=211.5\\\;\;9\=1\\\=748.0\\\;2\\\=223.5\\\;\;10\=1\\\=765.5\\\;2\\\=221.0\\\;\;11\=1\\\=775.5\\\;2\\\=211.0\\\;\;12\=1\\\=787.5\\\;2\\\=208.5\\\;\;13\=1\\\=770.0\\\;2\\\=196.0\\\;\;14\=1\\\=780.0\\\;2\\\=189.5\\\;\;15\=1\\\=774.0\\\;2\\\=180.5\\\;\;16\=1\\\=779.0\\\;2\\\=167.5\\\;\;17\=1\\\=788.0\\\;2\\\=170.0\\\;\;18\=1\\\=786.5\\\;2\\\=154.0\\\;\;19\=1\\\=781.5\\\;2\\\=142.0\\\;\;20\=1\\\=769.0\\\;2\\\=148.5\\\;\;21\=1\\\=766.0\\\;2\\\=164.0\\\;\;22\=1\\\=755.0\\\;2\\\=161.5\\\;\;;47=1\=1\\\=952.7\\\;2\\\=101.3\\\;\;2\=1\\\=946.7\\\;2\\\=67.3\\\;\;3\=1\\\=965.3\\\;2\\\=45.3\\\;\;4\=1\\\=974.7\\\;2\\\=45.3\\\;\;5\=1\\\=968.0\\\;2\\\=57.3\\\;\;6\=1\\\=970.0\\\;2\\\=64.7\\\;\;7\=1\\\=973.3\\\;2\\\=76.7\\\;\;8\=1\\\=962.0\\\;2\\\=79.3\\\;\;9\=1\\\=958.0\\\;2\\\=92.0\\\;\;;48=1\=1\\\=1056.0\\\;2\\\=33.3\\\;\;2\=1\\\=1052.0\\\;2\\\=13.3\\\;\;3\=1\\\=1051.3\\\;2\\\=2.7\\\;\;4\=1\\\=1070.0\\\;2\\\=-2.7\\\;\;5\=1\\\=1086.0\\\;2\\\=-5.3\\\;\;6\=1\\\=1083.3\\\;2\\\=4.7\\\;\;7\=1\\\=1070.7\\\;2\\\=17.3\\\;\;8\=1\\\=1062.0\\\;2\\\=20.7\\\;\;;49=1\=1\\\=281.7\\\;2\\\=1012.5\\\;\;2\=1\\\=287.5\\\;2\\\=1022.5\\\;\;3\=1\\\=305.8\\\;2\\\=1034.2\\\;\;4\=1\\\=329.2\\\;2\\\=1013.3\\\;\;5\=1\\\=321.7\\\;2\\\=995.8\\\;\;;50=1\=1\\\=354.2\\\;2\\\=994.2\\\;\;2\=1\\\=348.3\\\;2\\\=1001.7\\\;\;3\=1\\\=365.8\\\;2\\\=1015.0\\\;\;4\=1\\\=375.0\\\;2\\\=1010.8\\\;\;5\=1\\\=365.8\\\;2\\\=1001.7\\\;\;;51=1\=1\\\=217.2\\\;2\\\=1040.6\\\;\;2\=1\\\=225.0\\\;2\\\=1044.4\\\;\;3\=1\\\=236.1\\\;2\\\=1038.9\\\;\;4\=1\\\=235.0\\\;2\\\=1031.7\\\;\;5\=1\\\=224.4\\\;2\\\=1032.2\\\;\;;52=1\=1\\\=224.4\\\;2\\\=1050.0\\\;\;2\=1\\\=221.1\\\;2\\\=1054.4\\\;\;3\=1\\\=220.6\\\;2\\\=1057.2\\\;\;4\=1\\\=228.9\\\;2\\\=1058.3\\\;\;;53=1\=1\\\=-343.4\\\;2\\\=1211.4\\\;\;2\=1\\\=-299.0\\\;2\\\=1218.6\\\;\;3\=1\\\=-254.5\\\;2\\\=1205.2\\\;\;4\=1\\\=-167.6\\\;2\\\=1118.3\\\;\;5\=1\\\=-140.7\\\;2\\\=1129.7\\\;\;6\=1\\\=-126.2\\\;2\\\=1172.1\\\;\;7\=1\\\=-60.0\\\;2\\\=1194.8\\\;\;8\=1\\\=-37.2\\\;2\\\=1194.8\\\;\;9\=1\\\=-17.6\\\;2\\\=1216.6\\\;\;10\=1\\\=7.2\\\;2\\\=1249.7\\\;\;11\=1\\\=-14.5\\\;2\\\=1336.6\\\;\;12\=1\\\=-340.3\\\;2\\\=1346.9\\\;\;;54=1\=1\\\=505.9\\\;2\\\=1339.7\\\;\;2\=1\\\=524.5\\\;2\\\=1251.7\\\;\;3\=1\\\=537.9\\\;2\\\=1221.7\\\;\;4\=1\\\=514.1\\\;2\\\=1215.5\\\;\;5\=1\\\=483.1\\\;2\\\=1196.9\\\;\;6\=1\\\=373.4\\\;2\\\=1214.5\\\;\;7\=1\\\=265.9\\\;2\\\=1183.4\\\;\;8\=1\\\=160.3\\\;2\\\=1184.5\\\;\;9\=1\\\=113.8\\\;2\\\=1203.1\\\;\;10\=1\\\=48.6\\\;2\\\=1217.6\\\;\;11\=1\\\=-22.8\\\;2\\\=1210.3\\\;\;12\=1\\\=5.2\\\;2\\\=1244.5\\\;\;13\=1\\\=-16.6\\\;2\\\=1339.7\\\;\;;55=1\=1\\\=536.9\\\;2\\\=1220.7\\\;\;2\=1\\\=600.0\\\;2\\\=1196.9\\\;\;3\=1\\\=627.9\\\;2\\\=1213.4\\\;\;4\=1\\\=629.0\\\;2\\\=1238.3\\\;\;5\=1\\\=666.2\\\;2\\\=1220.7\\\;\;6\=1\\\=667.2\\\;2\\\=1241.4\\\;\;7\=1\\\=651.7\\\;2\\\=1262.1\\\;\;8\=1\\\=636.2\\\;2\\\=1264.1\\\;\;9\=1\\\=637.2\\\;2\\\=1293.1\\\;\;10\=1\\\=652.8\\\;2\\\=1309.7\\\;\;11\=1\\\=662.1\\\;2\\\=1340.7\\\;\;12\=1\\\=509.0\\\;2\\\=1339.7\\\;\;13\=1\\\=523.4\\\;2\\\=1247.6\\\;\;;56=1\=1\\\=1840.5\\\;2\\\=1080.0\\\;\;2\=1\\\=1805.8\\\;2\\\=1083.2\\\;\;3\=1\\\=1785.3\\\;2\\\=1117.9\\\;\;4\=1\\\=1769.5\\\;2\\\=1138.4\\\;\;5\=1\\\=1720.5\\\;2\\\=1158.9\\\;\;6\=1\\\=1685.8\\\;2\\\=1141.6\\\;\;7\=1\\\=1619.5\\\;2\\\=1141.6\\\;\;8\=1\\\=1617.9\\\;2\\\=1173.2\\\;\;9\=1\\\=1573.7\\\;2\\\=1188.9\\\;\;10\=1\\\=1546.8\\\;2\\\=1179.5\\\;\;11\=1\\\=1526.3\\\;2\\\=1157.4\\\;\;12\=1\\\=1494.7\\\;2\\\=1165.3\\\;\;13\=1\\\=1467.9\\\;2\\\=1160.5\\\;\;14\=1\\\=1442.6\\\;2\\\=1124.2\\\;\;15\=1\\\=1417.4\\\;2\\\=1080.0\\\;\;16\=1\\\=1398.4\\\;2\\\=1021.6\\\;\;17\=1\\\=1371.6\\\;2\\\=1021.6\\\;\;18\=1\\\=1366.8\\\;2\\\=988.4\\\;\;19\=1\\\=1395.3\\\;2\\\=972.6\\\;\;20\=1\\\=1425.3\\\;2\\\=972.6\\\;\;21\=1\\\=1469.5\\\;2\\\=963.2\\\;\;22\=1\\\=1491.6\\\;2\\\=944.2\\\;\;23\=1\\\=1497.9\\\;2\\\=923.7\\\;\;24\=1\\\=1485.3\\\;2\\\=915.8\\\;\;25\=1\\\=1486.8\\\;2\\\=895.3\\\;\;26\=1\\\=1562.6\\\;2\\\=888.9\\\;\;27\=1\\\=1584.7\\\;2\\\=870.0\\\;\;28\=1\\\=1644.7\\\;2\\\=808.4\\\;\;29\=1\\\=1711.1\\\;2\\\=789.5\\\;\;30\=1\\\=1758.4\\\;2\\\=794.2\\\;\;31\=1\\\=1838.9\\\;2\\\=794.2\\\;\;;57=1\=1\\\=1354.0\\\;2\\\=960.0\\\;\;2\=1\\\=1356.7\\\;2\\\=946.0\\\;\;3\=1\\\=1355.3\\\;2\\\=927.2\\\;\;4\=1\\\=1363.0\\\;2\\\=918.1\\\;\;5\=1\\\=1358.1\\\;2\\\=908.4\\\;\;6\=1\\\=1349.8\\\;2\\\=897.9\\\;\;7\=1\\\=1381.9\\\;2\\\=869.3\\\;\;8\=1\\\=1421.6\\\;2\\\=872.1\\\;\;9\=1\\\=1425.1\\\;2\\\=884.0\\\;\;10\=1\\\=1434.9\\\;2\\\=895.1\\\;\;11\=1\\\=1478.8\\\;2\\\=900.7\\\;\;12\=1\\\=1477.4\\\;2\\\=916.7\\\;\;13\=1\\\=1458.6\\\;2\\\=921.6\\\;\;14\=1\\\=1445.3\\\;2\\\=918.8\\\;\;15\=1\\\=1436.3\\\;2\\\=934.9\\\;\;16\=1\\\=1418.1\\\;2\\\=927.9\\\;\;17\=1\\\=1411.2\\\;2\\\=947.4\\\;\;18\=1\\\=1392.3\\\;2\\\=965.6\\\;\;19\=1\\\=1371.4\\\;2\\\=978.1\\\;\;20\=1\\\=1385.3\\\;2\\\=958.6\\\;\;21\=1\\\=1363.7\\\;2\\\=964.2\\\;\;;58=1\=1\\\=1841.3\\\;2\\\=605.8\\\;\;2\=1\\\=1816.1\\\;2\\\=598.1\\\;\;3\=1\\\=1771.6\\\;2\\\=596.1\\\;\;4\=1\\\=1731.0\\\;2\\\=590.3\\\;\;5\=1\\\=1712.6\\\;2\\\=576.8\\\;\;6\=1\\\=1726.1\\\;2\\\=568.1\\\;\;7\=1\\\=1736.8\\\;2\\\=560.3\\\;\;8\=1\\\=1751.3\\\;2\\\=514.8\\\;\;9\=1\\\=1718.4\\\;2\\\=489.7\\\;\;10\=1\\\=1746.5\\\;2\\\=473.2\\\;\;11\=1\\\=1769.7\\\;2\\\=451.0\\\;\;12\=1\\\=1765.8\\\;2\\\=438.4\\\;\;13\=1\\\=1731.9\\\;2\\\=456.8\\\;\;14\=1\\\=1719.4\\\;2\\\=458.7\\\;\;15\=1\\\=1726.1\\\;2\\\=413.2\\\;\;16\=1\\\=1755.2\\\;2\\\=403.5\\\;\;17\=1\\\=1725.2\\\;2\\\=302.9\\\;\;18\=1\\\=1567.4\\\;2\\\=323.2\\\;\;19\=1\\\=1544.2\\\;2\\\=295.2\\\;\;20\=1\\\=1503.5\\\;2\\\=300.0\\\;\;21\=1\\\=1464.8\\\;2\\\=248.7\\\;\;22\=1\\\=1407.7\\\;2\\\=282.6\\\;\;23\=1\\\=1394.2\\\;2\\\=249.7\\\;\;24\=1\\\=1378.7\\\;2\\\=240.0\\\;\;25\=1\\\=1377.7\\\;2\\\=224.5\\\;\;26\=1\\\=1397.1\\\;2\\\=225.5\\\;\;27\=1\\\=1413.5\\\;2\\\=204.2\\\;\;28\=1\\\=1332.3\\\;2\\\=149.0\\\;\;29\=1\\\=1328.4\\\;2\\\=108.4\\\;\;30\=1\\\=1236.5\\\;2\\\=96.8\\\;\;31\=1\\\=1196.8\\\;2\\\=30.0\\\;\;32\=1\\\=1205.5\\\;2\\\=8.7\\\;\;33\=1\\\=1191.0\\\;2\\\=-33.9\\\;\;34\=1\\\=1205.5\\\;2\\\=-72.6\\\;\;35\=1\\\=1204.5\\\;2\\\=-90.0\\\;\;36\=1\\\=1231.6\\\;2\\\=-101.6\\\;\;37\=1\\\=1243.2\\\;2\\\=-119.0\\\;\;38\=1\\\=1202.6\\\;2\\\=-136.5\\\;\;39\=1\\\=1184.2\\\;2\\\=-131.6\\\;\;40\=1\\\=1238.4\\\;2\\\=-269.0\\\;\;41\=1\\\=1189.0\\\;2\\\=-303.9\\\;\;42\=1\\\=1199.7\\\;2\\\=-325.2\\\;\;43\=1\\\=1161.9\\\;2\\\=-377.4\\\;\;44\=1\\\=1161.9\\\;2\\\=-406.5\\\;\;45\=1\\\=1133.9\\\;2\\\=-451.0\\\;\;46\=1\\\=1261.6\\\;2\\\=-449.0\\\;\;47\=1\\\=1268.4\\\;2\\\=-414.2\\\;\;48\=1\\\=1283.9\\\;2\\\=-382.3\\\;\;49\=1\\\=1311.9\\\;2\\\=-365.8\\\;\;50\=1\\\=1345.8\\\;2\\\=-359.0\\\;\;51\=1\\\=1371.0\\\;2\\\=-370.6\\\;\;52\=1\\\=1358.4\\\;2\\\=-390.0\\\;\;53\=1\\\=1339.0\\\;2\\\=-387.1\\\;\;54\=1\\\=1323.5\\\;2\\\=-397.7\\\;\;55\=1\\\=1324.5\\\;2\\\=-423.9\\\;\;56\=1\\\=1346.8\\\;2\\\=-417.1\\\;\;57\=1\\\=1388.4\\\;2\\\=-417.1\\\;\;58\=1\\\=1406.8\\\;2\\\=-426.8\\\;\;59\=1\\\=1381.6\\\;2\\\=-448.1\\\;\;60\=1\\\=1841.3\\\;2\\\=-450.0\\\;\ GraphicsWindow.KeyDown=kkk GraphicsWindow.MouseDown=see ldcall.Function4 ("stext" 1880, -310 "State of" "Times New Roman;68;true;true;white;true;darkblue") ldcall.Function4 ("stext" 1880, -220 "name:" "Times New Roman;48;false;true;darkblue;false") ldcall.Function4 ("stext" 1880, -170 "∙ area km2: " "Times New Roman;48;false;true;darkblue;false") Sub see If LDShapes.LastEventType="MouseDown" then GraphicsWindow.Title =LDShapes.LastEventShape endif endsub i=1 GraphicsWindow.Title ="EUmap GraphicsWindow.PenWidth =1 i=1 ww=0 For www=0 to 58 fld() endfor cx=-470 cy=-300 zz=.5 os=0 LDGraphicsWindow.Reposition (zz zz cx cy 0) Sub fld mx=wm[ww] pp= LDShapes.AddPolygon (mx) If ww=0 then cl=LDColours.HSLtoRGB (210 .7 .85) LDShapes.AnimateOpacity (pp 7500 0) Else cl=LDColours.HSLtoRGB (250 1 Math.GetRandomNumber (10)/20+.2) endif LDShapes.BrushColour (pp cl) If ww>0 then LDShapes.PenWidth (pp 3) LDShapes.PenColour (pp "cyan") LDEffect.DropShaddow (pp "") LDShapes.SetShapeEvent (pp) endif ww=ww+1 mx=0 i=1 EndSub LDShapes.ShapeEvent=seew While "true If sww Then sww="false i=1 mx=0 GraphicsWindow.Title =ww'+" saved." ww=ww+1 Program.Delay (1500) endif endwhile Sub kkk nn=text.GetCharacter (13) ll= text.ConvertToLowerCase (GraphicsWindow.LastKey) if ll="tab" Then ww=ww-1 GraphicsWindow.Title =ww ElseIf ll="return" then LDShapes.AddPolygon (mx) elseif ll="q" Then ww=ww+1 GraphicsWindow.Title =ww elseif ll="s" Then sww="true elseif ll="f1" Then lll="true elseif ll="left" Then cx=cx-30 elseif ll="right" Then cx=cx+30 elseif Text.IsSubText(ll "shift") Then cy=cy-30 elseif ll="down" Then cy=cy+30 EndIf LDGraphicsWindow.Reposition (zz zz cx cy 0) EndSub Sub mww zz=zz+ LDEvents.LastMouseWheelDelta /30 LDGraphicsWindow.Reposition (zz zz cx cy 0) EndSub Sub seew cl=LDColours.HSLtoRGB (250 1 Math.GetRandomNumber (10)/20+.2) If os=0 Then else LDShapes.BrushColour (os cl) LDShapes.AnimateOpacity (os 0 0) endif es= LDShapes.LastEventShape ess=text.GetSubTextToEnd (es 8) LDShapes.BrushShape(es LDShapes.BrushImage(fl[fa[ess]] )) LDShapes.BrushShape(zs LDShapes.BrushImage(fl[fa[ess]] )) stx=ldtext.Split (sttx[ess] "#") Shapes.SetText ( stt[1] stx[1]) Shapes.SetText ( stt[2] stx[3]+" "+stx[2]) Shapes.SetText ( stt[3] "∙ area km²: "+stx[4]) LDShapes.AnimateOpacity (es 1618 0) LDShapes.ZIndex (es 1000) os=es EndSub End>BCV978.sb< Start>BCW046.sb< ' Drawing out trace Graph (Like CP1919, Joy Division - Unknown Pleasures) ' Waves[1]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[2]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[3]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[4]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[5]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[6]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[7]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[8]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[9]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[10]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[11]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;2;4;8;8;8;7;8;6;5;2;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[12]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;2;22;36;38;16;9;9;9;9;9;9;9;9;8;8;8;7;6;3;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[13]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;9;32;38;34;35;32;43;67;82;104;114;98;16;9;9;9;9;9;9;9;9;7;3;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[14]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;19;27;31;31;28;28;39;80;101;119;126;129;129;125;128;139;172;181;172;150;111;23;9;9;9;8;4;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[15]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;16;31;31;29;28;29;58;105;119;127;128;131;131;129;134;136;168;201;202;196;172;137;140;188;213;191;156;76;7;4;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[16]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;28;39;36;29;29;50;89;107;123;130;132;133;130;131;133;135;144;172;199;206;202;181;138;133;164;204;208;172;203;159;145;138;134;64;6;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[17]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;34;37;28;28;43;79;103;117;124;130;132;132;132;131;134;134;135;147;174;200;203;198;182;139;138;152;192;205;183;210;213;150;144;141;156;135;71;33;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[18]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;49;43;33;29;70;93;106;116;126;130;134;131;131;131;133;133;134;139;151;177;196;201;198;176;148;146;153;181;205;201;201;235;154;149;146;150;169;119;74;60;29;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[19]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;69;36;28;32;110;94;122;124;130;133;133;134;134;131;132;128;132;136;137;154;182;197;200;191;163;151;147;153;182;211;225;227;253;205;155;149;149;153;151;144;70;108;172;106;4;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[20]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;16;88;31;28;108;110;121;127;132;134;133;135;133;133;130;128;130;132;132;139;160;184;196;199;179;157;150;151;160;189;210;218;233;253;233;163;156;153;155;151;151;158;102;172;93;44;3;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[21]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;120;29;31;53;119;128;133;133;133;134;133;130;131;131;127;126;130;130;128;133;168;187;194;192;172;156;150;156;165;199;209;216;251;253;227;168;161;154;156;158;163;171;130;183;169;43;54;2;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[22]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;99;50;28;43;116;130;133;133;134;132;130;128;129;129;127;129;130;130;130;127;142;171;181;190;185;158;153;153;156;177;199;215;205;253;252;219;168;162;161;157;157;182;166;210;156;122;143;51;49;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[23]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;17;86;35;28;116;131;133;130;130;130;129;126;127;127;130;127;129;131;132;133;136;165;177;179;181;165;154;155;156;165;180;197;189;232;253;252;180;167;166;163;162;164;202;174;162;219;81;131;48;100;31;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[24]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;74;46;29;96;132;131;131;130;129;126;128;130;127;128;128;125;129;130;134;133;149;149;169;172;168;155;153;156;160;174;184;187;181;247;253;249;172;169;166;165;163;164;199;190;164;233;128;55;61;68;170;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[25]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;54;35;42;133;134;130;133;130;130;127;128;128;126;127;129;126;128;130;136;144;152;146;161;166;154;150;150;154;163;180;185;183;204;251;253;230;170;170;168;166;163;165;188;203;172;214;196;74;42;88;198;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[26]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;47;30;117;133;133;131;135;133;132;130;125;124;127;127;128;128;130;133;149;149;146;144;154;150;145;144;149;150;166;180;185;181;217;254;253;197;167;168;164;164;164;167;185;196;174;187;245;135;76;73;192;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[27]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;39;34;135;131;132;132;137;134;135;131;129;128;126;128;126;128;130;135;161;160;149;146;145;140;140;136;145;152;174;182;183;181;239;254;251;176;167;164;163;162;163;167;190;192;172;176;247;176;89;63;221;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[28]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;5;35;78;133;130;129;129;132;133;126;128;128;127;129;129;128;129;136;152;172;173;155;133;136;136;137;145;147;158;172;174;173;201;251;252;225;172;167;166;163;161;162;168;188;184;171;177;249;189;134;73;185;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[29]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;15;33;135;133;131;131;130;128;128;127;127;128;129;131;130;129;137;153;167;175;172;156;136;135;135;141;143;150;162;173;175;169;219;246;244;177;169;169;168;167;164;161;164;186;180;172;181;248;180;162;90;145;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[30]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;25;54;138;133;132;132;130;128;130;128;129;130;131;130;132;136;147;154;166;175;170;146;137;137;134;140;141;154;162;168;171;176;207;209;203;171;166;166;168;168;165;164;164;181;174;169;182;246;180;145;139;196;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[31]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;36;100;136;135;133;133;131;129;129;131;134;134;134;132;132;136;153;151;154;163;153;134;138;135;133;138;137;145;152;154;153;173;186;191;181;157;153;160;161;163;164;164;167;176;169;170;193;244;185;146;172;151;4;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[32]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;37;127;136;136;132;133;130;130;130;132;133;130;129;132;126;129;135;138;143;140;132;133;132;132;130;130;130;126;127;115;112;124;148;157;148;117;121;125;142;140;162;164;165;168;169;169;205;238;195;151;204;85;19;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[33]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3;52;125;136;133;131;130;131;132;128;127;125;122;117;125;132;140;126;123;136;133;134;134;131;127;124;122;110;93;96;75;81;74;62;46;45;54;67;63;72;69;111;137;152;166;174;167;227;226;196;158;215;58;33;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[34]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;13;60;124;137;132;134;129;132;128;117;109;113;109;105;117;105;114;121;121;124;129;125;125;123;121;119;106;97;76;74;55;50;37;35;32;32;33;37;39;46;53;89;114;161;148;180;168;246;205;189;169;180;51;36;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[35]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;25;60;130;133;133;128;126;121;109;100;77;43;40;45;42;54;69;95;93;111;114;123;121;121;119;101;93;70;58;56;51;38;31;29;27;28;26;30;40;44;46;80;121;120;94;175;173;251;190;184;179;157;50;47;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[36]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;34;72;134;132;135;126;99;65;56;46;30;28;28;27;31;41;45;69;87;98;101;112;112;111;112;83;73;62;62;48;38;37;43;40;43;59;57;58;62;76;88;85;58;71;101;154;181;252;185;182;177;126;54;48;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[37]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;38;79;133;133;118;52;45;37;30;23;24;21;22;26;26;32;45;49;74;81;85;90;104;111;104;81;62;53;55;52;54;60;63;68;77;79;65;52;47;40;35;33;35;38;36;44;79;130;126;137;192;131;55;62;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[38]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;15;36;71;133;121;56;42;33;29;36;39;36;40;41;45;40;35;39;47;50;61;75;90;94;108;95;80;58;53;56;58;55;52;59;39;34;35;30;32;32;31;30;31;37;41;37;34;37;43;43;53;48;183;55;66;19;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[39]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;26;154;41;82;138;89;50;45;45;49;47;50;49;59;64;66;61;53;50;46;51;55;82;85;90;90;94;79;68;52;45;56;52;37;36;34;34;33;31;47;37;38;47;56;54;59;59;36;33;35;41;45;45;163;144;105;91;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[40]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;25;133;94;42;37;32;33;33;31;33;36;34;30;33;33;31;35;34;37;36;36;39;44;60;68;69;50;35;35;33;34;36;44;43;33;29;34;30;32;25;26;34;33;38;50;54;53;58;69;38;34;34;34;47;127;41;37;160;15;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[41]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;9;45;70;43;34;32;38;37;36;43;45;36;30;31;32;32;32;32;29;33;33;34;36;36;31;39;34;32;30;34;33;35;35;34;38;23;27;24;40;22;32;28;28;27;26;33;36;45;59;111;162;38;37;51;224;132;39;43;75;147;54;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[42]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3;67;75;61;34;63;64;47;40;47;54;44;53;46;43;46;38;21;28;31;29;32;39;39;32;34;30;31;30;32;33;31;56;37;42;27;23;21;19;20;22;25;26;32;32;35;33;36;70;167;176;41;44;64;212;153;62;101;121;136;140;121;7;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[43]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;37;40;38;35;47;50;56;48;48;48;40;37;40;34;36;42;39;25;22;22;21;43;33;31;29;47;53;30;33;32;41;34;59;46;23;19;22;23;30;25;26;28;40;63;54;41;46;104;176;176;42;64;124;227;159;97;118;143;146;160;159;135;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[44]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;21;37;37;36;49;47;46;44;48;32;30;44;28;31;51;52;31;23;22;22;22;28;32;32;63;112;174;111;29;31;34;33;27;44;38;30;26;25;36;28;28;30;32;35;38;42;53;102;167;148;39;62;162;221;160;112;111;156;134;120;160;157;23;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[45]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;18;36;37;36;46;42;39;36;34;55;37;29;28;31;33;41;37;31;27;26;25;33;34;33;87;153;161;88;31;32;38;27;30;28;27;43;44;33;23;25;26;29;33;36;38;55;65;119;109;168;42;58;175;206;157;126;150;135;117;116;129;155;30;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[46]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;11;34;37;45;49;51;49;60;54;90;69;58;58;37;28;25;28;26;39;61;58;31;37;59;139;97;87;68;34;31;41;39;65;42;27;36;32;36;35;53;39;45;51;52;51;54;69;140;171;113;41;132;187;177;155;155;118;139;121;106;104;150;17;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[47]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;9;38;34;47;47;49;50;63;57;61;78;62;63;26;44;24;28;36;32;33;52;33;35;96;92;98;104;96;48;31;40;97;132;152;58;39;37;32;36;49;54;53;56;56;46;52;84;165;177;42;38;164;190;166;155;141;149;146;130;107;118;148;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[48]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;20;62;39;47;46;46;53;69;57;58;38;42;38;34;35;46;46;35;37;32;46;33;30;90;96;108;115;122;110;29;34;110;161;115;108;46;49;41;36;51;48;53;52;49;43;51;109;171;178;35;61;162;179;161;154;148;187;151;140;102;141;128;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[49]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;41;110;36;30;45;49;82;67;54;37;34;44;52;38;33;41;80;40;41;41;31;35;66;99;103;136;123;125;125;77;37;85;128;107;100;91;52;46;32;89;40;51;47;39;39;51;125;186;58;36;152;162;174;162;146;159;145;163;137;107;144;87;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[50]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;74;97;47;35;42;54;71;61;48;58;32;32;35;32;36;43;85;83;72;51;32;53;95;112;147;163;161;176;131;118;41;42;39;97;78;91;82;82;40;42;49;40;33;36;37;47;117;59;35;70;163;160;179;156;126;158;144;142;134;110;164;39;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[51]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;8;101;78;37;28;64;77;79;57;58;43;47;38;36;37;80;81;85;81;30;30;95;96;118;141;150;163;176;142;131;90;33;36;37;58;80;85;77;89;81;87;43;34;33;34;41;30;40;40;164;160;161;185;163;115;141;160;128;124;125;184;2;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[52]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;31;74;38;34;37;69;75;52;65;46;46;49;48;55;75;83;69;32;34;74;98;112;117;131;144;154;148;156;164;134;134;44;38;36;37;35;57;67;67;65;42;29;30;33;36;28;135;221;161;159;159;187;160;110;122;157;157;127;158;166;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[53]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;55;61;33;34;32;63;47;54;38;36;46;41;32;32;35;34;35;68;101;112;127;123;132;134;144;138;163;170;140;141;130;61;44;37;36;37;37;34;32;37;32;39;98;180;210;215;182;155;157;157;196;154;88;118;176;181;199;182;114;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[54]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;30;63;120;48;42;44;33;33;30;35;33;33;33;37;36;42;62;119;110;113;126;128;132;134;137;147;159;154;145;144;140;113;86;94;99;96;100;101;105;109;115;123;140;185;201;184;154;156;150;157;185;150;90;113;175;178;208;169;54;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[55]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;12;63;122;117;129;131;121;114;116;112;106;102;99;88;76;76;114;119;114;105;119;124;128;129;136;141;122;102;115;125;126;103;95;101;104;103;102;108;117;125;131;134;140;156;164;150;143;145;148;153;180;131;69;138;129;171;191;160;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[56]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;22;70;116;128;134;127;122;124;117;115;113;104;87;90;90;83;85;85;82;45;107;120;121;120;128;78;75;86;85;68;81;96;123;111;115;115;105;105;111;122;130;131;136;139;137;144;141;139;147;176;179;129;75;144;121;197;169;89;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[57]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;24;72;110;126;136;128;127;128;127;126;114;97;80;90;86;68;64;64;75;93;99;107;107;110;112;105;104;77;53;97;75;76;78;83;107;112;99;95;100;112;119;126;131;133;135;142;133;143;145;182;145;119;64;136;117;198;126;39;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[58]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;40;62;124;117;119;127;124;129;124;116;98;73;82;75;59;43;34;37;37;54;70;99;97;97;97;75;60;35;40;38;35;52;63;61;64;65;66;56;87;82;105;120;126;128;130;133;138;130;156;155;123;88;54;101;128;174;127;12;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[59]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;73;64;107;118;116;126;128;125;115;76;52;49;49;56;43;31;29;30;28;36;37;52;74;80;64;37;34;35;35;37;35;36;35;47;48;40;48;47;51;47;59;91;116;114;124;134;117;120;147;134;110;88;79;103;131;202;116;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[60]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;53;63;90;117;115;116;120;111;59;24;30;38;37;34;30;30;32;27;30;33;31;29;47;43;33;30;29;30;29;35;32;34;33;38;47;33;37;32;37;28;35;49;69;109;118;108;106;120;122;100;92;69;95;130;149;121;129;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[61]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;4;58;59;89;100;113;118;112;78;28;26;29;41;34;33;27;29;31;29;30;31;30;31;39;47;40;29;30;29;28;29;41;30;37;44;53;43;47;36;36;37;25;40;41;96;125;123;101;85;76;72;67;60;75;123;153;107;102;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[62]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;59;45;87;87;112;120;104;39;28;32;32;35;39;35;36;31;29;36;29;33;32;32;60;46;77;41;32;32;38;30;31;46;41;48;60;155;156;49;43;36;31;35;34;73;118;124;109;60;48;59;62;54;92;122;162;90;53;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[63]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;61;40;74;84;105;109;98;40;33;33;35;43;53;55;62;50;55;40;35;49;38;60;101;85;103;99;66;49;49;59;44;59;52;65;56;53;51;41;39;30;37;32;32;78;120;112;62;49;46;48;53;59;67;144;163;105;18;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[64]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;29;36;58;72;79;107;84;36;25;31;30;44;32;35;26;30;73;87;106;82;115;104;138;142;119;141;147;114;142;117;127;133;101;73;32;22;29;41;48;33;31;32;43;105;93;71;56;47;40;42;46;105;107;143;78;71;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[65]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;38;44;59;57;83;78;41;28;27;24;48;66;36;30;21;75;101;132;106;134;135;150;157;140;154;154;143;153;102;128;116;71;29;28;41;60;77;66;38;30;28;57;87;68;53;47;45;49;47;81;111;173;151;45;53;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[66]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;39;34;43;47;65;57;40;32;29;31;49;69;91;63;43;38;76;120;71;93;129;144;139;75;112;71;58;55;59;60;65;63;71;71;95;98;89;81;40;26;28;60;69;49;43;41;41;45;60;131;132;112;144;48;86;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[67]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;34;31;35;39;59;55;57;39;27;28;58;72;93;101;96;83;88;87;85;86;86;88;87;92;91;90;90;95;96;100;100;101;106;111;116;103;95;89;36;28;34;75;53;39;39;59;37;60;84;125;105;86;106;82;4;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[68]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;13;34;38;38;39;47;58;42;31;32;52;83;94;100;113;117;110;99;100;102;98;100;101;98;101;98;108;116;115;124;126;131;132;127;119;104;103;78;31;26;32;65;37;35;47;53;42;54;76;145;130;148;47;62;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[69]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;25;35;37;38;39;48;34;31;33;41;69;85;97;108;117;121;127;122;121;118;123;125;127;126;126;132;129;132;135;130;126;114;114;103;103;102;49;31;28;39;41;38;32;33;35;43;80;126;99;102;98;50;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[70]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;5;30;36;35;36;33;32;31;32;35;71;88;96;98;107;107;103;98;91;99;109;116;106;110;108;99;123;117;112;105;102;103;99;95;93;85;36;31;28;36;32;31;34;31;32;45;110;122;46;164;45;10;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[71]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;34;32;37;37;30;30;29;31;37;55;75;87;86;82;86;76;69;63;66;75;86;71;73;75;124;68;76;83;81;82;84;95;87;94;57;34;28;27;30;33;30;33;29;34;68;115;34;106;122;43;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[72]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;26;31;30;34;30;30;31;33;32;39;45;74;78;73;66;61;62;47;46;47;55;46;55;98;87;48;48;67;66;85;88;89;80;74;46;33;30;28;30;28;27;36;31;47;110;39;70;140;53;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[73]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;57;30;30;28;27;30;29;29;31;35;47;60;65;57;60;44;41;37;45;82;85;64;91;49;52;46;46;74;103;100;116;83;45;41;41;27;26;30;27;29;33;34;84;53;41;147;67;14;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[74]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;20;40;31;27;30;32;28;29;30;33;38;50;59;67;63;40;39;38;129;77;82;65;53;50;46;40;52;79;104;107;83;77;35;37;39;25;29;31;28;29;40;28;53;39;78;89;64;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[75]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;30;26;27;30;30;31;28;29;32;35;44;49;66;55;43;35;111;105;69;90;97;66;53;57;54;59;91;109;102;68;44;29;31;33;23;29;33;27;30;48;37;39;58;77;56;37;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[76]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;23;28;26;28;27;26;31;33;33;38;45;48;44;67;105;81;122;60;64;67;60;52;51;63;57;106;87;52;44;40;32;33;34;32;32;32;36;45;63;32;47;55;72;56;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[77]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3;31;30;29;27;27;33;29;34;35;46;45;117;60;113;77;94;56;58;71;61;62;50;60;62;91;55;60;40;39;28;28;37;37;36;33;133;63;30;36;75;54;39;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[78]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;11;34;31;29;34;30;31;32;36;40;38;96;80;87;83;45;57;73;43;71;70;69;56;50;66;42;34;34;41;27;29;32;36;40;60;33;34;46;66;42;39;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[79]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;21;34;29;29;33;29;32;32;39;66;57;61;62;41;55;57;54;48;74;77;58;58;50;60;42;33;29;34;28;27;34;39;36;50;28;37;118;63;39;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[80]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;28;30;31;30;28;32;32;39;37;36;66;57;75;69;78;46;75;69;70;65;52;73;53;36;35;31;29;29;29;32;80;68;30;30;49;30;32;2;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[81]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;2;26;27;33;30;33;30;34;49;30;47;48;56;57;55;60;68;55;49;44;64;35;38;29;30;40;29;31;37;32;45;31;31;24;49;27;5;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[82]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;22;30;31;29;31;36;34;31;38;36;40;39;43;47;42;33;37;36;46;30;31;34;34;33;33;31;45;26;26;29;27;26;23;18;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[83]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;16;28;30;27;35;32;34;29;30;34;31;34;28;34;30;23;36;27;26;27;39;35;35;32;28;33;23;29;25;23;24;8;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[84]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;7;29;32;31;31;28;26;27;23;30;27;26;26;27;27;34;30;27;30;33;34;35;22;24;24;28;25;20;4;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[85]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;10;26;33;32;32;31;29;28;32;26;25;26;24;29;33;27;29;31;24;22;24;21;23;19;14;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[86]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;5;13;20;27;29;33;30;26;25;30;26;30;22;24;24;23;21;23;21;22;25;6;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[87]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;7;18;23;21;21;16;16;23;24;34;28;19;2;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[88]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[89]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[90]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[91]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[92]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[93]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[94]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[95]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[96]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[97]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[98]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[99]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" Waves[100]="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;" GraphicsWindow.BackgroundColor="black" GraphicsWindow.Width="700" GraphicsWindow.Height="700" ' Set come drawing control variables wd=3 yd=6 sx=200 sy=25 effect=0.7 For i = 1 To 100 arra=Waves[i] start=1 newtxt=arra history=0 For a = 1 To 100 ' Why can't I get Array.GetValue to work? Quick fix... Messy. pos = Text.GetIndexOf(newtxt,";") piece = Text.GetSubText(newtxt,start,pos) plen = Text.GetLength(piece) piece = Text.GetSubText(piece,1,plen-1)/4 newtxt = Text.GetSubTextToEnd(newtxt,pos+1) If piece = 0 Then piece=Math.GetRandomNumber(10-(effect*10)) ' Add Noise on flat-line EndIf GraphicsWindow.PenWidth="0.5" ' Draw out trace (White) ___________ GraphicsWindow.PenColor="white" GraphicsWindow.DrawLine(((a-1)*wd)+sx,((i*yd)-history)+sy,((a*wd))+sx,((i*yd)-(piece*effect))+sy) GraphicsWindow.PenColor="black" ' Render down black on new layer _______________ GraphicsWindow.PenWidth=wd GraphicsWindow.DrawLine(((a*wd)+2)+sx,((i*yd)-(piece*effect))+(sy),((a*wd)+2)+sx,700) history=piece*effect EndFor EndFor End>BCW046.sb< Start>BCZ053.sb< 'Initialisation Window gw = 800 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh 'Initialise Key events GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp keyLeft = 0 keyRight = 0 keyUp = 0 keyDown = 0 'Initialise ball ball = Shapes.AddEllipse(50,50) ballX = 100 ballY = 100 speed = 3 'Main loop - just move the ball While ("True") start = Clock.ElapsedMilliseconds processKey() Shapes.Move(ball,ballX-25,ballY-25) delay = 20 - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile 'Key press event subroutines 'A separate Down and Up is checked for each key, this tells us the state for any key 'And isn't affected by auto-repeat delays for keys Sub OnKeyDown key = GraphicsWindow.LastKey keyDown[key] = "True" EndSub Sub OnKeyUp key = GraphicsWindow.LastKey keyDown[key] = "" EndSub Sub processKey 'Move object - note it can move diagonally if 2 keys are pressed If (keyDown["Left"]) Then ballX = ballX-speed EndIf If (keyDown["Right"]) Then ballX = ballX+speed EndIf If (keyDown["Up"]) Then ballY = ballY-speed EndIf If (keyDown["Down"]) Then ballY = ballY+speed EndIf 'Check for hitting edges If (ballX < 0) Then ballX = ballX+gw EndIf If (ballX > gw) Then ballX = ballX-gw EndIf If (ballY < 0) Then ballY = ballY+gh EndIf If (ballY > gh) Then ballY = ballY-gh EndIf EndSub End>BCZ053.sb< Start>BCZ528.sb< GraphicsWindow.BackgroundColor="darkblue tt=LDControls.AddRichTextBox(600 800) GraphicsWindow.Height=850 GraphicsWindow.Width=1200 GraphicsWindow.Title="SimpleBasic LDShapes.BrushColour(tt "transparent") LDControls.RichTextBoxFontFamily="Lucida Console LDControls.RichTextBoxFontSize=14 LDControls.RichTextBoxFontForeground="cyan LDControls.RichTextBoxFontBackground="#007799 LDControls.RichTextBoxDefault(tt) LDControls.RichTextBoxTextTyped=rttx dnbtt="" chrs="~#~.#.#.#~.@@@#~.#;@@.#~.@@#.#~.@@#.;.@@#~~#~~#~~.@@;@#~#~#.#~.@~#.@#~;@@@~~@#~#~~@@#;@@@~~@#~#~~#~~;.@@#~~#~@#~.#.@@;#~.@~.@@@#~.@~.#;~#~~#~~#~~#~~#~;~~#~~#~~@~.#.@#.;#~#.#.#~@#~#~#.#~.#;#~~#~~#~~#~~@@#;#~.@#.@#.#.@~.@~.#;#~.@#~@.#.@~@#~.#;.@#.#~.@~.@~.#.@#.;@@.#~.@@#.#~~#~~;.@#.#~.@~.@~#~@.#;@@.#~.@@#.#~#.#~.#;.@@#~~.@#~~.@@#.;@@#~#~~#~~#~~#~;#~.@~.@~.@~.#.@#.;#~.@~.@~.#.#.#~.#~;#~.@~.@.#.@#.@#~.#;#~.#.#.#~.#~.#.#.#~.#;#~.#.#.#~.#~~#~~#~;@@#~.#~.#~.#~.@@#;~#~.@~#.#~~#~.@#.;.@#.#~.#~.#~#~.@@#;.@#.#~.#~.#.#~.#.@#.;~#~.#~.#~#.@@#~.#.;@@@~~@@~~.@@#.;.@@#~~@@.#~.#.@#.;@@#~~#~.#~.#~~#~;.@#.#~.#.@#.#~.#.@#.;.@#.#~.#.@@~~@@#. chrs=LDText.Replace(chrs "@" "##") chrs=LDText.Replace(chrs "~" "..") chm=LDText.Split(chrs ";") Controls.AddButton (" Run >>> " 5 5) cmp=Controls.AddButton (" >>Cmpct<< " 95 5) bsv=Controls.AddButton ("[ Save ]" 195 5) bld=Controls.AddButton ("[ Load ]" 295 5) bcl=Controls.AddButton ("[ Clear ]" 395 5) nln=Text.GetCharacter(13)+Text.GetCharacter(10) dd=LDText.Replace("get a supply_a_value;loop 5;get b supply_b_value;set c %a+%b;? result:_%a+%b=%c;eloop" ";" nln) dd=LDText.Replace("clr ;set h 0;for 0 120 15;set a 0;set x 0;set h %h+15;lpp 500;set y Math.Sin(%a)*70;set a %a+.02;hsb %h 1 .5;ell %x %y+155+%1 5 5 %ccc;set x %x+1;elp ;nxt ;dly 3333" ";" nln) LDControls.RichTextBoxSetText(tt dd "false") Shapes.Move(tt 5 35) rtbcc() Controls.ButtonClicked=bbb Sub rttx If text.StartsWith( GraphicsWindow.Title "*") Then Else GraphicsWindow.Title="*** "+GraphicsWindow.Title EndIf EndSub While "true If run Then mm="" Shapes.SetOpacity(tt 15) tx=ldtext.split(LDControls.RichTextBoxGetText(tt) nln) xx=1 For x=1 To Array.GetItemCount(tx) tx[x]= LDText.Trim(tx[x]) If Text.StartsWith(tx[x] "`") Then lbm[Text.GetSubTextToEnd(tx[x] 2)]=x+1 EndIf EndFor ' TextWindow.WriteLine(lbm) While xx<=Array.GetItemCount(tx) ll=LDText.Split(ldtext.Replace(ldtext.Replace(tx[xx] " " "~") "_" " ") "~") lc=Text.ConvertToLowerCase(ll[1]) ii=Array.GetAllIndices(mm) 'TextWindow.WriteLine(ii) For q=2 To Array.GetItemCount(ll) For m=1 To Array.GetItemCount(mm) ll[q]=LDText.Replace(ll[q] "%"+ii[m] mm[ii[m]]) EndFor For m=1 To Array.GetItemCount(lp) ll[q]=LDText.Replace(ll[q] "%"+m lps[m]) EndFor ll[q]=LDText.Replace(ll[q] "%ccc" clr) EndFor If lc="get" or lc="inp" or lc="<<<" Then mm[ll[2]]= FCDialogs.AskForTextLine(ll[3]) ElseIf lc="for" or lc="{::" Then lw=lw+1 lp[lw]=xx+1 lpc[lw]=Math.Floor((ll[3]-ll[2])/ll[4]) lps[lw]=ll[2] lpi[lw]=ll[4] ElseIf lc="jmp" or lc=">+>" Then xx=xx+ll[2] Goto nxt ElseIf lc="iff" or lc="whn" Then If LDMath.Evaluate3(ll[2]) Then Else xx=xx+ll[3] Goto nxt EndIf ElseIf lc="jtl" or lc=">>:" Then xx=ll[2] Goto nxt ElseIf lc="btn" Then mm[ll[2]]=Controls.AddButton(ll[3] ll[4] ll[5]) gtt[ll[2]]=ll[6] ElseIf lc="rct" or lc="rect" Then GraphicsWindow.BrushColor=ll[6] GraphicsWindow.FillRectangle(ldmath.Evaluate(ll[2]+"+0") ldmath.Evaluate("0+"+ll[3]) ldmath.Evaluate("0+"+ll[4]) ldmath.Evaluate("0+"+ll[5])) ElseIf lc="ell" or lc="elip" Then GraphicsWindow.BrushColor=ll[6] GraphicsWindow.FillEllipse(ldmath.Evaluate(ll[2]+"+0") ldmath.Evaluate("0+"+ll[3]) ldmath.Evaluate("0+"+ll[4]) ldmath.Evaluate("0+"+ll[5])) ElseIf lc="jlb" or lc=">>>" Then xx=lbm[ll[2]] Goto nxt ElseIf lc="lps" Then fff=1 For fy=0 To 4 For fx=0 To 4 lm[fff]=Shapes.AddRectangle(9 27) Shapes.Move(lm[fff] ll[2]+fx*33 ll[3]+fy*33) LDShapes.PenWidth(lm[fff] 0) If Text.GetSubText(ll[4] fff 1)="#" Then LDShapes.BrushColour(lm[fff] "orange") Else LDShapes.BrushColour(lm[fff] "darkred") EndIf fff=fff+1 EndFor EndFor ElseIf lc="lp@" Then For qq=1 To 25 cc=LDShapes.GetColour(lm[qq]) If (cc[1])="#FF8B0000" Then LDShapes.BrushColour(lm[qq] "orange") Else LDShapes.BrushColour(lm[qq] "darkred") EndIf EndFor ElseIf lc="lp#" Then For qq=1 To 25 Shapes.Remove(lm[qq]) EndFor ElseIf lc="scr" Then stx=text.ConvertToUpperCase(ll[2]) For f=1 To 5 smm[f]=" " EndFor For r=1 To Text.GetLength(stx) c=Text.GetCharacterCode(Text.GetSubText(stx r 1)) If c=Text.GetCharacterCode("-") or c=Text.GetCharacterCode("_") Then ch=" " ElseIf c>48 and c<58 Then ch=chm[27+c-49] ElseIf c=48 Then ch=chm[15] Else ch=chm[c-64] EndIf For f=1 To 5 smm[f]=smm[f]+Text.GetSubText(ch f*5-4 5)+"." EndFor EndFor For f=1 To 5 smm[f]=smm[f]+" " EndFor For sp=1 To Text.GetLength(smm[1]) llt="" For fq=1 To 5 llt=llt+Text.GetSubText (smm[fq] sp 5) EndFor For fff=1 To 25 If Text.GetSubText(llt fff 1)="#" Then LDShapes.BrushColour(lm[fff] LDColours.HSLtoRGB(55 1 Math.GetRandomNumber(50)/250+.7)) Shapes.Zoom(lm[fff] 1.6 1) Else LDShapes.BrushColour(lm[fff] "brown") Shapes.Zoom(lm[fff] 1 1) EndIf EndFor Program.Delay(155) EndFor scmd="false ElseIf lc="lp$" Then For fff=1 To 25 If Text.GetSubText(ll[2] fff 1)="#" Then LDShapes.BrushColour(lm[fff] "orange") Else LDShapes.BrushColour(lm[fff] "darkred") EndIf EndFor ElseIf lc="lp&" Then For fff=1 To 25 If Text.GetSubText(chm[ll[2]] fff 1)="#" Then LDShapes.BrushColour(lm[fff] "orange") Else LDShapes.BrushColour(lm[fff] "darkred") EndIf EndFor ElseIf lc="tsp" Then Turtle.Speed=ll[2] GraphicsWindow.PenWidth=ldmath.Evaluate(ll[3]+"+0") GraphicsWindow.PenColor=ll[4] ElseIf lc="trt" Then Turtle.Turn(ldmath.Evaluate(ll[2]+"+0")) Turtle.Move(ldmath.Evaluate(ll[3]+"+0")) ElseIf lc="trm" Then Turtle.MoveTo(ldmath.Evaluate(ll[2]+"+0") ldmath.Evaluate(ll[3]+"+0")) ElseIf lc="tru" Then Turtle.PenUp() ElseIf lc="trd" Then Turtle.PenDown() ElseIf lc="trr" Then LDShapes.RasteriseTurtleLines() LDShapes.RemoveTurtleLines() Turtle.Hide() Turtle.Angle=0 ElseIf lc="trp" Then Turtle.x=ldmath.Evaluate(ll[2]+"+0") Turtle.y=ldmath.Evaluate(ll[3]+"+0") ElseIf lc="hsb" Then clr= LDColours.HSLtoRGB(ldmath.Evaluate(ll[2]+"+0") ldmath.Evaluate(ll[3]+"+0") ldmath.Evaluate(ll[4]+"+0")) ElseIf lc="loop" or lc="lpp" or lc="{" Then lw=lw+1 lp[lw]=xx+1 lpc[lw]=ll[2]-1 lps[lw]=0 ElseIf lc="clr" Then GraphicsWindow.BrushColor="darkblue" GraphicsWindow.FillRectangle(0 0 GraphicsWindow.Width GraphicsWindow.Height) ElseIf lc="dly" or lc="pause" Then Program.Delay(ll[2]) ElseIf lc="efor" or lc="efr" or lc="}/}" or lc="nxt" Then If lpc[lw]>0 Then lpc[lw]=lpc[lw]-1 xx=lp[lw] lps[lw]=lps[lw]+lpi[lw] Goto nxt Else lw=lw-1 EndIf ElseIf lc="eloop" or lc="elp" or lc="}" Then If lpc[lw]>0 Then lpc[lw]=lpc[lw]-1 xx=lp[lw] lps[lw]=lps[lw]+1 Goto nxt Else lw=lw-1 EndIf ElseIf lc="inc" or lc="add" or lc="+++" Then vv=LDMath.Evaluate(ll[3]+"0") If ll[3]="" Then vv=1 EndIf mm[ll[2]]= mm[ll[2]]+vv ElseIf lc="dec" or lc="sbs" or lc="---" Then vv=LDMath.Evaluate(ll[3]+"0") If ll[3]="" Then vv=1 EndIf mm[ll[2]]= mm[ll[2]]-vv ElseIf lc="flc" Then pc=imagelist.LoadImage( Flickr.GetRandomPicture(ll[2])) GraphicsWindow.DrawResizedImage(pc ll[3] ll[4] ll[5] ll[6]) ElseIf lc="mul" or lc="fct" or lc="***" Then vv=LDMath.Evaluate(ll[3]+"0") If ll[3]="" Then vv=mm[ll[2]] EndIf mm[ll[2]]= mm[ll[2]]*vv ElseIf lc="div" or lc="///" Then vv=LDMath.Evaluate(ll[3]+"0") If ll[3]="" Then mm[ll[2]]=Math.SquareRoot(mm[ll[2]]) Else mm[ll[2]]= mm[ll[2]]/vv EndIf ElseIf lc="set" or lc="let" or lc=":::" Then mm[ll[2]]=LDMath.Evaluate(ll[3]) ' TextWindow.WriteLine( mm[ll[2]]) ElseIf lc="?" or lc="???" or lc="msg" Then GraphicsWindow.ShowMessage(ll[2] "Info") EndIf If dnbtt="" Then xx=xx+1 Else xx=gtt[dnbtt] EndIf nxt: EndWhile Shapes.SetOpacity(tt 95) run="false EndIf EndWhile Sub bbb lbb=Controls.LastClickedButton If lbb=cmp Then rtbcc() ElseIf lbb=bld Then ff=LDDialogs.OpenFile("rtf" "e:\") LDControls.RichTextBoxLoad(tt ff "false") GraphicsWindow.Title=ff ElseIf lbb=bcl Then LDControls.RichTextBoxClear(tt) ElseIf lbb=bsv Then If ss="" Then ss=LDDialogs.SaveFile("rtf" "e:\") EndIf LDControls.RichTextBoxSave(tt ss) GraphicsWindow.Title=ss ElseIf run Then dnbtt="" in=Array.GetAllIndices(mm) For w=1 To Array.GetItemCount(mm) If lbb=mm[in[w]] Then dnbtt=lbb 'TextWindow.WriteLine(dnbtt) EndIf EndFor Else run="true EndIf EndSub Sub rtbcc tx=ldtext.split(LDControls.RichTextBoxGetText(tt) nln) For x=1 To Array.GetItemCount(tx) tx[x]= LDText.Trim(tx[x]) ln=LDText.Split(tx[x] " ") q1=ln[1] If q1="loop" or q1="lpp"Then ln[1]="lpp ln[2]=ln[2]+" ════════════════════╗ ln[3]=" " ElseIf q1="eloop" or q1="elp" Then ln[1]="elp ═════════════════════╝ ln[2]=" " ElseIf q1="?" Then ln[1]="? " EndIf agg="" For r=2 To Array.GetItemCount(ln) agg=Text.Append(agg ln[r]+" ") EndFor tx[x]=ln[1]+"@"+ldtext.trim(agg) EndFor agg="" LDControls.RichTextBoxClear(tt) tx1="{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Lucida console;}{\f1\fnil\fcharset0 Calibri;}} tx1=tx1+"{\colortbl ;\red255\green85\blue0;\red0\green128\blue128;\red255\green170\blue0;\red255\green255\blue0;\red170\green255\blue0;\red85\green255\blue0;\red0\green255\blue0;\red0\green255\blue85;\red0\green255\blue170;\red0\green255\blue255;\red0\green170\blue255;\red0\green85\blue255;\red0\green0\blue255;\red0\green0\blue0;} tx1=tx1+"{\*\generator Riched20 6.3.9600}\viewkind4\uc1" tx1=tx1+"\pard\cf1\highlight2\f0 For r=1 To Array.GetItemCount(tx) ty=LDText.Split(tx[r] "@") tx1=tx1+"\cf3\fs22 "+ty[1]+" " tx1=tx1+"\cf5\fs24 "+ty[2]+"\par \pard EndFor tx1=tx1+"\par}" ' The following line could be harmful and has been automatically commented. ' File.WriteContents(Program.Directory+"\tx.rtf" tx1) LDControls.RichTextBoxLoad (tt Program.Directory+"\tx.rtf" "false") EndSub End>BCZ528.sb< Start>BDB389.sb< gw = 500 gh = 500 GraphicsWindow.Width = gw GraphicsWindow.Height = gh ball = Shapes.AddEllipse(100,100) 'Shapes.Zoom(ball,1,1) Program.Delay(100) LDShapes.ZoomAll(0.1,0.1) Program.Delay(100) LDShapes.ZoomAll(0.5,0.5) Program.Delay(100) Shapes.Zoom(ball,1,1) Program.Delay(1000) 'These are all the same LDGraphicsWindow.Reposition(0.5,0.5,gw/2,gh/2,3*gw/4,3*gh/4) LDGraphicsWindow.Reposition(0.5,0.5,0,0,gw/2,gh/2) LDGraphicsWindow.Reposition(0.5,0.5,100,100,gw/2+50,gh/2+50) LDGraphicsWindow.Reposition(0.5,0.5,0,0,gw/2,gh/2) GraphicsWindow.DrawRectangle(0,0,200,200) Shapes.Move(ball,50,50) GraphicsWindow.BackgroundColor = "Red" Program.Delay(1000) 'Shapes.Move(ball,-100,100) Shapes.AddRectangle(20,20) GraphicsWindow.BrushColor = LDColours.Transparent Shapes.AddRectangle(gw,gh) Program.Delay(3000) 'Attemot ti keep centered While 1=1 xm = GraphicsWindow.MouseX ym = GraphicsWindow.MouseY cx = (cx+xm)/2 cy = (cy+ym)/2 LDGraphicsWindow.Reposition(0.5,0.5,xm,ym,cx,cy) GraphicsWindow.Title = GraphicsWindow.MouseX+" , "+GraphicsWindow.MouseY Program.Delay(20) EndWhile End>BDB389.sb< Start>BDB469.sb< player() variables() Menu() 'Done 'got all mobs and bosses 'got hp and mp pots 'got skills 'got saving and loading 'Need 'equipment 'questgiver 'town 'map Sub variables path = Program.Directory + "\Overworld Slayer.txt" ' The following line could be harmful and has been automatically commented. ' variables=File.ReadContents(path) x = 0 y = 0 EndSub Sub Save_game path = Program.Directory + "\Overworld Slayer.txt" variables[1] = x variables[2] = y variables[3] = level variables[4] = playerhp variables[5] = playerstr variables[6] = playerdef variables[7] = playergold variables[8] = playerxp variables[9] = totalplayerhp variables[10] = sp variables[11] = totalplayermp variables[12] = playermp variables[13] = hppot variables[14] = mppot variables[15] = playervitinc variables[16] = playerintinc variables[17] = playervit variables[18] = playerint variables[19] = activatevls variables[20] = activatelbs variables[21] = activatescm variables[22] = activateepa variables[23] = activatesk variables[24] = activatezh variables[25] = activatedg ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path, variables) EndSub Sub load_game path = Program.Directory + "\Overworld Slayer.txt" x = variables[1] y = variables [2] level = variables[3] playerhp = variables[4] playerstr = variables[5] playerdef = variables[6] playergold = variables[7] playerxp = variables[8] totalplayerhp = variables[9] sp = variables[10] totalplayermp = variables[11] playermp = variables[12] hppot =variables[13] mppot = variables[14] playervitinc = variables[15] playerintinc = variables[16] playervit = variables[17] playerint = variables[18] activatevls = variables[19] activatelbs = variables[20] activatescm = variables[21] activateepa = variables[22] activatesk = variables[23] activatezh =variables[24] activatedg= variables[25] EndSub Sub player sp = 0 weapon = "Sword" level = 1 totalplayerhp = 100 + playervitinc playerhp = 100 + playervitinc playerstr = 10 - enemydef playerdef = 10 playergold = 0 playerxp = 0 playermp = 30 + playerintinc totalplayermp = 30 + playerintinc hppot = 10 mppot = 10 playervitinc = 0 playerintinc = 0 playervit = 10 playerint = 10 activatevls = 0 activatelbs = 0 activatescm = 0 activateepa = 0 activatedg = 0 activatesk = 0 activatezh = 0 EndSub Sub skeleton enemyname = "Skeleton" enemyhp = 10 totalenemyhp = 10 enemystr = 12 - playerdef enemydef = 1 xpdrop = 5 golddrop = 3 EndSub Sub zombie enemyname = "Zombie" enemyhp = 20 totalenemyhp = 20 enemystr = 14 - playerdef enemydef = 2 xpdrop = 10 golddrop = 6 EndSub Sub demon enemyname = "Demon" enemyhp = 30 totalenemyhp = 30 enemystr = 16- playerdef enemydef = 3 xpdrop = 15 golddrop = 9 EndSub Sub skeletonking enemyname = "Skeleton King" enemyhp = 250 totalenemyhp = 250 enemystr = 25- playerdef enemydef = 15 xpdrop = 25 golddrop = 45 EndSub Sub zombiehulk enemyname = "Zombie Hulk" enemyhp = 300 totalenemyhp = 300 enemystr = 30- playerdef enemydef = 20 xpdrop = 30 golddrop = 50 EndSub Sub demongeneral enemyname = "Demon General" enemyhp = 500 totalenemyhp = 500 enemystr = 35- playerdef enemydef = 25 xpdrop = 40 golddrop = 60 EndSub Sub Satan enemyname = "Satan" enemyhp = 1000 totalenemyhp = 1000 enemystr = 60- playerdef enemydef = 50 xpdrop = 50 golddrop = 100 EndSub Sub Menu TextWindow.WriteLine(" Overworld Slayer") space() TextWindow.WriteLine(" by Dinomite07") For i =1 To 5 space() EndFor TextWindow.WriteLine(" 1. New Game") TextWindow.WriteLine(" 2. Load Game") TextWindow.WriteLine(" 3. Exit") For i =1 To 10 space() EndFor TextWindow.WriteLine(" Copyright @ 2014") space() menu1 = TextWindow.ReadKey() If menu1 = 1 Then TextWindow.Clear() intro() ElseIf menu1 = 2 then TextWindow.Clear() ' The following line could be harmful and has been automatically commented. ' variables = File.ReadContents(path) load_game() selectlocation() elseif menu1 = 3 then Program.End() Else wrongoption() Menu() EndIf EndSub Sub space TextWindow.WriteLine(" ") endsub Sub enter TextWindow.WriteLine("Press Enter") TextWindow.PauseWithoutMessage() TextWindow.Clear() endsub Sub wrongoption TextWindow.Clear() TextWindow.WriteLine("You can only select the ones listed.") space() enter() EndSub Sub intro TextWindow.WriteLine("Story: You have been reborned in Hell and vowed to slay Satan!") space() enter() selectlocation() EndSub Sub leveling If (50 <= playerxp) And (playerxp <= 99 * 50) And (Math.Remainder(playerxp, 50) = 0) Then sp = sp + 1 level = level + 1 EndIf EndSub Sub town If x = 1 And y = 1 then TextWindow.Clear() selectlocation() EndIf If x = 4 And y = 60 then TextWindow.Clear() selectlocation() EndIf If x = 1 And (2 <= y And y <= 6) Then TownRandom() endif If x = 4 And (61 <= y And y <= 66) Then TownRandom() endif EndSub Sub townshopname If x = 1 And y = 1 then TextWindow.WriteLine("8. Enter Newb Town Shop") space() EndIf If x = 4 And y = 60 then TextWindow.WriteLine("8. Enter Hell Town Shop") space() EndIf EndSub Sub townshopname2 If x = 1 And y = 1 then TextWindow.Write("Newb Town ") EndIf If x = 4 And y = 60 then TextWindow.Write("Hell Town ") EndIf EndSub Sub townshopenter if selectlocation1 = 8 then TextWindow.Clear() shop() EndIf EndSub Sub townname If x = 1 And y = 1 then TextWindow.WriteLine("Newb Town Shop") space() EndIf If x = 1 And (2 <= y And y <= 6) Then TextWindow.WriteLine("Newb Town") space() endif If x =4 And y = 60 then TextWindow.WriteLine("Hell Town Shop") space() EndIf If x = 4 And (61 <= y And y <= 66) Then TextWindow.WriteLine("Hell Town") space() endif EndSub sub townrandom randomencounter1 = Math.GetRandomNumber(100) If randomencounter1 < 3then TextWindow.Clear() TextWindow.WriteLine("You found a HP Potion.") space() enter() hppot = hppot + 1 selectlocation() elseIf randomencounter1 < 6 then TextWindow.Clear() TextWindow.WriteLine("You found a MP Potion.") space() enter() mppot = mppot + 1 selectlocation() Else selectlocation() EndIf EndSub Sub selectlocation leveling() townname() TextWindow.WriteLine("Coordinates: " + "(" + x + "," + y + ")") space() TextWindow.WriteLine("Level: " + level + " Stat Point: " + sp) space() TextWindow.WriteLine("Exp: " + playerxp + " Gold: " + playergold) space() TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp + " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. North (" + x + "," + (y + 1) + ")") TextWindow.WriteLine("2. East (" + (x + 1) + "," + y + ")") TextWindow.WriteLine("3. West (" + (x - 1) + "," + y + ")") TextWindow.WriteLine("4. South (" + x + "," + (y - 1) + ")") space() TextWindow.WriteLine("5. Inventory") TextWindow.WriteLine("6. Stats") TextWindow.WriteLine("7. Journal") space() townshopname() TextWindow.WriteLine("9. Miscellaneous") space() selectlocation1 = TextWindow.ReadKey() townshopenter() If selectlocation1 = 1 Then TextWindow.Clear() y = y + 1 randomencounter() ElseIf selectlocation1 = 2 then TextWindow.Clear() x = x + 1 randomencounter() elseif selectlocation1 = 3 then TextWindow.Clear() x = x-1 randomencounter() elseif selectlocation1 = 4 then TextWindow.Clear() y = y-1 randomencounter() elseif selectlocation1 = 5 then TextWindow.Clear() selectlocationinventory() elseif selectlocation1 = 6 then TextWindow.Clear() stats() elseif selectlocation1 = 7 then TextWindow.Clear() journal() elseIf selectlocation1 = 9 Then misc() Else wrongoption() selectlocation() EndIf EndSub Sub journal TextWindow.WriteLine("Journal") space() TextWindow.WriteLine("Table of Contents") space() space() TextWindow.WriteLine("1. Mobs") TextWindow.WriteLine("2. Bosses") TextWindow.WriteLine("3. Weapons") TextWindow.WriteLine("4. Armors") TextWindow.WriteLine("5. Potions") TextWindow.WriteLine("6. Towns") TextWindow.WriteLine("7. Shops") space() TextWindow.WriteLine("8. Return") space() journal1 =TextWindow.ReadKey() If journal1 = 1 then TextWindow.Clear() mobjournal() elseIf journal1 = 2 then TextWindow.Clear() bossjournal() elseIf journal1 = 3 then TextWindow.Clear() weaponjournal() elseIf journal1 = 4 then TextWindow.Clear() armorjournal() elseIf journal1 = 5 then TextWindow.Clear() potionjournal() elseIf journal1 = 6 then TextWindow.Clear() townjournal() elseIf journal1 = 7 then TextWindow.Clear() shopjournal() elseIf journal1 = 8 Then TextWindow.Clear() selectLocation() Else TextWindow.Clear() wrongoption() TextWindow.Clear() journal() EndIf endsub Sub mobjournal TextWindow.WriteLine("Mobs") space() space() TextWindow.WriteLine("Skeleton: HP = 10, Str = 12, Def = 1, XP drop = 5, Gold drop = 3") space() TextWindow.WriteLine("Zombie: HP = 20, Str = 14, Def = 2, XP drop = 10, Gold drop = 6") space() TextWindow.WriteLine("Demon: HP = 30, Str = 16, Def = 3, XP drop = 15, Gold drop = 9") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() mobjournal() endif EndSub Sub bossjournal TextWindow.WriteLine("Bosses") space() space() TextWindow.WriteLine("Skeleton King: HP = 250, Str = 25, Def = 15, XP drop = 25, Gold drop = 45") TextWindow.WriteLine("Appears on (9,66)") space() TextWindow.WriteLine("Zombie Hulk: HP = 300, Str = 30, Def = 20, XP drop = 30, Gold drop = 50") TextWindow.WriteLine("Appears on (3,66)") space() TextWindow.WriteLine("Demon General: HP = 500, Str = 35, Def = 25, XP drop = 40, Gold drop = 60") TextWindow.WriteLine("Appears on (6,46)") space() TextWindow.WriteLine("Satan: HP = 1000, Str = 60, Def = 50, XP drop = 50, Gold drop = 100") TextWindow.WriteLine("Appears on (6,66) and when all previous bosses are defeated") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() bossjournal() endif EndSub Sub weaponjournal TextWindow.WriteLine("Weapons") space() space() TextWindow.WriteLine("Vampire Long Sword: Has a 40% chance to siphon the enemy hp and add it to yours") space() TextWindow.WriteLine("Lightning Broad Sword: Has a 30% chance to stun the enemy for 1 turn") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() weaponjournal() endif EndSub Sub armorjournal TextWindow.WriteLine("Armor") space() space() TextWindow.WriteLine("Spiked Chain Mail: Deals damage every turn to the enemy") space() TextWindow.WriteLine("Electric Plate Armor: Has a 30% chance to stub the enemey for 1 turn") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() armorjournal() endif EndSub Sub potionjournal TextWindow.WriteLine("Potions") space() space() TextWindow.WriteLine("HP Potion: Heals 15 HP") space() TextWindow.WriteLine("MP Potion: Gives 15 MP") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() potionjournal() endif EndSub Sub shopjournal TextWindow.WriteLine("Shop") space() space() TextWindow.WriteLine("A place of commerce where you can buy and sell goods") TextWindow.WriteLine("You will meet shops around the world randomly") space() space() TextWindow.WriteLine("Newb Town Shop: Appears on (1,1)") space() TextWindow.WriteLine("Hell Town Shop: Appears on (4,60)") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() shopjournal() endif EndSub Sub townjournal TextWindow.WriteLine("Town") space() space() TextWindow.WriteLine("Safe Zones where you will randomly find potions") TextWindow.WriteLine("Towns will always have 1 or 2 shops") space() space() TextWindow.WriteLine("Newb Town: Appears on (1,2),(1,3),(1,4),(1,5),(1,6)") space() TextWindow.WriteLine("Hell Town: Appears on (4,61),(4,62),(4,63),(4,64),(4,65),(4,66)") space() space() TextWindow.WriteLine("1. Return") space() space() journal1 =TextWindow.ReadKey() If journal1 = 1 Then TextWindow.Clear() journal() Else TextWindow.Clear() wrongoption() TextWindow.Clear() townjournal() endif EndSub Sub stats TextWindow.WriteLine("Level: " + level + " Stat Point: " + sp) space() TextWindow.WriteLine("Exp: " + playerxp + " Gold: " + playergold) space() TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp + " Player MP: " + playermp + "/" + totalplayermp) space() space() TextWindow.WriteLine("1. Strength: " + playerstr + " Gives 1 dmg per point") TextWindow.WriteLine("2. Vitality: " + playervit + " Gives 5 HP per point") TextWindow.WriteLine("3. Endurance: " + playerdef + " Gives reduces 1 dmg per point") TextWindow.WriteLine("4. Intelligence: " + playerint + " Gives 3 MP per point") TextWindow.WriteLine(" ") TextWindow.WriteLine("5. Return") space() staat = TextWindow.ReadKey() If staat = 1 then spiszero() sp = sp - 1 playerstr = playerstr + 1 TextWindow.Clear() stats() elseif staat = 2 then spiszero() sp = sp - 1 playervit = playervit + 1 playervitinc = playervitinc + 5 TextWindow.Clear() stats() elseif staat = 3 then spiszero() sp = sp - 1 playerdef = playerdef + 1 TextWindow.Clear() stats() elseif staat = 4 then spiszero() sp = sp - 1 playerint = playerint +1 playerintinc = playerintinc + 3 TextWindow.Clear() stats() elseIf staat = 5 Then TextWindow.Clear() selectLocation() Else TextWindow.Clear() wrongoption() stats() EndIf endsub Sub spiszero If sp = 0 Then TextWindow.Clear() stats() EndIf EndSub Sub randomencounter town() randomencounter1 = Math.GetRandomNumber(100) If randomencounter1 < 5then TextWindow.Clear() TextWindow.WriteLine("You found a HP Potion.") space() enter() hppot = hppot + 1 selectlocation() elseIf randomencounter1 < 10 then TextWindow.Clear() TextWindow.WriteLine("You found a MP Potion.") space() enter() mppot = mppot + 1 selectlocation() elseIf randomencounter1 < 30 then TextWindow.Clear() shop() else enemy() EndIf EndSub Sub shop TextWindow.Clear() townshopname2() TextWindow.WriteLine("Shop") space() TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Weapon") TextWindow.WriteLine("2. Armor") TextWindow.WriteLine("3. Potion") space() TextWindow.WriteLine("4. Return") space() shop = TextWindow.ReadKey() if shop = 1 Then TextWindow.Clear() weapons() ElseIf shop = 2 then TextWindow.Clear() armors() elseif shop = 3 Then TextWindow.Clear() potions() elseif shop = 4 then TextWindow.Clear() selectlocation() Else wrongoption() shop() EndIf EndSub Sub potions TextWindow.WriteLine("HP Pot: x" + hppot + " MP Pot: x" + mppot) space() TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Buy 1 HP Pot: 10 gold") TextWindow.WriteLine("2. Buy 1 MP Pot: 10 gold") space() TextWindow.WriteLine("3. Sell 1 MP Pot: 5 gold") TextWindow.WriteLine("4. Sell 1 MP Pot: 5 gold") space() TextWindow.WriteLine("5. Return") space() potion1 = TextWindow.ReadKey() If potion1= 1 Then If playergold < 10 Then TextWindow.Clear() potions() EndIf hppot = hppot + 1 playergold = playergold - 10 TextWindow.Clear() potions() ElseIf potion1= 2 then If playergold < 10 Then TextWindow.Clear() potions() EndIf mppot = mppot + 1 playergold = playergold - 10 TextWindow.Clear() potions() elseif potion1= 3 then If hppot <= 0 then TextWindow.Clear() potions() EndIf playergold = playergold + 5 hppot = hppot - 1 TextWindow.Clear() potions() elseif potion1= 4 then If mppot <= 0 then TextWindow.Clear() potions() EndIf playergold = playergold + 5 mppot = mppot - 1 TextWindow.Clear() potions() elseif potion1 = 5 then TextWindow.Clear() shop() Else wrongoption() potions() EndIf EndSub Sub weapons TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Buy Vampire Long Sword x" + activatevls + " Cost: 50 gold") TextWindow.WriteLine("2. Buy Lightning Broad Sword x" + activatelbs + " Cost: 50 gold") space() TextWindow.WriteLine("3. Return") space() weapon1 = TextWindow.ReadKey() If weapon1= 1 Then If activatevls =1 Then TextWindow.Clear() weapons() EndIf If playergold < 50 Then TextWindow.Clear() weapons() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Vampire Long Sword!") activatevls = 1 activatelbs = 0 playergold = playergold - 50 TextWindow.Clear() weapons() elseIf weapon1= 2 Then If activatelbs = 1 Then TextWindow.Clear() weapons() EndIf If playergold < 50 Then TextWindow.Clear() weapons() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Lightning Broad Sword!") activatelbs = 1 activatevls = 0 playergold = playergold - 50 TextWindow.Clear() weapons() elseif weapon1 = 3 then TextWindow.Clear() shop() Else wrongoption() weapons() EndIf EndSub Sub vampirelongsword If activatevls = 1 then vlschance = Math.GetRandomNumber(100) If vlschance <40 Then vlssiphon = enemyhp/10 weapon = "Vampire Long Sword" enemyhp = enemyhp - vlssiphon playerhp = playerhp + vlssiphon space() TextWindow.WriteLine("Vampire Long Sword siphons " + vlssiphon + " HP") Else endif playerhpormpoverhun() endif EndSub Sub playerhpormpoverhun If playerhp > 100 Then playerhp = totalplayerhp EndIf If playermp > 30 Then playermp = totalplayermp endif EndSub Sub lightningbroadsword If activatelbs = 1 then lbschance = Math.GetRandomNumber(100) lbsstun() EndIf EndSub Sub lbsstun stun = 0 If lbschance <30 Then weapon = "Lightning Broad Sword" stun = stun + 1 Else EndIf if stun > 0 then stun = stun - 1 playerattackstun() If enemyhp <= 0 Then TextWindow.Clear() EndIf Else EndIf EndSub sub playerattackstun space() TextWindow.WriteLine(enemyname + " is stun for 1 turn.") spikechainmail() enemyhp = enemyhp - playerstr space() enter() battle() endsub Sub armors TextWindow.WriteLine("Gold: " + playergold) space() TextWindow.WriteLine("1. Spiked Chain Mail x" + activatescm + " Cost: 50 gold") TextWindow.WriteLine("2. Electric Plate Armor x" + activateepa + " Cost: 50 gold") space() TextWindow.WriteLine("3. Return") space() armor1 = TextWindow.ReadKey() If armor1= 1 Then If activatescm =1 Then TextWindow.Clear() armors() EndIf If playergold < 50 Then TextWindow.Clear() armors() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Spiked Chain Mail!") activatescm = 1 activateepa = 0 playergold = playergold - 50 TextWindow.Clear() armors() elseIf armor1= 2 Then If activateepa =1 Then TextWindow.Clear() armors() EndIf If playergold < 50 Then TextWindow.Clear() armors() EndIf TextWindow.Clear() TextWindow.WriteLine("You bought the Electric Plate Armor!") activateepa = 1 activatescm = 0 playergold = playergold - 50 TextWindow.Clear() armors() elseif armor1 = 3 then TextWindow.Clear() shop() Else wrongoption() armors() EndIf EndSub Sub spikechainmail If activatescm = 1 then spikechainmaildmg = totalenemyhp/25 space() TextWindow.WriteLine(armor + " deals " + spikechainmaildmg + " dmg.") enemyhp = enemyhp - spikechainmaildmg Else endif endsub Sub electricplatearmor If activateepa = 1 then epachance = Math.GetRandomNumber(100) epastun() EndIf EndSub Sub epastun stun = 0 If epachance <30 Then armor = "Electric Plate Armor" stun = stun + 1 Else EndIf if stun > 0 then stun = stun - 1 epaarmorstun() If enemyhp <= 0 Then TextWindow.Clear() EndIf Else EndIf EndSub sub epaarmorstun space() enemyhp = enemyhp - playerstr TextWindow.WriteLine(enemyname + " is stun for 1 turn.") space() enter() battle() endsub Sub weaponname If activatevls = 1 then weapon = "Vampire Long Sword" EndIf If activatelbs = 1 then weapon = "Lightning Broad Sword" endif EndSub Sub armorname If activatescm = 1 then armor = "Spiked Chain Mail" EndIf If activateepa = 1 then armor = "Electric Plate Armor" EndIf EndSub Sub selectlocationinventory playerhpormpoverhun() If hppot < 1 Then TextWindow.Clear() selectlocationinventory() ElseIf mppot < 1 then TextWindow.Clear() selectlocationinventory() EndIf TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. Use HP Pot x" + hppot) TextWindow.WriteLine("2. Use MP Pot x" +mppot) space() TextWindow.WriteLine("3. Return") space() inventory1 = TextWindow.ReadKey() If inventory1 = 1 Then If playerhp = 100 Then TextWindow.Clear() selectlocationinventory() endif space() TextWindow.WriteLine("You gain 15 HP") space() playerhp = playerhp + 15 hppot = hppot - 1 enter() selectlocationinventory() elseIf inventory1 = 2 Then If playermp = 30 Then TextWindow.Clear() selectlocationinventory() endif space() TextWindow.WriteLine("You gain 15 MP") space() playermp = playermp + 15 mppot = mppot - 1 enter() selectlocationinventory() elseif inventory1 = 3 then TextWindow.Clear() selectlocation() EndIf EndSub Sub misc TextWindow.Clear() TextWindow.WriteLine("1. Save") TextWindow.WriteLine("2. Load") TextWindow.WriteLine("3. Return") TextWindow.WriteLine("4. Exit") space() misc1 = TextWindow.ReadKey() If misc1 = 1 Then Save_game() TextWindow.Clear() TextWindow.WriteLine("Game has been saved") space() enter() Program.End() ElseIf misc1 = 2 then TextWindow.Clear() ' The following line could be harmful and has been automatically commented. ' variables = File.ReadContents(path) load_game() selectlocation() elseif misc1 = 4 then Program.End() ElseIf misc1 = 3 then TextWindow.Clear() selectlocation() Else wrongoption() misc() EndIf EndSub Sub enemy TextWindow.Clear() If x = 6 And y = 66 and activatedg = 1 And activatesk = 1 And activatezh = 1 Then Satan() TextWindow.WriteLine("You encountered " + enemyname +".") space() enter() battle() ElseIf x = 6 and y = 46 then demongeneral() TextWindow.WriteLine("You encountered " + enemyname +".") space() enter() battle() elseif x = 3 and y = 66 then zombiehulk() TextWindow.WriteLine("You encountered " + enemyname +".") space() enter() battle() elseif x = 9 and y = 66 then skeletonking() battle() endif enemy1 = Math.GetRandomNumber(100) If enemy1 < 40 Then skeleton() TextWindow.WriteLine("You encountered a " + enemyname +".") space() enter() battle() ElseIf enemy1 <70 then zombie() TextWindow.WriteLine("You encountered a " + enemyname +".") space() enter() battle() elseif enemy1 <100 then demon() TextWindow.WriteLine("You encountered a " + enemyname +".") space() enter() battle() EndIf EndSub Sub battle If playerhp<=0Then defeat() EndIf If enemyhp <= 0 Then mobwin() EndIf TextWindow.Clear() weaponname() armorname() TextWindow.WriteLine(enemyname ) space() TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp) space() TextWindow.WriteLine("1. Use your " + weapon) TextWindow.WriteLine("2. Inventory") TextWindow.WriteLine("3. Skills") TextWindow.WriteLine("4. Run Away") TextWindow.WriteLine("5. Do Nothing") space() battle1 = TextWindow.ReadKey() If battle1 = 1 Then playerattack() ElseIf battle1 = 2 then TextWindow.Clear() inventory() elseif battle1 = 3 then TextWindow.Clear() skill() elseif battle1 = 4 then runaway1 = Math.GetRandomNumber(2) If runaway1 =1 then space() TextWindow.WriteLine(enemyname + " attacked your back and dealt " + enemystr+".") playerhp = playerhp - enemystr space() enter() battle() Else TextWindow.Clear() selectlocation() EndIf elseif battle1 = 5 then TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") playerhp = playerhp - enemystr space() enter() battle() Else wrongoption() battle() endif EndSub Sub inventory playerhpormpoverhun() If hppot < 1 Then TextWindow.Clear() selectlocationinventory() ElseIf mppot < 1 then TextWindow.Clear() selectlocationinventory() EndIf TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) space() TextWindow.WriteLine("1. Use HP Pot x" + hppot) TextWindow.WriteLine("2. Use MP Pot x" + mppot) space() TextWindow.WriteLine("3. Return") space() inventory1 = TextWindow.ReadKey() If inventory1 = 1 Then If playerhp = 100 Then TextWindow.Clear() inventory() endif space() TextWindow.WriteLine("You gain 15 HP") space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") playerhp = playerhp - enemystr playerhp = playerhp + 15 hppot = hppot -1 enter() inventory() elseIf inventory1 = 2 Then If playermp = 30 Then TextWindow.Clear() inventory() endif space() TextWindow.WriteLine("You gain 15 MP") space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") playerhp = playerhp - enemystr playermp = playermp + 15 mppot = mppot - 1 enter() inventory() elseif inventory1 = 3 then TextWindow.Clear() battle() EndIf EndSub Sub skill If playerhp<=0Then defeat() EndIf If enemyhp <= 0 Then mobwin() EndIf If playermp <= 0 Then TextWindow.Clear() battle() EndIf TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp) TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp) space() TextWindow.WriteLine("1. Insta Crit Cost: 5 MP") TextWindow.WriteLine("2. Heal Cost: 5 MP") space() TextWindow.WriteLine("3. Return") space() skill1 = TextWindow.ReadKey() space() If skill1 = 1 Then TextWindow.WriteLine("You dealt " + (playerstr *1.5)) space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") space() playerhp = playerhp - enemystr enemyhp = enemyhp - (playerstr*1.5) playermp = playermp - 5 enter() skill() ElseIf skill1 = 2 then TextWindow.WriteLine("You healed yourself for 50 HP") space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".") space() playerhp = playerhp - enemystr enter() playerhp = playerhp + 50 playermp = playermp - 5 playerhpormpoverhun() skill() elseif skill1 = 3 then TextWindow.Clear() battle() Else wrongoption() EndIf EndSub sub playerattack space() TextWindow.WriteLine("You attacked and dealt " +playerstr + " dmg.") vampirelongsword() lightningbroadsword() spikechainmail() electricplatearmor() space() TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+" dmg.") enemyhp = enemyhp - playerstr playerhp = playerhp - enemystr space() enter() battle() endsub Sub satanactivate If x = 6 and y = 46 then activatedg = 1 elseif x = 3 and y = 66 then activatezh = 1 elseif x = 9 and y = 66 then activatesk = 1 EndIf EndSub sub mobwin TextWindow.Clear() satanactivate() TextWindow.WriteLine("You defeated " + enemyname + ".") space() TextWindow.WriteLine("You gain " + xpdrop + " exp.") TextWindow.WriteLine("You gain " + golddrop + " gold.") playerxp = playerxp + xpdrop playergold = playergold + golddrop space() enter() selectlocation() EndSub Sub defeat TextWindow.Clear() TextWindow.WriteLine("You have been defeated!") enter() Program.End() EndSub End>BDB469.sb< Start>BDC439.sb< GraphicsWindow.MouseDown = click Controls.ButtonClicked = btnClick init() loadFont() loadWindow() drawMatrix() input() While "True" While flag shift = shift + 1 If shift > Text.GetLength(data[1]) Then shift = 0 EndIf Program.Delay(scrollSpeed) scrollText() EndWhile EndWhile Sub btnClick data = "" txtString = Controls.GetTextBoxText(txtBox) If txtString <> "" Then len = Text.GetLength(txtString) For i = 1 To len subChar = Text.GetSubText(txtString,i,1) subCharC = Text.GetCharacterCode(subChar) If subCharC > 96 And subCharC < 123 Then subChar = subChar + "1" EndIf For j = 1 To ledVirtical data[j] = Text.Append(data[j],characters[subChar][j]) EndFor EndFor EndIf flag = "True" EndSub Sub scrollText For i = 1 To ledHorizontal For j = 1 To ledVirtical subChar = Text.GetSubText(data[j],i+shift,1) If subChar = 1 Then Shapes.SetOpacity(matrix[i][j],100) ElseIf subChar = 0 Then Shapes.SetOpacity(matrix[i][j],30) EndIf EndFor EndFor EndSub Sub click If Mouse.IsRightButtonDown And count = 1 Then displayHeight = displayHeight + 90 GraphicsWindow.Height = displayHeight flag = "False" count = count + 1 ElseIf Mouse.IsRightButtonDown And count > 1 Then displayHeight = displayHeight - 90 GraphicsWindow.Height = displayHeight count = 1 flag = "True" EndIf EndSub Sub init ledSize = 10 ledHorizontal = 60 ledVirtical = 7 displayWidth = ledHorizontal*ledSize displayHeight = ledVirtical * ledSize bgColor = "Black" ledColor["inner"] = "Blue" ledColor["outer"] = "DarkBlue" scrollSpeed = 60 'lower the value faster the speed count = 1 flag = "False" EndSub Sub loadWindow GraphicsWindow.Title = "LED Matrix Scroller Version 0.1 [Right click to input text]" GraphicsWindow.BackgroundColor = bgColor GraphicsWindow.PenColor = ledColor["outer"] GraphicsWindow.BrushColor = ledColor["inner"] GraphicsWindow.Width = displayWidth - 10 GraphicsWindow.Height = displayHeight - 10 GraphicsWindow.CanResize = 0 GraphicsWindow.Show() EndSub Sub drawMatrix For i = 0 To ledVirtical - 1 For j = 0 to ledHorizontal - 1 matrix[j+1][i+1] = Shapes.AddEllipse(ledSize,ledSize) Shapes.SetOpacity(matrix[j+1][i+1],30) Shapes.Move(matrix[j+1][i+1],j*ledSize,i*ledSize) EndFor EndFor EndSub Sub input txtBox = Controls.AddTextBox(0,(ledVirtical*ledSize)+30) Controls.SetSize(txtBox,ledHorizontal*ledSize,25) GraphicsWindow.DrawText(0,(ledVirtical*ledSize)+5,"Enter Your Text And Click OK Button.: [Right click again to close input pan]") txtbtn = Controls.AddButton("OK",0,(ledVirtical*ledSize)+60) EndSub Sub loadFont characters[0][1] = "011100" characters[0][2] = "100010" characters[0][3] = "100110" characters[0][4] = "101010" characters[0][5] = "110010" characters[0][6] = "100010" characters[0][7] = "011100" characters[1][1] = "0100" characters[1][2] = "1100" characters[1][3] = "0100" characters[1][4] = "0100" characters[1][5] = "0100" characters[1][6] = "0100" characters[1][7] = "1110" characters[2][1] = "011100" characters[2][2] = "100010 characters[2][3] = "000010" characters[2][4] = "001100" characters[2][5] = "010000" characters[2][6] = "100000" characters[2][7] = "111110" characters[3][1] = "011100" characters[3][2] = "100010" characters[3][3] = "000010" characters[3][4] = "001100" characters[3][5] = "000010" characters[3][6] = "100010" characters[3][7] = "011100" characters[4][1] = "001100" characters[4][2] = "010100" characters[4][3] = "100100" characters[4][4] = "100100" characters[4][5] = "111110" characters[4][6] = "000100" characters[4][7] = "000100" characters[5][1] = "111100" characters[5][2] = "100000" characters[5][3] = "100000" characters[5][4] = "111100" characters[5][5] = "000010" characters[5][6] = "100010" characters[5][7] = "011100" characters[6][1] = "001100" characters[6][2] = "010000" characters[6][3] = "100000" characters[6][4] = "111100" characters[6][5] = "100010" characters[6][6] = "100010" characters[6][7] = "011100" characters[7][1] = "111110" characters[7][2] = "100010" characters[7][3] = "000010" characters[7][4] = "000100" characters[7][5] = "001000" characters[7][6] = "001000" characters[7][7] = "001000" characters[8][1] = "011100" characters[8][2] = "100010" characters[8][3] = "100010" characters[8][4] = "011100" characters[8][5] = "100010" characters[8][6] = "100010" characters[8][7] = "011100" characters[9][1] = "011100" characters[9][2] = "100010" characters[9][3] = "100010" characters[9][4] = "011110" characters[9][5] = "000010" characters[9][6] = "000100" characters[9][7] = "011000" characters["a1"][1] = "000000" characters["a1"][2] = "000000" characters["a1"][3] = "011100" characters["a1"][4] = "000010" characters["a1"][5] = "011110" characters["a1"][6] = "100010" characters["a1"][7] = "011110" characters["b1"][1] = "100000" characters["b1"][2] = "100000" characters["b1"][3] = "111100" characters["b1"][4] = "100010" characters["b1"][5] = "100010" characters["b1"][6] = "100010" characters["b1"][7] = "111100" characters["c1"][1] = "000000" characters["c1"][2] = "000000" characters["c1"][3] = "011100" characters["c1"][4] = "100010" characters["c1"][5] = "100000" characters["c1"][6] = "100010" characters["c1"][7] = "011100" characters["d1"][1] = "000010" characters["d1"][2] = "000010" characters["d1"][3] = "011110" characters["d1"][4] = "100010" characters["d1"][5] = "100010" characters["d1"][6] = "100010" characters["d1"][7] = "011110" characters["e1"][1] = "000000" characters["e1"][2] = "000000" characters["e1"][3] = "011100" characters["e1"][4] = "100010" characters["e1"][5] = "111110" characters["e1"][6] = "100000" characters["e1"][7] = "011100" characters["f1"][1] = "0010" characters["f1"][2] = "0100" characters["f1"][3] = "1110" characters["f1"][4] = "0100" characters["f1"][5] = "0100" characters["f1"][6] = "0100" characters["f1"][7] = "1110" characters["g1"][1] = "011110" characters["g1"][2] = "100010" characters["g1"][3] = "100010" characters["g1"][4] = "100010" characters["g1"][5] = "011110" characters["g1"][6] = "000010" characters["g1"][7] = "011100" characters["h1"][1] = "100000" characters["h1"][2] = "100000" characters["h1"][3] = "111100" characters["h1"][4] = "100010" characters["h1"][5] = "100010" characters["h1"][6] = "100010" characters["h1"][7] = "100010" characters["i1"][1] = "0100" characters["i1"][2] = "0000" characters["i1"][3] = "1100" characters["i1"][4] = "0100" characters["i1"][5] = "0100" characters["i1"][6] = "0100" characters["i1"][7] = "1110" characters["j1"][1] = "0100" characters["j1"][2] = "0000" characters["j1"][3] = "1100" characters["j1"][4] = "0100" characters["j1"][5] = "0100" characters["j1"][6] = "0100" characters["j1"][7] = "1000" characters["k1"][1] = "100000" characters["k1"][2] = "100000" characters["k1"][3] = "100010" characters["k1"][4] = "100100" characters["k1"][5] = "111000" characters["k1"][6] = "100100" characters["k1"][7] = "100010" characters["l1"][1] = "1100" characters["l1"][2] = "0100" characters["l1"][3] = "0100" characters["l1"][4] = "0100" characters["l1"][5] = "0100" characters["l1"][6] = "0100" characters["l1"][7] = "1110" characters["m1"][1] = "000000" characters["m1"][2] = "000000" characters["m1"][3] = "110100" characters["m1"][4] = "101010" characters["m1"][5] = "101010" characters["m1"][6] = "101010" characters["m1"][7] = "101010" characters["n1"][1] = "000000" characters["n1"][2] = "000000" characters["n1"][3] = "111100" characters["n1"][4] = "100010" characters["n1"][5] = "100010" characters["n1"][6] = "100010" characters["n1"][7] = "100010" characters["o1"][1] = "000000" characters["o1"][2] = "000000" characters["o1"][3] = "011100" characters["o1"][4] = "100010" characters["o1"][5] = "100010" characters["o1"][6] = "100010" characters["o1"][7] = "011100" characters["p1"][1] = "011100" characters["p1"][2] = "100010" characters["p1"][3] = "100010" characters["p1"][4] = "100010" characters["p1"][5] = "111100" characters["p1"][6] = "100000" characters["p1"][7] = "100000" characters["q1"][1] = "000000" characters["q1"][2] = "011100" characters["q1"][3] = "100010" characters["q1"][4] = "100010" characters["q1"][5] = "011110" characters["q1"][6] = "000010" characters["q1"][7] = "000010" characters["r1"][1] = "000000" characters["r1"][2] = "000000" characters["r1"][3] = "101100" characters["r1"][4] = "010010" characters["r1"][5] = "010000" characters["r1"][6] = "010000" characters["r1"][7] = "111000" characters["s1"][1] = "000000" characters["s1"][2] = "000000" characters["s1"][3] = "011100" characters["s1"][4] = "100000" characters["s1"][5] = "011100" characters["s1"][6] = "000010" characters["s1"][7] = "011100" characters["t1"][1] = "010000" characters["t1"][2] = "010000" characters["t1"][3] = "111110" characters["t1"][4] = "010000" characters["t1"][5] = "010000" characters["t1"][6] = "010010" characters["t1"][7] = "001100" characters["u1"][1] = "000000" characters["u1"][2] = "000000" characters["u1"][3] = "100010" characters["u1"][4] = "100010" characters["u1"][5] = "100010" characters["u1"][6] = "100010" characters["u1"][7] = "011100" characters["v1"][1] = "000000" characters["v1"][2] = "000000" characters["v1"][3] = "100010" characters["v1"][4] = "100010" characters["v1"][5] = "100010" characters["v1"][6] = "010100" characters["v1"][7] = "001000" characters["w1"][1] = "000000" characters["w1"][2] = "000000" characters["w1"][3] = "101010" characters["w1"][4] = "101010" characters["w1"][5] = "101010" characters["w1"][6] = "101010" characters["w1"][7] = "010100" characters["x1"][1] = "000000" characters["x1"][2] = "000000" characters["x1"][3] = "100010" characters["x1"][4] = "010100" characters["x1"][5] = "001000" characters["x1"][6] = "010100" characters["x1"][7] = "100010" characters["y1"][1] = "100010" characters["y1"][2] = "100010" characters["y1"][3] = "100010" characters["y1"][4] = "011110" characters["y1"][5] = "000010" characters["y1"][6] = "000010" characters["y1"][7] = "011100" characters["z1"][1] = "000000" characters["z1"][2] = "000000" characters["z1"][3] = "111110" characters["z1"][4] = "000100" characters["z1"][5] = "001000" characters["z1"][6] = "010000" characters["z1"][7] = "111110" characters["A"][1] = "001000" characters["A"][2] = "010100" characters["A"][3] = "100010" characters["A"][4] = "100010" characters["A"][5] = "111110" characters["A"][6] = "100010" characters["A"][7] = "100010" characters["B"][1] = "111100" characters["B"][2] = "100010" characters["B"][3] = "100010" characters["B"][4] = "111100" characters["B"][5] = "100010" characters["B"][6] = "100010" characters["B"][7] = "111100" characters["C"][1] = "011100" characters["C"][2] = "100010" characters["C"][3] = "100000" characters["C"][4] = "100000" characters["C"][5] = "100000" characters["C"][6] = "100010" characters["C"][7] = "011100" characters["D"][1] = "111100" characters["D"][2] = "100010" characters["D"][3] = "100010" characters["D"][4] = "100010" characters["D"][5] = "100010" characters["D"][6] = "100010" characters["D"][7] = "111100" characters["E"][1] = "111110" characters["E"][2] = "100000" characters["E"][3] = "100000" characters["E"][4] = "111110" characters["E"][5] = "100000" characters["E"][6] = "100000" characters["E"][7] = "111110" characters["F"][1] = "111110" characters["F"][2] = "100000" characters["F"][3] = "100000" characters["F"][4] = "111110" characters["F"][5] = "100000" characters["F"][6] = "100000" characters["F"][7] = "100000" characters["G"][1] = "011100" characters["G"][2] = "100010" characters["G"][3] = "100000" characters["G"][4] = "101110" characters["G"][5] = "100010" characters["G"][6] = "100010" characters["G"][7] = "011110" characters["H"][1] = "100010" characters["H"][2] = "100010" characters["H"][3] = "100010" characters["H"][4] = "111110" characters["H"][5] = "100010" characters["H"][6] = "100010" characters["H"][7] = "100010" characters["I"][1] = "1110" characters["I"][2] = "0100" characters["I"][3] = "0100" characters["I"][4] = "0100" characters["I"][5] = "0100" characters["I"][6] = "0100" characters["I"][7] = "1110" characters["J"][1] = "001110" characters["J"][2] = "000010" characters["J"][3] = "000010" characters["J"][4] = "000010" characters["J"][5] = "100010" characters["J"][6] = "100010" characters["J"][7] = "011100" characters["K"][1] = "100010" characters["K"][2] = "100100" characters["K"][3] = "101000" characters["K"][4] = "110000" characters["K"][5] = "101000" characters["K"][6] = "100100" characters["K"][7] = "100010" characters["L"][1] = "100000" characters["L"][2] = "100000" characters["L"][3] = "100000" characters["L"][4] = "100000" characters["L"][5] = "100000" characters["L"][6] = "100000" characters["L"][7] = "111110" characters["M"][1] = "100010" characters["M"][2] = "110110" characters["M"][3] = "101010" characters["M"][4] = "100010" characters["M"][5] = "100010" characters["M"][6] = "100010" characters["M"][7] = "100010" characters["N"][1] = "100010" characters["N"][2] = "110010" characters["N"][3] = "101010" characters["N"][4] = "100110" characters["N"][5] = "100010" characters["N"][6] = "100010" characters["N"][7] = "100010" characters["O"][1] = "011100" characters["O"][2] = "100010" characters["O"][3] = "100010" characters["O"][4] = "100010" characters["O"][5] = "100010" characters["O"][6] = "100010" characters["O"][7] = "011100" characters["P"][1] = "111100" characters["P"][2] = "100010" characters["P"][3] = "100010" characters["P"][4] = "111100" characters["P"][5] = "100000" characters["P"][6] = "100000" characters["P"][7] = "100000" characters["Q"][1] = "011100" characters["Q"][2] = "100010" characters["Q"][3] = "100010" characters["Q"][4] = "100010" characters["Q"][5] = "101010" characters["Q"][6] = "100110" characters["Q"][7] = "011110" characters["R"][1] = "111100" characters["R"][2] = "100010" characters["R"][3] = "100010" characters["R"][4] = "111100" characters["R"][5] = "101000" characters["R"][6] = "100100" characters["R"][7] = "100010" characters["S"][1] = "011100" characters["S"][2] = "100010" characters["S"][3] = "100000" characters["S"][4] = "011100" characters["S"][5] = "000010" characters["S"][6] = "100010" characters["S"][7] = "011100" characters["T"][1] = "111110" characters["T"][2] = "001000" characters["T"][3] = "001000" characters["T"][4] = "001000" characters["T"][5] = "001000" characters["T"][6] = "001000" characters["T"][7] = "001000" characters["U"][1] = "100010" characters["U"][2] = "100010" characters["U"][3] = "100010" characters["U"][4] = "100010" characters["U"][5] = "100010" characters["U"][6] = "100010" characters["U"][7] = "011100" characters["V"][1] = "100010" characters["V"][2] = "100010" characters["V"][3] = "100010" characters["V"][4] = "100010" characters["V"][5] = "100010" characters["V"][6] = "010100" characters["V"][7] = "001000" characters["W"][1] = "100010" characters["W"][2] = "100010" characters["W"][3] = "100010" characters["W"][4] = "100010" characters["W"][5] = "101010" characters["W"][6] = "110110" characters["W"][7] = "100010" characters["X"][1] = "100010" characters["X"][2] = "100010" characters["X"][3] = "010100" characters["X"][4] = "001000" characters["X"][5] = "010100" characters["X"][6] = "100010" characters["X"][7] = "100010" characters["Y"][1] = "100010" characters["Y"][2] = "100010" characters["Y"][3] = "010100" characters["Y"][4] = "001000" characters["Y"][5] = "001000" characters["Y"][6] = "001000" characters["Y"][7] = "001000" characters["Z"][1] = "111110" characters["Z"][2] = "100010" characters["Z"][3] = "000100" characters["Z"][4] = "001000" characters["Z"][5] = "010000" characters["Z"][6] = "100010" characters["Z"][7] = "111110" characters["!"][1] = "110" characters["!"][2] = "110" characters["!"][3] = "110" characters["!"][4] = "100" characters["!"][5] = "000" characters["!"][6] = "110" characters["!"][7] = "110" characters["@"][1] = "111110" characters["@"][2] = "100010" characters["@"][3] = "101010" characters["@"][4] = "101010" characters["@"][5] = "101110" characters["@"][6] = "100000" characters["@"][7] = "111110" characters["#"][1] = "010100" characters["#"][2] = "010100" characters["#"][3] = "111110" characters["#"][4] = "010100" characters["#"][5] = "111110" characters["#"][6] = "010100" characters["#"][7] = "010100" characters["$"][1] = "001000" characters["$"][2] = "011100" characters["$"][3] = "100000" characters["$"][4] = "011100" characters["$"][5] = "000010" characters["$"][6] = "011100" characters["$"][7] = "001000" characters["%"][1] = "010000" characters["%"][2] = "101010" characters["%"][3] = "010100" characters["%"][4] = "001000" characters["%"][5] = "010100" characters["%"][6] = "101010" characters["%"][7] = "000100" characters["^"][1] = "0100" characters["^"][2] = "1010" characters["^"][3] = "0000" characters["^"][4] = "0000" characters["^"][5] = "0000" characters["^"][6] = "0000" characters["^"][7] = "0000" characters["&"][1] = "011000" characters["&"][2] = "100100" characters["&"][3] = "100100" characters["&"][4] = "101000" characters["&"][5] = "011010" characters["&"][6] = "100100" characters["&"][7] = "011010" characters["*"][1] = "0000" characters["*"][2] = "0000" characters["*"][3] = "1010" characters["*"][4] = "0100" characters["*"][5] = "1010" characters["*"][6] = "0000" characters["*"][7] = "0000" characters["("][1] = "010" characters["("][2] = "100" characters["("][3] = "100" characters["("][4] = "100" characters["("][5] = "100" characters["("][6] = "100" characters["("][7] = "010" characters[")"][1] = "100" characters[")"][2] = "010" characters[")"][3] = "010" characters[")"][4] = "010" characters[")"][5] = "010" characters[")"][6] = "010" characters[")"][7] = "100" characters["_"][1] = "000000" characters["_"][2] = "000000" characters["_"][3] = "000000" characters["_"][4] = "000000" characters["_"][5] = "000000" characters["_"][6] = "000000" characters["_"][7] = "111110" characters["-"][1] = "0000" characters["-"][2] = "0000" characters["-"][3] = "0000" characters["-"][4] = "1110" characters["-"][5] = "0000" characters["-"][6] = "0000" characters["-"][7] = "0000" characters["="][1] = "0000" characters["="][2] = "0000" characters["="][3] = "1110" characters["="][4] = "0000" characters["="][5] = "1110" characters["="][6] = "0000" characters["="][7] = "0000" characters["+"][1] = "0000" characters["+"][2] = "0000" characters["+"][3] = "0100" characters["+"][4] = "1110" characters["+"][5] = "0100" characters["+"][6] = "0000" characters["+"][7] = "0000" characters["\"][1] = "000000" characters["\"][2] = "100000" characters["\"][3] = "010000" characters["\"][4] = "001000" characters["\"][5] = "000100" characters["\"][6] = "000010" characters["\"][7] = "000000" characters["|"][1] = "10" characters["|"][2] = "10" characters["|"][3] = "10" characters["|"][4] = "10" characters["|"][5] = "10" characters["|"][6] = "10" characters["|"][7] = "10" characters["["][1] = "110" characters["["][2] = "100" characters["["][3] = "100" characters["["][4] = "100" characters["["][5] = "100" characters["["][6] = "100" characters["["][7] = "110" characters["]"][1] = "110" characters["]"][2] = "010" characters["]"][3] = "010" characters["]"][4] = "010" characters["]"][5] = "010" characters["]"][6] = "010" characters["]"][7] = "110" characters["{"][1] = "0010" characters["{"][2] = "0100" characters["{"][3] = "0100" characters["{"][4] = "1000" characters["{"][5] = "0100" characters["{"][6] = "0100" characters["{"][7] = "0010" characters["}"][1] = "1000" characters["}"][2] = "0100" characters["}"][3] = "0100" characters["}"][4] = "0010" characters["}"][5] = "0100" characters["}"][6] = "0100" characters["}"][7] = "1000" characters["'"][1] = "10" characters["'"][2] = "10" characters["'"][3] = "10" characters["'"][4] = "00" characters["'"][5] = "00" characters["'"][6] = "00" characters["'"][7] = "00" characters[","][1] = "000" characters[","][2] = "000" characters[","][3] = "000" characters[","][4] = "000" characters[","][5] = "110" characters[","][6] = "110" characters[","][7] = "010" characters["."][1] = "000" characters["."][2] = "000" characters["."][3] = "000" characters["."][4] = "000" characters["."][5] = "000" characters["."][6] = "110" characters["."][7] = "110" characters["<"][1] = "0000" characters["<"][2] = "0010" characters["<"][3] = "0100" characters["<"][4] = "1000" characters["<"][5] = "0100" characters["<"][6] = "0010" characters["<"][7] = "0000" characters[">"][1] = "0000" characters[">"][2] = "1000" characters[">"][3] = "0100" characters[">"][4] = "0010" characters[">"][5] = "0100" characters[">"][6] = "1000" characters[">"][7] = "0000" characters["?"][1] = "011100" characters["?"][2] = "100010" characters["?"][3] = "000010" characters["?"][4] = "001110" characters["?"][5] = "001000" characters["?"][6] = "000000" characters["?"][7] = "001000" characters["/"][1] = "000000" characters["/"][2] = "000010" characters["/"][3] = "000100" characters["/"][4] = "001000" characters["/"][5] = "010000" characters["/"][6] = "100000" characters["/"][7] = "000000" characters[";"][1] = "000" characters[";"][2] = "110" characters[";"][3] = "110" characters[";"][4] = "000" characters[";"][5] = "110" characters[";"][6] = "110" characters[";"][7] = "010" characters[":"][1] = "000" characters[":"][2] = "110" characters[":"][3] = "110" characters[":"][4] = "000" characters[":"][5] = "110" characters[":"][6] = "110" characters[":"][7] = "000" characters[" "][1] = "000" characters[" "][2] = "000" characters[" "][3] = "000" characters[" "][4] = "000" characters[" "][5] = "000" characters[" "][6] = "000" characters[" "][7] = "000" EndSub End>BDC439.sb< Start>BDF760.sb< ' Program by Y LEDUC , March 22th 2016 'for classical guitar but my adaptation for a grand piano ' Andantino de Ferdinando Carulli 1770-1841 ' https://en.wikipedia.org/wiki/Ferdinando_Carulli ' program no : VQH744 ' July 17th 2016 ' slides show program by Yvan Leduc - first version ( CSC163 and XGK964) ' with collaboration and help by Nonki Takahashi ( CSC163-0 ) ' with collaboration and help by NaochanON ( HTB529 ) ' July 18th 2016 ' final slide show : program no: GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 gw = 1366 gh = 768 GraphicsWindow.Width = gw GraphicsWindow.Height = gh gray1=GraphicsWindow.GetColorFromRGB(200,200,200) GraphicsWindow.BackgroundColor = gray1 blue1=GraphicsWindow.GetColorFromRGB(41,68,116) blue2=GraphicsWindow.GetColorFromRGB(81,108,146) GraphicsWindow.FontName = "Segoe Script" url[1]="https://s3.amazonaws.com/storage.filemobile.com/storage/26492021/15" url[2]="https://s3.amazonaws.com/storage.filemobile.com/storage/26434764/15" url[3]="https://s3.amazonaws.com/storage.filemobile.com/storage/26472818/15" url[4]="https://s3.amazonaws.com/storage.filemobile.com/storage/26362722/15" url[5]="https://s3.amazonaws.com/storage.filemobile.com/storage/26492038/15" url[6]="https://s3.amazonaws.com/storage.filemobile.com/storage/26492021/15" AddCircles() ' show loading circles For st = 1 To 6 ' load picures PX=Math.GetRandomNumber(850)+20 PY=Math.GetRandomNumber(300)+20 image = ImageList.LoadImage(url[st]) img[st] = Shapes.AddImage(image) Shapes.Move(img[st],PX,PY) Shapes.SetOpacity(img[st], 0) EndFor GraphicsWindow.BrushColor = blue2 GraphicsWindow.FontSize = 20 txt = Shapes.AddText(" Photo by Yvan Leduc 2016") Shapes.SetOpacity(txt, 100) Shapes.Move(txt, 50, 10) Timer.Pause() Program.Delay(100) RemoveCircles() PlayMusic() GraphicsWindow.BrushColor = blue1 GraphicsWindow.FontSize = 80 txt = Shapes.AddText(" The End") Shapes.SetOpacity(txt, 100) Shapes.Move(txt, 800, 300) Sub Playmusic st=1 NN=0 For repeat = 1 to 2 For M= 1 To 16 ' scores is 16 measure of 4:4 Read_Measure() For T=1 TO 8 sound.PlayMusic (a[t]+n[t]) NN=NN+0.20 If NN>=6 Then Op=200-20*NN Else Op=20*NN EndIf If nn=10 Then NN=0 last=st Shapes.SetOpacity(img[last],50) st=st+1 st= Math.Remainder((st-1),7)+1 EndIf ' affiche les différents degrés de brillance de 0 à 100 opacit dans la variable op Shapes.SetOpacity(img[st],op) ' ici pour effacer les accords et notes en mémoire de la mesure a[t]="" n[t]="" endfor ENDFOR endfor EndSub ' octave longueur BASS + NOTE ' O 1-8 L 1-64 C=do D=ré E=mi F=fa G=sol A=la B=si SUB read_measure If (M=1) then ' measure 1 a[1]="O4L64 G" +"O6L64 B" n[1]="o6l6 B" n[2]="o6l6 G" a[3]="o4l64 G" n[3]="o6l6 B" n[4]="o6l6 G" a[5]="O4L64 A" +"O6L64 C" n[5]="o6l6 C" n[6]="o5l6 G" a[7]="o4l64 A" n[7]="o6l6 C" n[8]="o5l6 G" ElseIf (M=2) then ' measure 2 a[1]="O4L64 B" +"O6L64 D" n[1]="o6l6 D" n[2]="o5l6 G" a[3]="o4l64 B" n[3]="o6l6 D" n[4]="o5l6 G" a[5]="O4L64 B" +"O6L64 D" n[5]="o6l2 D" ' un noire n[6]="" 'un silence n[7]="o6l6 E" n[8]="o6l4 F#" ElseIf (M=3) then ' measure 3 a[1]="O4L64 E" +"O6L64 G" n[1]="o6l6 G" n[2]="o5l6 G" a[3]="o5l64 E" n[3]="o6l6 G" n[4]="o5l6 G" a[5]="O4L64 D" +"O6L64 F#" n[5]="o6l6 F#" n[6]="o5l6 G" a[7]="o5l64 D" n[7]="o6l6 F#" n[8]="o5l6 G" ElseIf (M=4) then ' measure 4 a[1]="O4L64 C" +"O6L64 E" n[1]="o6l6 E" n[2]="o5l6 G" a[3]="o4l64 C" n[3]="o6l6 E" ' eu peu de human feeling n[4]="o5l6 G" a[5]="O4L64 B" +"O6L64 G" n[5]="o6l1 D" ' un noire n[6]="" 'un silence n[7]="" 'un silence n[8]="" 'un silence ElseIf (M=5) then ' measure 5 a[1]="O4L64 C" +"O6L64 A" n[1]="o6l6 A" n[2]="o5l6 D" a[3]="o4l64 C" n[3]="o6l6 A" n[4]="o5l6 D" a[5]="O4L64 C" +"O6L64 A" n[5]="o6l6 A" n[6]="o5l6 D" n[7]="o6l6 E" n[8]="o6l4 D" ElseIf (M=6) then ' measure 6 a[1]="O4L64 B" +"O5L64 G" n[1]="o6l6 G" n[2]="o5l6 D" a[3]="o4l64 B" n[3]="o6l6 G" n[4]="o5l6 D" a[5]="O4L64 B" +"O5L64 G" n[5]="o6l6 G" n[6]="o5l6 D" n[7]="o6l6 G" n[8]="o6l6 F#" ElseIf (M=7) then ' measure 7 n[1]="o5l6 C" n[2]="o6l6 E" n[3]="o5l6 B" n[4]="o6l6 D" n[5]="o5l6 A" n[6]="o6l6 C" n[7]="o5l6 G" n[8]="o6l6 B" ElseIf (M=8) then ' measure 8 a[1]="O4L64 B" +"O5L64 D" n[1]="o5l6 D" n[2]="o5l4 C" n[3]="o5l4 C#" n[4]="o5l4 D" a[5]="O4L64 D" +"O5L64 A" n[5]="o6l1 A" n[6]="" n[7]="" n[8]="" ElseIf (M=9) then ' measure 9 n[1]="o5l6 D" n[2]="o6l6 C" n[3]="o6l6 F#" n[4]="o6l5 C" n[5]="o5l6 D" n[6]="o6l6 C" n[7]="o6l6 F#" n[8]="o6l5 C" ElseIf (M=10) then ' measure 10 n[1]="o5l6 G" n[2]="o6l6 G" n[3]="o5l6 D" n[4]="o6l5 C" n[5]="O5L6 G" n[6]="o5l6 B" n[7]="o5l6 G" n[8]="o5l5 D" ElseIf (M=11) then ' measure 11 n[1]="o5l6 D" n[2]="o6l6 C" n[3]="o6l6 F#" n[4]="o6l5 C" n[5]="o5l6 D" n[6]="o6l6 C" n[7]="o6l6 F#" n[8]="o6l5 C" ElseIf (M=12) then ' measure 12 n[1]="o5l6 G" n[2]="o6l6 G" n[3]="o5l6 D" n[4]="o6l5 C" n[5]="O5L6 G" n[6]="o5l6 B" n[7]="o5l5 G" n[8]="o5l5 D" ElseIf (M=13) then ' measure 13 n[1]="o4l6 C" n[2]="o5l6 G" n[3]="o6l6 E" n[4]="o4l6 C" n[5]="O4L6 B" n[6]="o5l6 G" n[7]="o6l6 D" n[8]="o4l5 B" ElseIf (M=14) then ' measure 14 n[1]="o4l6 D" n[2]="o5l6 C" n[3]="o6l6 F#" n[4]="o4l5 D" n[5]="O4L6 E" n[6]="o5l6 B" n[7]="o6l5 G" n[8]="o4l5 E" ElseIf (M=15) then ' measure 15 n[1]="o5l6 C" n[2]="o6l6 E" n[3]="o5l5 C" n[4]="o5l5 A" a[5]="O5L64 B" +"O5L64 D" n[5]="o5l6 D" n[6]="o6l5 D" a[7]="O5L64 B" +"O5L64 C" n[7]="o5l5 C" n[8]="o5l4 A" ElseIf (M=16) then ' measure16 a[1]="O4L64 G" +"O5L64 B"+"O3L64 G" n[1]="o5l5 B" n[2]="o5l4 G" ' la vitesse diminue pour la fin n[3]="o4l4 D" n[4]="o4l3 G" a[5]="O3L64 G" +"O4L64 B" n[5]="O5L1 G" EndIf endsub Sub AddCircles xo = gw / 2 yo = gh / 2 i = 0 GraphicsWindow.BrushColor = "White" GraphicsWindow.PenWidth = 0 For θ = 0 To 340 Step 20 i = i + 1 ell[i] = Shapes.AddEllipse(16, 16) x = xo + 60 * Math.Sin(Math.GetRadians(θ)) y = yo - 60 * Math.Cos(Math.GetRadians(θ)) Shapes.Move(ell[i], x - 8, y - 8) Shapes.SetOpacity(ell[i], 10) EndFor i = 1 n = Array.GetItemCount(ell) Timer.Interval = 100 Timer.Tick = OnTick EndSub Sub RemoveCircles For i = 1 To n Shapes.Remove(ell[i]) EndFor EndSub Sub OnTick Stack.PushValue("local", i) i = i + 4 If n < i Then i = Math.Remainder(i, n) EndIf For op = 50 To 10 Step -10 Shapes.SetOpacity(ell[i], op) i = i - 1 If i < 1 Then i = n EndIf EndFor i = Stack.PopValue("local") i = i + 1 If n < i Then i = 1 EndIf EndSub End>BDF760.sb< Start>BDJ777.sb< gw = 600 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "3D Rubic Cube" GraphicsWindow.BackgroundColor = "Black" view = LD3DView.AddView(gw,gh,"True") LD3DView.ResetCamera(view,-5,-5,-5,1,1,1,0,1,0) LD3DView.AutoControl("true","true",10,1) LD3DView.AddAmbientLight(view,"White") image = ImageList.LoadImage("http://litdev.co.uk/game_images/rubic.png") 'image = ImageList.LoadImage(Program.Directory+"/rubic.png") 'LD3DView.SpecularExponent = 5 col[1] = "#CC0000" ' red col[2] = "#FFFFFF" ' white col[3] = "#ffd700" ' yellow col[4] = "#fF6000" 'orange col[5] = "#00BB00" 'green col[6] = "#0000EE" ' blue numBit = 0 For iFace = 1 To 6 For i = 1 To 3 For j = 1 To 3 indices = "0:2:1 1:2:3" i1 = i-2.5 i2 = i-1.5 j1 = j-2.5 j2 = j-1.5 k1 = -1.5 k2 = 1.5 If (iFace = 1) Then p0 = k1+":"+i1+":"+j1 p1 = k1+":"+i2+":"+j1 p2 = k1+":"+i1+":"+j2 p3 = k1+":"+i2+":"+j2 x = 1 y = i z = j ElseIf (iFace = 2) Then p0 = k2+":"+i1+":"+j2 p1 = k2+":"+i2+":"+j2 p2 = k2+":"+i1+":"+j1 p3 = k2+":"+i2+":"+j1 x = 3 y = i z = j ElseIf (iFace = 3) Then p0 = j1+":"+k1+":"+i1 p1 = j1+":"+k1+":"+i2 p2 = j2+":"+k1+":"+i1 p3 = j2+":"+k1+":"+i2 x = j y = 1 z = i ElseIf (iFace = 4) Then p0 = j2+":"+k2+":"+i1 p1 = j2+":"+k2+":"+i2 p2 = j1+":"+k2+":"+i1 p3 = j1+":"+k2+":"+i2 x = j y = 3 z = i ElseIf (iFace = 5) Then p0 = i1+":"+j1+":"+k1 p1 = i2+":"+j1+":"+k1 p2 = i1+":"+j2+":"+k1 p3 = i2+":"+j2+":"+k1 x = i y = j z = 1 ElseIf (iFace = 6) Then p0 = i1+":"+j2+":"+k2 p1 = i2+":"+j2+":"+k2 p2 = i1+":"+j1+":"+k2 p3 = i2+":"+j1+":"+k2 x = i y = j z = 3 EndIf points = p0+" "+p1+" "+p2+" "+p3 numBit = numBit+1 'bitFace[numBit] = iFace bitX[numBit] = x bitY[numBit] = y bitZ[numBit] = z 'bitCube[numBit] = (z-1)*9+(y-1)*3+x bitCol[numBit] = col[iFace] bit[numBit] = LD3DView.AddGeometry(view,points,indices,"",bitCol[numBit],"D") LD3DView.AddImage(view,bit[numBit],"0:0 1:0 0:1 1:1",image,"D") bitPos[numBit] = LD3DView.GetPosition(view,bit[numBit]) LD3DView.SetCentre(view,bit[numBit],0,0,0,"R2") EndFor EndFor EndFor time = 1 repeat = 1 While ("True") xVal = 1 yVal = 0 zVal = 0 angle = -90 Rotate() xVal = 0 yVal = 1 zVal = 0 angle = 180 Rotate() xVal = 0 yVal = 0 zVal = 2 angle = 90 Rotate() xVal = 0 yVal = 0 zVal = 2 angle = -90 Rotate() xVal = 0 yVal = 1 zVal = 0 angle = 180 Rotate() xVal = 1 yVal = 0 zVal = 0 angle = 90 Rotate() EndWhile Sub Rotate For i = 1 To numBit If (bitX[i] = xVal) Then LD3DView.AnimateRotation(view,bit[i],1,0,0,0,angle,time,repeat) ElseIf (bitY[i] = yVal) Then LD3DView.AnimateRotation(view,bit[i],0,1,0,0,angle,time,repeat) ElseIf (bitZ[i] = zVal) Then LD3DView.AnimateRotation(view,bit[i],0,0,1,0,angle,time,repeat) EndIf EndFor Program.Delay(1000*time) LDGraphicsWindow.PauseUpdates() lastCol = bitCol For i = 1 To numBit If (bitX[i] = xVal Or bitY[i] = yVal Or bitZ[i] = zVal) Then pos1 = bitPos[i] For j = 1 To numBit If (bitX[j] = xVal Or bitY[j] = yVal Or bitZ[j] = zVal) Then pos2 = LD3DView.GetPosition(view,bit[j]) distSquared = (pos1[1]-pos2[1])*(pos1[1]-pos2[1]) + (pos1[2]-pos2[2])*(pos1[2]-pos2[2]) + (pos1[3]-pos2[3])*(pos1[3]-pos2[3]) If (distSquared < 0.001) Then 'bit j is now where i started bitCol[i] = lastCol[j] LD3DView.ResetMateral(view,bit[i],bitCol[i],"D") LD3DView.AddImage(view,bit[i],"0:0 1:0 0:1 1:1",image,"D") EndIf EndIf EndFor EndIf EndFor For i = 1 To numBit LD3DView.RotateGeometry2(view,bit[i],1,0,0,0) EndFor Program.Delay(10) LDGraphicsWindow.ResumeUpdates() EndSub End>BDJ777.sb< Start>BDK263.sb< ' Guess Word 0.3 ' Copyright (c) 2013 Nonki Takahashi ' ' History: ' 0.3 05/05/2013 Changed to use noun text file. ' 0.2 02/05/2013 Changed as graphics version. ' 0.1 02/05/2013 Created as text version. ' title = "Guess Word 0.3" GraphicsWindow.Title = title CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) min = 3 ' [letters] max = 5 ' [letters] letters[1] = "aeiou" letters[2] = "bcdfghjklmnpqrstvwxyz" GetWords() GraphicsWindow.BrushColor = "Black" x = 10 While "True" y = 10 GetRandomWord() GraphicsWindow.DrawText(x, y, "Hint 1: " + Text.GetLength(word) + " letters") GetMean() y = y + 20 GraphicsWindow.DrawText(x, y, "Hint 2: " + mean) img = Flickr.GetRandomPicture(word) name = ImageList.LoadImage(img) height = ImageList.GetHeightOfImage(name) / 2 width = ImageList.GetWidthOfImage(name) / 2 y = y + 20 GraphicsWindow.DrawResizedImage(name, x + 300, y, width, height) WaitToAnswer() EndWhile Sub WaitToAnswer answer = Controls.AddTextBox(x, y) ok = Controls.AddButton("OK", x + 200, y) t1 = Clock.ElapsedMilliseconds t2 = Clock.ElapsedMilliseconds tWait = 20000 Controls.ButtonClicked = OnButtonClicked y = y + 40 While (t2 - t1) < tWait GraphicsWindow.Title = title + " - " + (tWait / 1000 - Math.Floor((t2 - t1) / 1000)) Program.Delay(500) t2 = Clock.ElapsedMilliseconds EndWhile GraphicsWindow.Title = title + " (" + nWords + ")" GraphicsWindow.DrawText(x, y, "The word is " + word) Program.Delay(3000) GraphicsWindow.Clear() EndSub Sub OnButtonClicked guess = Controls.GetTextBoxText(answer) If Text.ConvertToLowerCase(guess) = Text.ConvertToLowerCase(word) Then GraphicsWindow.DrawText(x, y, "You win") words[word] = "" index = Array.GetAllIndices(words) nWords = nWords - 1 t1 = t2 - tWait Else GraphicsWindow.DrawText(x, y, "You lose") EndIf y = y + 20 EndSub Sub GetWords filename = "noun.txt" url = "http://www.nonkit.com/smallbasic.files/" + filename path = Network.DownloadFile(url) nWords = 0 ' The following line could be harmful and has been automatically commented. ' w = File.ReadLine(path, nWords) While w <> "" nWords = nWords + 1 words[w] = 1 ' The following line could be harmful and has been automatically commented. ' w = File.ReadLine(path, nWords) EndWhile ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(path) nWords = Array.GetItemCount(words) index = Array.GetAllIndices(words) EndSub Sub GetRandomWord ' return word ' return def - definition i = Math.GetRandomNumber(nWords) word = index[i] def = Dictionary.GetDefinition(word) EndSub Sub GetMean p = 1 q = 1 GetLineOfDef() p = q GetLineOfDef() p = q GetLineOfDef() mean = txt EndSub Sub GetLineOfDef While p = q q = Text.GetIndexOf(Text.GetSubTextToEnd(def, p), CRLF) If q = 0 Then q = Text.GetLength(Text.GetSubTextToEnd(def, p)) + 1 Else q = q + p - 1 EndIf If p = q Then p = p + 2 q = q + 2 EndIf EndWhile txt = Text.GetSubText(def, p, q - p) EndSub End>BDK263.sb< Start>BDM264.sb< ctr=1 mytext=file.readline("myconfig.txt",ctr) while mytext<> "" mytext=file.readline("myconfig.txt",ctr) Textwindow.writeline(mytext) Draw[ctr]=mytext Textwindow.writeline("Draw["+ctr+"] ="+ Draw[ctr]) Textwindow.writeline("form= : "+Draw[ctr]["form"]) Textwindow.writeline("heigth : "+ Draw[ctr]["heigth"]) ctr=ctr+1 Endwhile Textwindow.writeline("Number of lines in array Draw : "+Array.GetItemCount(Draw) ) 'Drawing the GraphicsWindow for ctr=1 to Array.GetItemCount(Draw) 'ctr is a counter If Draw[ctr]["form"]="Rectangle" then GraphicsWindow.DrawRectangle(Draw[ctr]["x"],Draw[ctr]["y"],Draw[ctr]["width"],Draw[ctr]["heigth"]) elseif Draw[ctr]["form"]="Ellips" then GraphicsWindow.DrawEllipse(Draw[ctr]["x"],Draw[ctr]["y"],Draw[ctr]["width"],Draw[ctr]["heigth"]) elseif Draw[ctr]["form"]="FillRectangle" then GraphicsWindow.FillRectangle(Draw[ctr]["x"],Draw[3]["y"],Draw[ctr]["width"],Draw[ctr]["heigth"]) endif endfor End>BDM264.sb< Start>BDM296-0.sb< GraphicsWindow.Width=500 GraphicsWindow.Height=500 GraphicsWindow.BackgroundColor="black" chart() 'This Part Made By WhTurner33,Thanks WhTurner33. sub chart NN=4 sum=0 For i=1 To NN num[i]=50 sum=sum+num[i] EndFor p2=Math.Pi/50 GraphicsWindow.FontSize=20 For i=1 To NN pct[i]=Math.Round(1000*num[i]/sum)/10 EndFor alf=0 For i=1 To NN alfh=alf+p2*pct[i]/2 alfa=alf+p2*pct[i] If i=1 Then GraphicsWindow.PenColor="red" EndIf If i=2 Then GraphicsWindow.PenColor="yellow" EndIf If i=3 Then GraphicsWindow.PenColor="blue" EndIf If i=4 Then GraphicsWindow.PenColor="green" EndIf GraphicsWindow.BrushColor="red" For j=alf To alfa Step 0.01 sline=Math.Sin(j) cline=Math.cos(j) GraphicsWindow.DrawLine(225,225,225+125*sline,225+125*cline) EndFor ss=Math.Sin(alf) cc=Math.Cos(alf) s2=Math.Sin(alfh) c2=Math.Cos(alfh) GraphicsWindow.PenColor="black" GraphicsWindow.DrawLine(225,225,225+125*ss,225+125*cc) alf=alfa EndFor GraphicsWindow.DrawLine(225,225,225,350) GraphicsWindow.DrawEllipse(100,100,250,250) EndSub End>BDM296-0.sb< Start>BDM296.sb< GraphicsWindow.Width=500 GraphicsWindow.Height=500 GraphicsWindow.BackgroundColor="black" rf=Controls.AddButton("refresh",0,475) ok=Controls.AddButton("OK",470,475) Controls.ButtonClicked=bttn Sub bttn last=Controls.LastClickedButton If last=rf Then chart() EndIf If last=ok Then Controls.Remove(rf) Controls.Remove(ok) EndIf EndSub chart() 'This Part Made By WhTurner33,Thanks WhTurner33. sub chart NN=4 sum=0 For i=1 To NN num[i]=50 sum=sum+num[i] EndFor p2=Math.Pi/50 GraphicsWindow.FontSize=20 For i=1 To NN pct[i]=Math.Round(1000*num[i]/sum)/10 EndFor alf=0 For i=1 To NN alfh=alf+p2*pct[i]/2 alfa=alf+p2*pct[i] o=Math.GetRandomNumber(8) If o>0 And o<3 Then GraphicsWindow.PenColor="red" EndIf If o>2 And o<5 Then GraphicsWindow.PenColor="yellow" EndIf If o>4 And o<7 Then GraphicsWindow.PenColor="blue" EndIf If o>6 And o<9 Then GraphicsWindow.PenColor="green" EndIf GraphicsWindow.BrushColor="red" For j=alf To alfa Step 0.01 sline=Math.Sin(j) cline=Math.cos(j) GraphicsWindow.DrawLine(225,225,225+125*sline,225+125*cline) EndFor ss=Math.Sin(alf) cc=Math.Cos(alf) s2=Math.Sin(alfh) c2=Math.Cos(alfh) GraphicsWindow.PenColor="black" GraphicsWindow.DrawLine(225,225,225+125*ss,225+125*cc) alf=alfa EndFor GraphicsWindow.DrawLine(225,225,225,350) GraphicsWindow.DrawEllipse(100,100,250,250) EndSub End>BDM296.sb< Start>BDN418.sb< ' endless soundplayandwait(path) Timer.Tick=digiwatch Timer.Interval=20000 waves() GraphicsWindow.Show() Timer.Resume() Sub digiwatch NN=NN+1 _Hr=Clock.hour t0= Clock.ElapsedMilliseconds Sound.PlayBellRingAndWait() Sound.PlayAndWait(kripayadhyande) Sound.PlayAndWait(_sound1[_Hr]) Sound.PlayAndWait(_sound2[_Hr]) Sound.PlayAndWait(bajchuke) Sound.PlayAndWait(aglaalarm1hbaadbajega) Sound.PlayAndWait(contact) GraphicsWindow.Title=NN+" : "+(Clock.ElapsedMilliseconds-t0) endsub sub waves path =Program.Directory ' "C:\Users\UTTAM\Desktop\MIGCLOCK" For i=1 To 24 _sound1[i] = path+"\night.wav" EndFor For i=4 To 11 _sound1[i] = path+"\morning.wav" EndFor For i=12 To 15 _sound1[i] = path+"\afternoon.wav" EndFor For i=16 To 19 _sound1[i] = path+"\evening.wav" EndFor For i=1 To 12 _sound2[i] = path+"\"+i+".wav" EndFor For i=13 To 24 _sound2[i] = path+"\" +(i-12)+".wav" EndFor am = path+"\am.wav" pm = path+"\pm.wav" kripayadhyande = path+"\attention.wav" kripayadobaradhyande = path+"\once again.wav" bajchuke = path+"\baj chuke.wav" aglaalarm1hbaadbajega = path+"\next alarm 1 h.wav" contact = path+"\contact.wav" EndSub End>BDN418.sb< Start>BDQ571.sb< ' SmallBasic Version 1.0 ' Funktion: MouseLogger, MouseTrail Recorder ' Autor: Pappa Lapub ' Herkunft: http://social.msdn.microsoft.com/Forums/en-US/f7370867-2508-4a48-8b37-07761bf60649/challenge-of-the-month-august-2014 ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev (LDShapes.ResetTurtle) ' Kommentar: https://de.wikipedia.org/wiki/Haus_vom_Nikolaus ' ' Variablen: ' ' ToDo: + alternat. GW.DrawLine + GWFill() instead of Turtle.PenDown + GW.Clear for trails ' OK (w/o LitDev) ' + already draw during rec... ' OK ' -------------------------------------------------------------------------------- LF = Text.GetCharacter(10) recInfo = " points recorded" helpTxt = "Click to record, then play back with" +LF+ "1-Shape, 2-Shape+Trail, 3-Turtle, 4-Turtle+Trail" +LF+ "Esc-Exit, C-ClearGW" ballSize = 10 ballR = ballSize/2 GW = 800 GH = 600 GraphicsWindow.Top = 0 GraphicsWindow.Width = GW GraphicsWindow.Height = GH GraphicsWindow.BackgroundColor = "Black" ResetVars() ShowHelp() lastTime = Clock.ElapsedMilliseconds GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseMove = OnMouseMove While "True" If playShape Or playTurtle And pntNo > 1 Then SetColor() If playShape Then ' Shapes.HideShape("_turtle") Shapes.Remove(ball) ShapePlay() ElseIf playTurtle Then TurtlePlay() EndIf ResetVars() EndIf EndWhile ' ////////// EVENTs \\\\\\\\\\ ' Recording Sub OnMouseDown pntNo = pntNo+1 X[pntNo] = GraphicsWindow.MouseX Y[pntNo] = GraphicsWindow.MouseY now = Clock.ElapsedMilliseconds T[pntNo] = now - lastTime ' duration lastTime = now GraphicsWindow.Title = pntNo + recInfo + " | X:" + X[pntNo] + " | Y:" + Y[pntNo] '' Already draw during recording (SetColor() before and also PenWidth to 1) 'GraphicsWindow.DrawText(X[pntNo]+ballR,Y[pntNo]-ballR, pntNo) 'If pntNo > 1 Then ' GraphicsWindow.DrawLine(X[pntNo-1],Y[pntNo-1], X[pntNo],Y[pntNo]) ' EndIf EndSub ' Selection Playback / Clear Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "Escape" Then Program.End() ElseIf lastKey = "D1" Then ' 1 .. Shape trails = "" playShape = "True" ElseIf lastKey = "D2" Then ' 2 .. Shape + trails trails = "True" playShape = "True" ElseIf lastKey = "D3" Then ' 3 .. Turtle trails = "" playTurtle = "True" ElseIf lastKey = "D4" Then ' 4 .. Turtle + trails trails = "True" playTurtle = "True" ElseIf lastKey = "C" Then ' Clear GW GWClear() ' or GWFill() EndIf EndSub Sub OnMouseMove MX = GraphicsWindow.MouseX MY = GraphicsWindow.MouseY GraphicsWindow.Title = pntNo + recInfo + " | X:" + MX + " | Y:" + MY EndSub ' ////////// SUBs \\\\\\\\\\ Sub SetColor brushCol = GraphicsWindow.GetRandomColor() While brushCol = GraphicsWindow.BackgroundColor brushCol = GraphicsWindow.GetRandomColor() EndWhile GraphicsWindow.BrushColor = brushCol ' point labels, ball GraphicsWindow.PenColor = brushCol ' trails EndSub ' Playback with Shape (+trails) Sub ShapePlay GraphicsWindow.PenWidth = 0 ball = Shapes.AddEllipse(ballSize,ballSize) Shapes.Move(ball, X[1]-ballR,Y[1]-ballR) GraphicsWindow.PenWidth = 1 GraphicsWindow.DrawText(X[1]+ballR, Y[1]-ballR, 1) ' 1st point label GraphicsWindow.Title = pntNo-1 + recInfo + " | X:" + X[1] + " | Y:" + Y[1] For N = 2 To pntNo Shapes.Animate(ball, X[N],Y[N], T[N]) Program.Delay(T[N]+100) If trails Then GraphicsWindow.DrawLine(X[N-1],Y[N-1], X[N],Y[N]) EndIf GraphicsWindow.DrawText(X[N]+ballR, Y[N]-ballR, N) GraphicsWindow.Title = pntNo-N + recInfo + " | X:" + X[N] + " | Y:" + Y[N] EndFor 'Shapes.Remove(ball) EndSub ' Playback with Turtle (+trails) Sub TurtlePlay LDShapes.ResetTurtle() ' with GWClear() 'Shapes.ShowShape("_turtle") ' with GWFill() GraphicsWindow.PenWidth = 1 Turtle.X = X[1] Turtle.Y = Y[1] GraphicsWindow.DrawText(X[1]+ballR, Y[1]-ballR, 1) ' 1st point label GraphicsWindow.Title = pntNo-1 + recInfo + " | X:" + X[1] + " | Y:" + Y[1] If trails = "" Then Turtle.PenUp() Else Turtle.PenDown() EndIf For N = 2 To pntNo RoundToNearestTurtleSpeed() Turtle.Speed = speed Turtle.MoveTo(X[N],Y[N]) 'If trails Then ' with GWFill() ' GraphicsWindow.DrawLine(X[N-1],Y[N-1], X[N],Y[N]) 'EndIf GraphicsWindow.DrawText(X[N]+ballR, Y[N]-ballR, N) GraphicsWindow.Title = pntNo-N + recInfo + " | X:" + X[N] + " | Y:" + Y[N] EndFor EndSub ' duration = Math.Abs(320 * distance / speed^2) Sub RoundToNearestTurtleSpeed dX = X[N] - X[N-1] dY = Y[N] - Y[N-1] distance = Math.SquareRoot(dX*dX + dY*dY) speed = Math.Round(Math.SquareRoot(320 * distance / T[N]) -0.1) ' MPR.ToEven -> round lil down (-0.1) ' speed = Math.Floor(Math.SquareRoot(320 * distance / T[N])) EndSub Sub GWFill ResetVars() bgColor = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(0,0, GW,GH) GraphicsWindow.BrushColor = bgColor ShowHelp() EndSub Sub GWClear ResetVars() GraphicsWindow.Clear() ' clears all Shapes and kills/destroys Turtle ShowHelp() 'SetColor() '' Already draw during rec... EndSub Sub ResetVars X = "" Y = "" T = "" pntNo = 0 playShape = "" playTurtle = "" GraphicsWindow.Title = "Click on GW to record points ..." EndSub Sub ShowHelp GraphicsWindow.BrushColor = "Dimgray" GraphicsWindow.DrawText(0,0, helpTxt) EndSub End>BDQ571.sb< Start>BDR631.sb< ' mahreen miangul ' Blinking Eyes Animation ' FebrUary 2017 GraphicsWindow.Width = "1080" GraphicsWindow.Height = "420" GraphicsWindow.BackgroundColor = "LightYellow" GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 120 GraphicsWindow.FontItalic = "True" GraphicsWindow.BrushColor = "Silver" ' Text shadow color GraphicsWindow.DrawText(5, 5, "mahreen miangul!") ' Shadow position/text GraphicsWindow.BrushColor = "RosyBrown" ' Text color GraphicsWindow.DrawText(0, 0, "mahreen miangul!") ' Position and text 'Data table draw[1] = "X=452;Y=120;W=152;H=152;color=crimson;tag=1" draw[2] = "X=605;Y=120;W=150;H=150;color=crimson;tag=1" draw[3] = "X=494;Y=140;W=110;H=110;color=mediumseagreen;tag=2" draw[4] = "X=605;Y=140;W=110;H=110;color=mediumseagreen;tag=2" draw[5] = "X=526;Y=160;W=80;H=80;color=dodgerblue;tag=3" draw[6] = "X=605;Y=160;W=80;H=80;color=dodgerblue;tag=3" draw[7] = "X=552;Y=170;W=50;H=50;color=yellow;tag=eye" 'left draw[8] = "X=608;Y=170;W=50;H=50;color=yellow;tag=eye" 'right 'Draw outline For i = 1 To Array.GetItemCount(draw) GraphicsWindow.PenColor = draw[i]["color"] GraphicsWindow.DrawEllipse(draw[i]["X"], draw[i]["Y"], draw[i]["W"], draw[i]["H"]) Program.Delay(300) EndFor 'Add and Animate shapes for solid color GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "darkslategray" For i = 1 To Array.GetItemCount(draw) GraphicsWindow.BrushColor = draw[i]["color"] shp[i] = Shapes.AddEllipse(draw[i]["W"], draw[i]["H"]) Shapes.Animate(shp[i], draw[i]["X"], draw[i]["Y"], 500) Program.Delay(500) EndFor 'Animate shapes - eyes and mouth dZ = 0.1 zoom = 1 While 0=0 zoom = zoom - dZ For i = 1 To Array.GetItemCount(draw) If Array.ContainsValue(draw[i] "eye") Then Shapes.Zoom(shp[i] 1 zoom) ElseIf Array.ContainsValue(draw[i] "mouth") Then Shapes.Zoom(shp[i] zoom zoom) EndIf EndFor If zoom = 0 Or zoom = 1 Then dZ = -dZ EndIf Program.Delay(100) EndWhile End>BDR631.sb< Start>BDT021.sb< UltimateRestart: TextWindow.ForegroundColor = "Silver" TextWindow.Write("Welcome User, please type in your name here:") name= TextWindow.Read() If name = ("taranoshi")Then Goto DOSLoop Else Goto DDDSSS EndIf DDDSSS: TextWindow.WriteLine("Welcome"+name+ "to BasicDOS 11.8.6.4! :-)") TextWindow.WriteLine("Copyright 2011 By Taranoshi"+".") TextWindow.WriteLine("Booting_BasicDOS.....................") Program.Delay(5000) TextWindow.WriteLine("|||||||||||||||||| |||||||||||||||| |||||||||||||||| || |||||||||||||||||") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("||||||||||||||||||| |||||||||||||||| ||||||||||||| || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || || || ") Program.Delay(500) TextWindow.WriteLine("||||||||||||||||||| || || ||||||||||||||| || |||||||||||||||||") Program.Delay(5000) TextWindow.WriteLine("|||||||||||| |||||||||||||| ||||||||||||||||") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || ||||||||||||| ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|| || || || ||") Program.Delay(500) TextWindow.WriteLine("|| || || || ||") Program.Delay(500) TextWindow.WriteLine("|| || || || ||") Program.Delay(500) TextWindow.WriteLine("|| || || || || ") Program.Delay(500) TextWindow.WriteLine("|||||||||||| |||||||||||||| |||||||||||||||| Kernel Boot Loader") Program.Delay(1000) TextWindow.Clear() TextWindow.WriteLine("Type {help} to get started") Goto DOSLoop DOSLoop: Program.Delay(100) TextWindow.Clear() TextWindow.ForegroundColor = "DarkGrey" TextWindow.Write(name + "'s " + "Profile" + "DOS A:/>") command= TextWindow.Read() If command= ("help") Then Goto Start1 Else Goto Apples EndIf Apples: If command= ("paint")Then Goto Start2 Else Goto Apples2 EndIf Apples2: If command= ("restart") Then Goto UltimateRestart Else Goto Apples3 EndIf Apples3: If command= ("flickr") Then Goto Start3 Else Goto Apples4 EndIf Apples4: If command= ("A:")Then Goto Start4 Else Goto Apples5 EndIf Apples5: If command= ("printtime")Then Goto Start5 Else Goto Apples6 EndIf Apples6: If command= ("dos")Then Goto Start6 Else Goto Apples7 EndIf Apples7: If command= ("tetris")Then Goto Start7 Else Goto Apples8 EndIf Apples8: If command= ("pong")Then Goto Start8 Else Goto Apples9 EndIf Apples9: If command= ("box")Then Goto Start9 Else Goto Apples10 EndIf Apples10: If command= ("tempcalc")Then Goto Start10 Else Goto Apples11 EndIf Apples11: If command= ("pong2")Then Goto Start11 Else Goto Apples12 EndIf Apples12: If command= ("astroids")Then Goto Start12 Else Goto Apples13 EndIf Apples13: If command= ("jet")Then Goto Start13 Else Goto Apples14 EndIf Apples14: If command= ("fly")Then Goto Start14 Else Goto Apples15 EndIf Apples15: If command= ("balls")Then Goto Start15 Else Goto Apples16 EndIf Apples16: If command= ("brick")Then Goto Start16 Else Goto Apples17 EndIf Apples17: If command= ("forces")Then Goto Start17 Else Goto Apples18 EndIf Apples18: If command= ("dwin") Then Goto Startdwin Else Goto Apples19 EndIf Apples19: If command = ("word")Then Goto Wordcom Else Goto Apples20 EndIf Apples20: If command = ("exit")Then Goto EXITDOS Else Goto DOSLoop EndIf Start1: TextWindow.ForegroundColor = "Grey" TextWindow.WriteLine("_______________________________________") TextWindow.WriteLine("|_ H_E_L_P_|_|_|_|_|_|_|_|_|_|_|_|_||||") TextWindow.WriteLine("| paint = PaintDOS 2.0 ||||") TextWindow.WriteLine("| restart = restart/reset BASICDOS ||||") TextWindow.WriteLine("| flickr = Flickr Pictures ||||") TextWindow.WriteLine("| printtime = Print the Time ||||") TextWindow.WriteLine("| dos = BasicDOS Version ||||") TextWindow.WriteLine("| tetris = Tetris Game ||||") TextWindow.WriteLine("| brick = Microsoft Brick Game ||||") TextWindow.WriteLine("| pong = pong game ||||") TextWindow.WriteLine("| pong2= pong2 Game ||||") TextWindow.WriteLine("| astroids = Astroids Game ||||") TextWindow.WriteLine("| jet = Jet Lag Game ||||") TextWindow.WriteLine("| balls = Ball Video ||||") TextWindow.WriteLine("| box = Box Video ||||") TextWindow.WriteLine("| fly = Swarm of Flies Video ||||") TextWindow.WriteLine("| tempcalc = TempCalculator ||||") TextWindow.WriteLine("| dwin = GUI console ||||") TextWindow.WriteLine("|word = word processor ||||") TextWindow.WriteLine("|exit = exit BasicDOS ||||") TextWindow.WriteLine("|||||||||||||||||||||||||||||||||||||||") TextWindow.WriteLine("---------------------------------------") Program.Delay(2000) TextWindow.Clear() Goto DOSLoop Start2: GraphicsWindow.Show() GraphicsWindow.Clear() GraphicsWindow.PenColor = "Black" GraphicsWindow.MouseMove= OnMouseMove GraphicsWindow.MouseDown= OnMouseDown Sub OnMouseDown prevX= GraphicsWindow.MouseX prevY= GraphicsWindow.MouseY EndSub Sub OnMouseMove x= GraphicsWindow.MouseX y= GraphicsWindow.MouseY EndSub If (Mouse.IsLeftButtonDown)Then GraphicsWindow.DrawLine(prevX, prevY, x, y) EndIf prevX= x prevY= y Goto DOSLoop Start3: GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.MouseDown = OnMouseDown2 Sub OnMouseDown2 pic = Flickr.GetRandomPicture("mountains, river") GraphicsWindow.DrawResizedImage(pic, 0, 0, 640, 480) EndSub Goto DOSLoop Start4: TextWindow.ForegroundColor = "Yellow" TextWindow.Write("Drive A: Not Found!") Goto DOSLoop Start5: Sub PrintTime TextWindow.WriteLine(Clock.Time) EndSub Goto DOSLoop Start6: TextWindow.ForegroundColor = "Grey" TextWindow.WriteLine("DOS Version 9.0.7.3") Goto DOSLoop Start7: GraphicsWindow.KeyDown = HandleKey GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB( 253, 252, 251 ) While "True" BOXES = 4 ' number of boxes per piece BWIDTH = 25 ' box width in pixels XOFFSET = 40 ' Screen X offset in pixels of where the board starts YOFFSET = 40 ' Screen Y offset in pixels of where the board starts CWIDTH = 10 ' Canvas Width, in number of boxes CHEIGHT = 20 ' Canvas Height, in number of boxes. STARTDELAY = 800 ENDDELAY = 175 PREVIEW_xpos = 13 PREVIEW_ypos = 2 GraphicsWindow.Clear() GraphicsWindow.Title = "Small Basic Tetris" GraphicsWindow.Height = 580 GraphicsWindow.Width = 700 GraphicsWindow.Show() SetupTemplates() SetupCanvas() MainLoop() GraphicsWindow.ShowMessage( "Game Over", "Small Basic Tetris" ) EndWhile Sub MainLoop template = Text.Append("template", Math.GetRandomNumber(7)) CreatePiece() ' in: template ret: h nextPiece = h end = 0 sessionDelay = STARTDELAY While end = 0 If sessionDelay > ENDDELAY Then sessionDelay = sessionDelay - 1 EndIf delay = sessionDelay thisPiece = nextPiece template = Text.Append("template", Math.GetRandomNumber(7)) CreatePiece() ' in: template ret: h nextPiece = h DrawPreviewPiece() h = thisPiece ypos = 0 done = 0 xpos = 3 ' always drop from column 3 CheckStop() ' in: ypos, xpos, h ret: done If done = 1 Then ypos = ypos - 1 MovePiece() 'in: ypos, xpos, h end = 1 EndIf yposdelta = 0 While done = 0 Or yposdelta > 0 MovePiece() 'in: ypos, xpos, h ' Delay, but break if the delay get set to 0 if the piece gets dropped delayIndex = delay While delayIndex > 0 And delay > 0 Program.Delay(10) delayIndex = delayIndex - 10 EndWhile If yposdelta > 0 Then yposdelta = yposdelta - 1 ' used to create freespin, when the piece is rotated Else ypos = ypos + 1 ' otherwise, move the piece down. EndIf ' Check if the piece should stop. CheckStop() ' in: ypos, xpos, h ret: done EndWhile EndWhile EndSub Sub HandleKey ' Stop game If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf ' Move piece left If GraphicsWindow.LastKey = "Left" Then moveDirection = -1 ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0 If invalidMove = 0 Then xpos = xpos + moveDirection EndIf MovePiece() 'in: ypos, xpos, h EndIf ' Move piece right If GraphicsWindow.LastKey = "Right" Then moveDirection = 1 ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0 If invalidMove = 0 Then xpos = xpos + moveDirection EndIf MovePiece() 'in: ypos, xpos, h EndIf ' Move piece down If GraphicsWindow.LastKey = "Down" or GraphicsWindow.LastKey = "Space" Then delay = 0 EndIf ' Rotate piece If GraphicsWindow.LastKey = "Up" Then basetemplate = Array.GetValue(h, -1) ' Array.GetValue(h, -1) = the template name template = "temptemplate" rotation = "CW" CopyPiece() 'in basetemplate, template, rotation Array.SetValue(h, -1, template) ' Array.GetValue(h, -1) = the template name moveDirection = 0 ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0 ' See if it can be moved so that it will rotate. xposbk = xpos yposdelta = 0 While yposdelta = 0 And Math.Abs(xposbk - xpos) < 3 ' move up to 3 times only ' if the rotation move worked, copy the temp to "rotatedtemplate" and use that from now on If invalidMove = 0 Then basetemplate = template template = "rotatedtemplate" Array.SetValue(h, -1, template) ' Array.GetValue(h, -1) = the template name rotation = "COPY" CopyPiece() 'in basetemplate, template, rotation yposdelta = 1 ' Don't move down if we rotate MovePiece() 'in: ypos, xpos, h ElseIf invalidMove = 2 Then ' Don't support shifting piece when hitting another piece to the right or left. xpos = 99 ' exit the loop Else ' if the rotated piece can't be placed, move it left or right and try again. xpos = xpos - invalidMove ValidateMove() ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0 EndIf EndWhile If invalidMove <> 0 Then xpos = xposbk Array.SetValue(h, -1, basetemplate) ' Array.GetValue(h, -1) = the template name template = "" EndIf EndIf EndSub Sub DrawPreviewPiece xpos = PREVIEW_xpos ypos = PREVIEW_ypos h = nextPiece XOFFSETBK = XOFFSET YOFFSETBK = YOFFSET XOFFSET = XOFFSET + Array.GetValue(Array.GetValue(h, -1), "pviewx") ' Array.GetValue(h, -1) = the template name YOFFSET = YOFFSET + Array.GetValue(Array.GetValue(h, -1), "pviewy") ' Array.GetValue(h, -1) = the template name MovePiece() 'in: ypos, xpos, h XOFFSET = XOFFSETBK YOFFSET = YOFFSETBK EndSub ' creates template that's a rotated basetemplate Sub CopyPiece 'in basetemplate, template, rotation L = Array.GetValue(basetemplate, "dim") If rotation = "CW" Then For i = 0 to BOXES - 1 ' x' = y y' = L - 1 - x v = Array.GetValue(basetemplate, i) 'x = Math.Floor(v/10) 'y = Math.Remainder(v, 10) ' new x and y x = (Math.Remainder(v, 10)) y = (L - 1 - Math.Floor(v/10)) Array.SetValue(template, i, x * 10 + y) EndFor ' Count-Cockwise is not currently used ElseIf rotation = "CCW" Then For i = 0 to BOXES - 1 ' x' = L - 1 - y y' = x v = Array.GetValue(basetemplate, i) 'x = Math.Floor(v/10) 'y = Math.Remainder(v, 10) ' new x and y x = (L - 1 - Math.Remainder(v, 10)) y = Math.Floor(v/10) Array.SetValue(template, i, x * 10 + y) EndFor ElseIf rotation = "COPY" Then For i = 0 to BOXES - 1 Array.SetValue(template, i, Array.GetValue(basetemplate, i)) EndFor Else GraphicsWindow.ShowMessage("invalid parameter", "Error") Program.End() EndIf ' Copy the remain properties from basetemplate to template. Array.SetValue(template, "color", Array.GetValue(basetemplate, "color")) Array.SetValue(template, "dim", Array.GetValue(basetemplate, "dim")) Array.SetValue(template, "pviewx", Array.GetValue(basetemplate, "pviewx")) Array.SetValue(template, "pviewy", Array.GetValue(basetemplate, "pviewy")) EndSub Sub CreatePiece ' in: template ret: h ' Create a new handle, representing an arrayName, that will represent the piece hcount = hcount + 1 h = Text.Append("piece", hcount) Array.SetValue(h, -1, template) ' Array.GetValue(h, -1) = the template name GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = Array.GetValue(template, "color") For i = 0 to BOXES - 1 s = Shapes.AddRectangle(BWIDTH, BWIDTH) Shapes.Move(s, -BWIDTH, -BWIDTH) ' move off screen Array.SetValue(h, i, s) EndFor EndSub Sub MovePiece 'in: ypos, xpos, h. ypos/xpos is 0-19, representing the top/left box coordinate of the piece on the canvas. h returned by CreatePiece For i = 0 to BOXES - 1 v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name x = Math.Floor(v/10) y = Math.Remainder(v, 10) ' Array.GetValue(h, i) = box for piece h. ' xpos/ypos = are topleft of shape. x/y is the box offset within the shape. Shapes.Move(Array.GetValue(h, i), XOFFSET + xpos * BWIDTH + x * BWIDTH, YOFFSET + ypos * BWIDTH + y * BWIDTH) EndFor EndSub Sub ValidateMove ' in: ypos, xpos, h, moveDirection ret: invalidMove = 1 or -1 or 2 if move is invalid, otherwise 0 i = 0 invalidMove = 0 While i < BOXES v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name 'x/y is the box offset within the shape. x = Math.Floor(v/10) y = Math.Remainder(v, 10) If (x + xpos + moveDirection) < 0 Then invalidMove = -1 i = BOXES ' force getting out of the loop EndIf If (x + xpos + moveDirection) >= CWIDTH Then invalidMove = 1 i = BOXES ' force getting out of the loop EndIf If Array.GetValue("c", (x + xpos + moveDirection) + (y + ypos) * CWIDTH) <> "." Then invalidMove = 2 i = BOXES ' force getting out of the loop EndIf i = i + 1 EndWhile EndSub Sub CheckStop ' in: ypos, xpos, h ret: done done = 0 i = 0 While i < BOXES v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name 'x/y is the box offset within the shape. x = Math.Floor(v/10) y = Math.Remainder(v, 10) If y + ypos > CHEIGHT Or Array.GetValue("c", (x + xpos) + (y + ypos) * CWIDTH) <> "." Then done = 1 i = BOXES ' force getting out of the loop EndIf i = i + 1 EndWhile ' If we need to stop the piece, move the box handles to the canvas If done = 1 Then For i = 0 to BOXES - 1 v = Array.GetValue(Array.GetValue(h, -1), i) ' Array.GetValue(h, -1) = the template name 'x = Math.Floor(v/10) 'y = Math.Remainder(v, 10) Array.SetValue("c", (Math.Floor(v/10) + xpos) + (Math.Remainder(v, 10) + ypos - 1) * CWIDTH, Array.GetValue(h, i)) EndFor ' 1 points for every piece successfully dropped score = score + 1 PrintScore() ' Delete clared lines DeleteLines() EndIf EndSub Sub DeleteLines linesCleared = 0 ' Iterate over each row, starting from the bottom For y = CHEIGHT - 1 to 0 Step -1 ' Check to see if the whole row is filled x = CWIDTH While x = CWIDTH x = 0 While x < CWIDTH piece = Array.GetValue("c", x + y * CWIDTH) If piece = "." then x = CWIDTH EndIf x = x + 1 EndWhile ' if non of them were empty (i.e "."), then remove the line. If x = CWIDTH Then ' Delete the line For x1 = 0 to CWIDTH - 1 Shapes.Remove(Array.GetValue("c", x1 + y * CWIDTH)) EndFor linesCleared = linesCleared + 1 ' Move everything else down one. For y1 = y To 1 Step -1 For x1 = 0 to CWIDTH - 1 piece = Array.GetValue("c", x1 + (y1 - 1) * CWIDTH) Array.SetValue("c", x1 + y1 * CWIDTH, piece) Shapes.Move(piece, Shapes.GetLeft(piece), Shapes.GetTop(piece) + BWIDTH) EndFor EndFor EndIf EndWhile EndFor If linesCleared > 0 Then score = score + 100 * Math.Round(linesCleared * 2.15 - 1) PrintScore() EndIf EndSub Sub SetupCanvas ' GraphicsWindow.DrawResizedImage( Flickr.GetRandomPicture( "bricks" ), 0, 0, GraphicsWindow.Width, GraphicsWindow.Height) GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(XOFFSET, YOFFSET, CWIDTH*BWIDTH, CHEIGHT*BWIDTH) Program.Delay(200) GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Pink" For x = 0 To CWIDTH-1 For y = 0 To CHEIGHT-1 Array.SetValue("c", x + y * CWIDTH, ".") ' "." indicates spot is free GraphicsWindow.DrawRectangle(XOFFSET + x * BWIDTH, YOFFSET + y * BWIDTH, BWIDTH, BWIDTH) EndFor EndFor GraphicsWindow.PenWidth = 4 GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(XOFFSET, YOFFSET, XOFFSET, YOFFSET + CHEIGHT*BWIDTH) GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH, YOFFSET, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH) GraphicsWindow.DrawLine(XOFFSET, YOFFSET + CHEIGHT*BWIDTH, XOFFSET + CWIDTH*BWIDTH, YOFFSET + CHEIGHT*BWIDTH) GraphicsWindow.PenColor = "Lime" GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET, XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 6) GraphicsWindow.DrawLine(XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 6) GraphicsWindow.DrawLine(XOFFSET - 4, YOFFSET + CHEIGHT*BWIDTH + 4, XOFFSET + CWIDTH*BWIDTH + 4, YOFFSET + CHEIGHT*BWIDTH + 4) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Pink" x = XOFFSET + PREVIEW_xpos * BWIDTH - BWIDTH y = YOFFSET + PREVIEW_ypos * BWIDTH - BWIDTH GraphicsWindow.FillRectangle(x, y, BWIDTH * 5, BWIDTH * 6) GraphicsWindow.DrawRectangle(x, y, BWIDTH * 5, BWIDTH * 6) GraphicsWindow.FillRectangle(x - 20, y + 190, 310, 170) GraphicsWindow.DrawRectangle(x - 20, y + 190, 310, 170) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontItalic = "False" GraphicsWindow.FontName = "Comic Sans MS" GraphicsWindow.FontSize = 16 GraphicsWindow.DrawText(x, y + 200, "Game control keys:") GraphicsWindow.DrawText(x + 25, y + 220, "Left Arrow = Move piece left") GraphicsWindow.DrawText(x + 25, y + 240, "Right Arrow = Move piece right") GraphicsWindow.DrawText(x + 25, y + 260, "Up Arrow = Rotate piece") GraphicsWindow.DrawText(x + 25, y + 280, "Down Arrow = Drop piece") GraphicsWindow.DrawText(x, y + 320, "Press to stop game") Program.Delay(200) ' without this delay, the above text will use the fontsize of the score GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Georgia" GraphicsWindow.FontItalic = "True" GraphicsWindow.FontSize = 36 GraphicsWindow.DrawText(x - 20, y + 400, "Small Basic Tetris") Program.Delay(200) ' without this delay, the above text will use the fontsize of the score GraphicsWindow.FontSize = 16 GraphicsWindow.DrawText(x - 20, y + 440, "ver.0.1") Program.Delay(200) ' without this delay, the above text will use the fontsize of the score score = 0 PrintScore() EndSub Sub PrintScore GraphicsWindow.PenWidth = 4 GraphicsWindow.BrushColor = "Pink" GraphicsWindow.FillRectangle(500, 65, 153, 50) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawRectangle(500, 65, 153, 50) GraphicsWindow.FontItalic = "False" GraphicsWindow.FontSize = 32 GraphicsWindow.FontName = "Impact" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(505, 70, Text.Append(Text.GetSubText( "00000000", 0, 8 - Text.GetLength( score ) ), score)) EndSub Sub SetupTemplates ' each piece has 4 boxes. ' the index of each entry within a piece represents the box number (1-4) ' the value of each entry represents to box zero-based box coordinate within the piece: tens place is x, ones place y '_X_ '_X_ '_XX Array.SetValue("template1", 0, 10) Array.SetValue("template1", 1, 11) Array.SetValue("template1", 2, 12) Array.SetValue("template1", 3, 22) Array.SetValue("template1", "color", "Yellow") Array.SetValue("template1", "dim", 3) Array.SetValue("template1", "pviewx", -12) Array.SetValue("template1", "pviewy", 12) '_X_ '_X_ 'XX_ Array.SetValue("template2", 0, 10) Array.SetValue("template2", 1, 11) Array.SetValue("template2", 2, 12) Array.SetValue("template2", 3, 02) Array.SetValue("template2", "color", "Magenta") Array.SetValue("template2", "dim", 3) Array.SetValue("template2", "pviewx", 12) Array.SetValue("template2", "pviewy", 12) '_X_ 'XXX '_ Array.SetValue("template3", 0, 10) Array.SetValue("template3", 1, 01) Array.SetValue("template3", 2, 11) Array.SetValue("template3", 3, 21) Array.SetValue("template3", "color", "Gray") Array.SetValue("template3", "dim", 3) Array.SetValue("template3", "pviewx", 0) Array.SetValue("template3", "pviewy", 25) 'XX_ 'XX_ '_ Array.SetValue("template4", 0, 00) Array.SetValue("template4", 1, 10) Array.SetValue("template4", 2, 01) Array.SetValue("template4", 3, 11) Array.SetValue("template4", "color", "Cyan") Array.SetValue("template4", "dim", 2) Array.SetValue("template4", "pviewx", 12) Array.SetValue("template4", "pviewy", 25) 'XX_ '_XX '_ Array.SetValue("template5", 0, 00) Array.SetValue("template5", 1, 10) Array.SetValue("template5", 2, 11) Array.SetValue("template5", 3, 21) Array.SetValue("template5", "color", "Green") Array.SetValue("template5", "dim", 3) Array.SetValue("template5", "pviewx", 0) Array.SetValue("template5", "pviewy", 25) '_XX 'XX_ '_ Array.SetValue("template6", 0, 10) Array.SetValue("template6", 1, 20) Array.SetValue("template6", 2, 01) Array.SetValue("template6", 3, 11) Array.SetValue("template6", "color", "Blue") Array.SetValue("template6", "dim", 3) Array.SetValue("template6", "pviewx", 0) Array.SetValue("template6", "pviewy", 25) '_X '_X '_X '_X Array.SetValue("template7", 0, 10) Array.SetValue("template7", 1, 11) Array.SetValue("template7", 2, 12) Array.SetValue("template7", 3, 13) Array.SetValue("template7", "color", "Red") Array.SetValue("template7", "dim", 4) Array.SetValue("template7", "pviewx", 0) Array.SetValue("template7", "pviewy", 0) EndSub Start8: GraphicsWindow.BackgroundColor = "DarkBlue" paddle = Shapes.AddRectangle(120, 12) ball = Shapes.AddEllipse(16, 16) GraphicsWindow.MouseMove = OnMouseMove2 x = 0 y = 0 deltaX = 1 deltaY = 1 RunLoop: x = x + deltaX y = y + deltaY gw = GraphicsWindow.Width gh = GraphicsWindow.Height If (x >= gw - 16 or x <= 0) Then deltaX = -deltaX EndIf If (y <= 0) Then deltaY = -deltaY EndIf padX = Shapes.GetLeft (paddle) If (y = gh - 28 and x >= padX and x <= padX + 120) Then deltaY = -deltaY EndIf Shapes.Move(ball, x, y) Program.Delay(5) If (y < gh) Then Goto RunLoop EndIf GraphicsWindow.ShowMessage("You Lose", "Paddle") Sub OnMouseMove2 paddleX = GraphicsWindow.MouseX Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12) EndSub Goto DOSLoop Start9: Blah: rows = 8 columns = 8 size = 40 For r = 1 To rows For c = 1 To columns GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() boxes[r][c] = Shapes.AddRectangle(size, size) Shapes.Move(boxes[r][c], c * size, r * size) EndFor EndFor For r = 1 To rows For c = 1 To columns Shapes.Animate(boxes[r][c], 0, 0, 1000) Program.Delay(300) EndFor EndFor TextWindow.ForegroundColor = "Dark Grey" TextWindow.Write("Replay Box?") reply= TextWindow.Read() If reply= ("yes")Then Goto Blah Else Goto DOSLoop EndIf Start10: CalcLoop: TextWindow.ForegroundColor = "Blue" TextWindow.Write("Enter temperature in Fahrenheit: ") fahr = TextWindow.ReadNumber() celsius = 5 * (fahr - 32) / 9 TextWindow.WriteLine("Temperature in Celsius is " + celsius) TextWindow.Write("Continue usind TempCalc?") word= TextWindow.Read() If word= ("yes")Then Goto CalcLoop Else Goto DOSLoop EndIf Start11: 'Ping Pong 'Point Multiplier Start5000: 'Points Multiplier pointsMultiply = 1 score = score+1 Sub MouseMove score = score+1 EndSub 'Bottom paddle If (y >= gh - paddle - ball/2 and x >= padX and x <= padX + paddle) Then y = gh - paddle - ball/2 Sound.PlayClick() score = score+1 EndIf 'Background GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() For i = 1 To 1000 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() x = Math.GetRandomNumber(640) y = Math.GetRandomNumber(480) GraphicsWindow.FillEllipse(x, y, 10, 10) EndFor paddle = Shapes.AddRectangle(100, 12) ball = Shapes.AddEllipse(16, 16) GraphicsWindow.MouseMove = OnMouseMove12 x = 0 y = 0 deltaX = 1 deltaY = 1 RunLoop5: 'Title Page GraphicsWindow.Title =GameTitle + (score*pointsMultiply) GameTitle = "Ping Pong Seconds You are playing:" x = x + deltaX y = y + deltaY gw = GraphicsWindow.Width gh = GraphicsWindow.Height If (x >= gw - 16 or x <= 0) Then deltaX = -deltaX EndIf If (y <= 0) Then deltaY = -deltaY EndIf padX = Shapes.GetLeft (paddle) If (y = gh - 28 and x >= padX and x <= padX + 120) Then deltaY = -deltaY EndIf Shapes.Move(ball, x, y) Program.Delay(1) If (y < gh) Then score = score+1 Goto RunLoop5 EndIf GraphicsWindow.ShowMessage ("Game Over :( . Seconds You have played:" + (score*pointsMultiply) + "Seconds. Thanks for playing! :)" "Play Again?") Sub OnMouseMove12 paddleX = GraphicsWindow.MouseX Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12) EndSub Shapes.Remove(paddle) TextWindow.ForegroundColor = "Pink" TextWindow.Write("Play Again?") reply2= TextWindow.Read() If reply2= ("Yes")Then Goto Start5000 Else Goto DOSLoop EndIf Start12: ' Asteroids Game ' Copyright (C) 2009, Jason T. Jacques ' License: MIT license http://www.opensource.org/licenses/mit-license.php ' Game area controls gameWidth = 640 gameHeight = 480 backColor = "black" ' Window title gameTitle = "Asteroids, Score: " ' Target frames per second fps = 25 ' Key controls leftKey = "Left" rightKey = "Right" forwardKey = "Up" backKey = "Down" fireKey = "Space" pauseKey = "P" ' Asteroid (rock) settings rockSpeed = 1 rockColor = "white" rockMin = 20 ' small size rock rockTypes = 3 ' number of rock sizes (multiples of small rock size) initRocks = 5 ' Ammo settings ammoSpeed = 5 ammoColor = "white" ammoLife = 60 ' moves before auto destruct ammoMax = 10 ammoSize = 5 ' Player settings playerColor = "white" playerHeight = 30 playerWidth = 20 safeTime = 100 ' time player has to get out of the way on level up ' Point multiplier pointsMultiply = 10 ' Array name initialisation rock = "rockArray" rockAngle = "rockAngle" rockSize = "rockSize" ammo = "ammoArray" ammoAngle = "ammoAngle" ammoAge = "ammoAge" rockCount = 0 ammoCount = 0 bigRock = ImageList.LoadImage("http://smallbasic.com/drop/Asteroids_BigRock.png") medRock = ImageList.LoadImage("http://smallbasic.com/drop/Asteroids_MediumRock.png") smlRock = ImageList.LoadImage("http://smallbasic.com/drop/Asteroids_SmallRock.png") background = ImageList.LoadImage("http://smallbasic.com/drop/Asteroids_Sky.png") ' Start game Init() Play() ' Setup world Sub Init GraphicsWindow.Hide() GraphicsWindow.Title = gameTitle + "0" GraphicsWindow.CanResize = "False" GraphicsWindow.Width = gameWidth GraphicsWindow.Height = gameHeight GraphicsWindow.BackgroundColor = backColor GraphicsWindow.BrushColor = backColor GraphicsWindow.DrawImage(background, 0, 0) LevelCheck() GraphicsWindow.PenColor = playerColor player = Shapes.AddImage("http://smallbasic.com/drop/Asteroids_Ship.png") ' player = Shapes.AddTriangle(playerWidth/2, 0, 0, playerHeight, playerWidth, playerHeight) Shapes.Move(player, (gameWidth - playerWidth) / 2, (gameHeight - playerHeight) / 2) playerAngle = 0 EndSub ' Main gane routine Sub Play GraphicsWindow.Show() GraphicsWindow.KeyDown = ChangeDirection ' Main loop play = 1 pause = 0 While(play = 1) Program.Delay(1000/fps) If (pause = 0) Then Move() CollisionCheck() AgeAmmo() LevelCheck() EndIf EndWhile EndSub ' Read key event and act Sub ChangeDirection If(GraphicsWindow.LastKey = rightKey) Then playerAngle = Math.Remainder(playerAngle + 10, 360) ElseIf(GraphicsWindow.LastKey = leftKey) Then playerAngle = Math.Remainder(playerAngle - 10, 360) ElseIf(GraphicsWindow.LastKey = forwardKey) Then playerSpeed = playerSpeed + 1 ElseIf(GraphicsWindow.LastKey = backKey) Then playerSpeed = playerSpeed - 1 ElseIf(GraphicsWindow.LastKey = fireKey) Then Fire() ElseIf(GraphicsWindow.LastKey = pauseKey) Then pause = Math.Remainder(pause + 1, 2) EndIf Shapes.Rotate(player, playerAngle) EndSub ' Move all on screen items Sub Move ' Move player x = Math.Remainder(Shapes.GetLeft(player) + (Math.Cos(Math.GetRadians(playerAngle - 90)) * playerSpeed) + gameWidth, gameWidth) y = Math.Remainder(Shapes.GetTop(player) + (Math.Sin(Math.GetRadians(playerAngle - 90)) * playerSpeed) + gameHeight, gameHeight) Shapes.Move(player, x, y) ' Move rocks For i = 1 To rockCount x = Math.Remainder(Shapes.GetLeft(Array.GetValue(rock, i)) + (Math.Cos(Math.GetRadians(Array.GetValue(rockAngle, i) - 90)) * rockSpeed) + gameWidth, gameWidth) y = Math.Remainder(Shapes.GetTop(Array.GetValue(rock, i)) + (Math.Sin(Math.GetRadians(Array.GetValue(rockAngle, i) - 90)) * rockSpeed) + gameHeight, gameHeight) Shapes.Move(Array.GetValue(rock, i), x, y) EndFor ' Move ammo For i = 1 To ammoCount x = Math.Remainder(Shapes.GetLeft(Array.GetValue(ammo, i)) + (Math.Cos(Math.GetRadians(Array.GetValue(ammoAngle, i) - 90)) * ammoSpeed) + gameWidth, gameWidth) y = Math.Remainder(Shapes.GetTop(Array.GetValue(ammo, i)) + (Math.Sin(Math.GetRadians(Array.GetValue(ammoAngle, i) - 90)) * ammoSpeed) + gameHeight, gameHeight) Shapes.Move(Array.GetValue(ammo, i), x, y) Array.SetValue(ammoAge, i, Array.GetValue(ammoAge, i) + 1) EndFor EndSub ' Check for collisions between onscreen items Sub CollisionCheck ' Calculate player bounding box. px1 = Shapes.GetLeft(player) - ( (Math.Abs(playerWidth * Math.Cos(Math.GetRadians(playerAngle)) + playerHeight * Math.Sin(Math.GetRadians(playerAngle))) - playerWidth) / 2) py1 = Shapes.GetTop(player) - ( (Math.Abs(playerWidth * Math.Sin(Math.GetRadians(playerAngle)) + playerHeight * Math.Cos(Math.GetRadians(playerAngle))) - playerHeight) / 2) px2 = px1 + Math.Abs(playerWidth * Math.Cos(Math.GetRadians(playerAngle)) + playerHeight * Math.Sin(Math.GetRadians(playerAngle))) py2 = py1 + Math.Abs(playerWidth * Math.Sin(Math.GetRadians(playerAngle)) + playerHeight * Math.Cos(Math.GetRadians(playerAngle))) ' Re-order co-oridinates if they are the wrong way arround If(px1 > px2) Then tmp = px1 px1 = px2 px2 = tmp EndIf If(py1 > py2) Then tmp = py1 py1 = py2 py2 = tmp EndIf ' Check if each rock has hit something For i = 1 To rockCount ax1 = Shapes.Getleft(Array.GetValue(rock, i)) ay1 = Shapes.GetTop(Array.GetValue(rock, i)) ax2 = ax1 + Array.GetValue(rockSize, i) ay2 = ay1 + Array.GetValue(rockSize, i) ' Player collison If(playerSafe < 1) Then If ( (ax1 < px1 And ax2 > px1) Or (ax1 < px2 And ax2 > px2) ) Then If ( (ay1 < py1 And ay2 > py1) Or (ay1 < py2 And ay2 > py2) ) Then EndGame() EndIf EndIf EndIf ' Ammo collison For j = 1 to ammoCount bx1 = Shapes.Getleft(Array.GetValue(ammo, j)) by1 = Shapes.GetTop(Array.GetValue(ammo, j)) bx2 = bx1 + ammoSize by2 = by1 + ammoSize If ( (ax1 < bx1 And ax2 > bx1) Or (ax1 < bx2 And ax2 > bx2) ) Then If ( (ay1 < by1 And ay2 > by1) Or (ay1 < by2 And ay2 > by2) ) Then nextRemove = i RemoveRock() nextRemove = j RemoveAmmo() EndIf EndIf EndFor EndFor ' Decrease the time player is safe If (playerSafe > 0) Then playerSafe = playerSafe - 1 EndIf EndSub ' Add a new rock to the world Sub AddRock ' Check if the next rock size/position has been specified If (nextSize <> 0) Then size = rockMin* nextSize x = Shapes.GetLeft(nextPosition) y = Shapes.GetTop(nextPosition) nextSize = 0 Else ' Choose a random size and position size = rockMin * Math.GetRandomNumber(rockTypes) x = Math.GetRandomNumber(gameWidth - size) y = Math.GetRandomNumber(gameHeight - size) EndIf ' Draw the rock GraphicsWindow.PenColor = rockColor If size = 60 Then Array.SetValue(rock, rockCount + 1, Shapes.AddImage(bigRock)) ElseIf size = 40 Then Array.SetValue(rock, rockCount + 1, Shapes.AddImage(medRock)) Else Array.SetValue(rock, rockCount + 1, Shapes.AddImage(smlRock)) EndIf rockCount = rockCount + 1 Shapes.Move(Array.GetValue(rock, rockCount), x, y) Array.SetValue(rockAngle, rockCount, Math.GetRandomNumber(360)) Array.SetValue(rockSize, rockCount, size) EndSub ' Remove a rock from the world and update score Sub RemoveRock removeSize = Array.GetValue(rockSize, nextRemove) / rockMin ' If not a mini rock If (removeSize > 1) Then ' ... add new rocks until we have made up for it being broken apart... While(removeSize > 0) nextSize = Math.GetRandomNumber(removeSize - 1) nextPosition = Array.GetValue(rock, nextRemove) removeSize = removeSize - nextSize AddRock() EndWhile ' And give a point for a 'hit' score = score + 1 Else ' We've destroyed it - give some extra points and score = score + 5 EndIf ' Show updated score GraphicsWindow.Title = gameTitle + (score * pointsMultiply) ' Remove all references from the arrays Shapes.Remove(Array.GetValue(rock, nextRemove)) For i = nextRemove To rockCount - 1 Array.SetValue(rock, i, Array.GetValue(rock, i+1)) Array.SetValue(rockAngle, i, Array.GetValue(rockAngle, i+1)) Array.SetValue(rockSize, i, Array.GetValue(rockSize, i+1)) EndFor Array.RemoveValue(rock, rockCount) Array.RemoveValue(rockAngle, rockCount) Array.RemoveValue(rockSize, rockCount) rockCount = rockCount - 1 EndSub ' Check if the player has completed the level, if so, level up Sub LevelCheck If(rockCount < 1) Then nextSize = 0 For i = 1 To initRocks AddRock() EndFor initRocks = initRocks + 1 ' Give players some time to move out of the way playerSafe = safeTime EndIf EndSub ' Add ammo to game Sub Fire ' Remove additional ammo While(ammoCount > (ammoMax - 1)) nextRemove = 1 RemoveAmmo() EndWhile ' Add the ammo GraphicsWindow.PenColor = ammoColor ammoCount = ammoCount + 1 Array.SetValue(ammo, ammoCount, Shapes.AddEllipse(ammoSize, ammoSize)) Shapes.Move(Array.GetValue(ammo, ammoCount), (px1 + px2 - ammoSize) / 2, (py1 + py2 - ammoSize) / 2) Array.SetValue(ammoAngle, ammoCount, playerAngle) EndSub ' Check ammo age Sub AgeAmmo While (Array.GetValue(ammoAge, 1) > ammoLife) nextRemove = 1 RemoveAmmo() EndWhile EndSub ' Remove top Ammo Sub RemoveAmmo Shapes.Remove(Array.GetValue(ammo, nextRemove)) For i = nextRemove To ammoCount - 1 Array.SetValue(ammo, i, Array.GetValue(ammo, i+1)) Array.SetValue(ammoAngle, i, Array.GetValue(ammoAngle, i+1)) Array.SetValue(ammoAge, i, Array.GetValue(ammoAge, i+1)) EndFor Array.RemoveValue(ammo, ammoCount) Array.RemoveValue(ammoAngle, ammoCount) Array.RemoveValue(ammoAge, ammoCount) ammoCount = ammoCount - 1 EndSub ' Display simple end game message box Sub EndGame play = 0 Shapes.Remove(player) GraphicsWindow.ShowMessage("You scored " + (score * pointsMultiply) + " points. Thanks for Playing.", "Game Over!") EndSub Goto DOSLoop Start13: Starter: Initialize() While (GameState<>"End") DoGameLoop() EndWhile Program.End() Sub Initialize 'Initialize Variables Score = 0 Direction = 0 GameState = "GameOver" GameDelay = 100 'Initialize the GraphicsWindow GraphicsWindow.Show() UpdateScore() GraphicsWindow.Width = 640 GraphicsWindow.Height = 480 GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor() GraphicsWindow.KeyDown = OnKeyDown 'Initialize Blocks GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() For Index=0 To 29 Temp = Shapes.AddRectangle(16,16) Shapes.Move(Temp,0,Index*16) Array.SetValue("Blocks",Index,Temp) Array.SetValue("BlockPositions",Index,0) EndFor 'Initialize Walls GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "#0000FF" Temp = Shapes.AddRectangle(16,480) shapes.Move(Temp,624,0) shapes.AddRectangle(16,480) 'Initialize Tail GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "#FFFF00" For Index = 0 To 4 Temp = Shapes.AddRectangle(16,16) Shapes.Move(Temp,320,Index*16) Array.SetValue("Tail",Index,Temp) Array.SetValue("TailPositions",Index,20) EndFor 'Initialize Head GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "#FF0000" Temp = Shapes.AddRectangle(16,16) Shapes.Move(Temp,320,5*16) Array.SetValue("Tail",5,Temp) Array.SetValue("TailPositions",5,20) EndSub Sub UpdateScore GraphicsWindow.Title = "SBJetLag - Score: " + Score EndSub Sub OnKeyDown Temp = GraphicsWindow.LastKey If (GameState = "GameOver") Then If (GraphicsWindow.LastKey = "Space") Then StartGame() Else If (GraphicsWindow.LastKey = "Escape") Then GameState = "End" Else If (GraphicsWindow.LastKey = "D1") Then GameDelay = 100 GraphicsWindow.ShowMessage("Game delay is set to 100ms","Speed Changed!") Else If (GraphicsWindow.LastKey = "D2") Then GameDelay = 200 GraphicsWindow.ShowMessage("Game delay is set to 200ms","Speed Changed!") Else If (GraphicsWindow.LastKey = "D3") Then GameDelay = 300 GraphicsWindow.ShowMessage("Game delay is set to 300ms","Speed Changed!") Else If (GraphicsWindow.LastKey = "D4") Then GameDelay = 400 GraphicsWindow.ShowMessage("Game delay is set to 400ms","Speed Changed!") Else If (GraphicsWindow.LastKey = "D5") Then GameDelay = 500 GraphicsWindow.ShowMessage("Game delay is set to 500ms","Speed Changed!") EndIf EndIf EndIf EndIf EndIf EndIf Endif Else If (GraphicsWindow.LastKey = "Left") Then Direction = -1 Else If (GraphicsWindow.LastKey = "Right") Then Direction = 1 EndIf EndIf EndIf EndSub Sub StartGame Score = 0 Direction = 1 UpdateScore() For Index=0 To 29 Temp = Array.GetValue("Blocks",Index) Shapes.Move(Temp,0,Index*16) Array.SetValue("BlockPositions",Index,0) EndFor For Index=0 To 5 Temp = Array.GetValue("Tail",Index) Shapes.Move(Temp,20*16,Index*16) Array.SetValue("TailPositions",Index,20) EndFor GameState = "Play" EndSub Sub DoGameLoop If (GameState = "Play") Then Score = Score + 1 UpdateScore() For Index=0 To 28 Temp = Array.GetValue("BlockPositions",Index+1) Array.SetValue("BlockPositions",Index,Temp) EndFor Array.SetValue("BlockPositions",29,Math.GetRandomNumber(38)) For Index=0 To 29 Temp = Array.GetValue("Blocks",Index) Shapes.Move(Temp,Array.GetValue("BlockPositions",Index)*16,Index*16) EndFor For Index=0 To 4 Temp = Array.GetValue("TailPositions",Index+1) Array.SetValue("TailPositions",Index,Temp) EndFor Array.SetValue("TailPositions",5,Array.GetValue("TailPositions",5)+Direction) For Index=0 To 5 Temp = Array.GetValue("Tail",Index) Shapes.Move(Temp,Array.GetValue("TailPositions",Index)*16,Index*16) EndFor Temp = Array.GetValue("TailPositions",5) If (Temp=0 Or Temp = 39 Or Temp = Array.GetValue("BlockPositions",5)) Then GameState = "GameOver" EndIf Program.Delay(GameDelay) EndIf EndSub Goto DOSLoop Start14: GraphicsWindow.Title="Swarm Of Flies" Background=ImageList.LoadImage("http://www.reiselandbulgarien.de/wp-content/uploaded_images/2008/Evgeni/Lake_Vaya.jpg") GraphicsWindow.DrawImage(Background,0,0) GraphicsWindow.Height=imagelist.GetHeightOfImage(Background) GraphicsWindow.Width=imagelist.GetWidthOfImage(Background) Insect_Amount=200 GraphicsWindow.BrushColor="Black" For i = 1 To Insect_Amount Insect[i]=shapes.AddRectangle(5,5) endfor While "True" Mouse_X = GraphicsWindow.MouseX Mouse_Y = GraphicsWindow.MouseY For i = 1 To Insect_Amount Insect_GotoX[i] = Mouse_X + (math.GetRandomNumber(30.1) - 15.1)*20 Insect_GotoY[i] = Mouse_Y + math.GetRandomNumber(20)*-20+150 Shapes.Animate(Insect[i],Insect_GotoX[i],Insect_GotoY[i],400) endfor Program.Delay(20) EndWhile Goto DOSLoop Start15: 'Program Title: Animated Balls 'From Small Basic Blog - http://blogs.msdn.com/b/smallbasic/ 'Coder: Bob, 16 Aug 2011 ' For i = 1 To 100 balls[i] = Shapes.AddEllipse(10, 10) EndFor While "True" For i = 1 To 100 ball = balls[i] x = Math.GetRandomNumber(640) y = Math.GetRandomNumber(480) Shapes.Animate(ball, x, y, 2000) EndFor Program.Delay(2900) EndWhile Goto DOSLoop Start16: 'BrickWall 'A development of the paddle game sample. 'Revove all the bricks to complete the game. ' Game over if you miss the ball. 'You are penalised -1 each time no bricks are hit. 'The movement of the ball is influenced by where it hits the paddle. 'Do not let the bricks reach the bottom of the screen. GameStartqw: 'paddle = GraphicsWindow.AddRectangle(120, 12) 'v0.2 paddle = Shapes.AddRectangle(120, 12) 'v0.3.1 'ball = GraphicsWindow.AddEllipse(16, 16) 'v0.2 ball = Shapes.AddEllipse(16,16) 'v0.3.1 bricksLeft = 48 brickStartY = 35 hitCount = 0 GraphicsWindow.FontSize = 14 GraphicsWindow.MouseMove = OnMouseMove123 GraphicsWindow.Title = "Brick Wall" For idx = 0 To 15 Array.SetValue("GreenBricks", idx, 1) Array.SetValue("YellowBricks", idx, 1) Array.SetValue("RedBricks", idx, 1) Endfor DrawBricks() score = 0 PrintScore() gw = GraphicsWindow.Width gh = GraphicsWindow.Height y = gh - 28 'GraphicsWindow.MoveShape(ball, x, y) 'v0.2 Shapes.Move(ball,x,y) 'v0.3.1 deltaX = 1 deltaY = -2 Sound.PlayBellRingAndWait() RunLoop300: x = x + deltaX y = y + deltaY gw = GraphicsWindow.Width gh = GraphicsWindow.Height If (x >= gw - 16 Or x <= 0) Then deltaX = -deltaX EndIf If (y <= 0) Then deltaY = -deltaY EndIf 'padX = GraphicsWindow.GetLeftOfShape(paddle) 'v0.2 padX = Shapes.GetLeft(paddle) 'v0.3.1 If ((y >= gh - 28 + 2) And x >= padX And x <= padX + 120) Then y = gh - 28 + 2 'Sound.PlayClick() hitCount = hitCount + 1 If Math.Remainder(hitCount, 3) = 0 Then 'Move bricks downwards For idx = 0 To 15 RemoveGreenBrick() RemoveYellowBrick() RemoveRedBrick() Endfor brickStartY = brickStartY + 20 DrawBricks() EndIf TestRed: For idx = 0 To 15 If Array.GetValue("RedBricks", idx) = 1 Then If brickStartY > gh - 160 Then Goto EndGame EndIf EndIf EndFor TestYellow: For idx = 0 To 15 If Array.GetValue("YellowBricks", idx) = 1 Then If brickStartY > gh - 100 Then Goto EndGame EndIf EndIf EndFor TestGreen: For idx = 0 To 15 If Array.GetValue("GreenBricks", idx) = 1 Then If brickStartY > gh - 40 Then Goto EndGame EndIf EndIf EndFor EndTest: deltaX = deltaX - 2 + (x - padX) / 30 ' Add some skill If score = oldScore Then 'No bricks hit score = score - 1 EndIf oldScore = score PrintScore() deltaY = -deltaY 'Change the ball direction EndIf ' GraphicsWindow.MoveShape(ball, x, y) 'v0.2 Shapes.Move(ball,x,y) 'v0.3.1 Program.Delay(5) ' Green Bricks If y > brickStartY - 16 And y < brickStartY + 20 Then ' y position of brick - diameter of ball idx = (x+8) / 40 ' Radius of ball / length of brick idx = Math.Floor(idx) ' take integer part If Array.GetValue("GreenBricks", idx) = 1 Then Array.SetValue("GreenBricks", idx, 0) RemoveGreenBrick() Sound.PlayChime() bricksLeft = bricksLeft - 1 deltaY = -deltaY 'Change ball direction score = score + 15 PrintScore() CheckEnd() EndIf EndIf ' Yellow Bricks If y > brickStartY + 44 And y < brickStartY + 80 Then ' y position of brick - diameter of ball = 19 idx = (x+8) / 40 ' Radius of ball / length of brick idx = Math.Floor(idx) ' take integer part If Array.GetValue("YellowBricks", idx) = 1 Then Array.SetValue("YellowBricks", idx, 0) RemoveYellowBrick() Sound.PlayChime() bricksLeft = bricksLeft - 1 deltaY = -deltaY 'Change ball direction score = score + 10 PrintScore() CheckEnd() EndIf EndIf ' Red Bricks If y > brickStartY + 104 And y < brickStartY + 140 Then ' y position of brick - diameter of ball = 19 idx = (x+8) / 40 ' Radius of ball / length of brick idx = Math.Floor(idx) ' take integer part If Array.GetValue("RedBricks", idx) = 1 Then Array.SetValue("RedBricks", idx, 0) RemoveRedBrick() Sound.PlayChime() bricksLeft = bricksLeft - 1 deltaY = -deltaY 'Change ball direction score = score + 5 PrintScore() CheckEnd() EndIf EndIf If (y < gh) Then 'Ball not reached bottom of window Goto RunLoop300 EndIf EndGame: GraphicsWindow.ShowMessage("Your score is: " + score, "BrickWall") Program.End() Sub OnMouseMove123 paddleX = GraphicsWindow.MouseX ' GraphicsWindow.MoveShape(paddle, paddleX - 60, GraphicsWindow.Height - 12) 'v0.2 Shapes.Move(paddle, paddleX - 60, GraphicsWindow.Height - 12) 'v0.3.1 EndSub Sub PrintScore45 ' Clear the score first and then draw the real score text GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(10, 10, 200, 20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(10, 10, "Score: " + score) EndSub Sub DrawBricks For idx = 0 To 15 ' Draw bricks 'Program.Delay(100) If Array.GetValue("GreenBricks", idx) = 1 Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Green" Else GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "White" EndIf GraphicsWindow.FillRectangle(idx * 40, brickStartY, 40, 20) GraphicsWindow.DrawRectangle(idx * 40, brickStartY, 40, 20) GraphicsWindow.BrushColor = "Yellow" If Array.GetValue("YellowBricks", idx) = 1 Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Yellow" Else GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "White" EndIf GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20) GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20) GraphicsWindow.BrushColor = "Red" If Array.GetValue("RedBricks", idx) = 1 Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Red" Else GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "White" EndIf GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20) GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20) endfor EndSub Sub RemoveGreenBrick GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(idx * 40, brickStartY, 40, 20) GraphicsWindow.DrawRectangle(idx * 40, brickStartY, 40, 20) EndSub Sub RemoveYellowBrick GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(idx * 40, brickStartY + 60, 40, 20) GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 60, 40, 20) EndSub Sub RemoveRedBrick GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(idx * 40, brickStartY + 120, 40, 20) GraphicsWindow.DrawRectangle(idx * 40, brickStartY + 120, 40, 20) EndSub Sub CheckEnd If bricksLeft = 0 Then GraphicsWindow.ShowMessage("Well Done. Wall destroyed. Your score is: " + score, "BrickWall") 'Goto GameStart Program.End() 'Goto EndGame EndIf EndSub Goto DOSLoop 'Copyright 2011 C Microsoft Corporation. All rights reservsed. Start17: 'Initialise graphics window GraphicsWindow.Hide() gw = 800 gh = 600 GraphicsWindow.CanResize = "False" GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Title = "Bouncing balls with realistic collision physics" GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightBlue" 'Reduce gw for options gw = gw-200 GraphicsWindow.MouseDown = OnMouseDown542 Start: ' Gravity, friction and attraction to mouse grav = 0.0 ' 0 for none fric = 0 ' 0 for none follow = 0 'attract to mouse attract = 0 'attract balls to each other dt = 1 'timestep (speed) shape = 0 '0:ball,1 square elastic = 1 '1 fully elastic collisions Colour = "Yellow" 'Initialise some balls radius = 20 diam = 2*radius nball = Math.Floor(gw/diam) istart = "True" reset() ireset = "False" istart = "False" iend = "False" iselect = "False" ioptions = "False" 'Show window - an MS comment GraphicsWindow.Show() 'Main loop While ("True") If (ioptions) Then options() ioptions = "False" EndIf energy = 0.0 isCollision = "False" If (iselect) Then For i = 1 To nball x = Xpos[i] y = Ypos[i] dist = (xm-x)*(xm-x)+(ym-y)*(ym-y) If (dist < radius*radius) Then u = 0 v = 0 Xvel[i] = u Yvel[i] = v EndIf EndFor iselect = "False" EndIf For i = 1 To nball update() move() u = Xvel[i] v = Yvel[i] energy = energy+(u*u+v*v) EndFor energy = dt*dt*energy energy = Math.Floor(energy) GraphicsWindow.BrushColor = "LightBlue" GraphicsWindow.FillRectangle(gw+15,560,190,20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(gw+65,560,"Energy "+energy) If (ireset) Then reset() ireset = "False" EndIf If (istart) Then Goto Start EndIf If (iend) Then Program.End() EndIf ' If (isCollision) Then ' Sound.PlayClick() ' EndIf Program.Delay(5) EndWhile 'Update ball positions Sub update u = Xvel[i] v = Yvel[i] u = Math.Min(100,Math.Max(u,-100)) v = Math.Min(100,Math.Max(v,-100)) x = Xpos[i]+dt*u y = Ypos[i]+dt*v bounce() gravity() collision() attraction() Xpos[i] = x Ypos[i] = y EndSub 'Check for edge bounces Sub bounce If (x < radius) Then Xvel[i] = -Xvel[i] x = radius EndIf If (x > gw-radius) Then Xvel[i] = -Xvel[i] x = gw-radius EndIf If (y < radius) Then Yvel[i] = -Yvel[i] y = radius EndIf If (y > gh-radius) Then Yvel[i] = -Yvel[i] y = gh-radius EndIf EndSub 'Check for collisions Sub collision 'Only check each pair once For j = i+1 To nball xi = x yi = y xj = Xpos[j] yj = Ypos[j] dx = xi-xj dy = yi-yj dist = Math.SquareRoot(dx*dx+dy*dy) If (dist < diam) Then isCollision = "True" 'Get ball vectors ui = Xvel[i] vi = Yvel[i] uj = Xvel[j] vj = Yvel[j] 'Move backwards (forwards if dt < 0) in time until balls are just touching CoefA = (ui-uj)*(ui-uj)+(vi-vj)*(vi-vj) CoefB = 2*((ui-uj)*(xi-xj)+(vi-vj)*(yi-yj)) CoefC = (xi-xj)*(xi-xj)+(yi-yj)*(yi-yj)-diam*diam If (CoefA = 0) Then t = -CoefC/CoefB Else If (dt >= 0) Then t = (-CoefB-Math.SquareRoot(CoefB*CoefB-4*CoefA*CoefC))/(2*CoefA) Else t = (-CoefB+Math.SquareRoot(CoefB*CoefB-4*CoefA*CoefC))/(2*CoefA) EndIf EndIF xi = xi+t*ui yi = yi+t*vi xj = xj+t*uj yj = yj+t*vj 'Centre of momentum coordinates mx = (ui+uj)/2 my = (vi+vj)/2 ui = ui-mx vi = vi-my uj = uj-mx vj = vj-my 'New centre to centre line dx = xi-xj dy = yi-yj dist = Math.SquareRoot(dx*dx+dy*dy) dx = dx/dist dy = dy/dist 'Reflect balls velocity vectors in centre to centre line OB = -(dx*ui+dy*vi) ui = ui+2*OB*dx vi = vi+2*OB*dy OB = -(dx*uj+dy*vj) uj = uj+2*OB*dx vj = vj+2*OB*dy 'Back to moving coordinates with elastic velocity change e = Math.SquareRoot(elastic) ui = e*(ui+mx) vi = e*(vi+my) uj = e*(uj+mx) vj = e*(vj+my) 'Move to new bounced position xi = xi-t*ui yi = yi-t*vi xj = xj-t*uj yj = yj-t*vj 'Set velocities Xvel[i] = ui Yvel[i] = vi Xvel[j] = uj Yvel[j] = vj 'Set position Xpos[j] = xj Ypos[j] = yj x = xi y = yi EndIf EndFor EndSub 'Gravity and friction and follow mouse Sub gravity xm = GraphicsWindow.MouseX-x ym = GraphicsWindow.MouseY-y dist = xm*xm+ym*ym dist = Math.Max(dist,radius*radius) 'dist = dist*Math.SquareRoot(dist) u = Xvel[i] v = Yvel[i] fricscale = (1-fric/Math.SquareRoot(1+u*u+v*v)) Xvel[i] = follow*xm/dist+fricscale*u Yvel[i] = follow*ym/dist+fricscale*v+grav EndSub 'Attract-repell balls to each other Sub attraction If (attract <> 0) Then For j = i+1 To nball xm = Xpos[j]-x ym = Ypos[j]-y dist = xm*xm+ym*ym dist = Math.Max(dist,radius*radius) 'dist = dist*Math.SquareRoot(dist) Xvel[i] = attract*xm/dist+Xvel[i] Yvel[i] = attract*ym/dist+Yvel[i] Xvel[j] = attract*xm/dist+Xvel[j] Yvel[j] = -attract*ym/dist+Yvel[j] EndFor EndIf EndSub 'Move ball Sub move156 ball = balls[i] Shapes.Move(ball,x-radius,y-radius) EndSub 'Update options display Sub options GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(gw,0,gw,gh) GraphicsWindow.BrushColor = "LightBlue" GraphicsWindow.FillRectangle(gw+10,10,190,gh-20) For i = 0 To 5 GraphicsWindow.DrawLine(gw+10,100*i+10,gw+190,100*i+10) EndFor GraphicsWindow.DrawLine(gw+100,10,gw+100,510) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(gw+15,20,70,"Gravity") GraphicsWindow.DrawBoundText(gw+15,40,70,grav) GraphicsWindow.DrawBoundText(gw+15,120,70,"Friction") GraphicsWindow.DrawBoundText(gw+15,140,70,fric) GraphicsWindow.DrawBoundText(gw+15,220,70,"Follow") GraphicsWindow.DrawBoundText(gw+15,240,70,follow) GraphicsWindow.DrawBoundText(gw+15,320,70,"Size") GraphicsWindow.DrawBoundText(gw+15,340,70,radius) GraphicsWindow.DrawBoundText(gw+15,420,70,"Count") GraphicsWindow.DrawBoundText(gw+15,440,70,nball) GraphicsWindow.DrawBoundText(gw+15,520,170,"Click coloured options or a ball to stop it") GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawBoundText(gw+15,580,50,"RESET") GraphicsWindow.DrawBoundText(gw+115,580,50,"QUIT") GraphicsWindow.DrawBoundText(gw+15,60,70,"More") GraphicsWindow.DrawBoundText(gw+15,160,70,"More") GraphicsWindow.DrawBoundText(gw+15,260,70,"More") GraphicsWindow.DrawBoundText(gw+15,360,70,"More") GraphicsWindow.DrawBoundText(gw+15,460,70,"More") GraphicsWindow.BrushColor = "Blue" GraphicsWindow.DrawBoundText(gw+15,80,70,"Less") GraphicsWindow.DrawBoundText(gw+15,180,70,"Less") GraphicsWindow.DrawBoundText(gw+15,280,70,"Less") GraphicsWindow.DrawBoundText(gw+15,380,70,"Less") GraphicsWindow.DrawBoundText(gw+15,480,70,"Less") GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(gw+115,20,70,"Speed") GraphicsWindow.DrawBoundText(gw+115,40,70,dt) GraphicsWindow.DrawBoundText(gw+115,120,70,"Attraction") GraphicsWindow.DrawBoundText(gw+115,140,70,attract) GraphicsWindow.DrawBoundText(gw+115,220,70,"Elastic") GraphicsWindow.DrawBoundText(gw+115,240,70,elastic) GraphicsWindow.DrawBoundText(gw+115,320,70,"Colour") GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawBoundText(gw+115,60,70,"More") GraphicsWindow.DrawBoundText(gw+115,160,70,"More") GraphicsWindow.DrawBoundText(gw+115,260,70,"More") GraphicsWindow.BrushColor = "Blue" GraphicsWindow.DrawBoundText(gw+115,80,70,"Less") GraphicsWindow.DrawBoundText(gw+115,180,70,"Less") GraphicsWindow.DrawBoundText(gw+115,280,70,"Less") GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawBoundText(gw+115,340,70,"Red") GraphicsWindow.BrushColor = "Blue" GraphicsWindow.DrawBoundText(gw+115,360,70,"Blue") GraphicsWindow.BrushColor = "Yellow" GraphicsWindow.DrawBoundText(gw+115,380,70,"Yellow") GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(gw+115,420,70,"Shape") GraphicsWindow.BrushColor = "Red" GraphicsWindow.DrawBoundText(gw+115,440,70,"Circle") GraphicsWindow.DrawBoundText(gw+115,460,70,"Square") EndSub 'Change settings Sub OnMouseDown542 xm = GraphicsWindow.MouseX ym = GraphicsWindow.MouseY 'Left column settings If (xm > gw+15 And xm < gw+85) Then If (ym > 60 And ym < 75) Then grav = grav+0.01 EndIf If (ym > 80 And ym < 95) Then grav = grav-0.01 EndIf If (ym > 160 And ym < 175) Then fric = fric+0.001 EndIf If (ym > 180 And ym < 195) Then fric = fric-0.001 EndIf If (ym > 260 And ym < 275) Then follow = follow+1 EndIf If (ym > 280 And ym < 295) Then follow = follow-1 EndIf If (ym > 360 And ym < 375) Then radius = radius+1 diam = 2*radius ireset = "True" EndIf If (ym > 380 And ym < 395) Then radius = radius-1 radius = Math.Max(1,radius) diam = 2*radius ireset = "True" EndIf If (ym > 460 And ym < 475) Then nball = nball+1 ireset = "True" EndIf If (ym > 480 And ym < 495) Then nball = nball-1 nball = Math.Max(1,nball) ireset = "True" EndIf If (ym > 580 And ym < 595) Then istart = "True" EndIf EndIf 'Right column settings If (xm > gw+115 And xm < gw+185) Then If (ym > 60 And ym < 75) Then dt = dt+0.1 EndIf If (ym > 80 And ym < 95) Then dt = dt-0.1 EndIf If (ym > 160 And ym < 175) Then attract = attract+1 EndIf If (ym > 180 And ym < 195) Then attract = attract-1 EndIf If (ym > 260 And ym < 275) Then elastic = elastic+0.01 EndIf If (ym > 280 And ym < 295) Then elastic = elastic-0.01 EndIf If (ym > 340 And ym < 355) Then Colour = "Red" ireset = "True" EndIf If (ym > 360 And ym < 375) Then Colour = "Blue" ireset = "True" EndIf If (ym > 380 And ym < 395) Then Colour = "Yellow" ireset = "True" EndIf If (ym > 440 And ym < 455) Then Shape = 0 ireset = "True" EndIf If (ym > 460 And ym < 475) Then Shape = 1 ireset = "True" EndIf If (ym > 580 And ym < 595) Then iend = "True" EndIf EndIf 'Select a ball If (xm < gw) Then iselect = "True" EndIf ioptions = "True" EndSub 'Reset new balls Sub reset mball = Array.GetItemCount(balls) For i = 1 To mball balls[i] = "" If (istart Or i > nball) Then Xpos[i] = "" Ypos[i] = "" Xvel[i] = "" Yvel[i] = "" EndIf EndFor GraphicsWindow.Clear() options() GraphicsWindow.BrushColor = Colour For i = 1 To nball If (shape = 0) Then ball = Shapes.AddEllipse(diam,diam) EndIf If (shape = 1) Then ball = Shapes.AddRectangle(diam,diam) EndIf balls[i] = ball If (istart Or i > mball) Then x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(gh) u = Math.GetRandomNumber(500)/100-3 v = Math.GetRandomNumber(500)/100-3 Xpos[i] = x Ypos[i] = y Xvel[i] = u Yvel[i] = v GraphicsWindow.Clear() EndIf EndFor EndSub Goto DOSLoop Startdwin: TextWindow.Write("Start MacOS OR Osasic") com = TextWindow.Read() If com= ("MacOS")Then Goto StartMac Else Goto Startos EndIf Startos: GraphicsWindow.BackgroundColor = "Gray" GraphicsWindow.Title = "Osasic Operating System. Version 3.0.9.8.7" GraphicsWindow.Width = 700 GraphicsWindow.Height = 500 GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(250, 400, "Booting The Osasic Operating System....................................") Program.Delay(500) GraphicsWindow.DrawText(100, 200, "<<<<<<<<<<<>>>>>>>>") Program.Delay(500) GraphicsWindow.DrawRectangle(1, 450, 50, 50) Program.Delay(300) GraphicsWindow.DrawRectangle(60, 450, 50, 50) Program.Delay(500) GraphicsWindow.DrawRectangle(120, 450, 50, 50) Program.Delay(600) GraphicsWindow.DrawRectangle(180, 450, 50, 50) Program.Delay(700) GraphicsWindow.DrawRectangle(240, 450, 50, 50) Program.Delay(1000) GraphicsWindow.DrawRectangle(300, 450, 50, 50) Program.Delay(920) GraphicsWindow.DrawRectangle(360, 450, 50, 50) Program.Delay(1000) GraphicsWindow.DrawRectangle(420, 450, 50, 50) Program.Delay(500) GraphicsWindow.DrawRectangle(480, 450, 50, 50) Program.Delay(1000) GraphicsWindow.DrawRectangle(540, 450, 50, 50) Program.Delay(300) GraphicsWindow.DrawRectangle(600, 450, 50, 50) GraphicsWindow.DrawRectangle(660, 450, 50, 50) Program.Delay(5000) GraphicsWindow.Clear() GraphicsWindow.DrawRectangle(200, 100, 300, 300) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawEllipse(250, 150, 100, 100) GraphicsWindow.FillRectangle(225, 250, 150, 150) Program.Delay(500) GraphicsWindow.DrawText(200, 80, "User Name: Admin") Program.Delay(500) GraphicsWindow.DrawText(250, 410, "Loging Into Osasic.....................") Program.Delay(5000) GraphicsWindow.Clear() GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.DrawText(3, 480, "Building The Desktop...........................................>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") GraphicsWindow.DrawRectangle(20, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(30, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(40, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(50, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(60, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(70, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(80, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(90, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(100, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(110, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(120, 485, 10, 10) Program.Delay(1000) GraphicsWindow.DrawRectangle(130, 485, 10, 10) Program.Delay(5000) GraphicsWindow.FillRectangle(0, 1, 700, 40) Program.Delay(500) GraphicsWindow.BrushColor = "Silver" GraphicsWindow.FillRectangle(1, 480, 700, 20) GraphicsWindow.BrushColor = 000000 Program.Delay(500) GraphicsWindow.DrawText(3, 5, "Programs") Program.Delay(100) GraphicsWindow.DrawText(3, 20, "User Settings") Program.Delay(200) GraphicsWindow.DrawText(100, 5, "Personalize") GraphicsWindow.DrawText(3, 480, "Osasic") GraphicsWindow.DrawText(50, 480,"Finder") Program.Delay(500) GraphicsWindow.DrawText(630, 480,"Shut Down") GraphicsWindow.FillRectangle(635,45,20,10) GraphicsWindow.DrawRectangle(630,45,40,40) GraphicsWindow.DrawRectangle(635,65,30,20) GraphicsWindow.DrawText(635,85,"Disk") GraphicsWindow.MouseDown = OnMouseDown909090 Sub OnMouseDown909090 MD = GraphicsWindow.MouseX MDA = GraphicsWindow.MouseY If ((MD > 625 And MD < 648 And MDA > 460 And MDA < 480)) Then GraphicsWindow.Clear() EndIf If (MD < 64 And MDA > 455) Then' GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(1, 200, 200, 278) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(1, 200, "Computer") GraphicsWindow.DrawText(1, 220, "Control Panel") GraphicsWindow.DrawRectangle(135, 203, 50, 50,) GraphicsWindow.DrawText(120,260, " User: Admin") GraphicsWindow.DrawEllipse(145, 203, 30, 30) GraphicsWindow.FillRectangle(143, 233, 35, 20) GraphicsWindow.DrawText(1, 240, "Tools") GraphicsWindow.DrawText(1, 260, "Programs") EndIf If (MD > 64 OR MDA < 455) Then GraphicsWindow.BrushColor = "Gray" GraphicsWindow.FILLRectangle(1,200,200,278) EndIf EndSub Goto DOSLoop StartMac: GraphicsWindow.BackgroundColor = "Gray" GraphicsWindow.Title = "Mac OS, Ver. Classic" GraphicsWindow.Width = 700 GraphicsWindow.Height = 500 GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(1, 1, 700, 20) GraphicsWindow.BrushColor = 000000 GraphicsWindow.DrawText(5, 5, "Mac") GraphicsWindow.FillRectangle(3, 480, 10, 10) GraphicsWindow.FillRectangle(635,40,20,10) GraphicsWindow.DrawText(11, 480, "Click") GraphicsWindow.DrawRectangle(630,40,40,40) GraphicsWindow.DrawRectangle(635,60,30,20) GraphicsWindow.DrawText(635,80,"Disk") GraphicsWindow.DrawRectangle(620, 475, 15, 10) GraphicsWindow.DrawRectangle(620, 455, 15, 20,) GraphicsWindow.DrawRectangle(622, 450, 10, 5) GraphicsWindow.DrawText(615, 485, "Trash") GraphicsWindow.MouseDown = OnMouseDown90909 Sub OnMouseDown90909 MD = GraphicsWindow.MouseX MDA = GraphicsWindow.MouseY If ((MD > 625 And MD < 648 And MDA > 460 And MDA < 480)) Then GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(200, 150, 250, 250) GraphicsWindow.FillRectangle(223, 151, 200, 10) GraphicsWindow.BrushColor = "Gray" GraphicsWindow.FillRectangle(202, 151, 247, 20) GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(300, 153, 60, 16) GraphicsWindow.FillRectangle(210, 154, 14, 14) GraphicsWindow.BrushColor = "Gray" GraphicsWindow.FillRectangle(202, 190, 247, 5) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(310, 155, "Trash") EndIf If (MD < 600 And MDA > 50) Then' GraphicsWindow.BrushColor = "White" GraphicsWindow.FillRectangle(1, 21, 200, 278) GraphicsWindow.BrushColor = "Black" EndIf If (MD > 64 OR MDA < 455) Then GraphicsWindow.BrushColor = "Gray" GraphicsWindow.FILLRectangle(1,21,200,278) EndIf EndSub Goto DOSLoop Wordcom: TextWindow.WriteLine("Welcome to the BasicDOS Word Proccessor Ver 1.0.0.1") Word: TextWindow.ForegroundColor = "Grey" TextWindow.Write(name + "'s Document Word D:\> ") doc = TextWindow.Read() If doc = ("help") Then TextWindow.WriteLine("------------------------------") TextWindow.WriteLine("| Word_Help__________________|") TextWindow.WriteLine("|new = make new dcument |") TextWindow.WriteLine("|open = open document |") TextWindow.WriteLine("|close = close document/menu |") TextWindow.WriteLine("|exit = exit word processor |") TextWindow.WriteLine("------------------------------") Else Goto Doc1 EndIf Doc1: If doc = ("new") Then Goto MakeNew Else Goto Doc2 EndIf Doc2: If doc = ("open")Then Goto OpenDoc Else Goto Doc3 EndIf Doc3: If doc = ("exit")Then Goto Exit Else Goto Doc4 EndIf Doc4: If doc = ("close")Then Goto Close Else Goto Word EndIf MakeNew: TextWindow.Write("Document Name: ") ndoc = TextWindow.Read() TextWindow.Write(">") ddoc = TextWindow.Read() File[ndoc]["document"] = ddoc Goto CloseDOC CloseDOC: TextWindow.Write("SAVE Document?") svdoc = TextWindow.Read() If svdoc = ("yes")Then TextWindow.WriteLine("Saving your Document..........") Program.Delay(800) TextWindow.Clear() Goto Word Else TextWindow.WriteLine("Exiting Document..............") Program.Delay(800) TextWindow.Clear() Goto Word EndIf OpenDoc: TextWindow.Write("Enter the document name: ") idoc = TextWindow.Read() TextWindow.WriteLine("Document: " + File[idoc]["document"]) Program.Delay(2000) TextWindow.Clear() Goto Word Close: Goto Word Exit: TextWindow.Write("Save all work today?") exitans= TextWindow.Read() If exitans = ("yes") Then Goto SAVE Else Goto EXITER SAVE: TextWindow.WriteLine("Saving all work...........") Program.Delay(1000) TextWindow.WriteLine("Exiting the BasicDOS word processor.......") Goto DOSLoop EXITER: TextWindow.Write("Are you sure you wish to quit without save?") bdoc= TextWindow.Read() If bdoc = ("yes")Then Goto DOSLoop Else Goto SAVE EndIf EndIf EXITDOS: TextWindow.Write("Are you shure you want to exit BasicDOS? :-( ") exit = TextWindow.Read() If exit = ("yes") Then TextWindow.WriteLine("Exiting BasicDOS...........:-(") Program.Delay(500) Program.End() Else TextWindow.WriteLine("Yay! :-)") Goto DOSLoop EndIf End>BDT021.sb< Start>BDT938-0.sb< ' SmallBasic Version 1.2 ' Program: ConicSectionCurvesTurtle ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/eaba725c-24a8-4300-8fa6-8231763398cb/challenge-of-the-month-may-2018 ' ImportURL: http://smallbasic.com/program/?BDT938-0 (BDT938 filled) ' Extension: (LitDev, when def = "True") ' Comment: Maths Challenge (Conics) ' Get the Turtle (or another way) to draw the main conic sections. These are: ' Circle, Ellipse, Parabola, Hyperbola ' https://en.wikipedia.org/wiki/Conic_section ' Variables: ' ToDo: '=============================================================================== def = "False" ' show graphical definitions? (LitDev) pw = 3 ' PenWidth f = Math.GetRadians(1) ' pi/180, factor deg->rad gw = GraphicsWindow.Width ' 624 gh = GraphicsWindow.Height ' 442 GraphicsWindow.Top = 0 GraphicsWindow.BackgroundColor = "#202020" GraphicsWindow.PenWidth = pw a = gw / 4 ' 156 b = gh / 4 ' 110.5 x0 = 2 * a ' = gw / 2 ' 312 y0 = 2 * b ' = gh / 2 ' 221 'Turtle.Speed = 10 ' may cause flickering If def Then GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Coral" ' "Salmon" tri = Shapes.AddTriangle(x0,y0, x0,y0, x0,y0) GraphicsWindow.PenWidth = pw EndIf Circle() Ellipse() Parabola() Hyperbola() ' OR Hyperbola2() Turtle.Hide() If def Then Shapes.Remove(tri) EndIf GraphicsWindow.Title = "Conic Section Curves (Turtle)" ' //////////////////// SUBs //////////////////// Sub Circle GraphicsWindow.Title = "Circle x,y = r*cos(t), r*sin(t)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = x0 + a Turtle.Y = y0 For deg = 1 To 360 x = a * Math.Cos(deg * f) y = a * Math.Sin(deg * f) Turtle.MoveTo(x0+x, y0-y) If def Then LDShapes.MoveTriangle(tri, x0-a,y0, x0+a,y0, x0+x,y0-y) ' showing 'Thales theorem': every angle in a halfcircle is a right one 'LDShapes.MoveTriangle(tri, x0+x,y0, x0,y0-y, x0+x,y0-y) ' showing parametric x,y=cos,sin construction EndIf EndFor EndSub Sub Ellipse GraphicsWindow.Title = "Ellipse x,y = a*cos(t), b*sin(t)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() e = Math.SquareRoot(a*a - b*b) ' focus F For deg = 1 To 360 x = a * Math.Cos(deg * f) y = b * Math.Sin(deg * f) Turtle.MoveTo(x0+x, y0-y) If def Then ' showing 'Ellipse definition', gardener construction (PF1+PF2 = 2a) LDShapes.MoveTriangle(tri, x0-e,y0, x0+e,y0, x0+x,y0-y) EndIf EndFor EndSub Sub Parabola GraphicsWindow.Title = "Parabola y = inv(q * x²)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() e = a / 4 ' focus F sgnX = 1 For n = 1 To 2 ' left & right parabola Turtle.X = x0 - sgnX*a Turtle.Y = y0 - a For x = -a To a y = x * x / a ' expl. x -> y Turtle.MoveTo(x0-sgnX*y, y0+x) ' inverse x<->y If def Then ' showing 'Parabel definition' (P1F1 = P1 F2x) LDShapes.MoveTriangle(tri, x0-sgnX*e,y0, x0+sgnX*e,y0+x, x0-sgnX*y,y0+x) EndIf EndFor sgnX = -sgnX EndFor EndSub Sub Hyperbola GraphicsWindow.Title = "Hyperbola y = b/a * √(x² - a²), inv(a/b * √(y² + b²))" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() e = Math.SquareRoot(a*a + b*b) ' focus F y1 = b*Math.SquareRoot(3) ' = b/a * √(x² - a²) @ x=2*a sgnX = 1 For n = 1 To 2 ' left & right hyperbola Turtle.X = x0 - sgnX*x0 Turtle.Y = y0 - y1 For x = -y1 To y1 ' endpoints at x=2*a y = a/b * Math.SquareRoot(x*x + b*b) ' expl. x -> y Turtle.MoveTo(x0-sgnX*y, y0+x) ' inverse x<->y If def Then ' showing 'Hyperbel definition' (P1F2 - P1F1 = 2a) LDShapes.MoveTriangle(tri, x0-e,y0, x0+e,y0, x0-sgnX*y,y0+x) EndIf EndFor sgnX = -sgnX EndFor EndSub ' Alt. with LDMath Sub Hyperbola2 GraphicsWindow.Title = "Hyperbola x,y = a*cosh(t), b*sinh(t)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() e = Math.SquareRoot(a*a + b*b) ' focus F sgnX = 1 For n = 1 To 2 ' left & right hyperbola Turtle.X = x0 - sgnX*x0 Turtle.Y = y0 - b*Math.SquareRoot(3) For deg = 76 To -76 Step -1 ' arcosh(x/a) = arcosh(2a/a) = 1.317 -> 75.458° t = deg * f x = a * LDMath.Cosh(t) ' = a/2 * (e^t + e^-t) y = b * LDMath.Sinh(t) ' = b/2 * (e^t - e^-t) Turtle.MoveTo(x0-sgnX*x, y0-y) If def Then ' showing 'Hyperbel definition' (P1F2 - P1F1 = 2a) LDShapes.MoveTriangle(tri, x0-e,y0, x0+e,y0, x0-sgnX*x,y0-y) EndIf EndFor sgnX = -sgnX EndFor EndSub End>BDT938-0.sb< Start>BDT938-1.sb< ' SmallBasic Version 1.2 ' Program: ConicSectionCurvesTurtle small ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/eaba725c-24a8-4300-8fa6-8231763398cb/challenge-of-the-month-may-2018 ' ImportURL: http://smallbasic.com/program/?BDT938-1 , BDT938-0 (add. feature with LitDev) , BDT938 (filled) ' Extension: --- ' Comment: Maths Challenge (Conics) ' Get the Turtle (or another way) to draw the main conic sections. These are: ' Circle, Ellipse, Parabola, Hyperbola ' https://en.wikipedia.org/wiki/Conic_section ' Variables: ' ToDo: '=============================================================================== pw = 3 ' PenWidth f = Math.GetRadians(1) ' pi/180, factor deg->rad gw = GraphicsWindow.Width ' 624 gh = GraphicsWindow.Height ' 442 GraphicsWindow.Top = 0 GraphicsWindow.BackgroundColor = "#202020" a = gw / 4 ' 156 x0 = 2 * a ' = gw / 2 ' 312 y0 = gh / 2 ' = 2 * b ' 221 'Turtle.Speed = 10 ' may cause flickering 'Grid() 'Axis() GraphicsWindow.PenWidth = pw Circle() Ellipse() Parabola() Hyperbola() Turtle.Hide() GraphicsWindow.Title = "Conic Section Curves (Turtle)" ' //////////////////// SUBs //////////////////// Sub Circle GraphicsWindow.Title = "Circle x,y = r*cos(t), r*sin(t)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = x0 + a Turtle.Y = y0 For deg = 1 To 360 x = a * Math.Cos(deg * f) y = a * Math.Sin(deg * f) Turtle.MoveTo(x0+x, y0-y) EndFor EndSub Sub Ellipse b = a / 2 '' mod. for circleH/2 GraphicsWindow.Title = "Ellipse x,y = a*cos(t), b*sin(t)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = x0 + a Turtle.Y = y0 For deg = 1 To 360 x = a * Math.Cos(deg * f) y = b * Math.Sin(deg * f) Turtle.MoveTo(x0+x, y0-y) EndFor EndSub Sub Parabola '' mod. to reach GW-corners, with init. gh:gw ≈ 1:sqrt(2) GraphicsWindow.Title = "Parabola y = inv(q * x²)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() sgnX = 1 For n = 1 To 2 ' left & right parabola 'Turtle.X = x0 - sgnX*a 'Turtle.Y = y0 - a 'For x = -a To a Turtle.X = x0 - sgnX*x0 Turtle.Y = 0 ' y0 - y0 For x = -y0 To y0 y = x * x / a ' expl. x -> y Turtle.MoveTo(x0-sgnX*y, y0+x) ' inverse x<->y EndFor sgnX = -sgnX EndFor EndSub Sub Hyperbola b = y0 / Math.SquareRoot(3) '' mod. to reach GW-corners GraphicsWindow.Title = "Hyperbola y = b/a * √(x² - a²), inv(a/b * √(y² + b²))" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() y1 = b*Math.SquareRoot(3) ' = b/a * √(x² - a²) @ x=2*a sgnX = 1 For n = 1 To 2 ' left & right hyperbola Turtle.X = x0 - sgnX*x0 Turtle.Y = y0 - y1 For x = -y1 To y1+1 ' endpoints at x=2*a y = a/b * Math.SquareRoot(x*x + b*b) ' expl. x -> y Turtle.MoveTo(x0-sgnX*y, y0+x) ' inverse x<->y EndFor sgnX = -sgnX EndFor EndSub Sub Grid GraphicsWindow.PenWidth = 0.18 GraphicsWindow.PenColor = "DimGray" d = a / 4 ' 5 For y = y0 To gh Step d For x = x0 To gw-d Step d GraphicsWindow.DrawRectangle(x,y, d,d) GraphicsWindow.DrawRectangle(gw-x-d,gh-y-d, d,d) GraphicsWindow.DrawRectangle(x,gh-y-d, d,d) GraphicsWindow.DrawRectangle(gw-x-d,y, d,d) EndFor EndFor EndSub Sub Axis GraphicsWindow.PenWidth = 0.5 GraphicsWindow.PenColor = "OrangeRed" GraphicsWindow.DrawLine(0,y0, gw,y0) GraphicsWindow.DrawLine(x0,0, x0,gh) 'GraphicsWindow.DrawEllipse(x0-a/2,y0-a/2, a,a) EndSub End>BDT938-1.sb< Start>BDT938.sb< ' SmallBasic Version 1.2 ' Program: ConicSectionsTurtle ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/eaba725c-24a8-4300-8fa6-8231763398cb/challenge-of-the-month-may-2018 ' ImportURL: http://smallbasic.com/program/? ' Extension: --- ' Comment: Maths Challenge (Conics) ' Get the Turtle (or another way) to draw the main conic sections. These are: ' Circle, Ellipse, Parabola, Hyperbola ' https://en.wikipedia.org/wiki/Conic_section ' Variables: ' ToDo: '=============================================================================== gw = 600 gh = 600 r = gw/4 GraphicsWindow.Top = 0 GraphicsWindow.Width = gw GraphicsWindow.Height = gh Turtle.Y = gh/2 ' 2*r Turtle.Turn(90) 'Turtle.Speed = 9 Circle() Ellipse() Parabola() Hyperbola() Turtle.Hide() GraphicsWindow.Title = "Conic Sections (Turtle)" ' //////////////////// SUBs //////////////////// Sub Circle GraphicsWindow.Title = "Circle y = √(r² -x²)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = r For x = -r To r y = Math.SquareRoot(r*r - x*x) GraphicsWindow.PenWidth = 2*y Turtle.Move(1) EndFor EndSub Sub Ellipse ' with a = 2*b = r GraphicsWindow.Title = "Ellipse y = b/a * √(a² -x²)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = r For x = -r To r y = Math.SquareRoot(r*r - x*x) GraphicsWindow.PenWidth = y Turtle.Move(1) EndFor EndSub Sub Parabola GraphicsWindow.Title = "Parabola y = p * √x | y = q * x²" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = r p = 12 ' = r/sqrt(r) = 150/sqrt(150) = 12.24745 For x = -r To r y = p * Math.SquareRoot(Math.Abs(x)) ' horz. OR .. 'y = x * x / r ' vert. (r = 150) GraphicsWindow.PenWidth = 2*y Turtle.Move(1) EndFor EndSub Sub Hyperbola ' with a = 2*b = r GraphicsWindow.Title = "Hyperbola y = b/a * √(x² - a²)" GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.X = 0 For x = -2*r To 2*r y = Math.SquareRoot(x*x - r*r) GraphicsWindow.PenWidth = 2*y ' Walk over undefined area If y = 0 Then ' If x = -r Then Turtle.Move(2*r-1) x = r EndIf Turtle.Move(1) EndFor EndSub End>BDT938.sb< Start>BDW444.sb< 'Written by Thaelmann-Pioniere init() writename() drawCarbonnatom() drawC_Obond() drawOxygenatom() Turtle.Turn(180) Turtle.PenUp() drawC_Obond() Turtle.TurnRight() Turtle.PenDown() drawC_Obond() drawOxygenatom() Turtle.Hide() Sub init r=20 d=r*2 GraphicsWindow.Title="Molecular Challenge-Carbon dioxide(CO2)" GraphicsWindow.Height=500 GraphicsWindow.Width=800 GraphicsWindow.BackgroundColor="#dabc72" GraphicsWindow.PenWidth=15 Turtle.Speed=9 EndSub Sub writename GraphicsWindow.FontBold="false" GraphicsWindow.FontName="Times New Roman" GraphicsWindow.BrushColor="White" GraphicsWindow.FontSize=48 GraphicsWindow.DrawText(300,20,"CO") GraphicsWindow.FontSize=24 GraphicsWindow.DrawText(370,50,"2") EndSub Sub drawHydrogenatom GraphicsWindow.BrushColor="White" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) EndSub Sub drawCarbonnatom GraphicsWindow.BrushColor="Black" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) EndSub Sub drawOxygenatom GraphicsWindow.BrushColor="Red" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) EndSub Sub drawNitrogenatom GraphicsWindow.BrushColor="DarkBlue" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) EndSub Sub drawC_Obond GraphicsWindow.PenColor="Black" Turtle.Move(r+10) GraphicsWindow.PenColor="Red" Turtle.Move(r+10) EndSub Sub drawC_Hbond GraphicsWindow.PenColor="Black" Turtle.Move(r+10) GraphicsWindow.PenColor="White" Turtle.Move(r+10) EndSub Sub drawH_Obond GraphicsWindow.PenColor="White" Turtle.Move(r+10) GraphicsWindow.PenColor="Red" Turtle.Move(r+10) EndSub Sub drawC_Nbond GraphicsWindow.PenColor="Black" Turtle.Move(r+10) GraphicsWindow.PenColor="DarkBlue" Turtle.Move(r+10) EndSub Sub drawC_Cbond GraphicsWindow.PenColor="Black" Turtle.Move(r+20+r) EndSub End>BDW444.sb< Start>BDX376-1.sb< gw = 900 gh = 900 GraphicsWindow.Width = gw GraphicsWindow.Height = gh xo = gw / 2 yo = gh / 2 c8=24 r1 = 4 rMax = 1 mag = 1.003 ll=.1 While rMax < gw * 0.1 For θ = 0 To 360 r2 = r2 + r1 / 360 For i = 1 To c8 ll=ll+.000015 _θ = Math.GetRadians(θ + (i - 1) * 360 /c8) x = xo + r2 * Math.Cos(_θ) y = yo + r2 * Math.Sin(_θ) GraphicsWindow.BrushColor = LDColours.HSLtoRGB (math.Remainder (θ 360) 1 ll) GraphicsWindow.FillEllipse(x - r1, y - r1, 2 * r1, 2 * r1) EndFor r1 = r1 * (mag - 0.002) r2 = r2 * mag rMax = rMax * mag EndFor EndWhile End>BDX376-1.sb< Start>BDX376-2.sb< gw = 900 gh = 900 GraphicsWindow.Width = gw GraphicsWindow.Height = gh xo = gw / 2 yo = gh / 2 c8=24 r1 = 4 rMax = 1 mag = 1.003 ll=.1 While rMax < gw * 0.1 For θ = 0 To 360 r2 = r2 + r1 / 360 For i = 1 To c8 ll=ll+.000015 _θ = Math.GetRadians(θ + (i - 1) * 360 /c8) x = xo + r2 * Math.Cos(_θ) y = yo + r2 * Math.Sin(_θ) GraphicsWindow.BrushColor = LDColours.HSLtoRGB (math.Remainder (θ+i*5 360) 1 ll) GraphicsWindow.FillEllipse(x - r1, y - r1, 2 * r1, 2 * r1) EndFor r1 = r1 * (mag - 0.002) r2 = r2 * mag rMax = rMax * mag EndFor EndWhile End>BDX376-2.sb< Start>BDX376-3.sb< gw = 900 gh = 900 GraphicsWindow.Width = gw GraphicsWindow.Height = gh xo = gw / 2 yo = gh / 2 c8=24 r1 = 4 rMax = 1 mag = 1.003 ll=.1 While rMax < gw * 0.1 For θ = 0 To 360 r2 = r2 + r1 / 360 For i = 1 To c8 ll=ll+.000015 _θ = Math.GetRadians(θ + (i - 1) * 360 /c8) x = xo + r2 * Math.Cos(_θ) y = yo + r2 * Math.Sin(_θ) GraphicsWindow.BrushColor = LDColours.HSLtoRGB (math.Remainder (i*i/2 360) 1 ll) GraphicsWindow.FillEllipse(x - r1, y - r1, 2 * r1, 2 * r1) EndFor r1 = r1 * (mag - 0.002) r2 = r2 * mag rMax = rMax * mag EndFor EndWhile End>BDX376-3.sb< Start>BDX376.sb< ' Spiral ' Copyright © 2016 Nonki Takahashi. The MIT License. ' Last update 2016-06-11 ' Challenge 2016-06 ' gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh xo = gw / 2 yo = gh / 2 color = "1=#FF0000;2=#FF5500;3=#FFAA00;4=#FFFF00;5=#AAFF00;6=#55FF00;" color = color + "7=#00FF00;8=#00FF55;9=#00FFAA;10=#00FFFF;11=#00AAFF;12=#0055FF;" color = color + "13=#0000FF;14=#5500FF;15=#AA00FF;16=#FF00FF;17=#FF00AA;18=#FF0055;" n = Array.GetItemCount(color) r1 = 4 rMax = 1 mag = 1.003 While rMax < gw * 0.05 For θ = 0 To 360 r2 = r2 + r1 / 360 For i = 1 To n _θ = Math.GetRadians(θ + (i - 1) * 360 / n) x = xo + r2 * Math.Cos(_θ) y = yo + r2 * Math.Sin(_θ) GraphicsWindow.BrushColor = color[i] GraphicsWindow.FillEllipse(x - r1, y - r1, 2 * r1, 2 * r1) EndFor r1 = r1 * (mag - 0.002) r2 = r2 * mag rMax = rMax * mag EndFor EndWhile End>BDX376.sb< Start>BDZ554.sb< 'Airwaves's Awesome Maze (Which is extremely awesome and better than everyone elses! :O ) GraphicsWindow.Title = "Airwaves's Maze!" GraphicsWindow.BackgroundColor = "Black" blocksize=50 blockcount=10 BuildMaze() 'Build the Maze GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenColor = "Black" Player = Shapes.AddEllipse(25, 25) Shapes.Move(Player, ((blockcount*50)-50)+(25/2), (((blockcount-2)*50)-50)+(25/2)) pX = Shapes.GetLeft(Player) pY = Shapes.GetTop(Player) input = 0 output = 0 GraphicsWindow.Width = blocksize*blockcount GraphicsWindow.Height = blocksize*blockcount GraphicsWindow.KeyDown = KeyDown direction = "" keypressed="False" Sub BuildMaze 'Make the grid for the spaces that ARE open; this will help with grid size, making it smaller and easier to control 'grid[x][y]=(0:Empty,1:Player occupies the block) grid[blockcount][blockcount-2]=1 grid[blockcount-1][blockcount-2]=0 grid[blockcount-2][blockcount-2]=0 grid[blockcount-3][blockcount-2]=0 grid[blockcount-4][blockcount-2]=0 grid[blockcount-5][blockcount-2]=0 grid[blockcount-6][blockcount-2]=0 grid[blockcount-7][blockcount-2]=0 grid[blockcount-7][blockcount-3]=0 grid[blockcount-7][blockcount-4]=0 grid[blockcount-7][blockcount-5]=0 grid[blockcount-7][blockcount-6]=0 grid[blockcount-7][blockcount-7]=0 GeneratePhysicalMaze() EndSub Sub ConvertBlockToPixels output = (input*50)-50 EndSub Sub ConvertPixelsToBlock output = Math.Floor((input/50)+1) EndSub Sub GeneratePhysicalMaze GraphicsWindow.PenColor = "Gray" GraphicsWindow.BrushColor = "White" For i = 1 To blockcount For j = 1 To blockcount If grid[i][j]=0 Or grid[i][j]=1 Then input = i ConvertBlockToPixels() X = output input = j ConvertBlockToPixels() Y = output block[i][j]=Shapes.AddRectangle(blocksize,blocksize) Shapes.Move(block[i][j], X, Y) EndIf EndFor EndFor EndSub Sub KeyDown lk = GraphicsWindow.LastKey If lk = "Left" Or lk = "Right" Or lk = "Up" Or lk = "Down" Then If lk = "Left" Then direction = "L" GetCollisionDetection() If Return Then Shapes.Move(Player, pX-10, pY) EndIf ElseIf lk = "Right" Then direction = "R" GetCollisionDetection() If Return Then Shapes.Move(Player, pX+10, pY) EndIf ElseIf lk = "Up" Then direction = "U" GetCollisionDetection() If Return Then Shapes.Move(Player, pX, pY-10) EndIf ElseIf lk = "Down" Then direction = "D" GetCollisionDetection() If Return Then Shapes.Move(Player, pX, pY+10) EndIf EndIf pX = Shapes.GetLeft(Player) pY = Shapes.GetTop(Player) EndIf EndSub Sub GetCollisionDetection If direction = "L" Then tt = pY tL = pX-10 input = tL ConvertPixelsToBlock() tL = output input = tt ConvertPixelsToBlock() tt = output If grid[tL][tt] = "" Then Return = "False" Else Return = "True" EndIf ElseIf direction = "U" Then tt = pY-10 tL = pX input = tL ConvertPixelsToBlock() tL = output input = tt ConvertPixelsToBlock() tt = output If grid[tL][tt] = "" Then Return = "False" Else Return = "True" EndIf ElseIf direction = "R" Then tt = pY tL = pX+30 input = tL ConvertPixelsToBlock() tL = output input = tt ConvertPixelsToBlock() tt = output If grid[tL][tt] = "" Then Return = "False" Else Return = "True" EndIf ElseIf direction = "D" Then tt = pY+30 tL = pX input = tL ConvertPixelsToBlock() tL = output input = tt ConvertPixelsToBlock() tt = output If grid[tL][tt] = "" Then Return = "False" Else Return = "True" EndIf EndIf EndSub End>BDZ554.sb< Start>BFD177.sb< datFile = Program.Directory+"\0002_NameAdress.db" database = LDDataBase.ConnectSQLite(datFile) GraphicsWindow.Show() listViewNAME = LDDataBase.AddListView(GraphicsWindow.Width,GraphicsWindow.Height/3) listViewADRESS = LDDataBase.AddListView(GraphicsWindow.Width,GraphicsWindow.Height/3) Controls.Move(listViewADRESS, 0, GraphicsWindow.Height/2) 'Some SQL commands on this databse Person = LDDataBase.Query(database, "SELECT * FROM NAME Where Name1 = 'Caroline';", listViewNAME, "True") Select = "SELECT * FROM ADRESS Where AdressType = 'PRIMARY RESIDENCE' AND Name_ID = " + Person[1]["ID"] + " ;" LDDataBase.Query(database, Select, listViewADRESS, "False") End>BFD177.sb< Start>BFD261.sb< ' January 19th 2017 ' hypothetical system around star X23 ' program by yled ' plus comet ' using small basic v1.2 plain ' program no: GLF916 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.height=768 GraphicsWindow.width=1366 GraphicsWindow.backgroundcolor="#000000" dgray=graphicswindow.GetColorFromRGB(65,65,65) GraphicsWindow.brushcolor="white" GraphicsWindow.fontsize=20 init_value() stars() draw_planets() star() While 1=1 pp1() comet() pp2() pp3() pp4() pp5() pp6() Program.Delay(50) endwhile Sub init_value me=68 v=20 t=-11 mo=1 ma=115 j=475 s=367 Cx=620 Cy=325 θ=1 a1=652 b1=200 F=Math.SquareRoot((a1*a1)-(b1*b1)) EndSub Sub star GraphicsWindow.BrushColor="black" center=shapes.AddEllipse(1,1) Shapes.Move(star, 620-15,325-15) Shapes.Move(center,620,325) ' le centre est a 625 par 325 EndSub Sub pp1 q1=3 me=me-q1 A=Math.GetRadians(me) rayon =50*math.Cos(A) x=593+rayon*math.Cos(A) y=325+rayon*math.sin(A) Shapes.Move(p1,x-1,y-1) GraphicsWindow.SetPixel(x+2,y+2,"#888811") EndSub Sub comet θ=θ+v1 x1=(Cx+400)+a1*(math.Cos(θ)) y1=Cy+b1*(math.sin(θ)) dx1 = Cx-F-x1 dy1 = Cy-y1 r1=Math.SquareRoot(dx1*dx1+dy1*dy1) v1=100/r1/Math.SquareRoot(r1) Shapes.Move(comete,x1,y1) GraphicsWindow.SetPixel(x1,y1+3,"#dddd22") EndSub Sub pp2 q2=2 v=v-q2 A=Math.GetRadians(v) rayon =100*math.Cos(A) x=568+rayon*math.Cos(A) y=325+rayon*math.sin(A) Shapes.Move(p2,x,y) GraphicsWindow.SetPixel(x+6,y+6,"#aa22cc") EndSub Sub pp3 q3=1 t=t-q3 A=Math.GetRadians(t) rayon =200*math.Cos(A) x=522+rayon*math.Cos(A) y=325+rayon*math.sin(A) Shapes.Move(p3,x,y) GraphicsWindow.SetPixel(x+8,y+8,"#7777ee") EndSub Sub pp4 q5=0.65 ma=ma-q5 A=Math.GetRadians(ma) rayon =375*math.Cos(A) x1=405+rayon*math.Cos(A) y1=325+rayon*math.sin(A) Shapes.Move(p4,x1,y1) GraphicsWindow.SetPixel(x1+7,y1+7,"#ff4400") EndSub Sub pp5 j=j-0.1 A=Math.GetRadians(j) rayon =580*math.Cos(A) x=325+rayon*math.Cos(A) y=325+rayon*math.sin(A) Shapes.Move(p5,x,y) GraphicsWindow.SetPixel(x+14,y+14,"#22dd22") EndSub Sub pp6 q6=0.05 ' s=s-q6 A=Math.GetRadians(s) rayon =800*math.Cos(A) x=225+rayon*math.Cos(A) y=325+rayon*math.sin(A) Shapes.Move(p6,x,y) GraphicsWindow.SetPixel(x+11,y+11,"#ff7733") EndSub Sub draw_planets GraphicsWindow.brushcolor="yellow" star=shapes.AddEllipse(32,32) GraphicsWindow.brushcolor="white" p1=shapes.AddEllipse(8,8) GraphicsWindow.brushcolor="#ff9999" p2=shapes.AddEllipse(12,12) GraphicsWindow.brushcolor="blue" p3=shapes.AddEllipse(16,16) GraphicsWindow.brushcolor="#bb2211" p4=shapes.AddEllipse(14,14) GraphicsWindow.brushcolor="#ddaa18" p5=shapes.AddEllipse(28,27) GraphicsWindow.brushcolor="#ddaa18" p6=shapes.AddEllipse(22,21) GraphicsWindow.brushcolor="white" comete=shapes.AddEllipse(52,10) endsub Sub stars For qs=1 To 250 s1=Math.GetRandomNumber(1366) s2=Math.GetRandomNumber(768) c1=Math.GetRandomNumber(100)+50 c2=Math.GetRandomNumber(100)+50 c3=Math.GetRandomNumber(115)+100 Scolor=graphicswindow.GetColorFromRGB(c1,c2,c3) GraphicsWindow.SetPixel(s1,s2,Scolor) EndFor EndSub End>BFD261.sb< Start>BFL283.sb< ' Write a program to input a user's name and address, ' 'then display it in a fancy way in the TextWindow using the TextWindow methods, ' 'BackgroundColor, ForegroundColor, CursorLeft and CursorTop.' TextWindow.ForegroundColor= "green" TextWindow.WriteLine("What is your name?") name=TextWindow.Read() TextWindow.Pause() TextWindow.Clear() TextWindow.ForegroundColor= "black" TextWindow.BackgroundColor= "white" TextWindow.WriteLine("What is your address?") address=textwindow.Read() TextWindow.Pause() TextWindow.Clear() TextWindow.ForegroundColor= "green" TextWindow.BackgroundColor= "white" TextWindow.WriteLine("Name: " + name) TextWindow.WriteLine("Adress: " + address) End>BFL283.sb< Start>BFM261.sb< Initialise() 'copied from build gui While "True" 'Where's the mouse cursor for this cycle? mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY 'If the mseBtn is down check to see if it's on a box If Mouse.IsLeftButtonDown Then If selected = "" And clicked = "False" Then 'Loop thru the boxes and select a part For i = 1 To Array.GetItemCount(part) If mseX >= boxX[i] And mseX <= boxX[i] + boxWidth And mseY >= boxY[i] And mseY <= boxY[i] + boxHeight Then selected = i EndIf EndFor EndIf clicked = "True" 'the btns has been clicked for this cylce Shapes.Move(part[selected], mseX, mseY) Else If Math.Round(mseX/50) = Math.Round(Shapes.GetLeft(flower[selected])/50) Then 'changed mseX/10 to mseX/50 etc If selected = 3 And mseY >= flowerY[3] And mseY < flowerY[3] + 90 Then 'added this for stem Shapes.Remove(part[3]) Shapes.SetOpacity(flower[3], 100) EndIf If Math.Round(mseY/50) = Math.Round(Shapes.GetTop(flower[selected])/50) Then Shapes.Remove(part[selected]) Shapes.SetOpacity(flower[selected], 100) EndIf EndIf Shapes.Move(part[selected], boxX[selected] + offsetPartX[selected], boxY[selected] + offsetPartY[selected]) selected = "" 'deselect when we're finishised with the part clicked = "False" 'inits here EndIf Program.Delay(20) EndWhile Sub Initialise GraphicsWindow.Width = 620 GraphicsWindow.Height = 420 gw = GraphicsWindow.Width gh = GraphicsWindow.Height 'Set Variables to use for drawing the boxes & frames margin = 10 columns = 2 rows = 4 boxWidth = 90 boxHeight = (gh - margin *4) / rows 'centre boxes 'Draw the boxes For r = 1 To rows 'numbers boxes left to right, top to bottom Y = (margin *2) + (boxHeight * (r-1)) For c = 1 To columns X = gw - (margin *2) - (boxWidth * (columns + 1 - c)) GraphicsWindow.DrawRectangle(X, Y, boxWidth, boxHeight) i = i + 1 'Index & Store box XY boxX[i] = X boxY[i] = Y EndFor EndFor 'Frame the boxes X = gw - margin *3 - boxWidth *2 height = margin *2 + boxHeight * rows GraphicsWindow.DrawRectangle(X, margin, margin *2 + boxWidth *2, height) 'Frame the flower width = X - margin *2 height = gh - margin *2 GraphicsWindow.DrawRectangle(margin, margin, width, height) 'Add & Position the flower flowerWidth = "1=70;2=68;3=3;4=20;5=40;6=68;7=44;8=68" flowerHeight = "1=25;2=42;3=65;4=20;5=65;6=41;7=68;8=22" flowerX = "1=183;2=100;3=180;4=170;5=156;6=192;7=157;8=110" flowerY = "1=280;2=135;3=233;4=143;5=77;6=130;7=165;8=280" angle = "1=-6;2=-2;5=-5;6=-8;7=8;8=8" GraphicsWindow.BrushColor = "Green" flower[1] = Shapes.AddEllipse(flowerWidth[1] + 5, flowerHeight[1] + 5) ' right leaf from box[1] upSize Flower by +5 flower[8] = Shapes.AddEllipse(flowerWidth[8] + 5, flowerHeight[8] + 5) 'left leaf GraphicsWindow.BrushColor = "Brown" flower[3] = Shapes.AddRectangle(flowerWidth[3] + 5, flowerHeight[3] + 90) 'stem GraphicsWindow.BrushColor = "Pink" flower[2] = Shapes.AddEllipse(flowerWidth[2] + 5, flowerHeight[2] + 5) 'left petal from box[2] flower[5] = Shapes.AddEllipse(flowerWidth[5] + 5, flowerHeight[5] + 5) 'top petal flower[6] = Shapes.AddEllipse(flowerWidth[6] + 5, flowerHeight[6] + 5) 'right petal flower[7] = Shapes.AddEllipse(flowerWidth[7] + 5, flowerHeight[7] + 5) 'bottom petal GraphicsWindow.BrushColor = "Yellow" flower[4] = Shapes.AddEllipse(flowerWidth[4] + 5, flowerHeight[4] + 5) 'stamin 'index the above BrushColors for the parts in the boxes build in - (you could now revise the above to add all the flowers in a loop as well) color = "1=Green;2=Brown;3=Pink;4=Yellow" assignColorToPart = "1=1;2=3;3=2;4=4;5=3;6=3;7=3;8=1" offsetPartX = "1=10;2=10;3=40;4=35;5=25;6=10;7=20;8=10" 'offset the parts in the box offsetPartY = "1=30;2=25;3=10;4=35;5=15;6=25;7=15;8=35" For i = 1 To Array.GetItemCount(flower) Shapes.Move(flower[i], flowerX[i], flowerY[i]) Shapes.Rotate(flower[i], angle[i]) 'from the Mouse part of the project Shapes.SetOpacity(flower[i], 30) GraphicsWindow.BrushColor = color[assignColorToPart[i]] 'set the color from the above BrushColor arrays part[i] = Shapes.AddEllipse(flowerWidth[i], flowerHeight[i]) Shapes.Move(part[i], boxX[i] + offsetPartX[i], boxY[i] + offsetPartY[i]) Shapes.Rotate(part[i], angle[i]) EndFor EndSub End>BFM261.sb< Start>BFM797.sb< 'Set the Graphics Window size and sow with your title GraphicsWindow.Show() GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "SHANU SmallBasic Drawing Tool" GraphicsWindow.Height = 800 GraphicsWindow.Width = 800 'Draw Toolbar GraphicsWindow.PenColor = "Black" GraphicsWindow.PenWidth = 1 titles="SHANU SmallBasic Drawing Tool GraphicsWindow.DrawBoundText(6, 4, GraphicsWindow.Width, titles) GraphicsWindow.DrawRectangle(6, 26, GraphicsWindow.Width-12, 70) drawType=0 'Draw the buttons at the toolbar drawButtons() Controls.ButtonClicked = ButtonEvents Sub drawButtons clearAll = Controls.AddButton("ClearALL", 20, 44) Controls.SetSize(clearAll, 80, 40) freePen = Controls.AddButton("Free PEN Draw", 104, 44) Controls.SetSize(freePen, 120, 40) drawImage = Controls.AddButton("Image",228, 44) Controls.SetSize(drawImage, 80, 40) drawRectangle = Controls.AddButton("Rectangle",310, 44) Controls.SetSize(drawRectangle, 80, 40) fillRectangle = Controls.AddButton("FillRectangle",394, 44) Controls.SetSize(fillRectangle, 80, 40) drawCircle = Controls.AddButton("Circle",478, 44) Controls.SetSize(drawCircle, 80, 40) fillCircle = Controls.AddButton("Fill Circle",564, 44) Controls.SetSize(fillCircle, 80, 40) EndSub ''set the Drwaing Area Starting Xval,Yval and width and Height drawXval=20 drawYval=140 drawWidth=GraphicsWindow.Width-60 drawHeight=GraphicsWindow.Height-200 '' Draw the Draw Area inside this area we will draw GraphicsWindow.DrawRectangle(drawXval, drawYval, drawWidth, drawHeight) '' Check for the button clieked event and perform the action Sub ButtonEvents buttonText = Controls.GetButtonCaption(Controls.LastClickedButton) If buttonText = "ClearALL" Then ' Clear the draw Area for redraw drawType=1 GraphicsWindow.BrushColor="white" GraphicsWindow.FillRectangle(drawXval, drawYval, drawWidth, drawHeight) ElseIf buttonText = "Free PEN Draw" Then ' Draw the Free Pen drawType=2 ElseIf buttonText = "Image" Then ' Add Image in draw area drawType=3 ElseIf buttonText = "Rectangle" Then ' Draw Rectangle in draw area drawType=4 ElseIf buttonText = "FillRectangle" Then ' Fill Rectangle in draw area drawType=5 ElseIf buttonText = "Circle" Then ' Draw Circle in draw area drawType=6 ElseIf buttonText = "Fill Circle" Then ' Draw Circle in draw area drawType=7 EndIf EndSub 'Mouse Click Events 'here we check for draw type and if the dray type is GraphicsWindow.MouseDown = MouseClick Sub MouseClick OrgX = GraphicsWindow.MouseX OrgY = GraphicsWindow.MouseY ' If the Drawtype is 3 then its for Image Add If drawType=3 Then if OrgX >drawXval And OrgXdrawYval And OrgYdrawXval And OrgXdrawYval And OrgYdrawXval And OrgXdrawYval And OrgYdrawXval And OrgXdrawYval And OrgYdrawXval And OrgXdrawYval And OrgYdrawXval And xdrawYval And yBFM797.sb< Start>BFN681-1.sb< '*************************************************** ' Small Basic Chomper (SBC) v 1.0 ' Pacman-style game (BETA) 'Version 1.3.7.13 (online version) ' ' Software designed & written in BASIC by Anthony Yarrell (QBasicLover in the SB forums) ' Designed for Microsoft Small Basic 1.0 ' March 2013 ' 'Sprites created using Microsoft Paint 'Maze designed using Microsoft Excel ' 'My Research Sources: '=============== 'Sprite Management & Animation: "Visual Basic Game Programming for Teens", Jonathan S. Harbour; '"Video Game Programming for Teens", Jonathan S. Harbour; Microsoft Small Basic Forums. 'Pacman Sprite Behavior: "The Pacman Dossier" http://home.comcast.net/~jpittman2/pacman/pacmandossier.html; 'Creating a Pacman Maze: http://stackoverflow.com/questions/622471/pacman-maze-in-java; ' '*************************************************** 'These variables control game play: BRAND_NEW_GAME = 0 PLAY_LEVEL = 1 ADVANCE_LEVEL = 2 REPLAY_LEVEL = 3 GAME_OVER = 4 gameState = BRAND_NEW_GAME 'Initialization: mazeScale = 8 'Size of maze and distance between tiles. The game runs better when 'the mazeScale is 2 x the number of animation frames. I set the total animation frames 'to 4 because it gave the best performance while making the math easier. gameScreenHeight = 375 gamescreenWidth = 225 monsterEatenCtr = 0 'Counts the number of monsters eaten in succession per energizer (4= bonus) monsterBonusPts = 1000 'Pts given to player for eating 4 monsters in succession. monsterPts = 200 'Points player gets when he/she eats a monster. monsterPtsMuliplier = 2 'Causes player to get bonus points when monsters are eaten in succession. monstersEatenPerLevel = 0'Counts the number of mosters eaten per level. SBC gets a life if he eats 16 monsters per level. gameSpeed = 20'<-- Decrease if game runs too slowly gameScore = 0 gameLevel = 0 pelletScore = 25 energizerScore = 100 hasReached50K = "False" 'Flag to track if score reaches 50,000. Player gets extra life. initialCountDownTime = 80 'Amount of time (cycles) the monsters stay "frightened" globalCycleCtr = 0 'Used for syncronization and scheduling. '********************************** 'Game loop '*********************************** While (gameState <> GAME_OVER) keyPressed = GraphicsWindow.LastKey start = Clock.ElapsedMilliseconds globalCycleCtr = globalCycleCtr + 1 If (gameState = BRAND_NEW_GAME) Then InitializeLookupTables() SetupGraphicsWindow() LoadBitmaps() InitializeSprites() SpriteArray[SBC][Lives] = 3 gameState = ADVANCE_LEVEL ElseIf (gameState = ADVANCE_LEVEL) Then globalCycleCtr = 0 monstersEatenPerLevel = 0 selectedRotation = 0 ' SBC goes through 4 max rotations. sbcDirection = Dir_R ' SBC moves to the right when level starts. SmallDelay() UpdateLevelState() ConstructGameElements() splashText = "L E V E L : "+ gameLevel DisplayLevelSplash() gameState = PLAY_LEVEL ElseIf (gameState = PLAY_LEVEL) Then LeaveMonsterPenOneByOne() 'Each sprite has a counter that it uses to track when it reaches a tile when moving though the maze. 'When this counter reaches mazeScale, the sprite updates it info and draws. 'Each sprite also has a spritespeed variable that it uses to set its movement speed. For example, 'if spritespeed = 1 then updates will be done on each tick of the global counter. If spritespeed = 2 then 'updates will be done on every 2nd tick, which will slow down that sprite, etc. For Sprites = firstSprite to lastSprite IF Math.Remainder(globalCycleCtr,SpriteArray[Sprites][spriteSpeed])=0 Then Update() Draw() EndIf Endfor ElseIf (gameState = REPLAY_LEVEL) Then sbcDirection = Dir_R Sprites=1 SpriteArray[SBC][Lives] = SpriteArray[sbc][Lives] - 1 SpriteArray[SBC][State] = NORMAL globalCycleCtr = 0 SmallDelay() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() DrawSprites() '<---BUG FIX. A call to DrawSprites( ) fixes an issue where SBC dissapears when level restarts. SmallDelay() gameState = PLAY_LEVEL If (SpriteArray[SBC][Lives] = 0) Then gameState = GAME_OVER splashText = "Game Over" DisplayLevelSplash() Endif Endif delay = gameSpeed - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf KeyboardHandler() EndWhile 'End of main state machine '*********************************************************************************** Sub SmallDelay Program.Delay(500) EndSub '******************************************************************************************* 'Updates various games elements (eg maze color, game speed, etc) as the player advances to a new level: '- gameSpeed: Overall speed of game. Game gets faster on each level. '- initialCountDownTime: amount of time that monsters stay afraid. Decreases on each level. Sub UpdateLevelState If math.Remainder(gameLevel,4) = 1 Then mazeBorderColor = "Cyan" ElseIf math.Remainder(gameLevel,4) = 2 then mazeBorderColor = "Red" Elseif math.Remainder(gameLevel,4) = 3 then mazeBorderColor = "midnightblue" Elseif math.Remainder(gameLevel,4) = 0 then mazeBorderColor = "magenta" EndIf gameLevel = gameLevel + 1 gameSpeed = gameSpeed - 2 If (gameSpeed <= 0) Then gameSpeed = 0 EndIf 'Give the player a new life on levels 4 and 8: If (gameLevel = 4 Or gameLevel = 8) Then SpriteArray[sbc][Lives]=SpriteArray[sbc][Lives] + 1 EndIf 'Reduce the amount of time that the monsters stay "Frightened" as game progresses. 'At much higher levels, the monsters won't stay frighened at all: initialCountDownTime = initialCountDownTime - 2 If initialCountDownTime <= 0 Then initialCountDownTime = 0 EndIf EndSub '******************************************************************************************* 'Dsplays a splash screen at the start of each level: Sub DisplayLevelSplash GraphicsWindow.FontSize=14 GraphicsWindow.BrushColor="white" l=Shapes.AddText(splashText) Shapes.Move(l,-200,205) Shapes.Animate(l,80,205,1000) SmallDelay() SmallDelay() SmallDelay() Shapes.Animate(l,-200,205,1000) EndSub '******************************************************************************************* 'The variables Dir_L, Dir_U, Dir_R, Dir_D are used as indexes into the xModifier and yModifier lookup tables. 'For example, xModifier[L] & yModifier[L] produces -1 and 0 respectively. When added to XY or RC values this will cause 'the sprite to go left, etc: Sub KeyboardHandler Dir_L = 1 Dir_U = 2 Dir_R = 3 Dir_D = 4 If (keyPressed = "Left") Then sbcDirection = Dir_L Elseif (keyPressed = "Right") Then sbcDirection = Dir_R Elseif (keyPressed = "Up") Then sbcDirection = Dir_U Elseif (keyPressed = "Down") Then sbcDirection = Dir_D Elseif (keyPressed = "Escape") Then gameState = GAME_OVER Endif EndSub '******************************************************************************************* Sub MoveSBC 'This routine moves SBC around the screen and causes SBC to stop at borders.It checks the maze 'locations adjacent to SBC's current location aganist the direction chosen by an arrow key press. 'If the new direction is possible (eg no borders in the way) SBC will go in the new direction. If 'the new direction is not possible, but the previous direction is, SBC will continue traveling in the 'direction it was moving in prior to the arrow key press. If neither direction is possible, SBC 'will stop moving: If Sprites=SBC Then canMoveInOldDirection = "False" canMoveInNewDirection = "False" 'Get maze data ahead of SBC: aheadDirX = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] aheadDirY = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] aheadDirData = Maze[aheadDirY][aheadDirX] 'Get maze data at location based on arrow key press: newDirX = SpriteArray[SBC][mazeCol] + xModifier[SbcDirection] newDirY = SpriteArray[SBC][mazeRow] + yModifier[SbcDirection] newDirData = Maze[newDirY][newDirX] 'The mazeTokens array holds data that represent ares that are NOT blocked by borders. For a = firstToken To lastToken If (mazeTokens[a] = newDirData) Then canMoveInNewDirection = "True" Goto _XIT_4Loop_Early EndIf If (mazeTokens[a] = aheadDirData) Then canMoveInOldDirection = "True" EndIf EndFor _XIT_4Loop_Early: 'If the new direction is possible, go in new direction: If (canMoveInNewDirection = "True") Then SpriteArray[SBC][DX] = xModifier[sbcDirection] SpriteArray[SBC][DY] = yModifier[sbcDirection] selectedRotation = rotationLookupTable[sbcDirection] EndIf 'If neither old nor new directions are possible, come to a stop: If (canMoveInNewDirection = "False" And canMoveInOldDirection = "False") Then SpriteArray[SBC][DX] = 0 SpriteArray[SBC][DY] = 0 EndIf SpriteArray[SBC][mazeCol] = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] SpriteArray[SBC][mazeRow] = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] EatPellet() EndIf EndSub '******************************************************************************************* Sub MoveMonstersTowardTarget 'This routine moves the monsters toward a target while allowing them to navigate around the maze 'borders. LL is a temporary array: INVALID = 9999 '9999 is used as an invalid flag because the total distance across the maze is 'much lower than 9999 pixels. Later, when the code calculates the distance 'between source to target, anything marked 9999 won't be considered. If (Sprites <> SBC) Then '<--SBC has his own movement routine (see MoveSBC) For a = 1 To 4 'step through XY/RC modifier table: SourceX = SpriteArray[Sprites][mazeCol] + xModifier[a] SourceY = SpriteArray[Sprites][mazeRow] + yModifier[a] targetX = SpriteArray[Sprites][targetCol] targetY = SpriteArray[Sprites][targetRow] For b = firstToken To lastToken 'If the maze area being examined is not a border then calculate the distance from that maze area ' to the target using the Manhattan Distance formula (SourceX-targetCol)+(SourceY-targetRow)... If mazeTokens[b]=Maze[SpriteArray[Sprites][mazeRow] + yModifier[a]][SpriteArray[Sprites][mazeCol]+ xModifier[a]] Then LL[a] = 1+(math.Abs(Sourcex-targetx) + math.Abs(Sourcey-targety)) Goto _XIT4 '...otherwise mark it as invalid because it's a border : Else LL[a] = INVALID EndIf EndFor _XIT4: EndFor 'For each maze area stored in the LL array, check to see if that was visited by the monster during previous 'game loop cycle. If so mark it INVALID, then save the monster's current maze location 'in VX, VY. These two steps will force the monster to travel in forward directions only (no reversing direction): For c = 1 To 4 If SpriteArray[Sprites][mazeCol] + xModifier[c] = SpriteArray[Sprites][VX] Then If SpriteArray[Sprites][mazeRow] + yModifier[c] = SpriteArray[Sprites][VY] Then LL[c] = INVALID EndIf EndIf EndFor SpriteArray[Sprites][VX] = SpriteArray[Sprites][mazeCol] SpriteArray[Sprites][VY] = SpriteArray[Sprites][mazeRow] 'Get the smallest number in temporary LL array, which will represent the direction to move in '1 = go left, 2 = go up, 3 = to right, 4 = go down: initialValue = LL[1] For ictr = 1 TO 4 If initialValue >= LL[ictr] THEN initialValue = LL[ictr] elementfound = ictr EndIf EndFor 'Set the movement direction. The xModifier/yModifier lookup tables eliminate the need for If/Then tests here: SpriteArray[Sprites][DX] = xModifier[elementfound] SpriteArray[Sprites][DY] = yModifier[elementfound] '** There is at least one circumstance where the monster finds a dead end - when the monster is in the 'monster pen at level start. In this instance, the monster's L, D, & R adjacent areas will be invalid 'due to being blocked by visible and invisible borders, and U is blocked because it will be added to the 'VX/VY variables after the first game cycle. When this happens the VX/VY variables must be deleted 'and on the next game cycle the monster will move out of dead end. ' if LL[elementfound] = INVALID Then SpriteArray[Sprites][DX] = 0 SpriteArray[Sprites][DY] = 0 SpriteArray[Sprites][VX] = 0 SpriteArray[Sprites][VY] = 0 EndIf 'Finally, move toward target: SpriteArray[Sprites][mazeCol] = (SpriteArray[Sprites][mazeCol] + SpriteArray[Sprites][dx]) SpriteArray[Sprites][mazeRow] = (SpriteArray[Sprites][mazeRow] + SpriteArray[Sprites][dy]) EndIf Endsub '******************************************************************************************* 'Detects when sprites touch each other and when sprites enter special areas of the maze: Sub CollisionDetect If Sprites <> SBC Then CheckRectangles() If isTouching = "True" Then isTouching = "False" 'Monster dies if touching SBC while fightened and then monster returns to the monster pen: If SpriteArray[Sprites][State] = FRIGHT then ShowEatSplash() SpriteArray[Sprites][State] = DIE hasEatenMonster = "True" ScoreAndBonusManager() 'SBC dies if touching monster when energizer is not active: ElseIf SpriteArray[Sprites][State] = CHASE then SpriteArray[SBC][State] = DIE gameState = REPLAY_LEVEL EndIf hasEatenMonster = "False" EndIf 'When monster reaches monster pen, get body back and leave: If SpriteArray[Sprites][mazeCol] = MonsterPenX and SpriteArray[Sprites][mazeRow]= MonsterPenY Then If SpriteArray[Sprites][State] = DIE then SpriteArray[Sprites][State] = EMERGE EndIf EndIf 'When monster has left monster pen, go back to chasing SBC: If SpriteArray[Sprites][mazeCol] = emergeX and SpriteArray[Sprites][mazeRow] = emergeY Then If SpriteArray[Sprites][State] = EMERGE then SpriteArray[Sprites][State] = CHASE EndIf EndIf EndIf '***BUG FIX: If a monster is in the monster pen when an energizer is eaten it will switch from whatever mode its in to 'FRIGHT mode. However, FRIGHT mode closes to doors when causes the monster to get trapped. This is a side effect - 'my intention was to keep the monsters from re-entering the pen prematurely. The fix below checks to see if a monster 'is in the pen and is the wrong mode. If so, it is switched to EMERGE mode so that it can properly emerge from the pen: If (SpriteArray[Sprites][mazeCol] = MonsterPenX) and (SpriteArray[Sprites][mazeRow] = MonsterPenY) Then If (SpriteArray[Sprites][State] <> DIE) Or (SpriteArray[Sprites][State] <> EMERGE) then SpriteArray[Sprites][State] = EMERGE EndIf EndIf EndSub '******************************************************************************************* 'Sets the targets that the monsters will move towards: Sub SetupMonsterTargets IF (Sprites <>SBC) then 'Sets ghosts to meander around the screen after SBC eats a power pellet: If SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][targetRow] = math.GetRandomNumber(maxMazeRows) SpriteArray[Sprites][targetCol] = math.GetRandomNumber(maxMazeCols) 'Sends the monsters back to monster pen after being eaten by SBC: ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][targetCol] = MonsterPenX SpriteArray[Sprites][targetRow] = MonsterPenY 'Makes the monsters leave home base: ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][targetCol] = emergeX SpriteArray[Sprites][targetRow] = emergeY Elseif SpriteArray[Sprites][State] = CHASE Then If Sprites = RedMonster Then 'Red monster pursues directly: SpriteArray[RedMonster][targetCol] = SpriteArray[SBC][mazeCol] SpriteArray[RedMonster][targetRow] = SpriteArray[SBC][mazeRow] ElseIf Sprites = PinkMonster Then 'Pink monster tries to ambush (***TO DO: needs to be fixed***): SpriteArray[PinkMonster][targetCol] = SpriteArray[SBC][mazeCol] + (SpriteArray[SBC][DX]-1) SpriteArray[PinkMonster][targetRow] = SpriteArray[SBC][mazeRow] + (SpriteArray[SBC][DY]-1) ElseIf Sprites = OrangeMonster Then 'Orange monster wanders around SpriteArray[OrangeMonster][targetCol] = math.GetRandomNumber(maxMazeCols) SpriteArray[OrangeMonster][targetRow] = math.GetRandomNumber(maxMazeRows) ElseIf Sprites = BlueMonster Then 'Blue monster considers red monster's coordinates and SBC's coordinates wheb determining how to move: SpriteArray[BlueMonster][targetCol] = math.abs(SpriteArray[SBC][mazeCol] + SpriteArray[RedMonster][mazeCol]) SpriteArray[BlueMonster][targetRow] = math.abs(SpriteArray[SBC][mazeRow] + SpriteArray[RedMonster][mazeRow]) EndIf EndIf ENDIF EndSub '******************************************************************************************* 'Animation manager. The animation frames are stored in the ImageArray 2D array. This routine 'sets the indexes into that array. FrameCtr + Offset is used as the index into ImageArray. 'When Offset = zero all sprites go through the normal 4-cycle animation sequence. When 'offset = 5, the monsters turn purple (Fright Mode), and when the offset = 6 the monsters turn dark gray '(Die Mode). Sub SetupAnimationSequence SpriteArray[SBC][LastFrame] = 4 SpriteArray[SBC][FirstFrame] = 1 SpriteArray[SBC][offset] = 0 If (Sprites <> SBC) Then If SpriteArray[Sprites][State] = CHASE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 ElseIf SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][offset] = 5 SpriteArray[Sprites][LastFrame] = 5 SpriteArray[Sprites][FirstFrame] = 5 ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][offset] = 6 SpriteArray[Sprites][LastFrame] = 6 SpriteArray[Sprites][FirstFrame] = 6 ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 Endif EndIf FlashMonsters() EndSub '******************************************************************************************* Sub EatPellet erasePelletFromScreen = "FALSE" mazeData = Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])] 'Pellet = mazeToken[1]. Energizer = mazeToken[2]: If (mazeData = mazeTokens[1] Or mazeData = mazeTokens[2]) Then Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])]=mazeTokens[0] 'empty this maze location pelletCount = pelletCount - 1 erasePelletFromScreen = "True" gameScore = gameScore + pelletScore If (mazeData = mazeTokens[1]) Then gameScore = gameScore + pelletScore ElseIf (mazeData = mazeTokens[2]) then monsterEatenCtr=0 SetMonstersToFrightState() gameScore = gameScore + energizerScore energizerTimer = ACTIVE energizerTime = initialCountDownTime EndIf If pelletCount <= 0 Then gameState = ADVANCE_LEVEL EndIf EndIf DoEnergizerTimer() EndSub '******************************************************************************************* 'Sets all monsters to FRIGHT state. VY & VX are zeroed out so that the monsters can switch 'directions. (MoveMonstersTowardTarget( ) normally restricts the monsters to forward-only movements): Sub SetMonstersToFrightState For ee = firstMonster to lastMonster if SpriteArray[ee][State] <> DIE then SpriteArray[ee][State] = FRIGHT shapes.SetOpacity(ImageArray[ee][5],100) SpriteArray[ee][VY] = 0 SpriteArray[ee][VX] = 0 EndIf Endfor EndSub '******************************************************************************************* 'Sets all monsters to CHASE state. This is a bug fix to keep the monsters from switching out of DIE 'mode prematurely: Sub MakeMonstersChase For mc = firstMonster to lastMonster If SpriteArray[mc][State] <> DIE then SpriteArray[mc][State] = CHASE EndIf Endfor EndSub '******************************************************************************************* 'Manages the count down timer that determines how long an energizer lasts. Sub DoEnergizerTimer If (energizerTimer = ACTIVE) Then If (energizerTime <> 0) Then energizerTime = energizerTime -1 Else energizerTimer = INACTIVE monsterEatenCtr=0 MakeMonstersChase() Endif Endif EndSub '******************************************************************************************* 'Dispatch routine for erasing pellets/energizers from the screen: Sub ErasePellet pelletColor = "black" pelletX = SpriteArray[SBC][screenX] + sWidth - mazeScale pelletY = SpriteArray[SBC][screenY] + sHeight - mazeScale DrawEnergizer() EndSub '******************************************************************************************* 'Draws/erases an energizer Sub DrawEnergizer pelletSize = 6 xOffset = -6 yOffset = -6 DP() Endsub '******************************************************************************************* 'Draws/erases a pellet Sub DrawPellet pelletSize = 3 xOffset = -3 yOffset = -3 DP() EndSub '******************************************************************************************* Sub DP GraphicsWindow.BrushColor = pelletColor GraphicsWindow.FillEllipse(pelletX+xOffset, pelletY+yOffset, pelletSize, pelletSize) EndSub '******************************************************************************************* 'Removes sprites from the maze Sub ClearSpritesFromaze For r=firstSprite To lastSprite For t = 1 To 6 Shapes.move(ImageArray[r][t],-100,-100) EndFor EndFor EndSub '******************************************************************************************* 'Draws sprites on screen while advancing through the animation sequence setup by SetupAnimationSequence(). Sub DrawSprites 'To reduce flicker only draw sprites that are moving (SBC sometimes stops) If SpriteArray[Sprites][dx]<>0 Or SpriteArray[Sprites][dy]<>0 Then 'Get a reference to the current animation frame. We will hide it later: oldFrameCtr=SpriteArray[Sprites][FrameCtr] SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][frameCtr]+1+SpriteArray[Sprites][offset] 'Advance to next frame and check to see if all frames have been displayed: If SpriteArray[Sprites][frameCtr]>SpriteArray[Sprites][lastFrame] then SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][firstFrame] Endif 'Update screen coordinates: SpriteArray[Sprites][screenX]= SpriteArray[Sprites][screenX]+ SpriteArray[Sprites][DX] * 1 SpriteArray[Sprites][screenY]= SpriteArray[Sprites][screenY]+ SpriteArray[Sprites][DY] * 1.5 'Get reference to new animation frame and apply rotation (for SBC): newFrameCtr=SpriteArray[Sprites][frameCtr] if Sprites = SBC Then Shapes.Rotate(ImageArray[Sprites][newFrameCtr], selectedRotation) EndIf 'Finally, hide previous frame and show new animation frame: shapes.Move(ImageArray[Sprites][oldFrameCtr],-20,-20) Shapes.Move(ImageArray[Sprites][newFrameCtr], SpriteArray[Sprites][screenX], SpriteArray[Sprites][screenY]) EndIf If erasePelletFromScreen = "True" Then ErasePellet() EndIf EndSub '******************************************************************************************* 'This routine intializes general purpose global lookup tables. Sub InitializeLookupTables 'The xModifier & yModifier arrays are used to modify the XY screen coordinates and RC maze coordinates: xModifier[0] = 0 'Stop moving xModifier[1] =-1 'Move Left (when added to X) xModifier[2] = 0 ' xModifier[3] = 1 'Move Right (when added to X) xModifier[4] = 0 yModifier[0] = 0 'Stop moving yModifier[1] = 0 ' yModifier[2] =-1 'Move Up (when added to Y) yModifier[3] = 0 ' yModifier[4] = 1 'Move Down (when added to Y) 'rotationLookupTable holds the rotation angles for SBC. SbcDirection is used as an index: rotationLookupTable[1] = 180 rotationLookupTable[2] = 270 rotationLookupTable[3] = 0 rotationLookupTable[4] = 90 EndSub '******************************************************************************************* 'Sets up sprite data structure and establishes related variables: Sub InitializeSprites 'State variables for sprites: DIE = 0 NORMAL = 1 CHASE = 2 SCATTER = 3 '<--not implemented yet FRIGHT = 4 EMERGE = 5 'State variables for energizer timer: ACTIVE = 1 INACTIVE = 0 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite: firstSprite = SBC lastSprite = PinkMonster firstMonster = RedMonster lastMonster = PinkMonster 'Variables for dimension #2: screenX = 1 'screen x coordinate screenY = 2 'screen y coordinate mazeCol = 3 'maze col mazeRow = 4 'maze row DX = 5 'x/col modifier DY = 6 'y/row modifier targetCol= 7 'maze target col targetRow= 8 'maze target row VX = 9 'visited maze col VY = 10 'visited maze row State = 11 Lives = 12 FrameCtr = 13 'Index into ImageArray[ ][ ] Offset = 14 FirstFrame = 15 LastFrame = 16 cycleCounter= 17 spriteSpeed= 18 'Initialize: For spriteCtr = firstSprite To lastSprite SpriteArray[spriteCtr][FirstFrame] = 1 SpriteArray[spriteCtr][LastFrame] = 4 SpriteArray[spriteCtr][FrameCtr] = 4 SpriteArray[spriteCtr][offset] = 4 SpriteArray[spriteCtr][DX] = 0 SpriteArray[spriteCtr][DY] = 0 SpriteArray[spriteCtr][VX] = 0 SpriteArray[spriteCtr][VY] = 0 SpriteArray[spriteCtr][targetCol] = 0 SpriteArray[spriteCtr][targetRow] = 0 SpriteArray[spriteCtr][State] = CHASE SpriteArray[spriteCtr][spriteSpeed] = 1 SpriteArray[spriteCtr][cycleCounter] = 1 Endfor SpriteArray[SBC][State] = NORMAL sbcDirection = Dir_R EndSub '******************************************************************************************* Sub PositionSpritesInMaze 'Used for alignment hacks: xxOffset= 0 yyOffset= 0 'Position SBC two tiles underneath Monster pen: SpriteArray[SBC][mazeCol] = 15 SpriteArray[SBC][mazeRow] = 24 'Position Red Monster outside & above Monster pen: SpriteArray[RedMonster][mazeCol] = 12 SpriteArray[RedMonster][mazeRow] = 12 'Blue, Orange and Pink Monsters inside Monster pen: SpriteArray[BlueMonster][mazeCol] = 12 SpriteArray[BlueMonster][mazeRow] = 16 SpriteArray[OrangeMonster][mazeCol] = 17 SpriteArray[OrangeMonster][mazeRow] = 16 SpriteArray[PinkMonster][mazeCol] = 14 SpriteArray[PinkMonster][mazeRow] = 15 'Set correct screen positions: For Sprites = firstSprite to lastSprite AdjustScreenCoords() EndFor EndSub '******************************************************************************************* 'Using maze RC values, calculate screen XYs: Sub AdjustScreenCoords SpriteArray[Sprites][screenX] = (SpriteArray[Sprites][mazeCol]) * mazeScale - mazeScale SpriteArray[Sprites][screenY] = (SpriteArray[Sprites][mazeRow]) * mazeScale * 1.5 - mazeScale EndSub '******************************************************************************************* Sub LoadBitmaps 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite. 'Variables to select the sprites (dimension #1 of SpriteArray): SBC = 1 RedMonster = 2 BlueMonster = 3 OrangeMonster = 4 PinkMonster = 5 sWidth = mazeScale * 2 sHeight = mazeScale * 2 'ImageArray is a 2D array that holds references to the bitmaps used by the sprites. Dimension #1 is used 'to select the sprite, dimension #2 is used to select the bitmap. 'Load bitmaps for normal animation sequence: filePath = Program.Directory +"\" 'SBC animation frames ImageArray[SBC][1]=shapes.addimage("http://farm9.staticflickr.com/8240/8528887960_413fda8a5a_t.jpg") ImageArray[SBC][2]=shapes.addimage("http://farm9.staticflickr.com/8379/8528887958_f8f6d3e534_t.jpg") ImageArray[SBC][3]=shapes.addimage("http://farm9.staticflickr.com/8520/8527774169_b73baef828_t.jpg") ImageArray[SBC][4]=shapes.addimage("http://farm9.staticflickr.com/8379/8528887958_f8f6d3e534_t.jpg") 'Red Monster animation frames ImageArray[RedMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") 'Blue Monster animation frames ImageArray[BlueMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") 'Orange Monster animation frames ImageArray[OrangeMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") 'Pink Monster animation frames ImageArray[PinkMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") For s= 1 to 5 'Load bitmaps for FRIGHT Mode: ImageArray[s][5]=shapes.addimage("http://farm9.staticflickr.com/8102/8528933134_d80645e3cc_t.jpg") 'Load bitmaps for DIE mode: ImageArray[s][6]=shapes.addimage("http://farm9.staticflickr.com/8532/8528888036_85d4b2906d_t.jpg") Shapes.SetOpacity(ImageArray[s][6],50) Endfor ClearSpritesFromaze() EndSub ''******************************************************************************************* 'Loads maze pattern into maze array, counts the number of pellets added to maze, and gets the 'maze XY coordinates for special areas. Also creates and populates the mazeToken[ ] lookup table: ' Sub LoadMaze M[1] = "/------\/----------\/------\" M[2] = "|......||..........||......|" M[3] = "|*/--\.||./------\.||./--\*|" M[4] = "|.(--).().(------).().(--).|" M[5] = "|..........................|" M[6] = "(-\./\./---\./\./---\./\./-)" M[7] = "oo|.||.| |.||.| |.||.|oo" M[8] = "oo|.||.(---).||.(---).||.|oo" M[9] = "oo|.||.......||.......||.|oo" M[10] = "oo|.|(--\+/--)(--\+/--)|.|oo" M[11] = "--).(---)+(------)+(---).(--" M[12] = "LT+.+++++++E++++++++++++.+SR" M[13] = "--\./---\+/AAAAAAo+/---\./--" M[14] = "oo|.|/--)+|+Co+B+|+(--\|.|oo" M[15] = "oo|.||++++|+oo+o+|++++||.|oo" M[16] = "oo|.||+/\+|MCo+B+|+/\+||.|oo" M[17] = "oo|.()+||+(------)+||+().|oo" M[18] = "oo|.+++||++++++++++||+++.|oo" M[19] = "oo|./--)(--\+/\+/--)(--\.|oo" M[20] = "oo|.(------)+||+(------).|oo" M[21] = "oo|.......+++||+++.......|oo" M[22] = "oo|./---\./--)(--\./---\.|oo" M[23] = "/-).(---).(------).(---).(-\" M[24] = "|............++............|" M[25] = "|./--\./---\./\./---\./--\.|" M[26] = "|.|oo|.|/--).||.(--\|.|oo|.|" M[27] = "|.|oo|.||....||....||.|oo|.|" M[28] = "|*|oo|.||./--)(--\.||.|oo|*|" M[29] = "|.(--).().(------).().(--).|" M[30] = "|..........................|" M[31] = "(--------------------------)" maxMazeRows = Array.GetItemCount(M) maxMazeCols = Text.GetLength(M[1]) 'mazeTokens[ ] hold tokens that represent walkable space in the maze: firstToken = 0 lastToken = 2 mazeTokens[0]= "+" mazeTokens[1]= "." mazeTokens[2]= "*" 'Load the maze pattern into the maze[ ] [ ] array: For rows = 1 To maxMazeRows For cols = 1 To maxMazeCols maze[rows][cols] = Text.GetSubText(M[rows], cols, 1) If maze[rows][cols] = mazeTokens[1] Or maze[rows][cols] = mazeTokens[2] Then pelletCount = pelletCount + 1 EndIf 'Special areas: If Maze[rows][cols] ="M" Then 'DIE mode target Monster Pen tile Maze[rows][cols] = mazeTokens[0] monsterpenX = cols MonsterPenY = rows ElseIf Maze[rows][cols] ="E" Then 'Emerge mode target tile Maze[rows][cols] = mazeTokens[0] emergeX = cols emergeY = rows ElseIf Maze[rows][cols] ="L" Then 'Left tunnel tile Maze[rows][cols] = mazeTokens[0] leftTunnelX = cols leftTunnelY = rows ElseIf Maze[rows][cols] ="R" Then 'Right tunnel tile Maze[rows][cols] = mazeTokens[0] rightTunnelX = cols rightTunnelY = rows ElseIf Maze[rows][cols] ="S" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld1X = cols sld1Y = rows ElseIf Maze[rows][cols] ="T" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld2X = cols sld2Y = rows EndIf EndFor EndFor 'Delete the temporary array holding the maze structure: M="" EndSub '******************************************************************************************* 'Steps through maze[ ] [ ] and draws the pattern on screen: Sub DrawMaze mazeBackgroundColor = "black" GraphicsWindow.BackgroundColor= mazeBackgroundColor x = 0 y = 0 mWidth = mazeScale mHeight = mazeScale MMX = (X + 1 * mWidth) MMY = (Y + 1.5 * mHeight) MMH = (1.5 * mHeight) MMW = (1 * mWidth) For rows = 1 To maxMazeRows tempMMYrows = MMY*rows 'helps speed up draw operations a bit. For cols = 1 To maxMazeCols mazeData = Maze[rows][cols] GraphicsWindow.PenColor = mazeBorderColor GraphicsWindow.PenWidth = 2 ' Upper Left corner: if mazeData = "/" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, mazeCol+MMW*cols, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, MMY+MMH*rows) 'Upper Right corner: elseif mazeData = "\" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows+MMH) 'Lower Left corner: elseif mazeData = "(" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) 'Lower right corner: elseif mazeData = ")" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) ' 'Vertical line: elseif mazeData = "-" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) ' 'Vertical line for top door elseif mazeData = "A" then GraphicsWindow.PenColor="white" GraphicsWindow.PenWidth="1" GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) ' 'Horizontal line: elseif mazeData = "|" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows+MMH) 'Pellet: elseif mazeData = "." then pelletColor = "white" pelletX=(cols * MMW) pelletY=(rows * MMY) DrawPellet() 'Energizer: elseif mazeData = "*" then pelletColor = "white" pelletX=(cols * MMW) pelletY=(rows * MMY) DrawEnergizer() Endif EndFor EndFor EndSub '******************************************************************************************* 'There are three invisible borders that keep the blue, pink and orange ghosts in the monster pen 'and also keeps the monsters from getting back in unless they are in EMERGE or DIE modes. 'The doors are "opened" by adding their tokens to the mazeToken[ ] array and extending the lastToken pointer. 'The doors are "closed" by resetting the lastToken pointer: Sub CloseDoors lastToken = 2 EndSub '******************************************************************************************* Sub OpenLeftDoor mazeTokens[3] = "B" lastToken = lastToken + 1 EndSub '******************************************************************************************* Sub OpenRightDoor mazeTokens[3] = "C" lastToken = lastToken + 1 EndSub '******************************************************************************************* Sub OpenTopDoor mazeTokens[3] = "A" lastToken = lastToken + 1 EndSub '******************************************************************************************* 'This routines causes the monsters to leave the monster pen one-by-one after a certain number of 'cycles have past. This done at game start, on each new level and when a level is replayed . The 'invisible "doors" open whenever the monsters are in EMERGE or DIE modes: Sub LeaveMonsterPenOneByOne If globalCycleCtr = 100 then SpriteArray[PinkMonster][state] = EMERGE ElseIf globalCycleCtr = 200 Then SpriteArray[OrangeMonster][state] = EMERGE Elseif globalCycleCtr = 400 Then SpriteArray[BlueMonster][state] = EMERGE EndIf EndSub '******************************************************************************************* 'Dispatches update-related routines: Sub Update SpriteArray[Sprites][cycleCounter]=SpriteArray[Sprites][cycleCounter]+1 'Do updates when a sprite reaches a new tile. Distance between tiles is set by MazeScale: if (SpriteArray[Sprites][cycleCounter] > mazeScale) Then MoveSBC() SetupMonsterTargets() SetupSpriteSpeed() OpenCloseDoors() MoveMonstersTowardTarget() CheckGoThroughTunnels() SpriteArray[Sprites][cycleCounter]=1 DisplayScore() DisplayLevel() EndIf Endsub '******************************************************************************************* 'Displaches draw-related routines: Sub Draw SetupAnimationSequence() DrawSprites() CollisionDetect() CheckGoThroughTunnels() Endsub '******************************************************************************************* 'Ensures that sprites are moving at correct speed: Sub SetupSpriteSpeed If SpriteArray[Sprites][state] = CHASE Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = FRIGHT Then SpriteArray[Sprites][spriteSpeed] = 2 ElseIf SpriteArray[Sprites][state] = NORMAL Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = DIE Then SpriteArray[Sprites][spriteSpeed] = 1 EndIf EndSub '******************************************************************************************* 'Can't speed up maze drawing, so black out the game screen and then construct maze and position 'bitmaps underneath the black cover: Sub ConstructGameElements BlackOutGameScreen() LoadMaze() DrawMaze() DisplayLevel() DisplayLives() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() RemoveBlackScreen() EndSub '******************************************************************************************* 'Causes the monsters to flash briefly as a warning to the player that the monsters are about 'to swtich from Fright to Chase states: '***BUG ??: This routine doesn't work well with Silverlight*** Sub FlashMonsters If (energizerTimer = ACTIVE) And (SpriteArray[Sprites][State] = FRIGHT) Then If (energizerTime < 20) Then If (Math.Remainder(energizerTime,3)=0) Then shapes.SetOpacity(ImageArray[sprites][5],100) 'Visible Else shapes.SetOpacity(ImageArray[sprites][5],10) 'Faint EndIf EndIf EndIf EndSub '********************************************************************************* 'Allows game to cage in or release monsters from monster pen: Sub OpenCloseDoors If SpriteArray[Sprites][State] = CHASE Then CloseDoors() ElseIf SpriteArray[Sprites][State] = FRIGHT Then CloseDoors() ElseIf SpriteArray[Sprites][State] = NORMAL Then CloseDoors() ElseIf SpriteArray[Sprites][State] = DIE Then OpenLeftDoor() OpenRightDoor() OpenTopDoor() ElseIf SpriteArray[Sprites][State] = EMERGE Then OpenLeftDoor() OpenRightDoor() OpenTopDoor() EndIf EndSub '************************************************************************** Sub ScoreAndBonusManager If (hasEatenMonster = "True") Then monsterEatenCtr = monsterEatenCtr + 1 gameScore = gameScore + monsterPts +(monsterEatenCtr * monsterPts) 'Give player a bonus when all 4 monsters are eaten in succession: If monsterEatenCtr = 4 Then gameScore = gameScore + monsterBonusPts splashText=monsterBonusPts + "PT BONUS!" DisplayLevelSplash() monsterEatenCtr=0 EndIf monstersEatenPerLevel = monstersEatenPerLevel + 1 'Give player an extra life whenever 16 monsters are eaten per level: If monstersEatenPerLevel = 16 Then SpriteArray[sbc][lives] = SpriteArray[sbc][lives] + 1 splashText="EXTRA LIFE ADDED!" monstersEatenPerLevel=0 DisplayLevelSplash() EndIf hasEatenMonster="False" EndIf If hasReached50K="False" Then If gameScore > 50000 Then hasReached50K="True" SpriteArray[sbc][lives] = SpriteArray[sbc][lives] + 1 splashText="EXTRA LIFE ADDED!" DisplayLevelSplash() DisplayLives() EndIf EndIf EndSub '******************************************************************************* 'Bounding Box collision detection routine from "Beginning Microsoft Small Basic", 9-30 Sub CheckRectangles isTouching = "False" Object1X=SpriteArray[sbc][screenX] Object1Y=SpriteArray[sbc][screenY] Object2X=SpriteArray[Sprites][screenX] Object2Y=SpriteArray[Sprites][screenY] If ((Object1X + 6 +sWidth - 6) > Object2X +6) Then  If (Object1X +6 < (Object2X+6 + sWidth - 6)) Then  If ((Object1Y+6 + sHeight - 6) > Object2Y+6) Then  If (Object1Y+6 < (Object2Y+6 + sHeight - 6)) Then  isTouching = "True" EndIf  EndIf EndIf EndIf EndSub '************************************************************************ 'Allows sprites to travel through tunnels and causes the monsters to slow down at tunnel entrances: sub CheckGoThroughTunnels If Sprites <> SBC Then if (SpriteArray[Sprites][mazecol]=sld1X And SpriteArray[Sprites][mazeRow]=sld2Y) or (SpriteArray[Sprites][mazecol]=sld2X And SpriteArray[Sprites][mazeRow]=sld2Y) Then SpriteArray[Sprites][spriteSpeed]=4 EndIf endif If SpriteArray[Sprites][mazeCol] = rightTunnelX and SpriteArray[Sprites][mazeRow] = rightTunnelY Then SpriteArray[Sprites][mazeCol] = leftTunnelX SpriteArray[Sprites][mazeRow] = leftTunnelY AdjustScreenCoords() ElseIf SpriteArray[Sprites][mazeCol] = leftTunnelX and SpriteArray[Sprites][mazeRow] = leftTunnelY Then SpriteArray[Sprites][mazeCol] = rightTunnelX SpriteArray[Sprites][mazeRow] = rightTunnelY AdjustScreenCoords() EndIf EndSub '******************************************************************** 'Shows the per-monster points at the location where the monster was eaten: Sub ShowEatSplash GraphicsWindow.BrushColor="white" GraphicsWindow.FontName="Arial" o=shapes.AddText(monsterPts +(monsterEatenCtr * monsterPts)) osx = SpriteArray[Sprites][screenX] - sWidth osy = SpriteArray[Sprites][screenY] + sHeight Shapes.Move(o,osx,osy) SmallDelay() Shapes.Remove(o) EndSub '******************************************************************************************* sub SetupGraphicsWindow GraphicsWindow.Title="Small Basic Chomper" GraphicsWindow.Width= gamescreenWidth GraphicsWindow.Height=gameScreenHeight GraphicsWindow.CanResize="false" GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize = 10 GraphicsWindow.FontBold = "False" GraphicsWindow.DrawText(10,0,"SCORE: ") GraphicsWindow.DrawText(100,0,"LEVEL: ") GraphicsWindow.DrawText(180,0,"LIVES: ") scoreShape=Shapes.AddText(gameScore) livesShape=Shapes.AddText(SpriteArray[sbc][Lives]) levelShape=Shapes.AddText(gameLevel) Shapes.Move(scoreShape,50,0) Shapes.Move(levelShape,135,0) Shapes.Move(livesShape,220,0) endsub '******************************************************************************************* Sub DisplayScore Shapes.SetText(scoreShape,gamescore) EndSub '******************************************************************************************* Sub DisplayLives Shapes.SetText(livesShape,SpriteArray[sbc][lives]) EndSub '******************************************************************************************* Sub DisplayLevel Shapes.SetText(levelShape,gameLevel) EndSub '******************************************************************************************* Sub BlackoutGameScreen GraphicsWindow.BrushColor="black" blkScreen = Shapes.AddRectangle(gamescreenWidth, gameScreenHeight) Endsub '******************************************************************************************* Sub RemoveBlackScreen Shapes.Remove(blkScreen) EndSub End>BFN681-1.sb< Start>BFN681.sb< '*************************************************** ' Small Basic Chomper (SBC) v 1.0 ' Pacman-style game (BETA) 'Version 1.3.7.13 (online version) ' ' Software designed & written in BASIC by Anthony Yarrell (QBasicLover in the SB forums) ' Designed for Microsoft Small Basic 1.0 ' March 2013 ' 'Sprites created using Microsoft Paint 'Maze designed using Microsoft Excel ' 'My Research Sources: '=============== 'Sprite Management & Animation: "Visual Basic Game Programming for Teens", Jonathan S. Harbour; '"Video Game Programming for Teens", Jonathan S. Harbour; Microsoft Small Basic Forums. 'Pacman Sprite Behavior: "The Pacman Dossier" http://home.comcast.net/~jpittman2/pacman/pacmandossier.html; 'Creating a Pacman Maze: http://stackoverflow.com/questions/622471/pacman-maze-in-java; ' '*************************************************** 'These variables control game play: BRAND_NEW_GAME = 0 PLAY_LEVEL = 1 ADVANCE_LEVEL = 2 REPLAY_LEVEL = 3 GAME_OVER = 4 gameState = BRAND_NEW_GAME 'Initialization: mazeScale = 8 'Size of maze and distance between tiles. The game runs better when 'the mazeScale is 2 x the number of animation frames. I set the total animation frames 'to 4 because it gave the best performance while making the math easier. gameScreenHeight = 375 gamescreenWidth = 225 monsterEatenCtr = 0 'Counts the number of monsters eaten in succession per energizer (4= bonus) monsterBonusPts = 1000 'Pts given to player for eating 4 monsters in succession. monsterPts = 200 'Points player gets when he/she eats a monster. monsterPtsMuliplier = 2 'Causes player to get bonus points when monsters are eaten in succession. monstersEatenPerLevel = 0'Counts the number of mosters eaten per level. SBC gets a life if he eats 16 monsters per level. gameSpeed = 20'<-- Decrease if game runs too slowly gameScore = 0 gameLevel = 0 pelletScore = 25 energizerScore = 100 hasReached50K = "False" 'Flag to track if score reaches 50,000. Player gets extra life. initialCountDownTime = 80 'Amount of time (cycles) the monsters stay "frightened" globalCycleCtr = 0 'Used for syncronization and scheduling. '********************************** 'Game loop '*********************************** While (gameState <> GAME_OVER) keyPressed = GraphicsWindow.LastKey start = Clock.ElapsedMilliseconds globalCycleCtr = globalCycleCtr + 1 If (gameState = BRAND_NEW_GAME) Then InitializeLookupTables() SetupGraphicsWindow() LoadBitmaps() InitializeSprites() SpriteArray[SBC][Lives] = 3 gameState = ADVANCE_LEVEL ElseIf (gameState = ADVANCE_LEVEL) Then globalCycleCtr = 0 monstersEatenPerLevel = 0 selectedRotation = 0 ' SBC goes through 4 max rotations. sbcDirection = Dir_R ' SBC moves to the right when level starts. SmallDelay() UpdateLevelState() ConstructGameElements() splashText = "L E V E L : "+ gameLevel DisplayLevelSplash() gameState = PLAY_LEVEL ElseIf (gameState = PLAY_LEVEL) Then LeaveMonsterPenOneByOne() 'Each sprite has a counter that it uses to track when it reaches a tile when moving though the maze. 'When this counter reaches mazeScale, the sprite updates it info and draws. 'Each sprite also has a spritespeed variable that it uses to set its movement speed. For example, 'if spritespeed = 1 then updates will be done on each tick of the global counter. If spritespeed = 2 then 'updates will be done on every 2nd tick, which will slow down that sprite, etc. For Sprites = firstSprite to lastSprite IF Math.Remainder(globalCycleCtr,SpriteArray[Sprites][spriteSpeed])=0 Then Update() Draw() EndIf Endfor ElseIf (gameState = REPLAY_LEVEL) Then sbcDirection = Dir_R Sprites=1 SpriteArray[SBC][Lives] = SpriteArray[sbc][Lives] - 1 SpriteArray[SBC][State] = NORMAL globalCycleCtr = 0 SmallDelay() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() DrawSprites() '<---BUG FIX. A call to DrawSprites( ) fixes an issue where SBC dissapears when level restarts. SmallDelay() gameState = PLAY_LEVEL If (SpriteArray[SBC][Lives] = 0) Then gameState = GAME_OVER splashText = "Game Over" DisplayLevelSplash() Endif Endif delay = gameSpeed - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf KeyboardHandler() EndWhile 'End of main state machine '*********************************************************************************** Sub SmallDelay Program.Delay(500) EndSub '******************************************************************************************* 'Updates various games elements (eg maze color, game speed, etc) as the player advances to a new level: '- gameSpeed: Overall speed of game. Game gets faster on each level. '- initialCountDownTime: amount of time that monsters stay afraid. Decreases on each level. Sub UpdateLevelState If math.Remainder(gameLevel,4) = 1 Then mazeBorderColor = "Cyan" ElseIf math.Remainder(gameLevel,4) = 2 then mazeBorderColor = "Red" Elseif math.Remainder(gameLevel,4) = 3 then mazeBorderColor = "midnightblue" Elseif math.Remainder(gameLevel,4) = 0 then mazeBorderColor = "magenta" EndIf gameLevel = gameLevel + 1 gameSpeed = gameSpeed - 2 If (gameSpeed <= 0) Then gameSpeed = 0 EndIf 'Give the player a new life on levels 4 and 8: If (gameLevel = 4 Or gameLevel = 8) Then SpriteArray[sbc][Lives]=SpriteArray[sbc][Lives] + 1 EndIf 'Reduce the amount of time that the monsters stay "Frightened" as game progresses. 'At much higher levels, the monsters won't stay frighened at all: initialCountDownTime = initialCountDownTime - 2 If initialCountDownTime <= 0 Then initialCountDownTime = 0 EndIf EndSub '******************************************************************************************* 'Dsplays a splash screen at the start of each level: Sub DisplayLevelSplash GraphicsWindow.FontSize=14 GraphicsWindow.BrushColor="white" l=Shapes.AddText(splashText) Shapes.Move(l,-200,205) Shapes.Animate(l,80,205,1000) SmallDelay() SmallDelay() SmallDelay() Shapes.Animate(l,-200,205,1000) EndSub '******************************************************************************************* 'The variables Dir_L, Dir_U, Dir_R, Dir_D are used as indexes into the xModifier and yModifier lookup tables. 'For example, xModifier[L] & yModifier[L] produces -1 and 0 respectively. When added to XY or RC values this will cause 'the sprite to go left, etc: Sub KeyboardHandler Dir_L = 1 Dir_U = 2 Dir_R = 3 Dir_D = 4 If (keyPressed = "Left") Then sbcDirection = Dir_L Elseif (keyPressed = "Right") Then sbcDirection = Dir_R Elseif (keyPressed = "Up") Then sbcDirection = Dir_U Elseif (keyPressed = "Down") Then sbcDirection = Dir_D Elseif (keyPressed = "Escape") Then gameState = GAME_OVER Endif EndSub '******************************************************************************************* Sub MoveSBC 'This routine moves SBC around the screen and causes SBC to stop at borders.It checks the maze 'locations adjacent to SBC's current location aganist the direction chosen by an arrow key press. 'If the new direction is possible (eg no borders in the way) SBC will go in the new direction. If 'the new direction is not possible, but the previous direction is, SBC will continue traveling in the 'direction it was moving in prior to the arrow key press. If neither direction is possible, SBC 'will stop moving: If Sprites=SBC Then canMoveInOldDirection = "False" canMoveInNewDirection = "False" 'Get maze data ahead of SBC: aheadDirX = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] aheadDirY = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] aheadDirData = Maze[aheadDirY][aheadDirX] 'Get maze data at location based on arrow key press: newDirX = SpriteArray[SBC][mazeCol] + xModifier[SbcDirection] newDirY = SpriteArray[SBC][mazeRow] + yModifier[SbcDirection] newDirData = Maze[newDirY][newDirX] 'The mazeTokens array holds data that represent ares that are NOT blocked by borders. For a = firstToken To lastToken If (mazeTokens[a] = newDirData) Then canMoveInNewDirection = "True" Goto _XIT_4Loop_Early EndIf If (mazeTokens[a] = aheadDirData) Then canMoveInOldDirection = "True" EndIf EndFor _XIT_4Loop_Early: 'If the new direction is possible, go in new direction: If (canMoveInNewDirection = "True") Then SpriteArray[SBC][DX] = xModifier[sbcDirection] SpriteArray[SBC][DY] = yModifier[sbcDirection] selectedRotation = rotationLookupTable[sbcDirection] EndIf 'If neither old nor new directions are possible, come to a stop: If (canMoveInNewDirection = "False" And canMoveInOldDirection = "False") Then SpriteArray[SBC][DX] = 0 SpriteArray[SBC][DY] = 0 EndIf SpriteArray[SBC][mazeCol] = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] SpriteArray[SBC][mazeRow] = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] EatPellet() EndIf EndSub '******************************************************************************************* Sub MoveMonstersTowardTarget 'This routine moves the monsters toward a target while allowing them to navigate around the maze 'borders. LL is a temporary array: INVALID = 9999 '9999 is used as an invalid flag because the total distance across the maze is 'much lower than 9999 pixels. Later, when the code calculates the distance 'between source to target, anything marked 9999 won't be considered. If (Sprites <> SBC) Then '<--SBC has his own movement routine (see MoveSBC) For a = 1 To 4 'step through XY/RC modifier table: SourceX = SpriteArray[Sprites][mazeCol] + xModifier[a] SourceY = SpriteArray[Sprites][mazeRow] + yModifier[a] targetX = SpriteArray[Sprites][targetCol] targetY = SpriteArray[Sprites][targetRow] For b = firstToken To lastToken 'If the maze area being examined is not a border then calculate the distance from that maze area ' to the target using the Manhattan Distance formula (SourceX-targetCol)+(SourceY-targetRow)... If mazeTokens[b]=Maze[SpriteArray[Sprites][mazeRow] + yModifier[a]][SpriteArray[Sprites][mazeCol]+ xModifier[a]] Then LL[a] = 1+(math.Abs(Sourcex-targetx) + math.Abs(Sourcey-targety)) Goto _XIT4 '...otherwise mark it as invalid because it's a border : Else LL[a] = INVALID EndIf EndFor _XIT4: EndFor 'For each maze area stored in the LL array, check to see if that was visited by the monster during previous 'game loop cycle. If so mark it INVALID, then save the monster's current maze location 'in VX, VY. These two steps will force the monster to travel in forward directions only (no reversing direction): For c = 1 To 4 If SpriteArray[Sprites][mazeCol] + xModifier[c] = SpriteArray[Sprites][VX] Then If SpriteArray[Sprites][mazeRow] + yModifier[c] = SpriteArray[Sprites][VY] Then LL[c] = INVALID EndIf EndIf EndFor SpriteArray[Sprites][VX] = SpriteArray[Sprites][mazeCol] SpriteArray[Sprites][VY] = SpriteArray[Sprites][mazeRow] 'Get the smallest number in temporary LL array, which will represent the direction to move in '1 = go left, 2 = go up, 3 = to right, 4 = go down: initialValue = LL[1] For ictr = 1 TO 4 If initialValue >= LL[ictr] THEN initialValue = LL[ictr] elementfound = ictr EndIf EndFor 'Set the movement direction. The xModifier/yModifier lookup tables eliminate the need for If/Then tests here: SpriteArray[Sprites][DX] = xModifier[elementfound] SpriteArray[Sprites][DY] = yModifier[elementfound] '** There is at least one circumstance where the monster finds a dead end - when the monster is in the 'monster pen at level start. In this instance, the monster's L, D, & R adjacent areas will be invalid 'due to being blocked by visible and invisible borders, and U is blocked because it will be added to the 'VX/VY variables after the first game cycle. When this happens the VX/VY variables must be deleted 'and on the next game cycle the monster will move out of dead end. ' if LL[elementfound] = INVALID Then SpriteArray[Sprites][DX] = 0 SpriteArray[Sprites][DY] = 0 SpriteArray[Sprites][VX] = 0 SpriteArray[Sprites][VY] = 0 EndIf 'Finally, move toward target: SpriteArray[Sprites][mazeCol] = (SpriteArray[Sprites][mazeCol] + SpriteArray[Sprites][dx]) SpriteArray[Sprites][mazeRow] = (SpriteArray[Sprites][mazeRow] + SpriteArray[Sprites][dy]) EndIf Endsub '******************************************************************************************* 'Detects when sprites touch each other and when sprites enter special areas of the maze: Sub CollisionDetect If Sprites <> SBC Then CheckRectangles() If isTouching = "True" Then isTouching = "False" 'Monster dies if touching SBC while fightened and then monster returns to the monster pen: If SpriteArray[Sprites][State] = FRIGHT then ShowEatSplash() SpriteArray[Sprites][State] = DIE hasEatenMonster = "True" ScoreAndBonusManager() 'SBC dies if touching monster when energizer is not active: ElseIf SpriteArray[Sprites][State] = CHASE then SpriteArray[SBC][State] = DIE gameState = REPLAY_LEVEL EndIf hasEatenMonster = "False" EndIf 'When monster reaches monster pen, get body back and leave: If SpriteArray[Sprites][mazeCol] = MonsterPenX and SpriteArray[Sprites][mazeRow]= MonsterPenY Then If SpriteArray[Sprites][State] = DIE then SpriteArray[Sprites][State] = EMERGE EndIf EndIf 'When monster has left monster pen, go back to chasing SBC: If SpriteArray[Sprites][mazeCol] = emergeX and SpriteArray[Sprites][mazeRow] = emergeY Then If SpriteArray[Sprites][State] = EMERGE then SpriteArray[Sprites][State] = CHASE EndIf EndIf EndIf '***BUG FIX: If a monster is in the monster pen when an energizer is eaten it will switch from whatever mode its in to 'FRIGHT mode. However, FRIGHT mode closes to doors when causes the monster to get trapped. This is a side effect - 'my intention was to keep the monsters from re-entering the pen prematurely. The fix below checks to see if a monster 'is in the pen and is the wrong mode. If so, it is switched to EMERGE mode so that it can properly emerge from the pen: If (SpriteArray[Sprites][mazeCol] = MonsterPenX) and (SpriteArray[Sprites][mazeRow] = MonsterPenY) Then If (SpriteArray[Sprites][State] <> DIE) Or (SpriteArray[Sprites][State] <> EMERGE) then SpriteArray[Sprites][State] = EMERGE EndIf EndIf EndSub '******************************************************************************************* 'Sets the targets that the monsters will move towards: Sub SetupMonsterTargets IF (Sprites <>SBC) then 'Sets ghosts to meander around the screen after SBC eats a power pellet: If SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][targetRow] = math.GetRandomNumber(maxMazeRows) SpriteArray[Sprites][targetCol] = math.GetRandomNumber(maxMazeCols) 'Sends the monsters back to monster pen after being eaten by SBC: ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][targetCol] = MonsterPenX SpriteArray[Sprites][targetRow] = MonsterPenY 'Makes the monsters leave home base: ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][targetCol] = emergeX SpriteArray[Sprites][targetRow] = emergeY Elseif SpriteArray[Sprites][State] = CHASE Then If Sprites = RedMonster Then 'Red monster pursues directly: SpriteArray[RedMonster][targetCol] = SpriteArray[SBC][mazeCol] SpriteArray[RedMonster][targetRow] = SpriteArray[SBC][mazeRow] ElseIf Sprites = PinkMonster Then 'Pink monster tries to ambush (***TO DO: needs to be fixed***): SpriteArray[PinkMonster][targetCol] = SpriteArray[SBC][mazeCol] + (SpriteArray[SBC][DX]-1) SpriteArray[PinkMonster][targetRow] = SpriteArray[SBC][mazeRow] + (SpriteArray[SBC][DY]-1) ElseIf Sprites = OrangeMonster Then 'Orange monster wanders around SpriteArray[OrangeMonster][targetCol] = math.GetRandomNumber(maxMazeCols) SpriteArray[OrangeMonster][targetRow] = math.GetRandomNumber(maxMazeRows) ElseIf Sprites = BlueMonster Then 'Blue monster considers red monster's coordinates and SBC's coordinates wheb determining how to move: SpriteArray[BlueMonster][targetCol] = math.abs(SpriteArray[SBC][mazeCol] + SpriteArray[RedMonster][mazeCol]) SpriteArray[BlueMonster][targetRow] = math.abs(SpriteArray[SBC][mazeRow] + SpriteArray[RedMonster][mazeRow]) EndIf EndIf ENDIF EndSub '******************************************************************************************* 'Animation manager. The animation frames are stored in the ImageArray 2D array. This routine 'sets the indexes into that array. FrameCtr + Offset is used as the index into ImageArray. 'When Offset = zero all sprites go through the normal 4-cycle animation sequence. When 'offset = 5, the monsters turn purple (Fright Mode), and when the offset = 6 the monsters turn dark gray '(Die Mode). Sub SetupAnimationSequence SpriteArray[SBC][LastFrame] = 4 SpriteArray[SBC][FirstFrame] = 1 SpriteArray[SBC][offset] = 0 If (Sprites <> SBC) Then If SpriteArray[Sprites][State] = CHASE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 ElseIf SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][offset] = 5 SpriteArray[Sprites][LastFrame] = 5 SpriteArray[Sprites][FirstFrame] = 5 ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][offset] = 6 SpriteArray[Sprites][LastFrame] = 6 SpriteArray[Sprites][FirstFrame] = 6 ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 Endif EndIf FlashMonsters() EndSub '******************************************************************************************* Sub EatPellet erasePelletFromScreen = "FALSE" mazeData = Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])] 'Pellet = mazeToken[1]. Energizer = mazeToken[2]: If (mazeData = mazeTokens[1] Or mazeData = mazeTokens[2]) Then Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])]=mazeTokens[0] 'empty this maze location pelletCount = pelletCount - 1 erasePelletFromScreen = "True" gameScore = gameScore + pelletScore If (mazeData = mazeTokens[1]) Then gameScore = gameScore + pelletScore ElseIf (mazeData = mazeTokens[2]) then monsterEatenCtr=0 SetMonstersToFrightState() gameScore = gameScore + energizerScore energizerTimer = ACTIVE energizerTime = initialCountDownTime EndIf If pelletCount <= 0 Then gameState = ADVANCE_LEVEL EndIf EndIf DoEnergizerTimer() EndSub '******************************************************************************************* 'Sets all monsters to FRIGHT state. VY & VX are zeroed out so that the monsters can switch 'directions. (MoveMonstersTowardTarget( ) normally restricts the monsters to forward-only movements): Sub SetMonstersToFrightState For ee = firstMonster to lastMonster if SpriteArray[ee][State] <> DIE then SpriteArray[ee][State] = FRIGHT shapes.SetOpacity(ImageArray[ee][5],100) SpriteArray[ee][VY] = 0 SpriteArray[ee][VX] = 0 EndIf Endfor EndSub '******************************************************************************************* 'Sets all monsters to CHASE state. This is a bug fix to keep the monsters from switching out of DIE 'mode prematurely: Sub MakeMonstersChase For mc = firstMonster to lastMonster If SpriteArray[mc][State] <> DIE then SpriteArray[mc][State] = CHASE EndIf Endfor EndSub '******************************************************************************************* 'Manages the count down timer that determines how long an energizer lasts. Sub DoEnergizerTimer If (energizerTimer = ACTIVE) Then If (energizerTime <> 0) Then energizerTime = energizerTime -1 Else energizerTimer = INACTIVE monsterEatenCtr=0 MakeMonstersChase() Endif Endif EndSub '******************************************************************************************* 'Dispatch routine for erasing pellets/energizers from the screen: Sub ErasePellet pelletColor = "black" pelletX = SpriteArray[SBC][screenX] + sWidth - mazeScale pelletY = SpriteArray[SBC][screenY] + sHeight - mazeScale DrawEnergizer() EndSub '******************************************************************************************* 'Draws/erases an energizer Sub DrawEnergizer pelletSize = 6 xOffset = -6 yOffset = -6 DP() Endsub '******************************************************************************************* 'Draws/erases a pellet Sub DrawPellet pelletSize = 3 xOffset = -3 yOffset = -3 DP() EndSub '******************************************************************************************* Sub DP GraphicsWindow.BrushColor = pelletColor GraphicsWindow.FillEllipse(pelletX+xOffset, pelletY+yOffset, pelletSize, pelletSize) EndSub '******************************************************************************************* 'Removes sprites from the maze Sub ClearSpritesFromaze For r=firstSprite To lastSprite For t = 1 To 6 Shapes.move(ImageArray[r][t],-100,-100) EndFor EndFor EndSub '******************************************************************************************* 'Draws sprites on screen while advancing through the animation sequence setup by SetupAnimationSequence(). Sub DrawSprites 'To reduce flicker only draw sprites that are moving (SBC sometimes stops) If SpriteArray[Sprites][dx]<>0 Or SpriteArray[Sprites][dy]<>0 Then 'Get a reference to the current animation frame. We will hide it later: oldFrameCtr=SpriteArray[Sprites][FrameCtr] SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][frameCtr]+1+SpriteArray[Sprites][offset] 'Advance to next frame and check to see if all frames have been displayed: If SpriteArray[Sprites][frameCtr]>SpriteArray[Sprites][lastFrame] then SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][firstFrame] Endif 'Update screen coordinates: SpriteArray[Sprites][screenX]= SpriteArray[Sprites][screenX]+ SpriteArray[Sprites][DX] * 1 SpriteArray[Sprites][screenY]= SpriteArray[Sprites][screenY]+ SpriteArray[Sprites][DY] * 1.5 'Get reference to new animation frame and apply rotation (for SBC): newFrameCtr=SpriteArray[Sprites][frameCtr] if Sprites = SBC Then Shapes.Rotate(ImageArray[Sprites][newFrameCtr], selectedRotation) EndIf 'Finally, hide previous frame and show new animation frame: shapes.Move(ImageArray[Sprites][oldFrameCtr],-20,-20) Shapes.Move(ImageArray[Sprites][newFrameCtr], SpriteArray[Sprites][screenX], SpriteArray[Sprites][screenY]) EndIf If erasePelletFromScreen = "True" Then ErasePellet() EndIf EndSub '******************************************************************************************* 'This routine intializes general purpose global lookup tables. Sub InitializeLookupTables 'The xModifier & yModifier arrays are used to modify the XY screen coordinates and RC maze coordinates: xModifier[0] = 0 'Stop moving xModifier[1] =-1 'Move Left (when added to X) xModifier[2] = 0 ' xModifier[3] = 1 'Move Right (when added to X) xModifier[4] = 0 yModifier[0] = 0 'Stop moving yModifier[1] = 0 ' yModifier[2] =-1 'Move Up (when added to Y) yModifier[3] = 0 ' yModifier[4] = 1 'Move Down (when added to Y) 'rotationLookupTable holds the rotation angles for SBC. SbcDirection is used as an index: rotationLookupTable[1] = 180 rotationLookupTable[2] = 270 rotationLookupTable[3] = 0 rotationLookupTable[4] = 90 EndSub '******************************************************************************************* 'Sets up sprite data structure and establishes related variables: Sub InitializeSprites 'State variables for sprites: DIE = 0 NORMAL = 1 CHASE = 2 SCATTER = 3 '<--not implemented yet FRIGHT = 4 EMERGE = 5 'State variables for energizer timer: ACTIVE = 1 INACTIVE = 0 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite: firstSprite = SBC lastSprite = PinkMonster firstMonster = RedMonster lastMonster = PinkMonster 'Variables for dimension #2: screenX = 1 'screen x coordinate screenY = 2 'screen y coordinate mazeCol = 3 'maze col mazeRow = 4 'maze row DX = 5 'x/col modifier DY = 6 'y/row modifier targetCol= 7 'maze target col targetRow= 8 'maze target row VX = 9 'visited maze col VY = 10 'visited maze row State = 11 Lives = 12 FrameCtr = 13 'Index into ImageArray[ ][ ] Offset = 14 FirstFrame = 15 LastFrame = 16 cycleCounter= 17 spriteSpeed= 18 'Initialize: For spriteCtr = firstSprite To lastSprite SpriteArray[spriteCtr][FirstFrame] = 1 SpriteArray[spriteCtr][LastFrame] = 4 SpriteArray[spriteCtr][FrameCtr] = 4 SpriteArray[spriteCtr][offset] = 4 SpriteArray[spriteCtr][DX] = 0 SpriteArray[spriteCtr][DY] = 0 SpriteArray[spriteCtr][VX] = 0 SpriteArray[spriteCtr][VY] = 0 SpriteArray[spriteCtr][targetCol] = 0 SpriteArray[spriteCtr][targetRow] = 0 SpriteArray[spriteCtr][State] = CHASE SpriteArray[spriteCtr][spriteSpeed] = 1 SpriteArray[spriteCtr][cycleCounter] = 1 Endfor SpriteArray[SBC][State] = NORMAL sbcDirection = Dir_R EndSub '******************************************************************************************* Sub PositionSpritesInMaze 'Used for alignment hacks: xxOffset= 0 yyOffset= 0 'Position SBC two tiles underneath Monster pen: SpriteArray[SBC][mazeCol] = 15 SpriteArray[SBC][mazeRow] = 24 'Position Red Monster outside & above Monster pen: SpriteArray[RedMonster][mazeCol] = 12 SpriteArray[RedMonster][mazeRow] = 12 'Blue, Orange and Pink Monsters inside Monster pen: SpriteArray[BlueMonster][mazeCol] = 12 SpriteArray[BlueMonster][mazeRow] = 16 SpriteArray[OrangeMonster][mazeCol] = 17 SpriteArray[OrangeMonster][mazeRow] = 16 SpriteArray[PinkMonster][mazeCol] = 14 SpriteArray[PinkMonster][mazeRow] = 15 'Set correct screen positions: For Sprites = firstSprite to lastSprite AdjustScreenCoords() EndFor EndSub '******************************************************************************************* 'Using maze RC values, calculate screen XYs: Sub AdjustScreenCoords SpriteArray[Sprites][screenX] = (SpriteArray[Sprites][mazeCol]) * mazeScale - mazeScale SpriteArray[Sprites][screenY] = (SpriteArray[Sprites][mazeRow]) * mazeScale * 1.5 - mazeScale EndSub '******************************************************************************************* Sub LoadBitmaps 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite. 'Variables to select the sprites (dimension #1 of SpriteArray): SBC = 1 RedMonster = 2 BlueMonster = 3 OrangeMonster = 4 PinkMonster = 5 sWidth = mazeScale * 2 sHeight = mazeScale * 2 'ImageArray is a 2D array that holds references to the bitmaps used by the sprites. Dimension #1 is used 'to select the sprite, dimension #2 is used to select the bitmap. 'Load bitmaps for normal animation sequence: filePath = Program.Directory +"\" 'SBC animation frames ImageArray[SBC][1]=shapes.addimage("http://farm9.staticflickr.com/8240/8528887960_413fda8a5a_t.jpg") ImageArray[SBC][2]=shapes.addimage("http://farm9.staticflickr.com/8379/8528887958_f8f6d3e534_t.jpg") ImageArray[SBC][3]=shapes.addimage("http://farm9.staticflickr.com/8520/8527774169_b73baef828_t.jpg") ImageArray[SBC][4]=shapes.addimage("http://farm9.staticflickr.com/8379/8528887958_f8f6d3e534_t.jpg") 'Red Monster animation frames ImageArray[RedMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") ImageArray[RedMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8388/8528887972_d45aa82d69_t.jpg") 'Blue Monster animation frames ImageArray[BlueMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") ImageArray[BlueMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8378/8527774263_5f7d6e6aac_t.jpg") 'Orange Monster animation frames ImageArray[OrangeMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") ImageArray[OrangeMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8377/8527774201_6fced83ebf_t.jpg") 'Pink Monster animation frames ImageArray[PinkMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") ImageArray[PinkMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8523/8527774181_5fa1ebe6bb_t.jpg") For s= 1 to 5 'Load bitmaps for FRIGHT Mode: ImageArray[s][5]=shapes.addimage("http://farm9.staticflickr.com/8102/8528933134_d80645e3cc_t.jpg") 'Load bitmaps for DIE mode: ImageArray[s][6]=shapes.addimage("http://farm9.staticflickr.com/8532/8528888036_85d4b2906d_t.jpg") Shapes.SetOpacity(ImageArray[s][6],50) Endfor ClearSpritesFromaze() EndSub ''******************************************************************************************* 'Loads maze pattern into maze array, counts the number of pellets added to maze, and gets the 'maze XY coordinates for special areas. Also creates and populates the mazeToken[ ] lookup table: ' Sub LoadMaze M[1] = "/------\/----------\/------\" M[2] = "|......||..........||......|" M[3] = "|*/--\.||./------\.||./--\*|" M[4] = "|.(--).().(------).().(--).|" M[5] = "|..........................|" M[6] = "(-\./\./---\./\./---\./\./-)" M[7] = "oo|.||.| |.||.| |.||.|oo" M[8] = "oo|.||.(---).||.(---).||.|oo" M[9] = "oo|.||.......||.......||.|oo" M[10] = "oo|.|(--\+/--)(--\+/--)|.|oo" M[11] = "--).(---)+(------)+(---).(--" M[12] = "LT+.+++++++E++++++++++++.+SR" M[13] = "--\./---\+/AAAAAAo+/---\./--" M[14] = "oo|.|/--)+|+Co+B+|+(--\|.|oo" M[15] = "oo|.||++++|+oo+o+|++++||.|oo" M[16] = "oo|.||+/\+|MCo+B+|+/\+||.|oo" M[17] = "oo|.()+||+(------)+||+().|oo" M[18] = "oo|.+++||++++++++++||+++.|oo" M[19] = "oo|./--)(--\+/\+/--)(--\.|oo" M[20] = "oo|.(------)+||+(------).|oo" M[21] = "oo|.......+++||+++.......|oo" M[22] = "oo|./---\./--)(--\./---\.|oo" M[23] = "/-).(---).(------).(---).(-\" M[24] = "|............++............|" M[25] = "|./--\./---\./\./---\./--\.|" M[26] = "|.|oo|.|/--).||.(--\|.|oo|.|" M[27] = "|.|oo|.||....||....||.|oo|.|" M[28] = "|*|oo|.||./--)(--\.||.|oo|*|" M[29] = "|.(--).().(------).().(--).|" M[30] = "|..........................|" M[31] = "(--------------------------)" maxMazeRows = Array.GetItemCount(M) maxMazeCols = Text.GetLength(M[1]) 'mazeTokens[ ] hold tokens that represent walkable space in the maze: firstToken = 0 lastToken = 2 mazeTokens[0]= "+" mazeTokens[1]= "." mazeTokens[2]= "*" 'Load the maze pattern into the maze[ ] [ ] array: For rows = 1 To maxMazeRows For cols = 1 To maxMazeCols maze[rows][cols] = Text.GetSubText(M[rows], cols, 1) If maze[rows][cols] = mazeTokens[1] Or maze[rows][cols] = mazeTokens[2] Then pelletCount = pelletCount + 1 EndIf 'Special areas: If Maze[rows][cols] ="M" Then 'DIE mode target Monster Pen tile Maze[rows][cols] = mazeTokens[0] monsterpenX = cols MonsterPenY = rows ElseIf Maze[rows][cols] ="E" Then 'Emerge mode target tile Maze[rows][cols] = mazeTokens[0] emergeX = cols emergeY = rows ElseIf Maze[rows][cols] ="L" Then 'Left tunnel tile Maze[rows][cols] = mazeTokens[0] leftTunnelX = cols leftTunnelY = rows ElseIf Maze[rows][cols] ="R" Then 'Right tunnel tile Maze[rows][cols] = mazeTokens[0] rightTunnelX = cols rightTunnelY = rows ElseIf Maze[rows][cols] ="S" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld1X = cols sld1Y = rows ElseIf Maze[rows][cols] ="T" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld2X = cols sld2Y = rows EndIf EndFor EndFor 'Delete the temporary array holding the maze structure: M="" EndSub '******************************************************************************************* 'Steps through maze[ ] [ ] and draws the pattern on screen: Sub DrawMaze mazeBackgroundColor = "black" GraphicsWindow.BackgroundColor= mazeBackgroundColor x = 0 y = 0 mWidth = mazeScale mHeight = mazeScale MMX = (X + 1 * mWidth) MMY = (Y + 1.5 * mHeight) MMH = (1.5 * mHeight) MMW = (1 * mWidth) For rows = 1 To maxMazeRows tempMMYrows = MMY*rows 'helps speed up draw operations a bit. For cols = 1 To maxMazeCols mazeData = Maze[rows][cols] GraphicsWindow.PenColor = mazeBorderColor GraphicsWindow.PenWidth = 2 ' Upper Left corner: if mazeData = "/" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, mazeCol+MMW*cols, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, MMY+MMH*rows) 'Upper Right corner: elseif mazeData = "\" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows+MMH) 'Lower Left corner: elseif mazeData = "(" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) 'Lower right corner: elseif mazeData = ")" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) ' 'Vertical line: elseif mazeData = "-" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) ' 'Vertical line for top door elseif mazeData = "A" then GraphicsWindow.PenColor="white" GraphicsWindow.PenWidth="1" GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols-MMW, TempMMYrows) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols+MMW, TempMMYrows) ' 'Horizontal line: elseif mazeData = "|" then GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows-MMH) GraphicsWindow.DrawLine(MMX*cols,TempMMYrows, MMX*cols, TempMMYrows+MMH) 'Pellet: elseif mazeData = "." then pelletColor = "white" pelletX=(cols * MMW) pelletY=(rows * MMY) DrawPellet() 'Energizer: elseif mazeData = "*" then pelletColor = "white" pelletX=(cols * MMW) pelletY=(rows * MMY) DrawEnergizer() Endif EndFor EndFor EndSub '******************************************************************************************* 'There are three invisible borders that keep the blue, pink and orange ghosts in the monster pen 'and also keeps the monsters from getting back in unless they are in EMERGE or DIE modes. 'The doors are "opened" by adding their tokens to the mazeToken[ ] array and extending the lastToken pointer. 'The doors are "closed" by resetting the lastToken pointer: Sub CloseDoors lastToken = 2 EndSub '******************************************************************************************* Sub OpenLeftDoor mazeTokens[3] = "B" lastToken = lastToken + 1 EndSub '******************************************************************************************* Sub OpenRightDoor mazeTokens[3] = "C" lastToken = lastToken + 1 EndSub '******************************************************************************************* Sub OpenTopDoor mazeTokens[3] = "A" lastToken = lastToken + 1 EndSub '******************************************************************************************* 'This routines causes the monsters to leave the monster pen one-by-one after a certain number of 'cycles have past. This done at game start, on each new level and when a level is replayed . The 'invisible "doors" open whenever the monsters are in EMERGE or DIE modes: Sub LeaveMonsterPenOneByOne If globalCycleCtr = 100 then SpriteArray[PinkMonster][state] = EMERGE ElseIf globalCycleCtr = 200 Then SpriteArray[OrangeMonster][state] = EMERGE Elseif globalCycleCtr = 400 Then SpriteArray[BlueMonster][state] = EMERGE EndIf EndSub '******************************************************************************************* 'Dispatches update-related routines: Sub Update SpriteArray[Sprites][cycleCounter]=SpriteArray[Sprites][cycleCounter]+1 'Do updates when a sprite reaches a new tile. Distance between tiles is set by MazeScale: if (SpriteArray[Sprites][cycleCounter] > mazeScale) Then MoveSBC() SetupMonsterTargets() SetupSpriteSpeed() OpenCloseDoors() MoveMonstersTowardTarget() CheckGoThroughTunnels() SpriteArray[Sprites][cycleCounter]=1 DisplayScore() DisplayLevel() EndIf Endsub '******************************************************************************************* 'Displaches draw-related routines: Sub Draw SetupAnimationSequence() DrawSprites() CollisionDetect() CheckGoThroughTunnels() Endsub '******************************************************************************************* 'Ensures that sprites are moving at correct speed: Sub SetupSpriteSpeed If SpriteArray[Sprites][state] = CHASE Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = FRIGHT Then SpriteArray[Sprites][spriteSpeed] = 2 ElseIf SpriteArray[Sprites][state] = NORMAL Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = DIE Then SpriteArray[Sprites][spriteSpeed] = 1 EndIf EndSub '******************************************************************************************* 'Can't speed up maze drawing, so black out the game screen and then construct maze and position 'bitmaps underneath the black cover: Sub ConstructGameElements BlackOutGameScreen() LoadMaze() DrawMaze() DisplayLevel() DisplayLives() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() RemoveBlackScreen() EndSub '******************************************************************************************* 'Causes the monsters to flash briefly as a warning to the player that the monsters are about 'to swtich from Fright to Chase states: '***BUG ??: This routine doesn't work well with Silverlight*** Sub FlashMonsters If (energizerTimer = ACTIVE) And (SpriteArray[Sprites][State] = FRIGHT) Then If (energizerTime < 20) Then If (Math.Remainder(energizerTime,3)=0) Then shapes.SetOpacity(ImageArray[sprites][5],100) 'Visible Else shapes.SetOpacity(ImageArray[sprites][5],10) 'Faint EndIf EndIf EndIf EndSub '********************************************************************************* 'Allows game to cage in or release monsters from monster pen: Sub OpenCloseDoors If SpriteArray[Sprites][State] = CHASE Then CloseDoors() ElseIf SpriteArray[Sprites][State] = FRIGHT Then CloseDoors() ElseIf SpriteArray[Sprites][State] = NORMAL Then CloseDoors() ElseIf SpriteArray[Sprites][State] = DIE Then OpenLeftDoor() OpenRightDoor() OpenTopDoor() ElseIf SpriteArray[Sprites][State] = EMERGE Then OpenLeftDoor() OpenRightDoor() OpenTopDoor() EndIf EndSub '************************************************************************** Sub ScoreAndBonusManager If (hasEatenMonster = "True") Then monsterEatenCtr = monsterEatenCtr + 1 gameScore = gameScore + monsterPts +(monsterEatenCtr * monsterPts) 'Give player a bonus when all 4 monsters are eaten in succession: If monsterEatenCtr = 4 Then gameScore = gameScore + monsterBonusPts splashText=monsterBonusPts + "PT BONUS!" DisplayLevelSplash() monsterEatenCtr=0 EndIf monstersEatenPerLevel = monstersEatenPerLevel + 1 'Give player an extra life whenever 16 monsters are eaten per level: If monstersEatenPerLevel = 16 Then SpriteArray[sbc][lives] = SpriteArray[sbc][lives] + 1 splashText="EXTRA LIFE ADDED!" monstersEatenPerLevel=0 DisplayLevelSplash() EndIf hasEatenMonster="False" EndIf If hasReached50K="False" Then If gameScore > 50000 Then hasReached50K="True" SpriteArray[sbc][lives] = SpriteArray[sbc][lives] + 1 splashText="EXTRA LIFE ADDED!" DisplayLevelSplash() DisplayLives() EndIf EndIf EndSub '******************************************************************************* 'Bounding Box collision detection routine from "Beginning Microsoft Small Basic", 9-30 Sub CheckRectangles isTouching = "False" Object1X=SpriteArray[sbc][screenX] Object1Y=SpriteArray[sbc][screenY] Object2X=SpriteArray[Sprites][screenX] Object2Y=SpriteArray[Sprites][screenY] If ((Object1X + 6 +sWidth - 6) > Object2X +6) Then  If (Object1X +6 < (Object2X+6 + sWidth - 6)) Then  If ((Object1Y+6 + sHeight - 6) > Object2Y+6) Then  If (Object1Y+6 < (Object2Y+6 + sHeight - 6)) Then  isTouching = "True" EndIf  EndIf EndIf EndIf EndSub '************************************************************************ 'Allows sprites to travel through tunnels and causes the monsters to slow down at tunnel entrances: sub CheckGoThroughTunnels If Sprites <> SBC Then if (SpriteArray[Sprites][mazecol]=sld1X And SpriteArray[Sprites][mazeRow]=sld2Y) or (SpriteArray[Sprites][mazecol]=sld2X And SpriteArray[Sprites][mazeRow]=sld2Y) Then SpriteArray[Sprites][spriteSpeed]=4 EndIf endif If SpriteArray[Sprites][mazeCol] = rightTunnelX and SpriteArray[Sprites][mazeRow] = rightTunnelY Then SpriteArray[Sprites][mazeCol] = leftTunnelX SpriteArray[Sprites][mazeRow] = leftTunnelY AdjustScreenCoords() ElseIf SpriteArray[Sprites][mazeCol] = leftTunnelX and SpriteArray[Sprites][mazeRow] = leftTunnelY Then SpriteArray[Sprites][mazeCol] = rightTunnelX SpriteArray[Sprites][mazeRow] = rightTunnelY AdjustScreenCoords() EndIf EndSub '******************************************************************** 'Shows the per-monster points at the location where the monster was eaten: Sub ShowEatSplash GraphicsWindow.BrushColor="white" GraphicsWindow.FontName="Arial" o=shapes.AddText(monsterPts +(monsterEatenCtr * monsterPts)) osx = SpriteArray[Sprites][screenX] - sWidth osy = SpriteArray[Sprites][screenY] + sHeight Shapes.Move(o,osx,osy) SmallDelay() Shapes.Remove(o) EndSub '******************************************************************************************* sub SetupGraphicsWindow GraphicsWindow.Title="Small Basic Chomper" GraphicsWindow.Width= gamescreenWidth GraphicsWindow.Height=gameScreenHeight GraphicsWindow.CanResize="false" GraphicsWindow.BrushColor="white" GraphicsWindow.FontSize = 10 GraphicsWindow.FontBold = "False" GraphicsWindow.DrawText(10,0,"SCORE: ") GraphicsWindow.DrawText(100,0,"LEVEL: ") GraphicsWindow.DrawText(180,0,"LIVES: ") scoreShape=Shapes.AddText(gameScore) livesShape=Shapes.AddText(SpriteArray[sbc][Lives]) levelShape=Shapes.AddText(gameLevel) Shapes.Move(scoreShape,50,0) Shapes.Move(levelShape,135,0) Shapes.Move(livesShape,220,0) endsub '******************************************************************************************* Sub DisplayScore Shapes.SetText(scoreShape,gamescore) EndSub '******************************************************************************************* Sub DisplayLives Shapes.SetText(livesShape,SpriteArray[sbc][lives]) EndSub '******************************************************************************************* Sub DisplayLevel Shapes.SetText(levelShape,gameLevel) EndSub '******************************************************************************************* Sub BlackoutGameScreen GraphicsWindow.BrushColor="black" blkScreen = Shapes.AddRectangle(gamescreenWidth, gameScreenHeight) Endsub '******************************************************************************************* Sub RemoveBlackScreen Shapes.Remove(blkScreen) EndSub End>BFN681.sb< Start>BFQ294.sb< InitializeWindow() StartSimulation() Sub InitializeWindow 'Create the height and width of the window Height = 500 Width = 400 GraphicsWindow.CanResize = 0 'Make it unresizable so that you can't resize it 'to make some sky appear in the middle of a field GraphicsWindow.Height = Height GraphicsWindow.Width = Width GraphicsWindow.BackgroundColor = "DarkBlue" 'Make it dark to give that wintry feeling 'Make some grass GraphicsWindow.BrushColor = "Green" GraphicsWindow.FillRectangle(0,Height-200,Width,200) 'Make some clouds GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(-30,-30,300,150) GraphicsWindow.FillEllipse(200,-60,400,160) 'Mark some events GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseMove = MouseMove EndSub Sub StartSimulation GraphicsWindow.BrushColor = "White" While 1 = 1 index = index + 1 'Add one to 'index' so that we don't keep overwriting the same variable GraphicsWindow.FontSize = Math.GetRandomNumber(15)+10 'Make the font size 'some reasonable size for the next snowflake Snowflake[index] = Shapes.AddText("*") 'Add the snowflake 'Make the X and Y for the snowflake X[index] = Math.GetRandomNumber(Width+GraphicsWindow.FontSize)-GraphicsWindow.FontSize Y[index] = Math.GetRandomNumber(240)+Height-220 'Move the snowflake to its X but not its Y so that we can animate it later with no slant Shapes.Move(Snowflake[index] , X[index] , -40) 'Animate the snowflake Shapes.Animate(Snowflake[index] , X[index] , Y[index] , (Math.GetRandomNumber(5)+5)*100) 'Create a delay so as to not crush the CPU Program.Delay(20) EndWhile EndSub Sub MouseMove MouseX = GraphicsWindow.MouseX MouseY = GraphicsWindow.MouseY If id = 3 Then 'Check to see if the user has clicked three times which would end the triangle 'Remove all lines For i = 1 To 3 Shapes.Remove(Line[i]) EndFor 'Redraw them Line[1] = Shapes.AddLine( Point ["1 : X"], Point ["1 : Y"] , Point ["2 : X"] , Point ["2 : Y"] ) Line[2] = Shapes.AddLine( Point ["2 : X"], Point ["2 : Y"] , Point ["3 : X"] , Point ["3 : Y"] ) Line[3] = Shapes.AddLine( Point ["1 : X"], Point ["1 : Y"] , Point ["3 : X"] , Point ["3 : Y"] ) 'Make those events do nothing GraphicsWindow.MouseMove = Nothing GraphicsWindow.MouseDown = Nothing 'And start calculations! 'Pythagorean theorem to calculate each side's length A = Math.SquareRoot( Math.Power(Point ["1 : X"]-Point ["2 : X"] , 2) + Math.Power(Point ["1 : Y"]-Point ["2 : Y"] , 2) ) B = Math.SquareRoot( Math.Power(Point ["1 : X"]-Point ["3 : X"] , 2) + Math.Power(Point ["1 : Y"]-Point ["3 : Y"] , 2) ) C = Math.SquareRoot( Math.Power(Point ["2 : X"]-Point ["3 : X"] , 2) + Math.Power(Point ["2 : Y"]-Point ["3 : Y"] , 2) ) 'Find the angles of the triangle Angle[1] = Math.Round(Math.GetDegrees(Math.ArcCos((B*B+C*C-A*A)/(2*B*C)))) Angle[2] = Math.Round(Math.GetDegrees(Math.ArcCos((A*A+C*C-B*B)/(2*A*C)))) Angle[3] = Math.Round(Math.GetDegrees(Math.ArcCos((A*A+B*B-C*C)/(2*A*B)))) 'And find the area now! (round it to leave off that unneccesary 12 digits behind it) Area = Math.Round(0.5*A*B*Math.Sin(Math.GetRadians(Angle[3]))) 'Move the text window to a good area TextWindow.Left = GraphicsWindow.Left + Width + 20 'Display the area and other information TextWindow.WriteLine("The area of the triangle you drew was "+Area+" square pixels.") ElseIf id > 1 Then 'If the user has clicked more than once 'Remove the current line to redraw it Shapes.Remove(Line[id]) 'Add a line from the last X and the last Y to the current X and the current Y Line[id] = Shapes.AddLine( Point [ (id-1) +" : X"] , Point [ (id-1) +" : Y"] , Point [ id +" : X"] , Point [ id +" : Y"] ) EndIf EndSub Sub Nothing EndSub Sub MouseDown If id < 3 Then 'If the three points aren't already specified id = id + 1 'Add one to the number of points Point[id+" : X"] = MouseX 'Make that point's X Point[id+" : Y"] = MouseY 'Make that point's Y GraphicsWindow.BrushColor = "Gray" 'Make the ellipse gray Ellipse[id] = Shapes.AddEllipse(20,20) 'Create an ellipse to make the current point stand 'out a little Shapes.Move(Ellipse[id] , Point [id + " : X"] - 10 , Point [id + " : Y"] - 10) 'Move the ellipse 'to the current point and center it GraphicsWindow.BrushColor = "White" 'Make the brush color white again so that the snowing 'simulation doesn't suddenly turn gray EndIf EndSub End>BFQ294.sb< Start>BFQ396.sb< gw = 700 gh = 600 GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.Width = gw GraphicsWindow.Height = gh shoot = 0 CreateSprites() 'Game Loop While shoot = 0 start = Clock.ElapsedMilliseconds If (spaceDown) Then FireMissile() spaceDown = "False" EndIf UpdateSprites() delay = 20 - (Clock.ElapsedMilliseconds - start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile Sub CreateSprites spriteImage = ImageList.LoadImage("http://i61.tinypic.com/vxn1xy.png") 'Sprite dimensions we use the half width and height spriteWidth = ImageList.GetWidthOfImage(spriteImage)/2 spriteHeight = ImageList.GetHeightOfImage(spriteImage)/2 numSprite = 5 For i = 1 To numSprite spriteData["image"] = Shapes.AddImage(spriteImage) spriteData["Xpos"] = spriteWidth + Math.GetRandomNumber(gw-2*spriteWidth) spriteData["Ypos"] = gh-spriteHeight spriteData["Xvel"] = 0 spriteData["Yvel"] = -5 spriteData["Status"] = 0 Shapes.HideShape(spriteData["image"]) sprites[i] = spriteData EndFor EndSub Sub UpdateSprites For i = 1 To numSprite spriteData = sprites[i] 'get current sprite array If (spriteData["Status"] = 1) Then 'Reposition sprite center spriteData["Xpos"] = spriteData["Xpos"] + spriteData["Xvel"] spriteData["Ypos"] = spriteData["Ypos"] + spriteData["Yvel"] 'Move sprite center Shapes.Move(spriteData["image"],spriteData["Xpos"]-spriteWidth,spriteData["Ypos"]-spriteHeight) 'Sprite finished with If (spriteData["Ypos"] < -spriteHeight) Then spriteData["Status"] = 0 Shapes.HideShape(spriteData["image"]) EndIf sprites[i] = spriteData 'save updated sprite array (it may have been modified) EndIf EndFor EndSub Sub FireMissile For i = 1 To numSprite spriteData = sprites[i] 'get current sprite array If (spriteData["Status"] = 0) Then spriteData["Status"] = 1 Shapes.ShowShape(spriteData["image"]) spriteData["Xpos"] = GraphicsWindow.MouseX spriteData["Ypos"] = gh-spriteHeight sprites[i] = spriteData 'save updated sprite array (it may have been modified) i = numSprite 'End loop EndIf EndFor shoot = 1 EndSub Sub OnKeyDown lastkey = GraphicsWindow.LastKey If lastkey = "space" then shoot = 0 spaceDown = "True" EndIf EndSub End>BFQ396.sb< Start>BFQ990.sb< ' Challenge of the Month - August 2015 Draw a Shark by NaochanON GUI() While "true" NN=NN+1 If Math.Remainder(NN,15)=0 then ddy=3- Math.GetRandomNumber(6) endif '------------------------------------------------------------------------------------------------------------------------- MaxLeft=0 For j= 1 To NMB Shapes.Move( Sardine[j],Shapes.GetLeft(Sardine[j])-5,Shapes.GetTop(Sardine[j])+ddy) If Shapes.GetTop(Sardine[j])<80 then Shapes.Move( Sardine[j],Shapes.GetLeft(Sardine[j])-5,80+math.GetRandomNumber(30)) endif endfor '------------------------------------------------------------------------------------------------------------------------- For i = 1 To Array.GetItemCount(Shark) If Shapes.GetTop(SHP[1])<80 then ddy=0 endif Shapes.Move(SHP[i],Shapes.GetLeft(SHP[i])-5,Shapes.GetTop(SHP[i])+ddy+1) EndFor If ddy>0 then For ii=10 to 13 Shapes.Rotate(SHP[ii],15) endfor Else For ii=10 to 13 Shapes.Rotate(SHP[ii],-5) endfor endif If Shapes.GetLeft(SHP[1])<-200 Then Sardine_Right() shark_Right() EndIf '------------------------------------------------------------------------------------------------------------------------- bbl_Move() Program.Delay(15) endwhile Sub GUI GraphicsWindow.BackgroundColor="Lightcyan" GraphicsWindow.width=1200 GraphicsWindow.height=700 GraphicsWindow.Top=0 GraphicsWindow.Left=0 '------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.BrushColor="Blue" GraphicsWindow.PenColor="blue" GraphicsWindow.PenWidth=2 For i=5 To 1 Step -1 sblue[i]= Shapes.AddRectangle(1400,42*i) ' stripe y=y+i Shapes.Move(sblue[i],0,720-42*y) Shapes.SetOpacity(sblue[i],15*i) EndFor '------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.BrushColor="White" GraphicsWindow.PenColor="White" GraphicsWindow.PenWidth=3 For k=1 To 5 For L=1 To 6 By[k][L]=800 sbbl[k][L]=Shapes.AddEllipse(L+4,L+4) ' bubbles bx[k][L]=250*(K-1)+30*Math.GetRandomNumber(L) Shapes.Move(sbbl[k][L],bx[k][L],By[k][L]) EndFor EndFor '------------------------------------------------------------------------------------------------------------------------- GraphicsWindow.BrushColor="Blue" GraphicsWindow.PenColor="Blue" NMB=80 For j=1 To NMB w= 15+math.GetRandomNumber(10) Sardine[j]=Shapes.AddEllipse(w,w*0.2) ' Sardines EndFor Sardine_Right() '------------------------------------------------------------------------------------------------------------------------- Shark[1] = "fn=rc;x=353;y=87;w=43;h=34;angle=25;bc=#2792C3;pc#2792C3;pw=2;" ' fin-1 Shark[2] = "fn=rc;x=273;y=192;w=43;h=34;angle=-20;bc=#2792C3;pc#2792C3;pw=2;" ' fin -2 Shark[3] = "fn=rc;x=353;y=172;w=43;h=34;angle=-30;bc=#2792C3;pc#2792C3;pw=2;" ' fin-3 Shark[4] = "fn=el;x=64;y=80;w=352;h=130;bc=#A0D8EF;pc#2792C3;pw=2;" ' body white Shark[5] = "fn=el;x=70;y=83;w=342;h=100;bc=#2792C3;pc#2792C3;pw=2;" ' body navy Shark[6] = "fn=tr;x=0;y=82;x1=0;y1=60;x2=95;y2=25;x3=80;y3=90;angle=0;bc=#2792C3;pc=#2792C3;pw=2;" ' Head Shark[7] = "fn=el;x=33;y=130;w=16;h=12;bc=#FFEA00;pc#2792C3;pw=2;" ' eye Shark[8] = "fn=ln;x=36;y=128;x1=0;y1=0;x2=8;y2=14;pc=#222C3A;bc=#FFFFF3;pw=2;" ' eye Shark[9] = "fn=tr;x=170;y=0;x1=68;y1=0;x2=0;y2=89;x3=85;y3=89;angle=0;bc=#2792C3;pc=#2792C3;pw=2;" ' Dorsal fin Shark[10] = "fn=tr;x=400;y=70;x1=140;y1=0;x2=0;y2=78;x3=58;y3=78;angle=0;bc=#2792C3;pc=#2792C3;pw=2;" ' upperCaudal fin Shark[11] = "fn=tr;x=440;y=70;x1=100;y1=0;x2=0;y2=78;x3=28;y3=78;angle=0;bc=#A0D8EF;pc#A0D8EF;pw=2;" ' Caudal fin white Shark[12] = "fn=tr;x=400;y=148;x1=0;y1=0;x2=70;y2=0;x3=95;y3=50;angle=0;bc=#A0D8EF;pc#2792C3;pw=2;" ' underCaudal fin Shark[13] = "fn=tr;x=135;y=160;x1=0;y1=20;x2=50;y2=0;x3=66;y3=122;angle=0;bc=#2992C3;pc#2792C3;pw=2;" ' Pelvic fin Shark[14] = "fn=tr;x=30;y=148;x1=0;y1=5;x2=40;y2=0;x3=10;y3=10;angle=0;bc=#A0D8EF;pc#2792C3;pw=2;" ' mouth Shark[15] = "fn=tr;x=356;y=94;x1=0;y1=0;x2=80;y2=46;x3=0;y3=75;angle=0;bc=#2792C3;pc=#2792C3;pw=2;" ' tail s=0.5 ' 0.4+ (2-math.GetRandomNumber(4))*0.1 For i = 1 To Array.GetItemCount(Shark) GraphicsWindow.Penwidth = Shark[i]["pw"]*s GraphicsWindow.PenColor = Shark[i]["pc"] GraphicsWindow.BrushColor = Shark[i]["bc"] If Shark[i]["fn"] = "rc" Then SHP[i] = shapes.Addrectangle(Shark[i]["w"]*s, Shark[i]["h"]*s) ElseIf Shark[i]["fn"] = "el" Then SHP[i] = shapes.Addellipse(Shark[i]["w"]*s, Shark[i]["h"]*s) ElseIf Shark[i]["fn"] = "tr" Then SHP[i]= Shapes.Addtriangle(Shark[i]["x1"]*s, Shark[i]["y1"]*s, Shark[i]["x2"]*s, Shark[i]["y2"]*s, Shark[i]["x3"]*s, Shark[i]["y3"]*s) ElseIf Shark[i]["fn"] = "ln" Then SHP[i]= Shapes.AddLine(Shark[i]["x1"]*s, Shark[i]["y1"]*s, Shark[i]["x2"]*s, Shark[i]["y2"]*s) EndIf shapes.Move(SHP[i], Shark[i]["x"]*s, Shark[i]["y"]*s) If Text.IsSubText("rc:el:tr", Shark[i]["fn"]) And Shark[i]["angle"] <> 0 Then Shapes.Rotate(SHP[i], Shark[i]["angle"]) EndIf pos[i]["X"]=Shapes.GetLeft(SHP[i]) pos[i]["Y"]=Shapes.Gettop(SHP[i]) EndFor shark_Right() EndSub Sub Sardine_Right Rposy=100+Math.GetRandomNumber(200) For j=1 To NMB R=20+math.GetRandomNumber(150) X=1250+R*math.Cos(math.GetRadians(j*3.6)) Y=R*math.sin(math.GetRadians(j*3.6))*0.2 Shapes.Move( Sardine[j],X,Y+Rposy) EndFor EndSub Sub shark_Right dx= 100+Math.GetRandomNumber(500) dy=50+Math.GetRandomNumber(200) For i = 1 To Array.GetItemCount(Shark) Shapes.Move(SHP[i],1300+dx+pos[i]["X"],100+dy+pos[i]["Y"]) EndFor EndSub Sub bbl_Move For k=1 To 5 For L=1 To 6 bdy[k][L]=Math.GetRandomNumber(5) By[k][L]=By[k][L]-bdy[k][L] Shapes.Move(sbbl[k][L],bx[k][L],By[k][L]) ' bubble go up If By[k][L]<100 Then By[k][L]=720 Shapes.Move(sbbl[k][L],bx[k][L],By[k][L]) ' new place EndIf EndFor EndFor EndSub End>BFQ990.sb< Start>BFR561.sb< 'Program KOU-KO-GEN N O T E I R I- Eddy Abts 19-4-2020 Debug="False" 'can be set to True - debuginfo is written to to the debugfile resultflag= "False" SetupDebug() If debug Then textScreen() EndIf InitVar() GraphicsScreen() DrawGrid() Drawpalette() '====== MAIN PROGRAM ======= 'START DRAWING LINE For Ax=Bx+.1 To End Step mystep 'begin of point Ax is Bx + .1 To avoid division by 0 DistanceAtoC() DrawLine() dif=hp-5 If Debug="False" and ResultFlag Then Debug="True" TextScreen() EndIf If difsign="pos" and dif<0 Then LDCall.Function("DebugFunc","======= SOLUTION ==========") LDCall.Function("DebugFunc","50-Ax= "+Ax+ " Cy= "+Cy+" Hp = "+Hp) LDCall.Function("DebugFunc","51-DIF = "+dif) mytxtshape=shapes.addtext("A "+Ax) 'draw solution on screen Shapes.move(mytxtshape,Ax*100+100,560) mytxtshape=shapes.addtext("C "+Cyrnd) Shapes.move(mytxtshape,110,(6-Cy)*100) LDCall.Function("DebugFunc","53-===========================================") difsign="neg" Debug="False" elseIf difsign="neg" and dif>0 Then LDCall.Function("DebugFunc","======= SOLUTION ==========") LDCall.Function("DebugFunc","60-Ax= "+Ax+ " Cy= "+Cyrnd+" Hp = "+Hp) LDCall.Function("DebugFunc","61-DIF = "+dif) mytxtshape=shapes.addtext("A "+Ax) 'draw solution on screen Shapes.move(mytxtshape,Ax*100+80,560) mytxtshape=shapes.addtext("C "+Cyrnd) Shapes.move(mytxtshape,110,(6-Cy)*100-20) LDCall.Function("DebugFunc","66-===========================================") difsign="pos" EndIf Debug="False" endfor 'END MAIN PROGRAM '============================================================================================= sub Coordinates Gx=args[1] Gy=args[2] LDCall.Function("DebugFunc","96- Gx= "+ Gx +" ; Gy= "+ Gy ) Gx=(Gx+1)*100 Gy=(6-Gy)*100 LDCall.Function("DebugFunc","99- Gx= "+ Gx +" ; Gy= "+ Gy ) endsub '=================== S U B R O U T I N E - DistanceAtoC==================== sub DistanceAtoC m=(By-Ay)/(Bx-Ax) 'Line equation : y=mx+p ===> m=slope p=Ay-(m * Ax) 'p=y-mp and Ay=0 p=-m * Ax Cx=0 'Point C(x,y) is intersection with y-axes Cy= p ' all digits CyRnd=Math.Round(Cy*1000)/1000 Hp= math.SquareRoot(Ax*Ax + Cy*Cy) ' all digits Hp100=Math.Round(Hp*100)/100 'Hypothenusa rounded at 2 digits behind comma Hp1000=Math.Round(Hp*1000)/1000 'Hypothenusa rounded at 2 digits behind comma LDCall.Function("DebugFunc","96-Hypothenusa : "+Hp1000) 'Calculate and draws Endpoint of the ladder Lx=(Ly-p)/m Ly=(Ladder*Cy)/Math.SquareRoot(Cy*Cy+Ax*Ax) 'The endpoint of the ladder ldcall.function4("Coordinates",Lx,Ly,Gx,Gy) LDCall.Function("DebugFunc","120-Gx= "+Gx+" ; Gy= "+Gy ) GraphicsWindow.brushcolor = "red" graphicswindow.fillellipse(Gx-1,Gy-1,2,2) GraphicsWindow.brushcolor = "Green" LDCall.Function("DebugFunc","89-Lx = "+Lx+" Ly = "+Ly) Endsub '=================== S U B R O U T I N E - DrawLine ==================== Sub DrawLine If Hp100=5 Then GraphicsWindow.Pencolor="brown" GraphicsWindow.PenWidth = 4 Else GraphicsWindow.Pencolor="green" GraphicsWindow.PenWidth = 1 EndIf If myline <> "" And remove Then Shapes.remove(myline) EndIf Gx=(Gx+1)*100 Gy=(6-Gy)*100 ldcall.function4("Coordinates",Ax,Ay,Gx,Gy) If HP100<>5 Then myline=shapes.addLine(Gx,Gy,0,600-(Cy*(Ax+1)/Ax)*100) Else myline=shapes.addLine(Gx,Gy,100,600-(Cy*100)) EndIf If Hp100=5 Then remove = "False" Else remove = "True" EndIf LDCall.Function("DebugFunc","42-===========================================") LDCall.Function("DebugFunc","43-Ax= "+Ax+ " Cy= "+Cy+" Hp = "+Hp) LDCall.Function("DebugFunc","45-DIF = "+dif) EndSub '=================== S U B R O U T I N E - DrawGrid ==================== Sub DrawGrid GraphicsWindow.PenColor = "Green" GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawLine(0, 0, 0, 700) For _x = 0 To 700 Step 100 GraphicsWindow.DrawLine(_x, 0, _x, 700) If _x=0 Then GraphicsWindow.DrawText(_x +4, 580, (_x/100)-1) Else GraphicsWindow.DrawText(_x -10, 580, (_x/100)-1) EndIf EndFor For _y=700 To 0 Step -100 GraphicsWindow.DrawLine(0, _y, 700, _y) GraphicsWindow.DrawText(104, _y + 4, 6-_y/100) EndFor EndSub '=================== S U B R O U T I N E - DeBugFunction ==================== Sub DebugFunc If debug Then TextWindow.WriteLine(args[1]) EndIf ' The following line could be harmful and has been automatically commented. ' File.AppendContents(DebugFile,args[1]) EndSub '=================== S U B R O U T I N E - T E X T S C R E E N ==================== Sub TextScreen TextWindow.top=0 TextWindow.left=900 TextWindow.ForegroundColor = "white" EndSub '=================== S U B R O U T I N E - G R A P H I C S S C R E E N ==================== Sub GraphicsScreen GraphicsWindow.top=0 GraphicsWindow.Left=0 GraphicsWindow.Width=700 GraphicsWindow.Height=600 GraphicsWindow.Title = "K O U - KO - G E N N O T E I R I" GraphicsWindow.CanResize="False" EndSub '=================== S U B R O U T I N E - I N I T V A R ==================== Sub InitVar Ay=0 'A is the point of the ladder on the x-axes Bx=1.20 'B is the point on top of the palette By=1.50 Cx=0 'C is the point of the ladder on the x-axes Cy=4.8 Ladder=5.00 args = "" mystep = 0.001 End=6 'End=6 for testing specific interval - End=scale min=999 max=0 flag="down" difsign="pos" EndSub '=================== S U B R O U T I N E - D R A W P A L E T T E ==================== Sub Drawpalette GraphicsWindow.penwidth=1 GraphicsWindow.BrushColor="#FF5A00" GraphicsWindow.FillRectangle(100,600-By*100,Bx*100,By*100) Endsub '=================== S U B R O U T I N E - S E T U P D E B U G ==================== Sub SetupDebug ' The following line could be harmful and has been automatically commented. ' DebugFile=Program.Directory + "\debugFile.txt" ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(DebugFile) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(DebugFile,"DebugFile : "+Clock.date+" = "+Clock.time) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(DebugFile,"=================================") EndSub End>BFR561.sb< Start>BFZ410.sb< GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Top = -27 GraphicsWindow.Left = -5 GraphicsWindow.Width = Desktop.Width - 5 GraphicsWindow.Height = Desktop.Height - 150 LDScrollBars.Add(29000 GraphicsWindow.Height) oxx=-14000 top: Amount =30 GraphicsWindow.KeyDown = pressed done = "false" ww=2 total = 0 rr=math.Pi /180 For i = 1 To Amount angle[i] = Math.GetRandomNumber(90) Dist[i] = Math.GetRandomNumber(Math.Round((GraphicsWindow.Height / 2) / Amount)-14) + 15 total = total + Dist[i] Rate[i] = Math.GetRandomNumber(20) - 10 EndFor Dist[Amount] = Dist[Amount] + ((GraphicsWindow.Height / 2) - total) X[0] = GraphicsWindow.Width/2 Y[0] = GraphicsWindow.Height/2 For i = 1 To Amount X[i] = X[i-1]+Dist[i]*Math.Cos(Math.GetRadians(Angle[i])) Y[i] = Y[i-1]+Dist[i]*Math.Sin(Math.GetRadians(Angle[i])) EndFor X[Amount+1] = X[Amount] Y[Amount+1] = Y[Amount] j=0 While 1=1 j=j+10 GraphicsWindow.PenWidth =1 For i = 1 To Amount Angle[i] = Angle[i]+Rate[i] X[i] = X[i-1]+Dist[i]*Math.Cos(Math.GetRadians(Angle[i])) Y[i] = Y[i-1]+Dist[i]*Math.Sin(Math.GetRadians(Angle[i])) EndFor If Math.Remainder (j,10)=0 then GraphicsWindow.PenColor =LDColours.HSLtoRGB(oxx 1 .6) endif GraphicsWindow.PenWidth =ww ww=math.Sin(Math.GetRadians(j))/2+ww GraphicsWindow.DrawLine(X[Amount]+oxx,Y[Amount],X[Amount+1]+oxx,Y[Amount+1]) X[Amount+1] = X[Amount] Y[Amount+1] = Y[Amount] oxx=oxx+1 LDScrollBars.HorizontalScroll=oxx+13500 Program.Delay(10) If done = "true" Then Goto top EndIf EndWhile Sub pressed If GraphicsWindow.LastKey = "Space" Then done = "true" EndIf EndSub End>BFZ410.sb< Start>BGB172.sb< GraphicsWindow.Width = 1288 GraphicsWindow.Height = 688 GraphicsWindow.BackgroundColor = "rosybrown" GraphicsWindow.KeyDown=Onkeydown shape_init() '   Human and Tree shape data N=0 M=0 shapes_add() '  Human shapes N=1 For M=1 to 6   shapes_add()  '  Tree shapes endfor 'Animate shapes - eyes and mouth dZ = 0.1 zoom = 1 ddx=4 While 0=0   zoom = zoom - dZ   For i = 1 To Array.GetItemCount(shape[0])     If Array.ContainsValue(shape[0][i], "eye") Then       Shapes.Zoom(shp[0][i], 1, zoom)     ElseIf Array.ContainsValue(shape[0][i], "mouth") Then     �� Shapes.Zoom(shp[0][i], zoom, zoom)     EndIf     shapes.Move(shp[0][i],shapes.GetLeft(shp[0][i])+ddx,shapes.Gettop(shp[0][i]))   EndFor   If zoom = 0 Or zoom = 1 Then     dZ = -dZ   EndIf   Program.Delay(100) EndWhile Sub Onkeydown   key= GraphicsWindow.LastKey   If key="S" Then     ddx=4   ElseIf key="A"Then     ddx=-4   ElseIf key="Space" Then     ddx=0 EndIf  EndSub Sub shapes_add   ss=s[M]    '  <--------- scale  data   for i=1 To Array.GetItemCount(shape[N])      GraphicsWindow.PenWidth = shape[N][i]["pw"]     GraphicsWindow.BrushColor = shape[N][i]["bc"]     GraphicsWindow.penColor = shape[N][i]["pc"]     If shape[N][i]["func"]="ell" Then       shp[M][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)     ElseIf shape[N][i]["func"]="rect" Then       shp[M][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)     ElseIf shape[N][i]["func"]="tri" Then       shp[M][i] = Shapes.Addtriangle(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss, shape[N][i]["x3"]*ss, shape[N][i]["y3"]*ss)     EndIf     Shapes.Animate(shp[M][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 500)   EndFor EndSub Sub shape_init   ' Human   Data   shape[0][1] = "func=ell;x=475;y=167;width=30;height=32;bc=bisque;tag=ear"'left   shape[0][2] = "func=ell;x=572;y=167;width=30;height=32;bc=bisque;tag=ear"'right   shape[0][3] = "func=ell;x=488;y=145;width=100;height=100;bc=darkgoldenrod;tag=face"   shape[0][4] = "func=ell;x=515;y=165;width=10;height=10;bc=blue;tag=eye"'left   shape[0][5] = "func=ell;x=555;y=165;width=10;height=10;bc=blue;tag=eye"'right   shape[0][6] = "func=ell;x=533;y=175;width=10;height=30;bc=sienna;tag=nose"   shape[0][7] = "func=ell;x=522;y=210;width=30;height=10;bc=pink;tag=mouth"   shape[0][8] = "func=rect;x=515;y=240;width=50;height=100;bc=sienna;tag=body"   shape[0][9] = "func=tri;x1=500;y1=150;x2=540;y2=100;x3=580;y3=150;bc=purple;angle=0;pw=0;tag=head"   shape[0][10] = "func=rect;x=520;y=340;width=8;height=50;bc=yellow;Leg1"   shape[0][11] = "func=rect;x=550;y=340;width=8;height=50;bc=yellow;Leg2"   shape[0][12] = "func=rect;x=565;y=270;width=50;height=8;bc=green;tag=mouth"'hand2   shape[0][13] = "func=rect;x=463;y=270;width=50;height=8;bc=green;tag=mouth"'hand1   '  Tree data   shape[1][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2"   shape[1][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2   shape[1][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2   shape[1][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2   shape[1][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2   shape[1][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2   shape[1][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2   shape[1][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2   shape[1][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2   shape[1][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   shape[1][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   shape[1][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   shape[1][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   '  scale and   start XY position   s   = "0=1.1;1=.8;2=.8;3=.8;4=.8;5=.8;6=.8"   shX = "0=0;1=10;2=160;3=655;4=822;5=988;6=1100" �� shY = "0=0;1=188;2=180;3=112;4=88;5=102;6=122" endsub End>BGB172.sb< Start>BGB309.sb< GraphicsWindow.PenWidth = 3 GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "White" For i=1 To 10 drop[i]["shape"] = Shapes.AddEllipse(100,100) z=math.GetRandomNumber(100) Shapes.zoom(drop[i]["shape"],z/100,z/100) Shapes.Move(drop[i]["shape"],Math.GetRandomNumber(GraphicsWindow.Width), Math.GetRandomNumber(GraphicsWindow.Height)) drop[i]["z"]=z/100 endfor Timer.tick=onTick Timer.Interval=100 Sub OnTick For i = 1 To 10 z=drop[i]["z"] z=z+0.05 If z>1 Then z=0.01 Shapes.Move(drop[i]["shape"],Math.GetRandomNumber(GraphicsWindow.Width), Math.GetRandomNumber(GraphicsWindow.Height)) endif Shapes.Zoom(drop[i]["shape"], z, z ) Shapes.SetOpacity(drop[i]["shape"] , 90 - z * i * 100) drop[i]["z"]=z EndFor endsub End>BGB309.sb< Start>BGB849.sb< 'Small Basic challenge of the month, January 2019 'Tartan Pattern 'CONFIG gw = 1200 gh = 800 Turtle.Speed = 9 scale = 1 '1 for original scale, increase or decrease to zoom. GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = (Desktop.Height - gh) / 2 GraphicsWindow.CanResize = "False" GraphicsWindow.BackgroundColor = "SteelBlue" GraphicsWindow.Title = "Tartan" 'MAIN createAssets() scaleAssets() drawStripes() 'SUBROUTINES Sub createAssets 'This can be modified to change the pattern, the index must be numbered sequentialy asset[1] = "start=150;gap=300;width=150;colour=#32ADFF2F" asset[2] = "start=0;gap=150;width=50;colour=#80000000" asset[3] = "start=355;gap=600;width=5;colour=#80000000" asset[4] = "start=365;gap=600;width=5;colour=#80000000" asset[5] = "start=430;gap=600;width=5;colour=#80000000" asset[6] = "start=440;gap=600;width=5;colour=#80000000" asset[7] = "start=95;gap=300;width=10;colour=#64FF0000" asset[8] = "start=245;gap=300;width=10;colour=#64FFFF00" EndSub Sub scaleAssets 'Sets the zoom level using the scale setting above For i = 1 To Array.GetItemCount(asset) asset[i]["start"] = asset[i]["start"] * scale asset[i]["gap"] = asset[i]["gap"] * scale asset[i]["width"] = asset[i]["width"] * scale EndFor EndSub Sub drawStripes For a = 1 To Array.GetItemCount(asset) GraphicsWindow.PenColor = asset[a]["colour"] width = asset[a]["width"] GraphicsWindow.PenWidth = width For i = asset[a]["start"] To Math.Max(gw, gh) Step asset[a]["gap"] If (i - width / 2 < gw) Then 'Draw horizontal stripes Turtle.PenUp() Turtle.MoveTo(i + width / 2, 0) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(gh + 10) EndIf If (i - width / 2 < gh) Then 'Draw vertical stripes Turtle.PenUp() Turtle.MoveTo(0, i + width / 2) Turtle.Angle = 90 Turtle.PenDown() Turtle.Move(gw + 10) EndIf EndFor EndFor Turtle.Hide() EndSub End>BGB849.sb< Start>BGC336.sb< textwindow.WriteLine("enter number of decks") decks=TextWindow.Read() TextWindow.WriteLine("pres a to reset the counter, press q for ace w for 2 e for 3 r for 4 t for 5 y for 6 u for 7 i for 8 o for 9 and p for 10 or figure") count=0 re: Program.Delay(500) GraphicsWindow.KeyDown=counter GraphicsWindow.Clear() GraphicsWindow.DrawBoundText(100,100,1000,count/decks+" % in favour of the player if positive there are more high cards") GraphicsWindow.DrawBoundText(100,150,1000,highcards/(decks*4)+" % in if positive there are more high cards") GraphicsWindow.DrawBoundText(100,200,1000,highlow/(decks)+" high low count") If highlow>0 then GraphicsWindow.DrawBoundText(100,250,1000,"dont hit 16 vs 10") GraphicsWindow.DrawBoundText(100,300,1000,"DD 11 vs A") GraphicsWindow.DrawBoundText(100,350,1000,"DD A7 vs 3 and 2") GraphicsWindow.DrawBoundText(100,400,1000,"DD A6 vs 3 but not vs 2") GraphicsWindow.DrawBoundText(100,450,1000,"DD A4 vs 4 and DD A3 vs 5") GraphicsWindow.DrawBoundText(100,550,1000,"DD A2 vs 5 but not vs 6") elseif highlow<0 then GraphicsWindow.DrawBoundText(100,250,1000,"hit 13 vs 2") GraphicsWindow.DrawBoundText(100,300,1000,"hit 12 vs 6,4,3 and 2") endif If highlow<-1 then GraphicsWindow.DrawBoundText(100,350,1000,"hit 13 vs 3 and 2") GraphicsWindow.DrawBoundText(100,400,1000,"hit 12 vs 6,5,4,3, and 2") endif if highlow<1 then GraphicsWindow.DrawBoundText(100,450,1000,"dont hit A7 vs A") endif If highlow>1 then GraphicsWindow.DrawBoundText(100,450,1000,"DD 11 vs A DD 8 vs 6") GraphicsWindow.DrawBoundText(100,500,1000,"A6 VS 2 AND a3 VS 4") GraphicsWindow.DrawBoundText(100,550,1000,"") endif Goto re Sub counter GraphicsWindow.Clear() If GraphicsWindow.LastKey="Q" Then count=count-0.6 highcards=highcards+6 highlow=highlow+1 ElseIf GraphicsWindow.LastKey="W" Then count=count+0.3 highcards=highcards+5 highlow=highlow+1 ElseIf GraphicsWindow.LastKey="E" Then count=count+0.4 highcards=highcards+4 highlow=highlow+1 ElseIf GraphicsWindow.LastKey="R" Then count=count+0.6 highcards=highcards+3 highlow=highlow+1 ElseIf GraphicsWindow.LastKey="T" Then count=count+0.8 highcards=highcards+2 highlow=highlow+1 ElseIf GraphicsWindow.LastKey="Y" Then count=count+0.4 highcards=highcards+1 highlow=highlow+1 ElseIf GraphicsWindow.LastKey="U" Then count=count+0.3 highcards=highcards-0 highlow=highlow+0 ElseIf GraphicsWindow.LastKey="I" Then count=count-0.0 highcards=highcards-2 highlow=highlow+0 ElseIf GraphicsWindow.LastKey="O" Then count=count-0.2 highcards=highcards-3 highlow=highlow+0 ElseIf GraphicsWindow.LastKey="P" Then count=count-0.5 highcards=highcards-4 highlow=highlow-1 ElseIf GraphicsWindow.LastKey="A" Then count=0 highcards=0 highlow=0 EndIf EndSub End>BGC336.sb< Start>BGF911-1.sb< 'http://smallbasic.com/program/?VST735-1 'Drop Down Menu System - (under construction) by Jibba Jabba, January 2014 'For my native SB code library Initialise() While "True" UpdateProgram() UpdateFrame() FrameRate() EndWhile '======================================================= 'FIRST ORDER SUBROUTINES '======================================================= Sub UpdateProgram start = Clock.ElapsedMilliseconds If mouseMove Then GetMousePosition() UpdateMenuOnMouseMove() mouseMove = "False" EndIf If mouseDown Then UpdateMenuOnMouseDown() 'creates a non async OnMenuClicked Event 'GetMousePosition() 'not used here for menu mouseDown = "False" EndIf If menuClicked Then 'OnMenuClicked TextWindow.WriteLine("menu = " + menu[menuSelection]) TextWindow.WriteLine(" submenu = " + subMenu[menuSelection][subMenuSelection]) menuSelection = 0 subMenuSelection = 0 menuClicked = "False" EndIf EndSub Sub UpdateFrame UpdateMenuFrame() EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then 'TextWindow.WriteLine("ms = " + (Clock.ElapsedMilliseconds - start)) 'speed Program.Delay(delay) Else 'TextWindow.WriteLine("delay = " + delay) 'lag EndIf EndSub '============================================================ 'SECOND ORDER SUBROUTINES - except for Menu Module '============================================================ Sub GetMousePosition mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY EndSub '=========================================================== 'INITIALISE '=========================================================== Sub Initialise 'DEBUG TextWindow.Top = 20 TextWindow.Left = GraphicsWindow.Width + 50 GraphicsWindow.Left = 10 'Main Loop fps = 50 '*6 drags > 300fps 'Get &/Or Set Stuff gw = GraphicsWindow.Width gh = GraphicsWindow.Height GetMousePosition() InitialiseMenu() 'Register Events GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown EndSub '========================================================= 'Event Handlers '========================================================= Sub OnMouseMove mouseMove = "True" EndSub Sub OnMouseDown mouseDown = "True" EndSub '************************************************************************************************************ '============================================================ 'DROP DOWN MENU SUBROUTINES '============================================================ 'Customise & Dynamic Subs - Second Order '----------------------------------------------------------------------------------------------------- Sub MenuDataTable 'USE THIS SUB TO CUSTOMISE MENU 'MENU 'Data Table menu = "1=View Screen;2=Program;3=Help;4=Test This" 'ADD DATA menuWidth = "1=105;2=85;3=55;4=85" 'MATCH WIDTH WITH DATA subMenu[1] = "1=Home;2=Small;3=Leaders Board;4=Extra for one;5=Another Extra for testing submenu one" subMenu[2] = "1=Debug;2=Close;3=test submenu two;4=more again" subMenu[3] = "1=How;2=About Match Picture;3=Again test me" subMenu[4] = "1=Test One;2=Test Sub Menu two" subMenuWidth = "1=285;2=145;3=165;4=155" 'MATCH WIDTH WITH DATA EndSub Sub DrawMenuBar 'USE THIS SUB TO REDRAW MENU BAR on Resize 'UNTESTED 'Add Menu Bar - Sub {redraw for new window size} If weHaveSprites Then GraphicsWindow.DrawResizedImage(menuBarTexture, 0, 0, gw, menuHeight) Else GraphicsWindow.BrushColor = "Peru" GraphicsWindow.FillRectangle(0, 0, gw, menuHeight) EndIf EndSub '----------------------------------------------------------------------------------------------------------- 'Initialise Menu - First Order '----------------------------------------------------------------------------------------------------------- Sub InitialiseMenu MenuDataTable() 'USED TO CUSTOMISE THE MENU 'Load Menu Sprites menuFileName[1] = "\Focus Texture.png" menuFocusSprite = ImageList.LoadImage(Program.Directory + menuFileName[1]) menuFileName[2] = "\subMenu Focus Sprite.png" subMenuFocusSprite = ImageList.LoadImage(Program.Directory + menuFileName[2]) menuFileName[3] = "\Sub Menu Background Sprite 2.png" subMenuBackgroundSprite = ImageList.LoadImage(Program.Directory + menuFileName[3]) menuFileName[4] = "\Menu Bar Texture.png" menuBarTexture = ImageList.LoadImage(Program.Directory + menuFileName[4]) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' getMenuFiles = File.GetFiles(Program.Directory) getMenuFiles = "" weHaveSprites = "True" For i = Array.GetItemCount(menuFileName) To 1 Step -1 If Text.IsSubText(getMenuFiles, menuFileName[i]) <> "True" Then weHaveSprites = "False" EndIf EndFor menuFocusOpacityIndex = 0 'Get posX for menuFocus For i = 1 To Array.GetItemCount(menuWidth) 'to be reversed totalMenuWidth = totalMenuWidth + menuWidth[i] menuFocusX[i] = totalMenuWidth - menuWidth[i] EndFor If totalMenuWidth > gw Then TextWindow.WriteLine("ERROR: total menu widths exceeds GW") TextWindow.Pause() EndIf 'Set Parameters menuHeight = 25 menuFocusWidth = 50 'original width before Zoom scale X menuTextOffset = 8 isMenuSelected = -1 'toggle init OFF menuFocusOpacity = "1=100;-1=30;0=0" subMenuTextOffset = 16 DrawMenuBar() 'USED TO REDRAW MENU AFTER WINDOW RESIZE 'Add Menu Focus If weHaveSprites Then menuFocus = Shapes.AddImage(menuFocusSprite) Else GraphicsWindow.BrushColor = "DeepPink" GraphicsWindow.PenWidth = 0 menuFocus = Shapes.AddRectangle(menuFocusWidth, menuHeight) 'WIP ************ EndIf Shapes.SetOpacity(menuFocus, 0) 'Add Menu GraphicsWindow.FontName = "Segoe Print" GraphicsWindow.FontSize = 13 GraphicsWindow.BrushColor = "PaleGreen" For i = Array.GetItemCount(menu) To 1 Step -1 menuText[i] = Shapes.AddText(menu[i]) Shapes.Move(menuText[i], menuFocusX[i] + menuTextOffset, 0) EndFor 'Error Check subMenu Width. NEEDS MORE TESTING If menuFocusX[Array.GetItemCount(menu)] + subMenuWidth[Array.GetItemCount(menu)] > gw Then TextWindow.WriteLine("ERROR: sum of all subMenu widths exceeds GW") TextWindow.Pause() EndIf 'Add Sub Menus - FIXING B/GROUND SPRITE ******************************* If weHaveSprites Then subMenuBackground = Shapes.AddImage(subMenuBackgroundSprite) Else GraphicsWindow.BrushColor = "SandyBrown" subMenuBackground = Shapes.AddRectangle(menuFocusWidth, menuHeight) EndIf Shapes.SetOpacity(subMenuBackground, 0) 'Add SubMenus If weHaveSprites Then subMenuFocus = Shapes.AddImage(subMenuFocusSprite) 'wip sprite *********** Else GraphicsWindow.BrushColor = "Grey" GraphicsWindow.PenWidth = 0 subMenuFocus = Shapes.AddRectangle(menuFocusWidth, menuHeight) EndIf Shapes.SetOpacity(subMenuFocus, 0) For j = Array.GetItemCount(subMenu) To 1 Step -1 left = menuFocusX[j] + subMenuTextOffset For i = Array.GetItemCount(subMenu[j]) To 1 Step -1 GraphicsWindow.BrushColor = "PaleGreen" subMenuText[j][i] = Shapes.AddText(subMenu[j][i]) Shapes.Move(subMenuText[j][i], left, menuHeight * i) Shapes.SetOpacity(subMenuText[j][i], 0) EndFor EndFor EndSub '------------------------------------------------------------------------------------------------------------ 'Menu Updates - Second Order '------------------------------------------------------------------------------------------------------------ Sub UpdateMenuOnMouseMove 'Update Menu Focus onMouseMove menuFocusedOn = 0 menuFocusOpacityIndex = 0 If mseY <= menuHeight And mseX <= totalMenuWidth Then For i = Array.GetItemCount(menu) To 1 Step -1 If mseX >= menuFocusX[i] And mseX <= menuFocusX[i] + menuWidth[i] Then menuFocusOpacityIndex = isMenuSelected 'isMenuSelected toggles onMouseDown 1/-1 menuFocusZoomX = menuWidth[i] / menuFocusWidth menuFocusedOn = i 'determines which SubMenu[i] to open If isMenuSelected = 1 nextMenuFocus = menuFocusedOn EndIf EndFor If isMenuSelected = 1 And nextMenuFocus <> currentMenuFocus Then 'change selected Menu focus priorMenuFocus = currentMenuFocus currentMenuFocus = nextMenuFocus EndIf ElseIf isMenuSelected = 1 Then 'lock the selected Menu and its opacity to show related SubMenu menuFocusedOn = currentMenuFocus '...so that SubMenu stays open when mouse is off location menuFocusOpacityIndex = 1 EndIf 'Update SubMenu Focus onMouseMove subMenuFocusedOn = 0 'WIP If isMenuSelected = 1 Then subMenuFocusOpacity = 0 'Loop thru sub menu, as required. Sets subMenuFocus Top, Opacity & ZoomX. And sets subMenuBackgroundZoomY If mseX >= menuFocusX[menuFocusedOn] And mseX <= menuFocusX[menuFocusedOn] + subMenuWidth[menuFocusedOn] Then If mseY > menuHeight And mseY <= menuHeight * (Array.GetItemCount(subMenu[menuFocusedOn]) + 1) Then For i = Array.GetItemCount(subMenu[menuFocusedOn]) To 1 Step -1 If mseY >= menuHeight * i And mseY <= menuHeight * (i+1) Then subMenuFocusTop = menuHeight * i subMenuFocusedOn = i EndIf EndFor subMenuFocusOpacity = 100 EndIf subMenuFocusZoomX = subMenuWidth[menuFocusedOn] / menuFocusWidth subMenuBackgroundZoomY = (Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) / menuHeight EndIf Else subMenuFocusOpacity = 0 EndIf EndSub Sub UpdateMenuOnMouseDown 'Update Menu onMouseDown If menuFocusedOn <> 0 Then isMenuSelected = -isMenuSelected 'toggle on Click 1/-1 menuFocusOpacityIndex = isMenuSelected EndIf priorMenuFocus = 0 If isMenuSelected = -1 Then If mseY > menuHeight Or mseX > totalMenuWidth Then menuFocusOpacityIndex = 0 priorMenuFocus = menuFocusedOn EndIf EndIf 'Update SubMenu onMouseDown If isMenuSelected = 1 Then subMenuOpacity = 100 subMenuFocusZoomX = subMenuWidth[menuFocusedOn] / menuFocusWidth subMenuBackgroundZoomY = (Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) / menuHeight '****** Else subMenuOpacity = 0 subMenuFocusOpacity = 0 EndIf 'OnMenuClicked event {non async Event} - pass the selection to If menuClicked If isMenuSelected = -1 And subMenuFocusedOn > 0 Then menuSelection = menuFocusedOn subMenuSelection = subMenuFocusedOn If menuSelection > 0 And subMenuSelection > 0 Then '***OnMenuClicked Event*** menuClicked = "True" 'non async event. Sequential EndIf menuFocusedOn = 0 subMenuFocusedOn = 0 'Unlock the selected Menu after no mouseMove between clicks ElseIf isMenuSelected = -1 And mseY > menuHeight Or isMenuSelected = -1 And mseX > totalMenuWidth Then '****wip here menuFocusedOn = 0 EndIf EndSub Sub UpdateMenuFrame 'Update Menu Focus - Main Bar Shapes.SetOpacity(menuFocus, menuFocusOpacity[menuFocusOpacityIndex]) Shapes.Zoom(menuFocus, menuFocusZoomX, 1) Shapes.Move(menuFocus, menuFocusX[menuFocusedOn] + (menuWidth[menuFocusedOn] - menuFocusWidth) /2, 0) 'Update SubMenu - Got Focus Shapes.SetOpacity(subMenuBackground, subMenuOpacity) Shapes.Zoom(subMenuBackground, subMenuFocusZoomX, subMenuBackgroundZoomY) Y = menuHeight + ((Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) - menuHeight) / 2 'wip put in update program Shapes.Move(subMenuBackground, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2, Y) For i = Array.GetItemCount(subMenu[menuFocusedOn]) To 1 Step -1 Shapes.SetOpacity(subMenuText[menuFocusedOn][i], subMenuOpacity) EndFor 'Update SubMenu - Lost Focus Shapes.SetOpacity(subMenuBackground[priorMenuFocus], 0) 'check if index needed For i = Array.GetItemCount(subMenu[priorMenuFocus]) To 1 Step -1 Shapes.SetOpacity(subMenuText[priorMenuFocus][i], 0) EndFor 'Update SubMenu Focus Shapes.SetOpacity(subMenuFocus, subMenuFocusOpacity) Shapes.Zoom(subMenuFocus, subMenuFocusZoomX, 1) Shapes.Move(subMenuFocus, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2, subMenuFocusTop) EndSub End>BGF911-1.sb< Start>BGF911-4.sb< 'http://smallbasic.com/program/?VST735-1 'Drop Down Menu System - (under construction) by Jibba Jabba, January 2014 'For my native SB code library GraphicsWindow.BackgroundColor="teal clr=ldtext.Split ("Blue DarkBlue White LightGray White Black #99555555"," ") fps=50 Initialise() pff=printing.CreatePrintFont ("Segoe",14,"Blue") While "True" UpdateProgram() UpdatemenuFrame() FrameRate() EndWhile Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then 'TextWindow.WriteLine("ms = " + (Clock.ElapsedMilliseconds - start)) 'speed Program.Delay(delay) Else 'TextWindow.WriteLine("delay = " + delay) 'lag EndIf EndSub Sub UpdateProgram start = Clock.ElapsedMilliseconds If mouseMove Then GetMousePosition() UpdateMenuOnMouseMove() mouseMove = "False" EndIf If mouseDown Then UpdateMenuOnMouseDown() 'creates a non async OnMenuClicked Event 'GetMousePosition() 'not used here for menu mouseDown = "False" EndIf If menuClicked Then 'OnMenuClicked smss=subMenu[menuSelection][subMenuSelection] smm=menu[menuSelection] TextWindow.WriteLine("menu = " + smm) TextWindow.WriteLine(" submenu =>" + smss+"<<") If smm="File" then If smss="Exit" Then Program.End() ElseIf smss="PrtFont" then Printing.SetFontUsingDialog (pff) ElseIf smss="Print" then GraphicsWindow.Title ="Printing..." Printing.PrintPreview (fff,pff) ElseIf smss="Open" then fff= LDDialogs.OpenFile ("txt","e:\") cfp=file.ReadContents (fff) GraphicsWindow.BrushColor="white GraphicsWindow.DrawBoundText (10,60,400,cfp) endif endif menuSelection = 0 subMenuSelection = 0 menuClicked = "False" endif endsub '============================================================ 'SECOND ORDER SUBROUTINES - except for Menu Module '============================================================ Sub GetMousePosition mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY EndSub '=========================================================== 'INITIALISE '=========================================================== Sub Initialise 'DEBUG TextWindow.Top = 20 TextWindow.Left = GraphicsWindow.Width + 50 GraphicsWindow.Left = 10 'Get &/Or Set Stuff gw = GraphicsWindow.Width gh = GraphicsWindow.Height For x=1 To 30 Lorr=lorr+"Uni visi et voluptat sic qua non mod lorem ipsum dolor sit ament. Just keep on echtings zync while quick fox jumps over brown lazy dogs waiting in file for some stuff. " endfor GraphicsWindow.FontName ="Segoe print GraphicsWindow.BrushColor ="DarkCyan GraphicsWindow.DrawBoundText (10,10,gw-20,lorr) GetMousePosition() InitialiseMenu() 'Register Events GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown EndSub '========================================================= 'Event Handlers '========================================================= Sub OnMouseMove mouseMove = "True" EndSub Sub OnMouseDown mouseDown = "True" EndSub '************************************************************************************************************ '============================================================ 'DROP DOWN MENU SUBROUTINES '============================================================ 'Customise & Dynamic Subs - Second Order '----------------------------------------------------------------------------------------------------- Sub MenuDataTable 'USE THIS SUB TO CUSTOMISE MENU 'MENU 'Data Table menu = "1=File;2=Program;3=Help;4=Test This" '<<<<<<<< "True" Then weHaveSprites = "False" EndIf EndFor menuFocusOpacityIndex = 0 'Get posX for menuFocus For i = 1 To Array.GetItemCount(menuWidth) 'to be reversed totalMenuWidth = totalMenuWidth + menuWidth[i] menuFocusX[i] = totalMenuWidth - menuWidth[i] EndFor If totalMenuWidth > gw Then TextWindow.WriteLine("ERROR: total menu widths exceeds GW") TextWindow.Pause() EndIf 'Set Parameters menuHeight = 25 menuFocusWidth = 50 'original width before Zoom scale X menuTextOffset = 8 isMenuSelected = -1 'toggle init OFF menuFocusOpacity = "1=100;-1=30;0=0" subMenuTextOffset = 16 DrawMenuBar() 'USED TO REDRAW MENU AFTER WINDOW RESIZE 'Add Menu Focus If weHaveSprites Then menuFocus = Shapes.AddImage(menuFocusSprite) Else GraphicsWindow.BrushColor = clr[2]'"DeepPink" GraphicsWindow.PenWidth = 0 menuFocus = Shapes.AddRectangle(menuFocusWidth, menuHeight) 'WIP ************ EndIf Shapes.SetOpacity(menuFocus, 0) 'Add Menu GraphicsWindow.FontName = "SegoeUI" GraphicsWindow.FontSize = 13 GraphicsWindow.FontBold="False GraphicsWindow.BrushColor = clr[3]'"PaleGreen" For i = Array.GetItemCount(menu) To 1 Step -1 menuText[i] = Shapes.AddText(menu[i]) Shapes.Move(menuText[i], menuFocusX[i] + menuTextOffset, 0) EndFor 'Error Check subMenu Width. NEEDS MORE TESTING If menuFocusX[Array.GetItemCount(menu)] + subMenuWidth[Array.GetItemCount(menu)] > gw Then TextWindow.WriteLine("ERROR: sum of all subMenu widths exceeds GW") TextWindow.Pause() EndIf 'Add Sub Menus - FIXING B/GROUND SPRITE ******************************* If weHaveSprites Then subMenuBackground = Shapes.AddImage(subMenuBackgroundSprite) Else GraphicsWindow.BrushColor = clr[4]'"DarkBlue subMenuBackground = Shapes.AddRectangle(menuFocusWidth, menuHeight) EndIf Shapes.SetOpacity(subMenuBackground, 0) 'Add SubMenus If weHaveSprites Then subMenuFocus = Shapes.AddImage(subMenuFocusSprite) 'wip sprite *********** Else ' GraphicsWindow.BrushColor = clr[7] ' subMenuFocus1 = Shapes.AddRectangle(menuFocusWidth, menuHeight) GraphicsWindow.BrushColor = clr[5]'"Grey" GraphicsWindow.PenWidth = 0 subMenuFocus = Shapes.AddRectangle(menuFocusWidth, menuHeight) EndIf Shapes.SetOpacity(subMenuFocus, 0) For j = Array.GetItemCount(subMenu) To 1 Step -1 left = menuFocusX[j] + subMenuTextOffset For i = Array.GetItemCount(subMenu[j]) To 1 Step -1 GraphicsWindow.BrushColor = clr[6]'"PaleGreen" subMenuText[j][i] = Shapes.AddText(subMenu[j][i]) Shapes.Move(subMenuText[j][i], left, menuHeight * i) Shapes.SetOpacity(subMenuText[j][i], 0) EndFor EndFor EndSub '------------------------------------------------------------------------------------------------------------ 'Menu Updates - Second Order '------------------------------------------------------------------------------------------------------------ Sub UpdateMenuOnMouseMove 'Update Menu Focus onMouseMove menuFocusedOn = 0 menuFocusOpacityIndex = 0 If mseY <= menuHeight And mseX <= totalMenuWidth Then For i = Array.GetItemCount(menu) To 1 Step -1 If mseX >= menuFocusX[i] And mseX <= menuFocusX[i] + menuWidth[i] Then menuFocusOpacityIndex = isMenuSelected 'isMenuSelected toggles onMouseDown 1/-1 menuFocusZoomX = menuWidth[i] / menuFocusWidth menuFocusedOn = i 'determines which SubMenu[i] to open If isMenuSelected = 1 nextMenuFocus = menuFocusedOn EndIf EndFor If isMenuSelected = 1 And nextMenuFocus <> currentMenuFocus Then 'change selected Menu focus priorMenuFocus = currentMenuFocus currentMenuFocus = nextMenuFocus EndIf ElseIf isMenuSelected = 1 Then 'lock the selected Menu and its opacity to show related SubMenu menuFocusedOn = currentMenuFocus '...so that SubMenu stays open when mouse is off location menuFocusOpacityIndex = 1 EndIf 'Update SubMenu Focus onMouseMove subMenuFocusedOn = 0 'WIP If isMenuSelected = 1 Then subMenuFocusOpacity = 0 'Loop thru sub menu, as required. Sets subMenuFocus Top, Opacity & ZoomX. And sets subMenuBackgroundZoomY If mseX >= menuFocusX[menuFocusedOn] And mseX <= menuFocusX[menuFocusedOn] + subMenuWidth[menuFocusedOn] Then If mseY > menuHeight And mseY <= menuHeight * (Array.GetItemCount(subMenu[menuFocusedOn]) + 1) Then For i = Array.GetItemCount(subMenu[menuFocusedOn]) To 1 Step -1 If mseY >= menuHeight * i And mseY <= menuHeight * (i+1) Then subMenuFocusTop = menuHeight * i subMenuFocusedOn = i EndIf EndFor subMenuFocusOpacity = 100 EndIf subMenuFocusZoomX = subMenuWidth[menuFocusedOn] / menuFocusWidth subMenuBackgroundZoomY = (Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) / menuHeight EndIf Else subMenuFocusOpacity = 0 EndIf EndSub Sub UpdateMenuOnMouseDown 'Update Menu onMouseDown If menuFocusedOn <> 0 Then isMenuSelected = -isMenuSelected 'toggle on Click 1/-1 menuFocusOpacityIndex = isMenuSelected EndIf priorMenuFocus = 0 If isMenuSelected = -1 Then If mseY > menuHeight Or mseX > totalMenuWidth Then menuFocusOpacityIndex = 0 priorMenuFocus = menuFocusedOn EndIf EndIf 'Update SubMenu onMouseDown If isMenuSelected = 1 Then subMenuOpacity = 100 subMenuFocusZoomX = subMenuWidth[menuFocusedOn] / menuFocusWidth subMenuBackgroundZoomY = (Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) / menuHeight '****** Else subMenuOpacity = 0 subMenuFocusOpacity = 0 EndIf 'OnMenuClicked event {non async Event} - pass the selection to If menuClicked If isMenuSelected = -1 And subMenuFocusedOn > 0 Then menuSelection = menuFocusedOn subMenuSelection = subMenuFocusedOn If menuSelection > 0 And subMenuSelection > 0 Then '***OnMenuClicked Event*** menuClicked = "True" 'non async event. Sequential EndIf menuFocusedOn = 0 subMenuFocusedOn = 0 'Unlock the selected Menu after no mouseMove between clicks ElseIf isMenuSelected = -1 And mseY > menuHeight Or isMenuSelected = -1 And mseX > totalMenuWidth Then '****wip here menuFocusedOn = 0 EndIf EndSub Sub UpdateMenuFrame 'Update Menu Focus - Main Bar Shapes.SetOpacity(menuFocus, menuFocusOpacity[menuFocusOpacityIndex]) Shapes.Zoom(menuFocus, menuFocusZoomX, 1) Shapes.Move(menuFocus, menuFocusX[menuFocusedOn] + (menuWidth[menuFocusedOn] - menuFocusWidth) /2, 0) 'Update SubMenu - Got Focus Shapes.SetOpacity(subMenuBackground, subMenuOpacity) Shapes.Zoom(subMenuBackground, subMenuFocusZoomX, subMenuBackgroundZoomY) Y = menuHeight + ((Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) - menuHeight) / 2 'wip put in update program Shapes.Move(subMenuBackground, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2, Y) For i = Array.GetItemCount(subMenu[menuFocusedOn]) To 1 Step -1 Shapes.SetOpacity(subMenuText[menuFocusedOn][i], subMenuOpacity) EndFor 'Update SubMenu - Lost Focus Shapes.SetOpacity(subMenuBackground[priorMenuFocus], 0) 'check if index needed For i = Array.GetItemCount(subMenu[priorMenuFocus]) To 1 Step -1 Shapes.SetOpacity(subMenuText[priorMenuFocus][i], 0) EndFor 'Update SubMenu Focus Shapes.SetOpacity(subMenuFocus, subMenuFocusOpacity) Shapes.Zoom(subMenuFocus, subMenuFocusZoomX, 1) Shapes.Move(subMenuFocus, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2, subMenuFocusTop) ' Shapes.Move(subMenuFocus1, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2+5, subMenuFocusTop+5) EndSub End>BGF911-4.sb< Start>BGF911.sb< 'http://smallbasic.com/program/?VST735-1 'Drop Down Menu System - (under construction) by Jibba Jabba, January 2014 'For my native SB code library Initialise() While "True" UpdateProgram() UpdateFrame() FrameRate() EndWhile '======================================================= 'FIRST ORDER SUBROUTINES '======================================================= Sub UpdateProgram start = Clock.ElapsedMilliseconds If mouseMove Then GetMousePosition() UpdateMenuOnMouseMove() mouseMove = "False" EndIf If mouseDown Then UpdateMenuOnMouseDown() 'creates a non async OnMenuClicked Event 'GetMousePosition() 'not used here for menu mouseDown = "False" EndIf If menuClicked Then 'OnMenuClicked TextWindow.WriteLine("menu = " + menu[menuSelection]) TextWindow.WriteLine(" submenu = " + subMenu[menuSelection][subMenuSelection]) menuSelection = 0 subMenuSelection = 0 menuClicked = "False" EndIf EndSub Sub UpdateFrame UpdateMenuFrame() EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then 'TextWindow.WriteLine("ms = " + (Clock.ElapsedMilliseconds - start)) 'speed Program.Delay(delay) Else 'TextWindow.WriteLine("delay = " + delay) 'lag EndIf EndSub '============================================================ 'SECOND ORDER SUBROUTINES - except for Menu Module '============================================================ Sub GetMousePosition mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY EndSub '=========================================================== 'INITIALISE '=========================================================== Sub Initialise 'DEBUG TextWindow.Top = 20 TextWindow.Left = GraphicsWindow.Width + 50 GraphicsWindow.Left = 10 'Main Loop fps = 50 '*6 drags > 300fps 'Get &/Or Set Stuff gw = GraphicsWindow.Width gh = GraphicsWindow.Height GetMousePosition() InitialiseMenu() 'Register Events GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown EndSub '========================================================= 'Event Handlers '========================================================= Sub OnMouseMove mouseMove = "True" EndSub Sub OnMouseDown mouseDown = "True" EndSub '************************************************************************************************************ '============================================================ 'DROP DOWN MENU SUBROUTINES '============================================================ 'Customise & Dynamic Subs - Second Order '----------------------------------------------------------------------------------------------------- Sub MenuDataTable 'USE THIS SUB TO CUSTOMISE MENU 'MENU 'Data Table menu = "1=View Screen;2=Program;3=Help;4=Test This" '<<<<<<<< "True" Then weHaveSprites = "False" EndIf EndFor menuFocusOpacityIndex = 0 'Get posX for menuFocus For i = 1 To Array.GetItemCount(menuWidth) 'to be reversed totalMenuWidth = totalMenuWidth + menuWidth[i] menuFocusX[i] = totalMenuWidth - menuWidth[i] EndFor If totalMenuWidth > gw Then TextWindow.WriteLine("ERROR: total menu widths exceeds GW") TextWindow.Pause() EndIf 'Set Parameters menuHeight = 25 menuFocusWidth = 50 'original width before Zoom scale X menuTextOffset = 8 isMenuSelected = -1 'toggle init OFF menuFocusOpacity = "1=100;-1=30;0=0" subMenuTextOffset = 16 DrawMenuBar() 'USED TO REDRAW MENU AFTER WINDOW RESIZE 'Add Menu Focus If weHaveSprites Then menuFocus = Shapes.AddImage(menuFocusSprite) Else GraphicsWindow.BrushColor = "DeepPink" GraphicsWindow.PenWidth = 0 menuFocus = Shapes.AddRectangle(menuFocusWidth, menuHeight) 'WIP ************ EndIf Shapes.SetOpacity(menuFocus, 0) 'Add Menu GraphicsWindow.FontName = "Segoe Print" GraphicsWindow.FontSize = 13 GraphicsWindow.BrushColor = "PaleGreen" For i = Array.GetItemCount(menu) To 1 Step -1 menuText[i] = Shapes.AddText(menu[i]) Shapes.Move(menuText[i], menuFocusX[i] + menuTextOffset, 0) EndFor 'Error Check subMenu Width. NEEDS MORE TESTING If menuFocusX[Array.GetItemCount(menu)] + subMenuWidth[Array.GetItemCount(menu)] > gw Then TextWindow.WriteLine("ERROR: sum of all subMenu widths exceeds GW") TextWindow.Pause() EndIf 'Add Sub Menus - FIXING B/GROUND SPRITE ******************************* If weHaveSprites Then subMenuBackground = Shapes.AddImage(subMenuBackgroundSprite) Else GraphicsWindow.BrushColor = "SandyBrown" subMenuBackground = Shapes.AddRectangle(menuFocusWidth, menuHeight) EndIf Shapes.SetOpacity(subMenuBackground, 0) 'Add SubMenus If weHaveSprites Then subMenuFocus = Shapes.AddImage(subMenuFocusSprite) 'wip sprite *********** Else GraphicsWindow.BrushColor = "Grey" GraphicsWindow.PenWidth = 0 subMenuFocus = Shapes.AddRectangle(menuFocusWidth, menuHeight) EndIf Shapes.SetOpacity(subMenuFocus, 0) For j = Array.GetItemCount(subMenu) To 1 Step -1 left = menuFocusX[j] + subMenuTextOffset For i = Array.GetItemCount(subMenu[j]) To 1 Step -1 GraphicsWindow.BrushColor = "PaleGreen" subMenuText[j][i] = Shapes.AddText(subMenu[j][i]) Shapes.Move(subMenuText[j][i], left, menuHeight * i) Shapes.SetOpacity(subMenuText[j][i], 0) EndFor EndFor EndSub '------------------------------------------------------------------------------------------------------------ 'Menu Updates - Second Order '------------------------------------------------------------------------------------------------------------ Sub UpdateMenuOnMouseMove 'Update Menu Focus onMouseMove menuFocusedOn = 0 menuFocusOpacityIndex = 0 If mseY <= menuHeight And mseX <= totalMenuWidth Then For i = Array.GetItemCount(menu) To 1 Step -1 If mseX >= menuFocusX[i] And mseX <= menuFocusX[i] + menuWidth[i] Then menuFocusOpacityIndex = isMenuSelected 'isMenuSelected toggles onMouseDown 1/-1 menuFocusZoomX = menuWidth[i] / menuFocusWidth menuFocusedOn = i 'determines which SubMenu[i] to open If isMenuSelected = 1 nextMenuFocus = menuFocusedOn EndIf EndFor If isMenuSelected = 1 And nextMenuFocus <> currentMenuFocus Then 'change selected Menu focus priorMenuFocus = currentMenuFocus currentMenuFocus = nextMenuFocus EndIf ElseIf isMenuSelected = 1 Then 'lock the selected Menu and its opacity to show related SubMenu menuFocusedOn = currentMenuFocus '...so that SubMenu stays open when mouse is off location menuFocusOpacityIndex = 1 EndIf 'Update SubMenu Focus onMouseMove subMenuFocusedOn = 0 'WIP If isMenuSelected = 1 Then subMenuFocusOpacity = 0 'Loop thru sub menu, as required. Sets subMenuFocus Top, Opacity & ZoomX. And sets subMenuBackgroundZoomY If mseX >= menuFocusX[menuFocusedOn] And mseX <= menuFocusX[menuFocusedOn] + subMenuWidth[menuFocusedOn] Then If mseY > menuHeight And mseY <= menuHeight * (Array.GetItemCount(subMenu[menuFocusedOn]) + 1) Then For i = Array.GetItemCount(subMenu[menuFocusedOn]) To 1 Step -1 If mseY >= menuHeight * i And mseY <= menuHeight * (i+1) Then subMenuFocusTop = menuHeight * i subMenuFocusedOn = i EndIf EndFor subMenuFocusOpacity = 100 EndIf subMenuFocusZoomX = subMenuWidth[menuFocusedOn] / menuFocusWidth subMenuBackgroundZoomY = (Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) / menuHeight EndIf Else subMenuFocusOpacity = 0 EndIf EndSub Sub UpdateMenuOnMouseDown 'Update Menu onMouseDown If menuFocusedOn <> 0 Then isMenuSelected = -isMenuSelected 'toggle on Click 1/-1 menuFocusOpacityIndex = isMenuSelected EndIf priorMenuFocus = 0 If isMenuSelected = -1 Then If mseY > menuHeight Or mseX > totalMenuWidth Then menuFocusOpacityIndex = 0 priorMenuFocus = menuFocusedOn EndIf EndIf 'Update SubMenu onMouseDown If isMenuSelected = 1 Then subMenuOpacity = 100 subMenuFocusZoomX = subMenuWidth[menuFocusedOn] / menuFocusWidth subMenuBackgroundZoomY = (Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) / menuHeight '****** Else subMenuOpacity = 0 subMenuFocusOpacity = 0 EndIf 'OnMenuClicked event {non async Event} - pass the selection to If menuClicked If isMenuSelected = -1 And subMenuFocusedOn > 0 Then menuSelection = menuFocusedOn subMenuSelection = subMenuFocusedOn If menuSelection > 0 And subMenuSelection > 0 Then '***OnMenuClicked Event*** menuClicked = "True" 'non async event. Sequential EndIf menuFocusedOn = 0 subMenuFocusedOn = 0 'Unlock the selected Menu after no mouseMove between clicks ElseIf isMenuSelected = -1 And mseY > menuHeight Or isMenuSelected = -1 And mseX > totalMenuWidth Then '****wip here menuFocusedOn = 0 EndIf EndSub Sub UpdateMenuFrame 'Update Menu Focus - Main Bar Shapes.SetOpacity(menuFocus, menuFocusOpacity[menuFocusOpacityIndex]) Shapes.Zoom(menuFocus, menuFocusZoomX, 1) Shapes.Move(menuFocus, menuFocusX[menuFocusedOn] + (menuWidth[menuFocusedOn] - menuFocusWidth) /2, 0) 'Update SubMenu - Got Focus Shapes.SetOpacity(subMenuBackground, subMenuOpacity) Shapes.Zoom(subMenuBackground, subMenuFocusZoomX, subMenuBackgroundZoomY) Y = menuHeight + ((Array.GetItemCount(subMenu[menuFocusedOn]) * menuHeight) - menuHeight) / 2 'wip put in update program Shapes.Move(subMenuBackground, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2, Y) For i = Array.GetItemCount(subMenu[menuFocusedOn]) To 1 Step -1 Shapes.SetOpacity(subMenuText[menuFocusedOn][i], subMenuOpacity) EndFor 'Update SubMenu - Lost Focus Shapes.SetOpacity(subMenuBackground[priorMenuFocus], 0) 'check if index needed For i = Array.GetItemCount(subMenu[priorMenuFocus]) To 1 Step -1 Shapes.SetOpacity(subMenuText[priorMenuFocus][i], 0) EndFor 'Update SubMenu Focus Shapes.SetOpacity(subMenuFocus, subMenuFocusOpacity) Shapes.Zoom(subMenuFocus, subMenuFocusZoomX, 1) Shapes.Move(subMenuFocus, menuFocusX[menuFocusedOn] + (subMenuWidth[menuFocusedOn] - menuFocusWidth) /2, subMenuFocusTop) EndSub End>BGF911.sb< Start>BGH855.sb< ''' Binary and Hexadecimal ''' Copyright © 2016 Nonki Takahashi. The MIT License. ''' Last update 2016-05-02 ''' Challenge 2016-05 ' GraphicsWindow.Title = "Binary and Hexadecimal" Form() For dec = 255 To 0 Step -1 ShowBinary() ShowHex() Program.Delay(30) EndFor While "True" dec = Math.GetRandomNumber(256) - 1 ShowBinary() ShowHex() Shapes.SetOpacity(hex, 0) Program.Delay(3000) For op = 0 To 100 Shapes.SetOpacity(hex, op) Program.Delay(30) EndFor Program.Delay(1000) EndWhile Sub Form GraphicsWindow.Width = 598 GraphicsWindow.Height = 428 size = 40 x0 = 70 y0 = 60 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "Lime" For i = 1 To 8 bit[8 - i] = Shapes.AddEllipse(size, size) Shapes.Move(bit[8 - i], x0 + (i - 1) * size * 1.4, y0) Shapes.SetOpacity(bit[8 - i], 20) EndFor GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.FontSize = size * 5 GraphicsWindow.BrushColor = "White" hex = Shapes.AddText("00") Shapes.Move(hex, x0 + size * 2.5, y0 + size * 1.6) EndSub Sub DecToBaseN ' Convert decimal number to notation system of base n ' param dec - decimal number ' param n - base n ' return num - number in notation system of base n Stack.PushValue("local", dec) If dec = 0 Then num = 0 Else num = "" While 0 < dec num = Text.Append(Text.GetSubText("0123456789ABCDEF", Math.Remainder(dec, n) + 1, 1), num) dec = Math.Floor(dec / n) EndWhile EndIf dec = Stack.PopValue("local") EndSub Sub ShowBinary ' param dec - decimal number n = 2 DecToBaseN() len = Text.GetLength(num) ' binary If len < 8 Then num = Text.Append(Text.GetSubTextToEnd("0000000", len), num) len = 8 EndIf For i = 1 To len If Text.GetSubText(num, i, 1) = "1" Then Shapes.SetOpacity(bit[len - i], 100) Else Shapes.SetOpacity(bit[len - i], 20) EndIf EndFor EndSub Sub ShowHex ' param dec - decimal number n = 16 DecToBaseN() If Text.GetLength(num) = 1 Then num = Text.Append(0, num) EndIf Shapes.SetText(hex, num) EndSub End>BGH855.sb< Start>BGJ192.sb< GraphicsWindow.BackgroundColor="teal" GraphicsWindow.Title = "Pascal's Triangle" level = 12 Init() For j = 1 To level _x = x For i = 1 To j If (i = 1) Or (i = j) Then p[j][i] = 1 Else p[j][i] = p[j - 1][i - 1] + p[j - 1][i] EndIf h = fs * 1.1 w = Text.GetLength(p[j][i]) * fs * 0.6 GraphicsWindow.BrushColor=LDColours.HSLtoRGB( (p[j][i]/460)*290 1 .5) GraphicsWindow.FillEllipse(x - r, y - r, 2 * r, 2 * r) GraphicsWindow.BrushColor="black" GraphicsWindow.DrawText(x - w / 2+2, 2+y - h / 2, p[j][i]) GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(x - w / 2, y - h / 2, p[j][i]) x = x + 2 * dx EndFor x = _x - dx y = y + dy EndFor Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh dy = gh / (level + 1) dx = dy / Math.SquareRoot(3) y = dy x = gw / 2 r = dy * 0.5 fs = r * 0.9 GraphicsWindow.PenColor = "Cyan" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = fs GraphicsWindow.FontName = "Trebuchet MS" EndSub End>BGJ192.sb< Start>BGL597.sb< 'JPT045 args=0 p=0 GraphicsWindow.title="3D Star view3D = LD3DView.AddView(900,900,"true") LD3DView.AddDirectionalLight (view3D,"#77aaaa00",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 3) sl=LD3DView.AddspotLight(view3D,"white",5,25, 5 ,-1 ,-1 ,-1 90 150) LD3DView.AddAmbientLight(view3D,"#77555555") r35=44 ya=15 LD3DView.ResetCamera(view3D, r35/2,ya,r35/2, -1, -.5, 0, "","","") ann=0 ln=1 GraphicsWindow.left=10 GraphicsWindow.top=10 GraphicsWindow.Width =1500 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor ="darkblue GraphicsWindow.PenWidth =1 GraphicsWindow.PenColor ="lime cll=ldtext.Split ("gold yellow" " ") dd=0 w=1 For f=1 to 6 tb="" tang=0 For rr1=0 to 0 For x=0 to 12 txx=LDMath.Cos(tang-15)*2 tyy=LDMath.sin(tang-15)*2 tb=tb+txx+":"+tyy+":0:" rr=Math.Remainder (x+f 2)*5+rr1/3 txx=LDMath.Cos(tang)*(15-rr) tyy=LDMath.sin(tang)*(15-rr) tb=tb+txx+":"+tyy+":0:" tang =tang+30 endfor tu=LD3DView.AddTube (view3D tb .3 50 cll[Math.Remainder (f 2)+1] "D") LD3DView.AnimateRotation (view3D tu 0 0 1 0 360*w 6 ,-1) LD3DView.RotateGeometry (view3D tu 0 1 0 f*30) endfor w=-w endfor 'TextWindow.WriteLine (tb) For aa=0 to 7200 step .5 If GraphicsWindow.LastKey ="Space" Then aa=aa-.5 else px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") Program.Delay(22) endif endfor Sub tmov mm=LDMath.Convert2Cartesian(tx ty dd tang-90) dx=0'ty/10*ldmath.sin(ann) dz=0'ty/10*LDMath.Cos(ann) tb=tb+ LDMath.FixDecimal (mm[1]+dx 3)+":"+ ldmath.FixDecimal (mm[2] 3)+":"+dz+":" tx=mm[1] ty=mm[2] EndSub End>BGL597.sb< Start>BGM715.sb< Initialise() While "True" UpdateGame() UpdateFrame() FrameRate() EndWhile Sub UpdateGame 'update game on keyDown If keyDown Then If key["x"] Then TextWindow.WriteLine("hit key x") key["x"] = "" 'flag OFF here for hit key EndIf 'player motion If key["q"] Then playerOneX = playerOneX - 2 EndIf If key["w"] Then playerOneX = playerOneX + 2 EndIf If key["o"] Then playerTwoX = playerTwoX - 2 EndIf If key["p"] Then playerTwoX = playerTwoX + 2 EndIf keyDown = "False" EndIf EndSub Sub UpdateFrame Shapes.Move(playerOne, playerOneX, 0) Shapes.Move(playerTwo, playerTwoX, 0) EndSub Sub FrameRate delay = 1000 / fps - (Clock.ElapsedMilliseconds - start) If delay > 0 Then Program.Delay(delay) EndIf start = Clock.ElapsedMilliseconds EndSub Sub Initialise fps = 50 TextWindow.Left = 5 GraphicsWindow.Left = Desktop.Width - GraphicsWindow.Width -50 playerOne = Shapes.AddEllipse(50, 50) playerTwo = Shapes.AddRectangle(50, 50) Shapes.Move(playerTwo, GraphicsWindow.Width - 50, 0) playerTwoX = Shapes.GetLeft(playerTwo) GraphicsWindow.DrawText(10, 150, "Player 1: q w for left/right") GraphicsWindow.DrawText(10, 180, "Player 2: o p for left/right") GraphicsWindow.DrawText(10, 210, "hit key : x for not hold key down") GraphicsWindow.KeyDown = OnKeyDown 'GraphicsWindow.KeyUp = OnKeyUp EndSub Sub OnKeyDown lastKey = Text.ConvertToLowerCase(GraphicsWindow.LastKey) key[lastKey] = "True" keyDown = "True" EndSub End>BGM715.sb< Start>BGN927.sb< 'WINDOW GraphicsWindow.Hide() GraphicsWindow.Width = 580 GraphicsWindow.Height = 500 GraphicsWindow.Left = (Desktop.Width - 800) / 2 GraphicsWindow.Top = 50 GraphicsWindow.CanResize = "false" GraphicsWindow.Title = "Optical Illusion" GraphicsWindow.BackgroundColor = "black" GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "cyan" GraphicsWindow.BrushColor = "black" GraphicsWindow.Show() 'ILLUSION Timer.Interval = 25 Timer.Tick = tick Sub tick zoom = zoom - 0.005 rotation = rotation + 12 square = Shapes.AddTriangle(500, 450, 600, 350, 600, 400) Shapes.Rotate(square, rotation) Shapes.Zoom(square, 1 + zoom, 1 + zoom) EndSub End>BGN927.sb< Start>BGR254.sb< ' Flag of United Kingdom ' Copyright © 2017 Nonki Takahashi. The MIT License. ' Last update 2017-10-20 GraphicsWindow.Title = "Flag of United Kingdom" SB_Workaround() Init() ' initialize error shapes Shapes_Init() name = "UK" scale = gw / 480 Group_Add() Sub Init gw = 598 gh = gw / 2 GraphicsWindow.Width = gw GraphicsWindow.Height = gh angle = 0 EndSub Sub Group_Add ' Group | add shapes to a group ' param name - group name ' param shX, shY, origin of shape array ' param scale - scale of group ' param shape[] - shape array ' param nGroup - number of group ' return nGroup - updated number of group ' return group - group array Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nGroup = nGroup + 1 grp = "" grp["name"] = name grp["x"] = shX grp["y"] = shY grp["angle"] = 0 grp["dir"] = 1 Shapes_CalcWidthAndHeight() grp["width"] = shWidth grp["cx"] = shWidth / 2 grp["height"] = shHeight s = scale grp["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If Text.IsSubText("text|btn", shp["func"]) Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] If shp["fb"] = "False" Then GraphicsWindow.FontBold = "False" Else GraphicsWindow.FontBold = "True" EndIf EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor grp["shape"] = shape group[nGroup] = grp y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param shape[] - shape array ' return shWidth, shHeight - total size of shapes For i = i To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 0 ' x offset shY = 0 ' y offset shape = "" shape[1] = "pw=0;bc=#CF142B;func=rect;width=480;height=240;x=0;y=0;" shape[2] = "pw=0;bc=#FFF;func=tri;x1=222.11;y1=0;x2=0;y2=111.05;x3=444.22;y3=111.05;x=35.77;y=128.94;" shape[3] = "pw=0;bc=#FFF;func=tri;x1=222.11;y1=0;x2=0;y2=111.05;x3=444.22;y3=111.05;x=0;y=0;angle=180;" shape[4] = "pw=0;bc=#FFF;func=tri;x1=111.05;y1=0;x2=0;y2=222.11;x3=222.11;y3=222.11;x=0;y=17.88;angle=90;" shape[5] = "pw=0;bc=#FFF;func=tri;x1=111.05;y1=0;x2=0;y2=222.11;x3=222.11;y3=222.11;x=257.88;y=0;angle=-90;" shape[6] = "pw=0;bc=#00247D;func=tri;x1=186.33;y1=0;x2=0;y2=93.16;x3=372.66;y3=93.16;x=53.66;y=146.83;" shape[7] = "pw=0;bc=#00247D;func=tri;x1=186.33;y1=0;x2=0;y2=93.16;x3=372.66;y3=93.16;x=53.66;y=0;angle=180;" shape[8] = "pw=0;bc=#00247D;func=tri;x1=93.16;y1=0;x2=0;y2=186.33;x3=186.33;y3=186.33;x=0;y=26.83;angle=90;" shape[9] = "pw=0;bc=#00247D;func=tri;x1=93.16;y1=0;x2=0;y2=186.33;x3=186.33;y3=186.33;x=293.66;y=26.83;angle=-90;" shape[10] = "pw=0;bc=#FFF;func=rect;width=480;height=80;x=0;y=80;" shape[11] = "pw=0;bc=#FFF;func=rect;width=80;height=240;x=200;y=0;" shape[12] = "pw=0;bc=#CF142B;func=rect;width=480;height=48;x=0;y=96;" shape[13] = "pw=0;bc=#CF142B;func=rect;width=48;height=240;x=216;y=0;" EndSub End>BGR254.sb< Start>BGS154.sb< CreateButtons() lang = "En" SetButtonLanguage() page = 0 ShowPage() Controls.ButtonClicked = OnButtonClicked '=============================================== 'BUTTON SUBROUTINES '=============================================== Sub CreateButtons numButton = 0 GraphicsWindow.FontName = "Arial" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = 0 'Page 0 numButton = numButton+1 buttonData[numButton]["Page"] = 0 buttonData[numButton]["X"] = 42 buttonData[numButton]["Y"] = 20 buttonData[numButton]["En"] = "English" buttonData[numButton]["De"] = "English" numButton = numButton+1 buttonData[numButton]["Page"] = 0 buttonData[numButton]["X"] = 40 buttonData[numButton]["Y"] = 70 buttonData[numButton]["En"] = "Deutsch" buttonData[numButton]["De"] = "Deutsch" 'Page 1 numButton = numButton+1 buttonData[numButton]["Page"] = 1 buttonData[numButton]["X"] = -300 buttonData[numButton]["Y"] = -30 buttonData[numButton]["En"] = "Back" buttonData[numButton]["De"] = "Zurück" numButton = numButton+1 buttonData[numButton]["Page"] = 1 buttonData[numButton]["X"] = -200 buttonData[numButton]["Y"] = -30 buttonData[numButton]["En"] = "Next" buttonData[numButton]["De"] = "Weiter" numButton = numButton+1 buttonData[numButton]["Page"] = 1 buttonData[numButton]["X"] = -100 buttonData[numButton]["Y"] = -30 buttonData[numButton]["En"] = "Cancel" buttonData[numButton]["De"] = "Abbrechen" numButton = numButton+1 buttonData[numButton]["Page"] = 1 buttonData[numButton]["X"] = 30 buttonData[numButton]["Y"] = 250 buttonData[numButton]["En"] = "Show Readme" buttonData[numButton]["De"] = "Zeige Readme" 'Page 2 'numButton = numButton+1 'buttonData[numButton]["Page"] = 2 'buttonData[numButton]["X"] = -300 'buttonData[numButton]["Y"] = -30 'buttonData[numButton]["En"] = "Back" 'buttonData[numButton]["De"] = "Zurück" 'numButton = numButton+1 'buttonData[numButton]["Page"] = 2 'buttonData[numButton]["X"] = -200 'buttonData[numButton]["Y"] = -30 'buttonData[numButton]["En"] = "Next" 'buttonData[numButton]["De"] = "Weiter" numButton = numButton+1 buttonData[numButton]["Page"] = 2 buttonData[numButton]["X"] = -100 buttonData[numButton]["Y"] = -30 buttonData[numButton]["En"] = "Finish" buttonData[numButton]["De"] = "Fertig" 'Page 3 'numButton = numButton+1 'buttonData[numButton]["Page"] = 3 'buttonData[numButton]["X"] = -300 'buttonData[numButton]["Y"] = -30 'buttonData[numButton]["En"] = "Back" 'buttonData[numButton]["De"] = "Zurück" 'numButton = numButton+1 'buttonData[numButton]["Page"] = 3 'buttonData[numButton]["X"] = -100 'buttonData[numButton]["Y"] = -30 'buttonData[numButton]["En"] = "Finish" 'buttonData[numButton]["De"] = "Fertig" numPage = 0 For _i = 1 To numButton buttons[_i] = Controls.AddButton("",-1000,-1000) numPage = Math.Max(numPage,buttonData[_i]["Page"]) EndFor EndSub Sub HideAllButtons For _i = 1 To numButton Controls.HideControl(buttons[_i]) EndFor EndSub Sub SetButtonLanguage For _i = 1 To numButton Controls.SetButtonCaption(buttons[_i],buttonData[_i][lang]) EndFor EndSub Sub ShowPageButtons HideAllButtons() For _i = 1 To numButton If (page = buttonData[_i]["Page"]) Then x = buttonData[_i]["X"] y = buttonData[_i]["Y"] If (x < 0) Then x = x+gw EndIf If (y < 0) Then y = y+gh EndIf Shapes.Move(buttons[_i],x,y) Controls.ShowControl(buttons[_i]) EndIf EndFor EndSub '=============================================== 'PAGE SUBROUTINES '=============================================== Sub InitialisePage GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.CanResize = "False" GraphicsWindow.Left = 700 GraphicsWindow.Top = 450 LDUtilities.Icon = Program.Directory + "\Icon.ico" GraphicsWindow.Title = "NoobHelper Installer" GraphicsWindow.FontName = "Arial" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = 0 EndSub Sub ShowPage If (page = 0) Then gw = 180 gh = 130 Else gw = 650 gh = 500 EndIf InitialisePage() ShowPageButtons() ClearPage() 'Do page specific stuff or call appropriate subroutine If (page = 1) Then Hintergrund = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp") GraphicsWindow.DrawImage(Hintergrund, 0, 0) LDUtilities.Icon = Program.Directory + "\Icon.ico" GraphicsWindow.Title = "NoobHelper Installer" GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 GraphicsWindow.PenWidth = 0 GraphicsWindow.DrawRectangle(25,75,600,420) GraphicsWindow.DrawBoundText(30,110,600,"Willkommen beim Installer von NoobHelper! In den nächsten Schritten werde ich euch durch die Installation führen.") GraphicsWindow.DrawBoundText(30,160,600,"Bitte gebt den Installationspfad ein:") EinPfadBox = Controls.AddMultiLineTextBox(30,200) Controls.SetSize(EinPfadBox,590,30) Controls.SetTextBoxText(EinPfadBox, "C:\Programme (x86)\NoobHelper") GraphicsWindow.FontSize = 20 GraphicsWindow.FontBold = 0 ElseIf (page = 2) Then Hintergrund1 = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp")' ## GraphicsWindow.DrawImage(Hintergrund1, 0, 0) Directory = Controls.GetTextBoxText(EinPfadBox) Controls.HideControl(EinPfadBox) GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 GraphicsWindow.PenWidth = 0 GraphicsWindow.DrawRectangle(30,100,600,420) GraphicsWindow.DrawBoundText(30,120,600,"NoobHelper wird nun installiert...") FilePlus.DecompressFile(Program.Directory + "\NoobHelper Data.rar", Directory) GraphicsWindow.FontSize = 15 'Program.Delay(1000) GraphicsWindow.DrawBoundText(30, 170, 550, "Erstelle Verzeichnisse...") ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(Directory) GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(400) GraphicsWindow.DrawBoundText(280, 170, 550, "Fertig!") GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 'Program.Delay(200) GraphicsWindow.DrawBoundText(30, 200, 550, "Kopiere Bilder...") GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(5310) GraphicsWindow.DrawBoundText(280, 200, 550, "Fertig!") GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 'Program.Delay(200) GraphicsWindow.DrawBoundText(30, 260, 550, "Kopiere Noobhelper.exe...") GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(1300) GraphicsWindow.DrawBoundText(280, 260, 550, "Fertig!") GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 'Program.Delay(200) GraphicsWindow.DrawBoundText(30, 290, 550, "Kopiere Data.dll...") GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(900) GraphicsWindow.DrawBoundText(280, 290, 550, "Fertig!") GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 'Program.Delay(200) GraphicsWindow.DrawBoundText(30, 320, 550, "Kopiere FC.dll...") GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(825) GraphicsWindow.DrawBoundText(280, 320, 550, "Fertig!") GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 'Program.Delay(200) GraphicsWindow.DrawBoundText(30, 350, 550, "Kopiere LitDev.dll...") GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(828) GraphicsWindow.DrawBoundText(280, 350, 550, "Fertig!") GraphicsWindow.FontSize = 15 GraphicsWindow.FontBold = 1 'Program.Delay(200) GraphicsWindow.DrawBoundText(30, 380, 550, "Kopiere SmallBasicLibrary.dll...") GraphicsWindow.FontSize = 18 GraphicsWindow.FontBold = 0 'Program.Delay(832) GraphicsWindow.DrawBoundText(280, 380, 550, "Fertig!") GraphicsWindow.FontSize = 20 'ElseIf (page = 3) Then ' Hintergrund2 = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp") ' GraphicsWindow.DrawImage(Hintergrund2, 0, 0) ' GraphicsWindow.FontSize = 12 ' GraphicsWindow.FontBold = 1 ' GraphicsWindow.PenWidth = 0 ' GraphicsWindow.DrawRectangle(30,100,600,420) ' GraphicsWindow.DrawBoundText(30,120,600,"NoobHelper wurde erfolgreich installiert!") ' GraphicsWindow.FontSize = 20 ' GraphicsWindow.FontBold = 0 EndIf EndSub Sub ClearPage brush = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(0,0,gw,gh) GraphicsWindow.BrushColor = brush EndSub '=============================================== 'README WINDOWS '=============================================== Sub ReadmeEnSub ReadmeFensterEN = FCInstances.Add("WinReadmeEN") While ("True") FCInstances.CallSub(ReadmeFensterEN, "TextWinReadmeEN") EndWhile EndSub Sub WinReadmeEN GraphicsWindow.Height = 750 GraphicsWindow.Width = 500 GraphicsWindow.Title = "NoobHelper Installer" CloseB = Controls.AddButton("Close", 390, 710) Controls.SetSize(CloseB, 100,30) EndSub Sub TextWinReadmeEN ' The following line could be harmful and has been automatically commented. ' ReadmeEn = File.ReadContents(Program.Directory + "\README_EN.txt") GraphicsWindow.DrawBoundText(30, 30, 440, ReadmeEN) EndSub Sub ReadmeDeSub ReadmeFensterDE = FCInstances.Add("WinReadmeDE") While ("True") FCInstances.CallSub(ReadmeFensterDE, "TextWinReadmeDE") EndWhile EndSub Sub WinReadmeDE GraphicsWindow.Height = 750 GraphicsWindow.Width = 500 GraphicsWindow.Title = "NoobHelper Installer" SchliesenB = Controls.AddButton("Schließen", 390, 710) Controls.SetSize(SchliesenB, 100,30) EndSub Sub TextWinReadmeDE ' The following line could be harmful and has been automatically commented. ' ReadmeDe = File.ReadContents(Program.Directory + "\README_DE.txt") GraphicsWindow.DrawBoundText(30, 30, 440, ReadmeDE) EndSub '=============================================== 'EVENT SUBROUTINES '=============================================== Sub OnButtonClicked button = Controls.LastClickedButton For i = 1 To numButton If (button = buttons[i]) Then If (buttonData[i]["En"] = "English") Then lang = "En" SetButtonLanguage() page = 1 ShowPage() ElseIf (buttonData[i]["En"] = "Deutsch") Then lang = "De" SetButtonLanguage() page = 1 ShowPage() ElseIf (buttonData[i]["En"] = "Back") Then page = page-1 ShowPage() ElseIf (buttonData[i]["En"] = "Next" And page < numPage) Then page = page+1 ShowPage() ElseIf (buttonData[i]["En"] = "Exit") Then Program.End() ElseIf (buttonData[i]["En"] = "Finish") Then Program.End() ElseIf (buttonData[i]["En"] = "Show Readme") Then lang = "EN" ReadmeEnSub() ElseIf (buttonData[i]["De"] = "Zeige Readme") Then lang = "De" ReadmeDeSub() ElseIf (button = CloseB) Then GraphicsWindow.Hide() ElseIf (button = SchliesenB) Then GraphicsWindow.Hide() EndIf EndIf EndFor EndSub End>BGS154.sb< Start>BGT662.sb< GraphicsWindow.Clear() TextWindow.Hide() GraphicsWindow.Show() pos1=1 pos2=1 up="Up" down="Down" left="Left" right="Right" GraphicsWindow.SetPixel(pos1,pos2,"black") GraphicsWindow.KeyDown=OnKeyDown GraphicsWindow.KeyUp=OnKeyUp Sub OnKeyDown If GraphicsWindow.LastKey=up Then keydown1() ElseIf GraphicsWindow.LastKey=down Then keydown2() ElseIf GraphicsWindow.LastKey=left Then keydown3() ElseIf GraphicsWindow.LastKey=right Then keydown4() EndIf EndSub Sub OnKeyUp If GraphicsWindow.LastKey=up Then keyup1() ElseIf GraphicsWindow.LastKey=down Then keyup2() ElseIf GraphicsWindow.LastKey=left Then keyup3() ElseIf GraphicsWindow.LastKey=right Then keyup4() EndIf EndSub Sub keydown1 GraphicsWindow.Clear() pos1=pos1 pos2=pos2-1 GraphicsWindow.SetPixel(pos1,pos2-1,"black") endsub sub keyup1 GraphicsWindow.SetPixel(pos1,pos2,"black") endsub Sub keydown2 GraphicsWindow.Clear() pos1=pos1 pos2=pos2+1 GraphicsWindow.SetPixel(pos1,pos2+1,"black") endsub sub keyup2 GraphicsWindow.SetPixel(pos1,pos2,"black") endsub Sub keydown3 GraphicsWindow.Clear() pos1=pos1-1 pos2=pos2 GraphicsWindow.SetPixel(pos1-1,pos2,"black") endsub sub keyup3 GraphicsWindow.SetPixel(pos1,pos2,"black") endsub Sub keydown4 GraphicsWindow.Clear() pos1=pos1+1 pos2=pos2 GraphicsWindow.SetPixel(pos1+1,pos2,"black") endsub sub keyup4 GraphicsWindow.SetPixel(pos1,pos2,"black") endsub End>BGT662.sb< Start>BGV234.sb< TextWindow.Show() TextWindow.WriteLine("Number of rows in the grid (50 max):") rows = TextWindow.Read() v = 0 size = 10 sc = 0 sr = 0 TextWindow.WriteLine("Number of columns in the grid (100 max):") columns = TextWindow.Read() TextWindow.WriteLine("Colour of boxes (Eg. Type #8B0000 for Dark Red):") colour = TextWindow.Read() TextWindow.Clear() TextWindow.WriteLine("Loaded " + r + " out of " + rows) For r = 0 To rows - 1 For c = 0 To columns - 1 GraphicsWindow.BrushColor = colour boxes[r][c] = Shapes.AddRectangle(size, size) Shapes.Move(boxes[r][c], c * size, r * size) hidden[sr][sc] = "T" sc = sc + 1 If sc= columns Then sc = 0 EndIf EndFor sr = sr + 1 TextWindow.Clear() TextWindow.WriteLine("Loaded " + r + " out of " + rows) EndFor 'TextWindow.WriteLine(hidden) 'TextWindow.Pause() GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Width = columns * 10 GraphicsWindow.Height = rows * 10 TextWindow.Clear() TextWindow.WriteLine("Click to Remove. Click again to Place") GraphicsWindow.MouseDown = SquareVisible Sub SquareVisible MX = GraphicsWindow.MouseX MY = GraphicsWindow.MouseY MX = MX/10 MY = MY/10 MX = Math.Floor(MX) MY = Math.Floor(MY) r = MY c = MX sr = MY sc = MX If r < rows Then If c < columns Then TextWindow.WriteLine("Square Row is " + r) TextWindow.WriteLine("Square Column is " + c) If hidden[sr][sc] = "T" Then TextWindow.WriteLine(hidden[sr][sc]) Shapes.HideShape(boxes[r][c]) hidden[sr][sc] = "F" ElseIf hidden[sr][sc] = "F" Then TextWindow.WriteLine(hidden[sr][sc]) Shapes.ShowShape(boxes[r][c]) hidden[sr][sc] = "T" EndIf TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") TextWindow.WriteLine(" ") EndIf EndIf EndSub End>BGV234.sb< Start>BGV706-1.sb< ''============================= 'Data Extension Initialisation DataExtension.Init() '============================= '==================================================================== 'Init Graphic Window GameWindow.Width = 690 GameWindow.Height = 422 GameWindow.CanResize = "False" GameWindow.Theme = "ExpressionLight" GameWindow.Show() 'GUI Controls VideoBox = GameControls.AddRectangle(5,5,450,300) PlayListBox = GameControls.AddRectangle(460,5,215,380) GameControls.SetColors(VideoBox,"White","Black",1) GameControls.SetColors(PlayListBox,"White","Black",1) 'File Extension list Musicext="mp3:wma:mp4:avi:wmv:mpg" ' add your file type extension 'Buttons Show_PlayList = GameControls.AddButton(">>",430,360,30,25) Hide_PlayList = GameControls.AddButton("<<",430,360,30,25) Play_Button = GameControls.AddButton("Play",140,345,60,40) Pause_Button = GameControls.AddButton("Pause",205,345,60,40) Next_Button = GameControls.AddButton("Next",270,345,60,40) Prev_Button = GameControls.AddButton("Prev",75,345,60,40) Stop_Button = GameControls.AddButton("Stop",10,345,60,40) Seek_Bar = GameControls.AddSlider(0,10,315,395,22) Volume_Control_Bar = GameControls.AddSlider(0,350,345,75,22) 'Time text box Time_Box = GameControls.AddTextBox("Text",410,315,45,22) 'Register Sub GameControls.RegisterMouseDownEvent(Play_Button,"Play_Song") GameControls.RegisterMouseDownEvent(Next_Button,"Play_Next") GameControls.RegisterMouseDownEvent(Prev_Button,"Play_Prev") GameControls.RegisterMouseDownEvent(Stop_Button,"Stop_Song") GameControls.RegisterMouseDownEvent(Pause_Button,"Pause") GameControls.RegisterMouseDownEvent(Hide_PlayList,"Hide") GameControls.RegisterMouseDownEvent(Show_PlayList,"Show") GameControls.RegisterMouseDownEvent(Seek_Bar,"Slider_Move") GameControls.RegisterValueChangedEvent(Volume_Control_Bar,"Volume_Set") 'Sub To Call On Window load Open_Files() '===================================================================== 'Create Media Play Control Player = Media.CreateMediaPlayer(Files_Array[3],7,7,446,296) ' Open first music file '===================================================================== 'Seek Bar update and next media on end While "True" Media_Position= (Media.GetPosition(Player)*100)/Media.GetLength(Player) ' ##.# % GameControls.SetValue(Seek_Bar,Media_Position/10) ' #.## % Min = Math.Floor(Media.GetPosition(Player)/1000/60) ' ## min Secs = Math.Floor(Math.Remainder(Media.GetPosition(Player)/1000,60)) ' ## sec GameControls.SetText(Time_Box,Min+" : "+Secs+"") If Media_Position>=99.9 then ' End point Play_Next() EndIf endwhile 'Loading Video and Sound File into an array Sub Open_Files start: Dir = Dialogs.AskForDirectory() ' Select a directory that include music files Files_Array = FilePlus.GetAllFiles(Dir) Total_Files = Array.GetItemCount(Files_Array) GameWindow.Title = "Small Music Player - By Amir "+Dir Song_Id=3 'First file To Play SetVolume() CurrentExt=text.GetSubTextToEnd(Files_Array[Song_Id],Text.GetLength(Files_Array[Song_Id])-2) If text.IsSubText(Musicext,CurrentExt)="True" then Play_Song() Currentmedia=GameControls.AddText(song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id]),460,110,"Comic Sans MS",16,"True","False") Else Dialogs.ShowMessageBox("Please Select Media Directory First","No Files","OK","Error") Goto Start EndIf EndSub '========================================================================================= '========================================================================================= 'Play First song Sub Play_Song If GameControls.GetText(Pause_Button) = "Paused" Then Media.Resume(Player) Else Media.stop(Player) Media.SetMedia(Player, Files_Array[Song_Id]) ' set new music file GameControls.SetValue(Seek_Bar,Media_Position/10) ' slider =0 GameControls.SetText(Currentmedia,song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id])) Media.Play(Player) EndIf GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '========================================================================================= '========================================================================================= 'Play next song Sub Play_Next Media.Stop(Player) Song_Id = Song_Id + 1 If Song_Id > Total_Files Then Song_Id = Total_Files EndIf Media.SetMedia(Player, Files_Array[Song_Id]) ' Song_ID is already +1 GameControls.SetValue(Seek_Bar,0) ' progress bar =0 GameControls.SetText(Currentmedia,song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id])) Media.Play(Player) GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '=========================================================================================== '=========================================================================================== 'Play previous song Sub Play_Prev Media.stop(Player) Song_Id = Song_Id - 1 If Song_Id < 1 Then Song_Id = 1 EndIf Media.SetMedia(Player, Files_Array[Song_Id]) GameControls.SetText(Currentmedia,song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id])) GameControls.SetValue(Seek_Bar,0) ' progress bar =0 GameControls.SetValue(Seek_Bar,0) Media.Play(Player) GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '============================================================================================ '============================================================================================ 'Stop Current Playing Song Sub Stop_Song Media.stop(Player) GameControls.SetText(Play_Button,"Play") GameControls.SetText(Pause_Button,"Pause") EndSub '============================================================================================ 'Volume Settings Sub Volume_Set Vol_Value = GameControls.GetValue(Volume_Control_Bar) Media.SetVolume(Player,Vol_Value/100) EndSub '============================================================================================ 'Pause Playing song Sub Pause GameControls.SetText(Pause_Button,"Paused") Media.Pause(Player) GameControls.SetText(Play_Button,"Play") EndSub '============================================================================================ 'Hide PlayList Sub Hide For i = 680 To 460 Step -5 GameWindow.Width = i EndFor GameControls.SetVisibility(Hide_PlayList,"False") EndSub 'Show PlayList Sub Show For i = 460 To 680 Step 5 GameWindow.Width = i EndFor GameControls.SetVisibility(Hide_PlayList,"True") EndSub '============================================================================================ 'Set Song possition Sub Slider_Move Slider_Position = GameControls.GetValue(Seek_Bar) Slider_Time_Position = (Slider_Position*Media.GetLength(Player))/100 Media.SetPosition(Player,Slider_Time_Position) EndSub '============================================================================================ 'Set Volume level at 50% Sub SetVolume Media.SetVolume(Player,50) GameControls.SetValue(Volume_Control_Bar,50/10) EndSub '============================================================================================ End>BGV706-1.sb< Start>BGV706-2.sb< ''============================= 'Data Extension Initialisation DataExtension.Init() '============================= '==================================================================== 'Init Graphic Window GameWindow.Width = 690 GameWindow.Height = 422 GameWindow.CanResize = "False" GameWindow.Theme = "ExpressionLight" GameWindow.Show() 'GUI Controls VideoBox = GameControls.AddRectangle(5,5,450,300) PlayListBox = GameControls.AddRectangle(460,5,215,380) GameControls.SetColors(VideoBox,"White","Black",1) GameControls.SetColors(PlayListBox,"White","Black",1) 'File Extension list Musicext="mp3:wma:mp4:avi:wmv:mpg" ' add your file type extension 'Buttons Show_PlayList = GameControls.AddButton(">>",430,360,30,25) Hide_PlayList = GameControls.AddButton("<<",430,360,30,25) Play_Button = GameControls.AddButton("Play",140,345,60,40) Pause_Button = GameControls.AddButton("Pause",205,345,60,40) Next_Button = GameControls.AddButton("Next",270,345,60,40) Prev_Button = GameControls.AddButton("Prev",75,345,60,40) Stop_Button = GameControls.AddButton("Stop",10,345,60,40) Seek_Bar = GameControls.AddSlider(0,10,315,395,22) Volume_Control_Bar = GameControls.AddSlider(0,350,345,75,22) 'Time text box Time_Box = GameControls.AddTextBox("Text",410,315,45,22) 'Register Sub GameControls.RegisterMouseDownEvent(Play_Button,"Play_Song") GameControls.RegisterMouseDownEvent(Next_Button,"Play_Next") GameControls.RegisterMouseDownEvent(Prev_Button,"Play_Prev") GameControls.RegisterMouseDownEvent(Stop_Button,"Stop_Song") GameControls.RegisterMouseDownEvent(Pause_Button,"Pause") GameControls.RegisterMouseDownEvent(Hide_PlayList,"Hide") GameControls.RegisterMouseDownEvent(Show_PlayList,"Show") GameControls.RegisterMouseDownEvent(Seek_Bar,"Slider_Move") GameControls.RegisterValueChangedEvent(Volume_Control_Bar,"Volume_Set") 'Sub To Call On Window load Open_Files() '===================================================================== 'Create Media Play Control Player = Media.CreateMediaPlayer(Files_Array[3],7,7,446,296) ' Open first music file '===================================================================== 'Seek Bar update and next media on end While "True" Media_Position= (Media.GetPosition(Player)*100)/Media.GetLength(Player) ' ##.# % GameControls.SetValue(Seek_Bar,Media_Position/10) ' #.## % Min = Math.Floor(Media.GetPosition(Player)/1000/60) ' ## min Secs = Math.Floor(Math.Remainder(Media.GetPosition(Player)/1000,60)) ' ## sec GameControls.SetText(Time_Box,Min+" : "+Secs+"") If Media_Position>=99.9 then ' End point Play_Next() EndIf endwhile 'Loading Video and Sound File into an array Sub Open_Files start: Dir = Dialogs.AskForDirectory() ' Select a directory that include music files Files_Array = FilePlus.GetAllFiles(Dir) Total_Files = Array.GetItemCount(Files_Array) GameWindow.Title = "Small Music Player - By Amir "+Dir Song_Id=3 'First file To Play SetVolume() CurrentExt=text.GetSubTextToEnd(Files_Array[Song_Id],Text.GetLength(Files_Array[Song_Id])-2) If text.IsSubText(Musicext,CurrentExt)="True" then Play_Song() Currentmedia=GameControls.AddText(song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id]),460,110,"Comic Sans MS",16,"True","False") GameControls.SetColors(Currentmedia,"Red","Red",1) Else Dialogs.ShowMessageBox("Please Select Media Directory First","No Files","OK","Error") Goto Start EndIf EndSub '========================================================================================= '========================================================================================= 'Play First song Sub Play_Song If GameControls.GetText(Pause_Button) = "Paused" Then Media.Resume(Player) Else Media.stop(Player) Media.SetMedia(Player, Files_Array[Song_Id]) ' set new music file GameControls.SetValue(Seek_Bar,Media_Position/10) ' slider =0 GameControls.SetText(Currentmedia,song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id])) Media.Play(Player) EndIf GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '========================================================================================= '========================================================================================= 'Play next song Sub Play_Next Media.Stop(Player) Song_Id = Song_Id + 1 If Song_Id > Total_Files Then Song_Id = Total_Files EndIf Media.SetMedia(Player, Files_Array[Song_Id]) ' Song_ID is already +1 GameControls.SetValue(Seek_Bar,0) ' progress bar =0 GameControls.SetText(Currentmedia,song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id])) Media.Play(Player) GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '=========================================================================================== '=========================================================================================== 'Play previous song Sub Play_Prev Media.stop(Player) Song_Id = Song_Id - 1 If Song_Id < 1 Then Song_Id = 1 EndIf Media.SetMedia(Player, Files_Array[Song_Id]) GameControls.SetText(Currentmedia,song_ID+":"+fileplus.GetFileName(Files_Array[Song_Id])) GameControls.SetValue(Seek_Bar,0) ' progress bar =0 GameControls.SetValue(Seek_Bar,0) Media.Play(Player) GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '============================================================================================ '============================================================================================ 'Stop Current Playing Song Sub Stop_Song Media.stop(Player) GameControls.SetText(Play_Button,"Play") GameControls.SetText(Pause_Button,"Pause") EndSub '============================================================================================ 'Volume Settings Sub Volume_Set Vol_Value = GameControls.GetValue(Volume_Control_Bar) Media.SetVolume(Player,Vol_Value/100) EndSub '============================================================================================ 'Pause Playing song Sub Pause GameControls.SetText(Pause_Button,"Paused") Media.Pause(Player) GameControls.SetText(Play_Button,"Play") EndSub '============================================================================================ 'Hide PlayList Sub Hide NN=0 For i = 680 To 460 Step -5 GameWindow.Width = i NN=NN+1 GameControls.Move(Currentmedia,460-NN*5,110,1) EndFor GameControls.SetVisibility(Hide_PlayList,"False") EndSub 'Show PlayList Sub Show MM=0 For i = 460 To 680 Step 5 GameWindow.Width = i MM=MM+1 GameControls.Move(Currentmedia,460+(MM-NN)*5,110,1) EndFor GameControls.SetVisibility(Hide_PlayList,"True") EndSub '============================================================================================ 'Set Song possition Sub Slider_Move Slider_Position = GameControls.GetValue(Seek_Bar) Slider_Time_Position = (Slider_Position*Media.GetLength(Player))/100 Media.SetPosition(Player,Slider_Time_Position) EndSub '============================================================================================ 'Set Volume level at 50% Sub SetVolume Media.SetVolume(Player,50) GameControls.SetValue(Volume_Control_Bar,50/10) EndSub '============================================================================================ End>BGV706-2.sb< Start>BGV706.sb< '============================= 'Data Extension Initialisation DataExtension.Init() '============================= '==================================================================== 'Init Graphic Window GameWindow.Width = 690 GameWindow.Height = 422 GameWindow.CanResize = "False" GameWindow.Theme = "ExpressionLight" GameWindow.Show() 'GUI Controls VideoBox = GameControls.AddRectangle(5,5,450,300) PlayListBox = GameControls.AddRectangle(460,5,215,380) GameControls.SetColors(VideoBox,"White","Black",1) GameControls.SetColors(PlayListBox,"White","Black",1) 'File Extension list Musicext="mp3:wma:mp4:avi:wmv" 'Buttons Show_PlayList = GameControls.AddButton(">>",430,360,30,25) Hide_PlayList = GameControls.AddButton("<<",430,360,30,25) Play_Button = GameControls.AddButton("Play",140,345,60,40) Pause_Button = GameControls.AddButton("Pause",205,345,60,40) Next_Button = GameControls.AddButton("Next",270,345,60,40) Prev_Button = GameControls.AddButton("Prev",75,345,60,40) Stop_Button = GameControls.AddButton("Stop",10,345,60,40) Seek_Bar = GameControls.AddSlider(0,10,315,395,22) Volume_Control_Bar = GameControls.AddSlider(0,350,345,75,22) 'Time text box Time_Box = GameControls.AddTextBox("Text",410,315,45,22) 'Register Sub GameControls.RegisterMouseDownEvent(Play_Button,"Play_Song") GameControls.RegisterMouseDownEvent(Next_Button,"Play_Next") GameControls.RegisterMouseDownEvent(Prev_Button,"Play_Prev") GameControls.RegisterMouseDownEvent(Stop_Button,"Stop_Song") GameControls.RegisterMouseDownEvent(Pause_Button,"Pause") GameControls.RegisterMouseDownEvent(Hide_PlayList,"Hide") GameControls.RegisterMouseDownEvent(Show_PlayList,"Show") GameControls.RegisterMouseDownEvent(Seek_Bar,"Slider_Move") GameControls.RegisterValueChangedEvent(Volume_Control_Bar,"Volume_Set") 'Sub To Call On Window load Open_Files() '===================================================================== 'Create Media Play Control Player = Media.CreateMediaPlayer(Files_Array[1],7,7,446,296) ' Open first music file '===================================================================== 'Loading Video and Sound File into an array Sub Open_Files start: Dir = Dialogs.AskForDirectory() ' Select a directory that include music files Files_Array = FilePlus.GetAllFiles(Dir) Total_Files = Array.GetItemCount(Files_Array) GameWindow.Title = "Small Music Player - By Amir "+Dir Song_Id=2 'First file To Play CurrentExt=text.GetSubTextToEnd(Files_Array[Song_Id],Text.GetLength(Files_Array[Song_Id])-2) If text.IsSubText(Musicext,CurrentExt)="True" then Else Dialogs.ShowMessageBox("Please Select Media Directory First","No Files","OK","Error") Goto Start EndIf SetVolume() EndSub '========================================================================================= '========================================================================================= 'Play First song Sub Play_Song If GameControls.GetText(Pause_Button) = "Paused" Then Media.Resume(Player) Else Media.stop(Player) Media.SetMedia(Player, Files_Array[1]) ' set new music file GameControls.SetValue(Seek_Bar,Media_Position/10) ' slider =0 Media.Play(Player) EndIf GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '========================================================================================= '========================================================================================= 'Play next song Sub Play_Next Media.Stop(Player) Song_Id = Song_Id + 1 If Song_Id > Total_Files Then Song_Id = Total_Files EndIf Media.SetMedia(Player, Files_Array[Song_Id]) ' Song_ID is already +1 GameControls.SetValue(Seek_Bar,0) ' progress bar =0 Media.Play(Player) GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '=========================================================================================== '=========================================================================================== 'Play previous song Sub Play_Prev Media.stop(Player) Song_Id = Song_Id - 1 If Song_Id < 1 Then Song_Id = 1 EndIf Media.SetMedia(Player, Files_Array[Song_Id]) GameControls.SetValue(Seek_Bar,0) ' progress bar =0 GameControls.SetValue(Seek_Bar,0) Media.Play(Player) GameControls.SetText(Play_Button,"Playing") GameControls.SetText(Pause_Button,"Pause") EndSub '============================================================================================ '============================================================================================ 'Stop Current Playing Song Sub Stop_Song Media.stop(Player) GameControls.SetText(Play_Button,"Play") GameControls.SetText(Pause_Button,"Pause") EndSub '============================================================================================ 'Volume Settings Sub Volume_Set Vol_Value = GameControls.GetValue(Volume_Control_Bar) Media.SetVolume(Player,Vol_Value/100) EndSub '============================================================================================ 'Pause Playing song Sub Pause GameControls.SetText(Pause_Button,"Paused") Media.Pause(Player) GameControls.SetText(Play_Button,"Play") EndSub '============================================================================================ 'Hide PlayList Sub Hide For i = 680 To 460 Step -5 GameWindow.Width = i EndFor GameControls.SetVisibility(Hide_PlayList,"False") EndSub 'Show PlayList Sub Show For i = 460 To 680 Step 5 GameWindow.Width = i EndFor GameControls.SetVisibility(Hide_PlayList,"True") EndSub '============================================================================================ 'Set Song possition Sub Slider_Move Slider_Position = GameControls.GetValue(Seek_Bar) Slider_Time_Position = (Slider_Position*Media.GetLength(Player))/100 Media.SetPosition(Player,Slider_Time_Position) EndSub '============================================================================================ 'Set Volume level at 50% Sub SetVolume Media.SetVolume(Player,50) GameControls.SetValue(Volume_Control_Bar,50/10) EndSub '============================================================================================ 'Seek Bar update and next media on end While "True" Media_Position= (Media.GetPosition(Player)*100)/Media.GetLength(Player) ' ##.# % GameControls.SetValue(Seek_Bar,Media_Position/10) ' #.## % Min = Math.Floor(Media.GetPosition(Player)/1000/60) ' ## min Secs = Math.Floor(Math.Remainder(Media.GetPosition(Player)/1000,60)) ' ## sec GameControls.SetText(Time_Box,Min+" : "+Secs+"") If Media_Position>=99.9 then ' End point Play_Next() EndIf endwhile End>BGV706.sb< Start>BGW081.sb< GraphicsWindow.Height = 600 GraphicsWindow.Width = 800 GraphicsWindow.BackgroundColor = "Black" Heightnum = 800 GraphicsWindow.MouseDown = OnmouseDown GraphicsWindow.MouseUp = OnmouseUp GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" GraphicsWindow.DrawLine(0,300,800,300) While Key <> "Return" Program.Delay(5) If Mouse = "Down" Then if GraphicsWindow.MouseY < 300 Then GraphicsWindow.FillRectangle(Math.Round(GraphicsWindow.MouseX / 5) * 5,Math.Round(GraphicsWindow.MouseY / 5) * 5,5,5) EndIf EndIf EndWhile For x = 0 To Heightnum Step 5 For y = 0 To 300 Step 5 Color[x][y] =GraphicsWindow.GetPixel(x + 1,y + 1) ' ' Color[x][y] = GraphicsWindow.GetColorFromRGB(300/(y-300)*255,300/(y-300)*255,300/(y-300)*255) TextWindow.Clear() TextWindow.WriteLine(Math.Round(x/ Heightnum * 100) + "%") EndFor EndFor For x = 0 To Heightnum Step 5 For y = 0 To 300 Step 5 If Color[x][y] <> "#000000" Then var = 255 - Math.Abs((y-300)/300*255) TextWindow.WriteLine(var) Color[x][y] = GraphicsWindow.GetColorFromRGB(var,var,var) endIf GraphicsWindow.BrushColor = Color[x][y] GraphicsWindow.FillRectangle(x + 1,300+(300-y) + 1,5,5) 'GraphicsWindow.SetPixel(x + 1,300+(300-y) + 1,Color[x][y]) EndFor EndFor Sub OnmouseDown Mouse = "Down" EndSub Sub OnmouseUp Mouse = "Up" EndSub Sub OnKeyDown Key = GraphicsWindow.LastKey EndSub End>BGW081.sb< Start>BGW269.sb< '=========================================================== ' A SIMPLE 3D MAZE GAME for SMALL BASIC using LITDEV extension '=========================================================== LDUtilities.GWState = 2 gw = GraphicsWindow.Width gh = GraphicsWindow.Height 'GraphicsWindow.Width = gw 'GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Title = "Small Basic 3D Cone Maze" 'User name GraphicsWindow.BrushColor = "Red" GraphicsWindow.FontSize = 20 user = "" userBox = Controls.AddTextBox(50,100) Controls.SetTextBoxText(userBox,"") Controls.SetSize(userBox,200,30) LDFocus.SetFocus(userBox) '<--- Insert Martin userTxt = Shapes.AddText("Enter your user name here") Shapes.Move(userTxt,50,50) userButton = Controls.AddButton("OK",50,150) Controls.ButtonClicked = OnButtonClicked While (user = "") Program.Delay(100) EndWhile Shapes.Remove(userBox) Shapes.Remove(userButton) Shapes.Remove(userTxt) Sub OnButtonClicked user = Controls.GetTextBoxText(userBox) EndSub '=========================================================== ' INITIALISATION '=========================================================== GraphicsWindow.DrawText(50,50,"KEYS: Keypad + W, S, A, D, Escape") GraphicsWindow.DrawText(50,100,"Recommend just Left, Right and W (forward)") GraphicsWindow.DrawText(50,150,"Find all the evil spinning cones to get a high score!") GraphicsWindow.DrawText(50,200,"Go when the title bar timer starts...") 'Load images and set main control variables wallImg = ImageList.LoadImage(Program.Directory+"\wall.jpg") stonesImg = ImageList.LoadImage(Program.Directory+"\stones.jpg") waterImg = ImageList.LoadImage(Program.Directory+"\water.jpg") args = "" 'For use with LDCall speed = 1 'Control speed size = 1 ' The image per tile scaling proximity = size/10 'Closest approach to an object 'Wait for OK button = Controls.AddButton("OK",50,250) ok = 0 Controls.ButtonClicked = OnOK While (ok = 0) Program.Delay(100) EndWhile START: GraphicsWindow.Clear() 'Create a view view3D = LD3DView.AddView(gw,gh,"True") 'Will not clip to size if window rescaled creation = Shapes.AddText("Creating Scene") 'Create a cone geometry createCone() 'Create a basic wall tile object createBasicWall() 'Animation end event LD3DView.TranslationCompleted = OnTranslationCompleted 'Create a world based on layout ' X is an empty room ' L is a room with a light ' C is a room with a rotating illuminated cone layout = "" layout[15] = "LXX LXXXXXXXXXXXXXXXLXXXX" layout[14] = "X X XXLXX X X XCX " layout[13] = "XXLXX X X X L " layout[12] = "L C XXL XL X LXXXXXXXLXXXXX" layout[11] = "XXX L X X LXXXX X XCX" layout[10] = "L XXXXXX X L X XXLXXXLXXXLX" layout[9] = "X X L XXXXLXXXXXXXXL X X X" layout[8] = " X X X L X XLXX" layout[7] = "LXXX LXXXXXXXXXXXLXXXXXX L X X" layout[6] = "C X XLXX X X XXXXX L " layout[5] = "XXLXX X XXXX LXXXXXXX L X" layout[4] = "L X XXL XL X XXXXXXXXXX" layout[3] = "XXX L X XXXXXXXLXXXX XCX" layout[2] = "X XXXXXX X X XXLXXXXXXXLX" layout[1] = "XXL XX XLXXXXXXXXXXXXXXXXXXXXLXXXXXXX" createWorld() 'Some different light types 'LD3DView.AddDirectionalLight(view3D,"#201010",1,1,1) 'LD3DView.AddDirectionalLight(view3D,"#201010",-1,1,-1) LD3DView.AddAmbientLight(view3D,"#101010") 'Dim ambient light Shapes.Remove(creation) '=========================================================== ' GAME LOOP '=========================================================== startTime = Clock.ElapsedMilliseconds progress = 0 While (progress < coneCount) start = Clock.ElapsedMilliseconds 'Use the keys to move the camera - comment S to prevent backwards movement out of the maze, or Up, Down, A and D to simplify movement yaw = 0 pitch = 0 roll = 0 move = 0 If (LDUtilities.KeyDown("Left")) Then yaw = yaw-1.5*speed EndIf If (LDUtilities.KeyDown("Right")) Then yaw = yaw+1.5*speed EndIf If (LDUtilities.KeyDown("Up")) Then pitch = pitch-1.5*speed EndIf If (LDUtilities.KeyDown("Down")) Then pitch = pitch+1.5*speed EndIf If (LDUtilities.KeyDown("A")) Then roll = roll+1.5*speed EndIf If (LDUtilities.KeyDown("D")) Then roll = roll-1.5*speed EndIf If (LDUtilities.KeyDown("W")) Then move = move+size/25*speed 'Begin block insert by Martin Ausgabe = "move = "+move+" : size = "+size+" : speed = "+speed TextWindow.WriteLine(Ausgabe) 'End block insert by Martin EndIf If (LDUtilities.KeyDown("S")) Then move = move-size/25*speed EndIf 'Prevent forward movement into an object hit = LD3DView.HitTest(view3D,-1,-1) If (hit <> "" And hit[2] < proximity) Then move = Math.Min(0,move) 'We can still back up For i = 1 To coneCount If (hit[1] = cone[i]) Then 'Remove cones as we find them LD3DView.ModifyObject(view3D,cone[i],"H") progress = progress+1 EndIf EndFor EndIf 'Perhaps better without the pitch and roll LD3DView.MoveCamera(view3D,yaw,pitch,roll,move) 'These are relative changes wrt current view 'Exit If (LDUtilities.KeyDown("Escape")) Then Program.End() EndIf 'Reanimate cones For kCone = 1 To coneCount If (startConeAnimation[kCone] = 1) Then startConeAnimation[kCone] = 0 LDCall.Function("animateCone",kCone) EndIf EndFor 'Display the camera position and direction and game time pos = LDCall.Function2("truncate",LD3DView.GetCameraPosition(view3D),2) dir = LDCall.Function2("truncate",LD3DView.GetCameraDirection(view3D),2) GraphicsWindow.Title = "Time = "+Math.Round((Clock.ElapsedMilliseconds-startTime)/1000)+" Cones remaining = "+(coneCount-progress)+" Position = ("+pos[1]+" , "+pos[2]+" , "+pos[3]+") Direction = "+dir[1]+" , "+dir[2]+" , "+dir[3]+")" delay = 20 - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile 'Game ends - check the scores Shapes.Remove(view3D) timesec = Math.Round((Clock.ElapsedMilliseconds-startTime)/1000) GraphicsWindow.DrawText(50,50,"You did it in "+timesec+" seconds") score = Math.Max(0,1000-timesec) hightscore = LDNetwork.HighScore("3DMazeGame2",user,score) GraphicsWindow.DrawText(50,100,"Your score is "+score) GraphicsWindow.DrawText(50,150,"The high score is "+hightscore[2]+" by "+hightscore[1]) 'Wait for OK button = Controls.AddButton("OK",50,200) ok = 0 Controls.ButtonClicked = OnOK While (ok = 0) Program.Delay(100) EndWhile GoTo START '=========================================================== ' SUBROUTINES '=========================================================== 'Creata a basic wall tile object Sub createBasicWall points = "" indices = "" textures = "" index = 0 For i = 1 To size For j = 1 To size x1 = i-1 x2 = i y1 = j-1 y2 = j z = 0 'Triangle1 points = points+x1+","+y1+","+z+"," points = points+x2+","+y1+","+z+"," points = points+x2+","+y2+","+z+"," indices = indices + index+","+(index+1)+","+(index+2)+"," index = index+3 textures = textures + "0 0,0 1,1 1," 'Triangle2 points = points+x1+","+y1+","+z+"," points = points+x2+","+y2+","+z+"," points = points+x1+","+y2+","+z+"," indices = indices + index+","+(index+1)+","+(index+2)+"," index = index+3 textures = textures + "0 0,1 1,1 0," EndFor EndFor wall = LD3DView.AddGeometry(view3D,points,indices,"","White","D") LD3DView.AddImage(view3D,wall,textures,wallImg,"D") LD3DView.ModifyObject(view3D,wall,"H") EndSub Sub createWall i = args[1] 'Left to Right j = args[2] 'Front to Back k = args[3] 'Down to Up dir = args[4] If (dir = "F") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.TranslateGeometry(view3D,return,i*size,k*size,-j*size) ElseIf (dir = "B") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.RotateGeometry(view3D,return,0,1,0,180) LD3DView.TranslateGeometry(view3D,return,i*size,k*size,-j*size+size) ElseIf (dir = "L") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.RotateGeometry(view3D,return,0,1,0,90) LD3DView.TranslateGeometry(view3D,return,i*size-size/2,k*size,-j*size+size/2) ElseIf (dir = "R") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.RotateGeometry(view3D,return,0,1,0,-90) LD3DView.TranslateGeometry(view3D,return,i*size+size/2,k*size,-j*size+size/2) ElseIf (dir = "U") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.AddImage(view3D,return,textures,waterImg,"D") LD3DView.RotateGeometry(view3D,return,1,0,0,90) LD3DView.TranslateGeometry(view3D,return,i*size,k*size+size/2,-j*size+size/2) ElseIf (dir = "D") Then return = LD3DView.CloneObject(view3D,wall) LD3DView.AddImage(view3D,return,textures,stonesImg,"D") LD3DView.RotateGeometry(view3D,return,1,0,0,-90) LD3DView.TranslateGeometry(view3D,return,i*size,k*size-size/2,-j*size+size/2) EndIf LD3DView.Freeze(view3D,return) ' We won't ever modify this so freeze it EndSub 'Change the input array of numbers to the required number of decimal places Sub truncate return = args[1] sigfig = args[2] multiplier = Math.Power(10,sigfig) For i = 1 To Array.GetItemCount(return) return[i] = (1/multiplier)*Math.Round(multiplier*return[i]) EndFor EndSub 'Get layout character Sub getChar i = args[1] j = args[2] return = Text.GetSubText(layout[i],j,1) If (return = " ") Then return = "" EndIf EndSub 'Crearte a maze layout - the large indexes are forward Sub createWorld cameraSet = 0 coneCount = 0 For y = 1 To Array.GetItemCount(layout) Shapes.Remove(creation) creation = Shapes.AddText("Creating Scene "+Math.Round(100*(y)/(Array.GetItemCount(layout)))+"%") For x = 1 To Text.GetLength(layout[y]) char = LDCall.Function2("getChar",y,x) If (char <> "") Then If (cameraSet = 0) Then 'Initial camera position and direction and view angle LD3DView.ResetCamera(view3D,x*size+size/2,0.4*size,-size/2,0,0,-1,"","","") LD3DView.CameraProperties(view3D,0,30*size,60) ' limit to 30 blocks (the longest corridor) cameraSet = 1 'The first room is the start point EndIf 'Floor and ceiling LDCall.Function4("createWall",x,y,0,"U") LDCall.Function4("createWall",x,y,0,"D") 'Left and right walls If (LDCall.Function2("getChar",y,x-1) = "") Then LDCall.Function4("createWall",x,y,0,"L") EndIf If (LDCall.Function2("getChar",y,x+1) = "") Then LDCall.Function4("createWall",x,y,0,"R") EndIf 'Front and back walls If (LDCall.Function2("getChar",y-1,x) = "") Then LDCall.Function4("createWall",x,y,0,"B") EndIf If (LDCall.Function2("getChar",y+1,x) = "") Then LDCall.Function4("createWall",x,y,0,"F") EndIf 'Add a lit cone - these are the main performance limiters so keep this kind of thing to a minimum If (char = "C") Then 'Lots of spotlights are slow. 'spot = LD3DView.AddSpotLight(view3D,"Red",x*size+0.1,size/2,-(y*size)+0.1,1,0,1,80,0.8*size) 'spot = LD3DView.AddSpotLight(view3D,"Green",x*size+size-0.1,size/2,-(y*size)+0.1,-1,0,1,80,0.8*size) 'spot = LD3DView.AddSpotLight(view3D,"Blue",x*size+size-0.1,size/2,-(y*size-size)-0.1,-1,0,-1,80,0.8*size) 'spot = LD3DView.AddSpotLight(view3D,"Yellow",x*size+0.1,size/2,-(y*size-size)-0.1,1,0,-1,80,0.8*size) color = LDColours.HSLtoRGB(Math.GetRandomNumber(360),1,0.5)' A random high brightness colour 'spot = LD3DView.AddSpotLight(view3D,color,x*size+size/2,size,-(y*size-size/2),0,-1,0,30,size/2) 'spot = LD3DView.AddPointLight(view3D,color,x*size+size/2,0.98*size,-(y*size-size/2),2*size) coneCount = coneCount+1 cone[coneCount] = LD3DView.AddGeometry(view3D,pointsCone,indicesCone,"",color,"D") 'A base colour LD3DView.AddImage(view3D,cone[coneCount],texturesCone,waterImg,"S") ' Some shiny texture that is stronly affected by lights LD3DView.TranslateGeometry(view3D,cone[coneCount],x*size+size/2,size/3,-(y*size-size/2)) LD3DView.AnimateRotation(view3D,cone[coneCount], 0, 1, 0, 0, 360, 3, -1) coneX[coneCount] = x coneY[coneCount] = y LDCall.Function("animateCone",coneCount) EndIf 'Add a point light If (char = "L") Then point = LD3DView.AddPointLight(view3D,"White",x*size+size/2,0.98*size,-(y*size-size/2),5*size) EndIf EndIf EndFor EndFor EndSub 'Create a cone geometry Sub createCone nside = 10 height = size/2 radius = size/4 pointsCone = "0,"+(2/3*height)+",0," indicesCone = "" texturesCone = "0.5,1," For i = 0 To nside angle = i/nside*2*Math.Pi x = radius*Math.Cos(-angle) y = radius*Math.Sin(-angle) pointsCone = pointsCone+x+","+(-height/3)+","+y+"," If (i < nside) Then indicesCone = indicesCone + "0,"+(i+1)+","+(i+2)+"," Else indicesCone = indicesCone + "0,"+(i+1)+","+1+"," EndIf texturesCone = texturesCone + i/nside+",0," EndFor EndSub 'OK button Sub OnOK ok = 1 EndSub 'Animate a cone Sub animateCone iCone = args[1] 'Current position xPos = coneX[iCone] yPos = coneY[iCone] 'The 4 possible new positions newX[1] = xPos-1 newY[1] = yPos newX[2] = xPos newY[2] = yPos+1 newX[3] = xPos+1 newY[3] = yPos newX[4] = xPos newY[4] = yPos-1 'Check for directions we can move For iDir = 1 To 4 move[iDir] = LDCall.Function2("getChar",newY[iDir],newX[iDir]) EndFor 'coneMoveDir is the last direction 1 to 4 as listed above - start in +Y direction if unset If (coneMoveDir[iCone] = "") Then coneMoveDir[iCone] = 2 EndIf 'Find the forward, back, left and right wrt current direction dirForward = coneMoveDir[iCone] dirLeft = coneMoveDir[iCone]-1 If (dirLeft < 1) Then dirLeft = 4+dirLeft EndIf dirRight = coneMoveDir[iCone]-3 If (dirRight < 1) Then dirRight = 4+dirRight EndIf dirBack = coneMoveDir[iCone]-2 If (dirBack < 1) Then dirBack = 4+dirBack EndIf 'Move forward with high chance If (move[dirForward] <> "" And Math.GetRandomNumber(10) > 2) Then coneX[iCone] = newX[dirForward] coneY[iCone] = newY[dirForward] coneMoveDir[iCone] = dirForward Else 'If not then move left or right with 50% chance each - otherwise move back If (move[dirLeft] <> "" And Math.GetRandomNumber(2) = 1) Then coneX[iCone] = newX[dirLeft] coneY[iCone] = newY[dirLeft] coneMoveDir[iCone] = dirLeft ElseIf (move[dirRight] <> "") Then coneX[iCone] = newX[dirRight] coneY[iCone] = newY[dirRight] coneMoveDir[iCone] = dirRight ElseIf (move[dirLeft] <> "") Then 'Move left if we cannot go right coneX[iCone] = newX[dirLeft] coneY[iCone] = newY[dirLeft] coneMoveDir[iCone] = dirLeft ElseIf (move[dirBack] <> "") Then coneX[iCone] = newX[dirBack] coneY[iCone] = newY[dirBack] coneMoveDir[iCone] = dirBack ElseIf (move[dirForward] <> "") Then ' It is possible we can only go forward coneX[iCone] = newX[dirForward] coneY[iCone] = newY[dirForward] coneMoveDir[iCone] = dirForward EndIf EndIf 'Do the move LD3DView.AnimateTranslation(view3D,cone[iCone],coneX[iCone]*size+size/2,size/3,-(coneY[iCone]*size-size/2),1) EndSub 'Move the cone when its last translation is completed Sub OnTranslationCompleted 'Handle rare possibility that a cone can 'get stuck' by ending its animation at the same time as another so check for all queued completed animations While (LD3DView.QueuedTranslationCompleted > 0) 'Almost always exactly one. lastCone = LD3DView.LastTranslationCompleted ' Get this value only once since it will dequeue any queued items For jCone = 1 To coneCount ' We use jCone because iCone and kCone are used elsewhere and we don't want them to conflict If (cone[jCone] = lastCone) Then startConeAnimation[jCone] = 1 EndIf EndFor EndWhile EndSub End>BGW269.sb< Start>BGX678.sb< GraphicsWindow.BackgroundColor="teal rb=ldControls.AddRichTextBox (700 700) LDControls.RichTextBoxFontFamily ="Lucida console LDControls.RichTextBoxFontBackground="lightgray LDControls.RichTextBoxFontSize=14 LDControls.RichTextBoxDefault (rb) Controls.Move (rb 15 15) GraphicsWindow.Width=1300 GraphicsWindow.Height=800 GraphicsWindow.Title ="NewBasic v0.2 GraphicsWindow.FontBold="true GraphicsWindow.FontName ="Liberation sans GraphicsWindow.FontSize=16 GraphicsWindow.BrushColor="White txx="#bg /hu/ /sa/ /lg/ | bckgrnd clr 0-360 0-100 0-100~#fg\pc /hu /sa /lg | forgrnd/pen clr 0-360 0-100 0-100~ txx=txx+"#gw /lt/ /tp/ /wd/ /ht/ | grwnd size/pos~ txx=txx+"#rp /ttf/ /ttr/ | replaces text with ~ txx=txx+"#ff /vv/ /st/ /en/ /stp/...`ff | for vv=st to en step stp ... Endfor~ txx=txx+"#if /cnd/ #tt #ef #ee `ii~ txx=txx+"#ii /cnd/ ## | oneline short if~ txx=txx+"#wh /cnd/ ... `ww | while ... endwh.~ txx=txx+"#gr /px,py/ /nx,ny/ /sx,sy/ ## | draws grid(nx,ny) of object at (px,py), sized each (sx,sy)~ txx=txx+"#sb ... `ss | Sub ... Endsub~ txx=txx+"#rr /n/ ...`rr [rpt] | repeats ... n times [indic. by rpt]~ txx=txx+"~spec.consts:~`y` = true / `n` = false ~`g` = graph.window~`t` = textwindow~`s` = shapes~`a` = array~`c` = controls~`f` = file~`p` = prog.~`x` = text~\\ = LD xtension~ txx=txx+"!> /fnm/ /p1/ /p2/ ... /pn/ | call func w args 1..n nln=text.GetCharacter (13)+Text.GetCharacter(10) txx=LDText.Replace (txx "~" nln) GraphicsWindow.DrawBoundText (800 10 490 txx) GraphicsWindow.BrushColor="black bt1=Controls.AddButton ("Convert to SB" 10 750) bt2=Controls.AddButton ("EXEC" 140 750) Controls.ButtonClicked=cbc err[1]="Number or args different than required."+nln+"Missing args will be null, other ignored. err[2]="Uneven block count. Program won't start!" err[3]="Unexpected End of block. err[4]="Too many sub args. Truncated to 5 ss=", " args=0 Sub getpp pp=ldtext.Split (cl " ") pc=array.GetItemCount (pp) endsub Sub repcc nn=text.GetCharacter (34) txt="not="+nn+"true=false;false=true"+nln+"args=0"+nln+txt txt=ldtext.Replace (txt "\\" "LD") txt=ldtext.Replace (txt "`y`" nn+"true"+nn) txt=ldtext.Replace (txt "`n`" nn+"false"+nn) txt=ldtext.Replace (txt "`g`" "GraphicsWindow.") txt=ldtext.Replace (txt "`t`" "TextWindow.") txt=ldtext.Replace (txt "`s`" "Shapes.") txt=ldtext.Replace (txt "`c`" "Controls.") ' The following line could be harmful and has been automatically commented. ' txt=ldtext.Replace (txt "`f`" "File.") txt=ldtext.Replace (txt "`a`" "Array.") txt=ldtext.Replace (txt "`p`" "Program.") txt=ldtext.Replace (txt "`x`" "Text.") txt=ldtext.Replace (txt "``ln" "Text.GetLength(") txt=ldtext.Replace (txt "``tc" "Text.GetCharacter(") txt=ldtext.Replace (txt "``ac" "Array.GetItemCount(") txt=ldtext.Replace (txt "`\" "Math.Remainder (") txt=ldtext.Replace (txt "`rnd" "Math.GetRandomNumber(") txt=ldtext.Replace (txt "@rc" "AddRectangle(") txt=ldtext.Replace (txt "@el" "AddEllipse(") txt=ldtext.Replace (txt "@drc" "DrawRectangle(") txt=ldtext.Replace (txt "@del" "DrawEllipse(") txt=ldtext.Replace (txt "@frc" "FillRectangle(") txt=ldtext.Replace (txt "@fel" "FillEllipse(") txt=ldtext.Replace (txt "@tr" "AddTriangle(") txt=ldtext.Replace (txt "@dtr" "DrawTriangle(") txt=ldtext.Replace (txt "@ftr" "FillTriangle(") EndSub Sub cbc If Controls.LastClickedButton=bt1 then pl=2 bc=0 dac ="false l1=ldlist.CreateFromValues (LDText.Split ("#bg #fg #pc" " ")) lc1=LDText.Split (ldtext.Replace ("g#BackgroundColor g#BrushColor g#PenColor" "g#" "GraphicsWindow.") " ") ar=LDText.Split ("'prog.list '*******Endprg." " ") prg=LDList.CreateFromValues (ar) frl= ldlist.CreateFromValues("1=1") txt= LDControls.RichTextBoxGetText (rb) repcc() tt=ldtext.Split (txt nln) For xx=1 To Array.GetItemCount (tt) cl=text.ConvertToLowerCase (ldtext.Trim (tt[xx])) oc=tt[xx] if Text.StartsWith (cl "#bg") Or Text.StartsWith (cl "#fg") Or Text.StartsWith (cl "#pc") Then getpp() If pc<>4 Then GraphicsWindow.ShowMessage (err[1]+nln+cl "Warning line:"+xx) endif ii=LDList.IndexOf(l1 pp[1]) oc=lc1[ii]+"= LDColours.HSLtoRGB ("+pp[2]+ss+pp[3]/100+ss+pp[4]/100+")" elseif Text.StartsWith (cl "#sb") Then getpp() dac="true oc="SUB "+pp[2]+" '*********************************** bc=bc+1 elseif Text.StartsWith (cl "!>") Then getpp() nc=pc-2 If nc>5 then nc=5 GraphicsWindow.ShowMessage (err[4] "Args err at line "+(pl-1)) endif oc="Ldcall.function"+nc+"("+nn+pp[2]+nn+ss For f=1 to nc-1 oc=oc+pp[f+2]+ss endfor oc=oc+pp[nc+2]+")" elseif Text.StartsWith (cl "`sb") Then bc=bc-1 oc="EndSUB"+nln elseif Text.StartsWith (cl "#gw") Then getpp() LDCall.Function ("ladd" "GraphicsWindow.Left="+pp[2]) LDCall.Function ("ladd" "GraphicsWindow.Top="+pp[3]) LDCall.Function ("ladd" "GraphicsWindow.Width="+pp[4]) LDCall.Function ("ladd" "GraphicsWindow.Height="+pp[5]) Goto nxt elseif Text.StartsWith (cl "#wh") or text.StartsWith (cl "#rr") Then obc=bc bc=bc+1 getpp() If text.StartsWith (cl "#rr") Then oc="rpt["+bc+"]= "+pp[2]+nln cbc=obc gsp() oc=oc+isp+"WHILE rpt["+bc+"]>0 else oc="WHILE "+pp[2] endif dac="true elseif Text.StartsWith (cl "`ww") Then bc=bc-1 oc="EndWHILE"+nln elseif Text.StartsWith (cl "#gr") Then' ----------------------------------------grid cmd ip=ldtext.Split (cl "|") xl=array.GetItemCount (ip) gx=0 gy=0 fx=1 fy=1 cl=text.GetSubTextToEnd(ip[1],5) cl=LDText.Replace (cl "," " ") getpp() gx=pp[3]-1 gy=pp[4]-1 sx=pp[5] sy=pp[6] dx=pp[1] dy=pp[2] oc="For _x1=0 to "+gx+nln+isp+" " oc=oc+"For _y1=0 to "+gy+nln+isp+" " For ll=2 to xl cl=ip[ll] if Text.StartsWith (cl "#bg") Or Text.StartsWith (cl "#fg") Or Text.StartsWith (cl "#pc") Then getpp() If pc<>4 Then GraphicsWindow.ShowMessage (err[1]+nln+cl "Warning line:"+xx) endif ii=LDList.IndexOf(l1 pp[1]) oc=oc+isp+lc1[ii]+"= LDColours.HSLtoRGB ("+pp[2]+ss+pp[3]/100+ss+pp[4]/100+")"+nln ElseIf Text.StartsWith (cl "#sw") then pp=ldtext.Split (cl,":") GraphicsWindow.Title =pp cs=pp[3]'------condition array cn=pp[2] ElseIf Text.StartsWith (cl "%x") then getpp() oc=oc+isp+"fx=fx*"+pp[2]+nln ElseIf Text.StartsWith (cl "%y") then getpp() oc=oc+isp+"fy=fy*"+pp[2]+nln Else oc=oc+isp+cl+nln endif endfor oc=oc+isp+"_cn="+cn+nln oc=oc+isp+"IF _cn=1 then"+nln For b=1 to Array.GetItemCount (cs) oc=oc+isp+" "+cs[b]+dx+"+"+(sx+"*_x1")+ss+dy+"+"+(sy+"*_y1")+ss+sx+"*fx"+ss+sy+"*fy"+")"+nln If b=Array.GetItemCount (cs)-1 then oc=oc+isp+"else"+nln ElseIf b0 Then GraphicsWindow.ShowMessage (err[2] "Fatal err") endif TextWindow.Write ("Output:") ary=ldarray.CreateFromValues (LDList.ToArray(prg)) for x=1 to LDArray.Count(ary) TextWindow.WriteLine (LDArray.GetValue (ary x)) txo=txo+LDArray.GetValue (ary x)+nln endfor LDClipboard.SetText (txo) endif EndSub Sub gsp isp="" If cbc>0 Then isp=text.GetSubText (" " 1 cbc*3) endif EndSub Sub ladd LDList.InsertAt (prg pl args[1]) pl=pl+1 EndSub End>BGX678.sb< Start>BGX735.sb< dw=1200 dh=900 sffm="true"'<<<---------set true to display 3d nodes GraphicsWindow.Title="Drawing, please wait... GraphicsWindow .Left =0 GraphicsWindow.Top=0 TextWindow.Show () TextWindow.Left=1230 TextWindow.top=0 TextWindow.BackgroundColor="darkblue TextWindow.ForegroundColor="lime LDUtilities.ShowErrors="false nln=text.GetCharacter (13)+Text.GetCharacter(10) 'model nodes, can be replaced by ur desired 3d model or loaded from a file, struct.: x1: y1: z1:... xn: yn: zn 'warning: this is very long line, over 25000 chars! cc="3.57:13.70:0.15:3.49:13.64:0.73:3.66:14.30:0.66:3.44:15.31:1.49:3.61:14.70:0.99:3.45:14.04:1.06:3.34:14.04:1.35:3.11:14.70:2.11:3.33:15.31:1.78:2.93:12.89:1.95:3.08:13.60:2.06:3.23:12.94:1.25:3.15:12.12:1.19:3.11:11.16:1.08:2.93:12.04:1.74:|2.37:14.73:3.23:2.66:14.30:2.74:2.58:13.59:2.68:2.58:12.75:2.47:2.07:13.48:3.25:2.06:14.19:3.41:1.11:14.63:4.21:1.56:14.10:3.83:1.57:13.40:3.68:1.70:12.68:3.41:1.13:13.39:3.91:0.22:13.78:4.42:0.69:14.36:4.42:0.68:13.10:4.07:0.79:12.37:3.88:0.35:12.36:4.02:0.26:13.07:4.22:-0.84:14.26:4.76:-0.43:13.84:4.56:-0.39:13.12:4.36:-0.30:12.42:4.18:-1.20:12.36:4.27:-1.30:13.08:4.46:-1.38:13.68:4.61:|2.59:11.63:2.22:2.62:10.95:2.09:2.22:11.64:2.74:2.08:12.36:3.00:1.83:11.64:3.13:1.96:10.97:2.98:1.37:11.63:3.45:1.25:12.35:3.63:|-0.07:9.51:3.94:-1.02:9.66:3.95:-1.15:10.71:4.04:-0.77:10.77:4.04:0.50:9.89:3.86:0.31:9.57:3.92:0.07:11.24:3.92:0.44:10.30:3.84:-0.83:11.18:4.07:1.28:10.27:3.55:0.97:10.07:3.73:0.59:11.02:3.78:0.62:11.33:3.78:1.06:11.35:3.62:1.29:10.58:3.50:2.03:10.47:2.96:1.65:10.37:3.31:1.40:11.13:3.41:2.66:10.49:2.06:2.38:10.51:2.55:2.23:11.18:2.69:3.07:10.20:1.00:2.91:10.41:1.53:2.87:11.09:1.66:3.33:11.18:0.05:3.26:10.53:0.05:3.25:10.73:0.44:3.29:11.70:0.56:3.36:12.51:0.62:3.45:12.57:0.05:3.35:11.74:0.05:3.26:9.31:0.36:|3.22:9.48:0.30:3.23:9.28:-0.11:3.30:8.76:-0.11:3.37:8.65:0.03:3.29:9.02:0.07:3.00:10.06:1.34:3.12:9.85:0.79:3.18:9.67:0.86:3.17:9.69:1.04:3.02:9.92:1.51:2.95:10.07:1.51:2.56:10.23:2.36:2.80:10.21:1.83:2.86:10.05:1.84:2.83:10.02:2.01:2.59:10.06:2.52:2.48:10.19:2.51:1.90:10.11:3.19:2.25:10.21:2.79:2.36:10.08:2.81:1.26:9.79:3.67:1.57:9.98:3.47:1.73:9.86:3.48:1.69:9.76:3.57:1.37:9.55:3.83:1.20:9.68:3.73:0.79:9.23:3.89:0.98:9.55:3.81:1.15:9.42:3.91:1.16:9.30:3.95:1.01:9.04:3.98:0.80:9.11:3.92:0.71:8.70:3.92:|0.69:8.96:3.91:0.90:8.90:3.97:1.09:8.77:3.99:1.46:8.58:4.02:1.17:8.46:3.97:0.91:8.57:3.94:1.65:8.47:4.01:1.59:8.29:3.93:1.36:8.35:3.96:1.28:8.94:4.01:1.43:9.19:3.98:1.75:8.89:4.04:1.65:8.76:4.04:2.21:9.23:3.77:1.95:9.01:3.96:1.63:9.31:3.91:1.62:9.49:3.82:1.93:9.68:3.55:2.20:9.40:3.67:2.67:9.67:3.08:2.43:9.53:3.43:2.16:9.82:3.31:1.97:9.92:3.27:2.45:9.90:2.93:2.78:9.89:2.50:3.00:9.84:1.99:3.25:9.60:2.09:2.99:9.65:2.64:3.48:9.30:1.26:3.42:9.47:1.70:3.18:9.72:1.59:3.16:9.74:1.40:3.27:9.49:0.93:3.44:9.30:1.07:|3.46:8.85:0.56:3.50:9.08:0.86:3.34:9.27:0.72:3.31:9.25:0.57:3.33:8.96:0.29:3.42:8.82:0.42:3.41:8.37:0.14:3.44:8.60:0.31:3.36:8.74:0.18:3.42:7.86:-0.16:3.41:8.12:-0.02:3.39:8.23:-0.16:3.36:7.28:-0.13:3.33:6.70:-0.13:3.21:6.77:0.08:3.28:7.54:0.16:3.38:7.84:0.08:3.38:7.58:-0.06:3.21:7.07:0.16:3.30:7.76:0.23:3.36:8.00:0.31:3.40:8.06:0.15:3.46:8.47:0.35:3.42:8.23:0.18:3.40:8.18:0.35:3.48:8.54:0.62:3.55:8.84:0.80:3.48:8.61:0.50:3.43:8.32:0.50:3.50:8.68:0.80:3.53:8.91:1.09:3.56:8.98:0.98:3.52:9.31:1.62:|3.55:9.13:1.19:3.54:9.06:1.30:3.51:9.09:1.46:3.46:9.23:1.82:3.49:9.33:1.78:3.32:9.30:2.20:3.08:9.29:2.71:3.10:9.47:2.72:3.35:9.41:2.16:2.64:9.32:3.43:2.89:9.45:3.10:2.89:9.29:3.09:2.81:9.19:3.18:2.59:9.07:3.45:2.57:9.22:3.52:2.40:8.95:3.64:2.15:8.75:3.82:2.12:8.88:3.92:2.38:9.10:3.72:1.85:8.61:4.02:1.95:8.75:4.01:1.98:8.62:3.93:1.97:8.56:3.90:1.90:8.50:3.91:1.83:8.55:4.00:1.70:8.32:3.91:1.77:8.49:4.00:1.83:8.44:3.91:1.82:8.38:3.85:1.75:8.25:3.76:1.70:8.25:3.86:|3.30:7.99:0.40:3.34:7.98:0.38:3.28:7.74:0.29:3.42:8.36:0.56:3.38:8.14:0.44:3.34:8.14:0.46:3.33:8.20:0.52:3.35:8.39:0.65:3.43:8.42:0.62:3.49:8.80:1.04:3.46:8.57:0.75:3.39:8.54:0.78:3.37:8.60:0.88:3.37:8.81:1.14:3.47:8.86:1.14:3.36:8.96:1.41:3.31:9.08:1.76:3.41:9.14:1.77:3.46:9.00:1.41:3.16:9.15:2.18:2.94:9.14:2.63:3.03:9.19:2.70:3.26:9.20:2.19:2.64:9.04:3.31:2.86:9.16:3.04:2.77:9.10:2.97:2.34:8.81:3.44:2.12:8.61:3.59:2.18:8.68:3.71:2.42:8.89:3.53:2.55:8.95:3.19:1.92:8.48:3.84:1.99:8.53:3.83:1.93:8.46:3.71:|1.88:8.40:3.69:1.80:8.29:3.72:1.87:8.42:3.81:1.48:7.80:3.94:1.61:8.11:3.87:1.66:8.11:3.78:1.49:7.46:3.90:1.39:7.04:3.96:1.42:7.54:3.95:1.60:7.85:3.81:1.42:6.67:3.86:1.50:6.11:3.67:1.36:6.61:3.93:1.46:7.04:3.89:1.64:5.71:3.32:1.75:5.42:3.08:1.61:5.64:3.38:1.54:6.20:3.59:1.86:5.38:2.77:2.00:5.19:2.46:1.87:5.24:2.78:1.76:5.53:3.03:1.93:5.33:2.58:2.06:5.23:2.27:2.08:5.14:2.27:2.37:5.17:1.65:2.24:5.12:1.94:2.21:5.21:1.94:2.34:5.24:1.68:2.48:5.26:1.37:2.46:5.35:1.42:2.64:5.52:1.05:2.63:5.36:1.12:2.42:5.02:1.56:|2.28:5.06:1.86:2.41:5.11:1.58:2.53:5.19:1.29:2.12:4.84:2.15:2.00:5.05:2.48:2.14:5.00:2.16:2.29:4.96:1.85:1.73:4.86:2.77:1.71:5.31:3.11:1.84:5.09:2.79:1.95:4.88:2.46:1.51:4.92:2.98:1.14:5.16:3.35:1.49:5.37:3.31:1.30:6.18:3.83:1.43:5.69:3.51:1.07:5.49:3.50:0.85:5.64:3.59:0.54:6.31:3.85:1.07:6.34:3.88:1.06:7.88:3.97:1.03:7.38:3.96:0.51:7.34:3.92:0.51:8.00:3.89:-0.28:8.13:3.86:0.70:8.36:3.91:0.97:8.25:3.94:1.38:7.82:3.97:1.29:8.19:3.95:1.52:8.13:3.92:0.32:8.77:3.91:-0.66:9.17:3.93:0.30:9.03:3.92:-0.98:8.38:3.80:|-0.97:9.01:3.89:0.00:8.61:3.88:-1.15:7.33:3.87:-1.07:7.87:3.78:-0.28:7.74:3.85:-1.00:6.97:3.93:-0.14:7.39:3.89:-0.14:6.73:3.91:-0.89:6.66:3.92:0.11:6.28:3.85:0.43:5.61:3.64:-0.13:5.96:3.75:-0.65:6.21:3.85:|3.39:6.33:-0.10:3.33:6.27:0.12:3.21:6.50:0.12:3.33:6.44:-0.10:3.26:6.20:0.26:3.08:6.14:0.45:3.15:6.32:0.33:3.15:6.45:0.27:3.27:6.10:0.34:3.20:5.98:0.49:3.08:6.02:0.52:2.84:5.75:0.79:2.97:5.94:0.63:3.09:5.89:0.59:3.00:5.53:0.74:2.79:5.45:0.91:2.82:5.61:0.84:3.07:5.76:0.66:2.90:4.97:0.78:2.80:4.64:0.76:2.72:4.96:0.90:2.73:5.11:0.95:2.78:5.29:0.92:3.00:5.37:0.77:2.97:5.14:0.79:2.51:5.03:1.36:2.63:5.20:1.11:2.62:5.04:1.06:4.17:6.06:-0.09:4.13:5.98:0.14:3.62:6.11:0.12:3.68:6.18:-0.09:3.43:5.96:0.43:3.49:6.06:0.28:|4.00:5.93:0.30:4.17:5.85:0.34:4.15:5.72:0.44:3.59:5.86:0.46:3.32:5.58:0.64:3.38:5.80:0.55:3.94:5.66:0.52:4.13:5.54:0.54:4.14:5.33:0.65:3.50:5.46:0.65:4.04:5.19:0.70:4.08:5.05:0.71:3.37:5.09:0.73:3.41:5.32:0.71:4.07:4.82:0.69:4.03:4.60:0.63:3.36:4.58:0.62:3.36:4.87:0.69:4.01:4.38:0.50:4.00:4.21:0.33:3.36:4.16:0.29:3.35:4.36:0.49:4.01:4.09:0.13:4.02:4.02:-0.10:3.38:3.97:-0.10:3.36:4.03:0.10:2.98:4.81:0.71:2.98:4.52:0.63:2.85:4.49:0.66:2.87:4.06:0.39:2.84:4.30:0.59:2.95:4.34:0.54:2.99:4.28:0.47:3.00:4.08:0.26:|2.89:4.01:0.30:2.99:3.97:0.10:3.01:3.91:-0.10:2.90:3.83:-0.10:2.90:3.90:0.14:4.82:5.78:-0.11:4.82:5.71:0.06:4.52:5.85:0.13:4.56:5.93:-0.11:4.80:5.60:0.21:4.79:5.47:0.33:4.49:5.62:0.39:4.51:5.75:0.28:4.45:5.31:0.60:4.43:5.51:0.48:4.74:5.37:0.43:4.79:5.04:0.50:4.55:5.02:0.64:4.51:5.17:0.62:4.80:5.23:0.45:4.46:4.64:0.59:4.50:4.86:0.64:4.74:4.88:0.51:4.81:4.83:0.46:4.76:4.66:0.44:4.52:4.59:0.54:4.71:4.52:0.37:4.74:4.39:0.23:4.46:4.28:0.30:4.47:4.45:0.47:4.75:4.29:0.05:4.75:4.25:-0.11:4.48:4.11:-0.11:|4.47:4.18:0.12:5.13:5.31:-0.07:5.11:5.23:0.04:5.00:5.34:0.21:5.01:5.46:0.10:4.96:5.05:0.36:4.97:5.24:0.31:5.09:5.13:0.14:5.12:5.06:0.09:5.11:4.96:0.09:5.00:4.98:0.30:5.05:4.82:0.13:4.91:4.55:0.18:4.89:4.68:0.32:4.93:4.84:0.34:5.08:4.70:-0.14:4.96:4.44:-0.14:4.95:4.49:0.02:5.08:4.76:-0.02:2.78:4.10:0.66:2.79:3.87:0.45:2.74:3.55:0.59:2.68:3.83:0.88:2.82:3.70:0.18:2.83:3.63:-0.05:2.78:3.32:-0.05:2.76:3.39:0.31:2.39:3.78:1.66:2.22:4.51:1.95:2.38:4.64:1.65:2.65:3.50:0.94:2.71:3.23:0.65:2.71:2.83:0.72:|2.77:2.54:-0.20:2.76:2.60:0.23:2.75:3.00:0.16:2.76:2.93:-0.20:2.75:3.00:-0.57:2.75:2.60:-0.64:|2.01:4.27:2.30:2.14:3.24:2.20:1.74:3.55:2.71:1.79:4.26:2.62:2.57:4.34:1.20:2.63:4.03:1.05:2.55:3.75:1.28:2.46:4.33:1.50:2.47:3.46:1.51:2.62:3.08:1.06:2.36:2.82:1.95:2.42:3.16:1.70:2.29:4.20:1.80:0.71:4.31:3.54:0.94:4.90:3.37:1.34:4.66:3.06:1.43:4.34:2.96:1.39:3.63:3.07:0.83:3.99:3.49:|2.80:2.18:-0.64:2.88:1.74:-0.83:2.92:1.65:-0.20:2.81:2.13:-0.20:2.87:1.74:0.42:2.79:2.18:0.23:2.68:2.24:1.03:2.74:1.79:1.22:2.42:1.98:1.92:1.82:2.95:2.72:2.21:2.63:2.20:2.13:2.28:2.45:1.99:2.26:2.68:1.59:2.52:3.10:1.65:2.92:2.93:0.79:3.62:3.57:1.36:3.26:3.16:1.30:2.86:3.32:1.13:2.70:3.46:1.05:2.47:3.54:0.46:3.06:3.86:0.62:3.46:3.69:|2.87:1.45:0.63:2.93:1.36:0.00:2.85:1.12:0.00:2.80:1.08:0.23:2.77:1.16:0.91:2.83:1.40:0.86:2.61:1.31:1.48:2.27:1.52:2.19:2.34:1.74:2.13:2.69:1.56:1.43:1.91:1.74:2.76:1.50:2.02:3.16:1.60:2.23:3.11:2.00:1.97:2.70:0.84:2.36:3.64:0.14:2.76:4.02:0.26:2.94:3.98:|2.35:0.87:0.13:2.24:0.96:0.78:2.60:1.02:0.81:2.63:0.95:0.13:2.17:1.34:2.09:2.50:1.15:1.38:2.14:1.05:1.35:1.93:1.12:1.55:1.63:1.33:2.17:1.96:1.38:2.30:1.43:1.83:3.10:1.82:1.57:2.67:1.49:1.48:2.55:1.28:1.56:2.65:0.96:1.77:3.06:1.21:1.88:3.20:0.25:2.52:3.87:0.95:2.13:3.49:0.69:1.99:3.37:0.39:2.09:3.42:-0.27:2.46:3.68:-0.05:2.60:3.92:-1.13:3.23:4.19:-0.43:2.89:4.11:-0.66:2.74:3.88:-0.96:2.83:3.83:-1.64:3.22:3.94:-1.43:3.29:4.17:0.08:5.45:3.70:0.62:5.11:3.52:0.39:4.51:3.69:-0.70:5.08:3.87:-1.17:5.16:3.93:|-1.09:5.29:3.88:-0.40:5.56:3.78:-0.06:4.62:3.84:-0.27:3.59:4.11:-0.94:3.89:4.28:-0.74:4.45:4.02:-0.46:4.49:3.92:0.17:4.02:3.84:0.00:3.62:3.99:-0.82:3.54:4.32:-0.16:3.23:4.14:-0.27:3.05:4.20:-0.54:3.10:4.24:-1.24:3.42:4.33:-1.09:3.59:4.38:-1.30:5.60:3.93:-1.12:6.12:3.93:-0.61:5.87:3.81:-1.43:4.05:4.40:-1.77:4.14:4.48:-1.69:4.68:4.17:-1.51:4.84:4.07:-1.04:4.77:4.02:-1.24:4.21:4.29:-1.83:3.54:4.54:-1.80:3.86:4.58:-1.47:3.76:4.47:-1.40:3.68:4.45:-1.54:3.52:4.39:-1.77:3.46:4.48:-1.88:3.35:4.09:-1.89:3.37:4.41:|-1.66:3.44:4.30:-2.28:3.83:4.60:-2.01:3.87:4.60:-2.04:3.55:4.57:-2.20:3.38:4.48:-2.35:3.18:4.36:-2.74:3.39:4.33:-2.44:3.65:4.52:-2.00:3.28:4.07:-2.16:3.09:4.28:-2.01:3.29:4.39:-2.17:2.80:3.94:-2.20:2.97:4.16:-2.04:3.15:3.95:-1.76:3.01:3.74:-1.25:2.72:3.41:-1.41:2.43:3.43:-1.88:2.66:3.73:-0.83:2.54:3.11:-0.52:2.42:2.84:-0.66:2.14:2.84:-1.00:2.24:3.13:-0.20:2.32:2.49:0.09:2.23:2.07:-0.03:1.96:2.07:-0.35:2.05:2.48:0.34:2.15:1.64:0.57:2.09:1.19:0.43:1.85:1.20:0.22:1.89:1.63:0.71:2.03:0.68:0.79:2.01:0.09:|0.65:1.79:0.09:0.57:1.81:0.68:|-2.89:3.08:4.01:-2.91:3.25:4.19:-2.52:3.04:4.22:-2.61:2.66:3.56:-2.83:2.92:3.86:-2.45:2.89:4.07:-2.31:2.83:4.05:-2.28:2.66:3.84:-2.47:2.59:3.56:-1.95:2.13:3.12:-2.39:2.40:3.34:-2.18:2.47:3.62:-1.96:2.44:3.60:-1.49:2.19:3.31:-1.72:2.09:3.11:-1.14:1.81:2.64:-1.52:1.92:2.87:-1.28:2.03:3.08:-1.09:2.04:3.03:-0.75:1.95:2.74:-0.95:1.82:2.60:-0.51:1.85:2.43:-0.21:1.77:2.00:-0.42:1.66:1.91:-0.71:1.72:2.28:-0.52:1.32:1.03:-0.66:1.33:1.35:-0.33:1.52:1.47:-0.17:1.49:1.10:-0.11:1.63:1.57:0.09:1.60:1.13:-0.31:1.33:0.07:|-0.39:1.30:0.56:-0.04:1.48:0.63:0.08:1.47:0.07:0.22:1.58:0.66:0.30:1.55:0.07:-0.88:1.58:2.12:-0.58:1.52:1.74:-0.91:1.32:1.63:-1.08:1.27:1.72:-1.30:1.35:2.08:-1.06:1.55:2.20:-1.52:1.47:2.36:-1.87:1.65:2.66:-1.65:1.79:2.72:-1.27:1.67:2.48:-2.26:1.84:2.88:-2.69:2.01:3.02:-2.48:2.25:3.15:-2.05:1.97:2.94:-3.18:2.80:3.37:-2.79:2.50:3.28:-2.99:2.27:3.13:-3.20:2.26:3.08:-3.63:2.47:3.00:-3.36:2.80:3.27:-2.99:2.95:3.71:-2.80:2.66:3.43:-3.15:2.98:3.48:-3.42:3.88:3.64:-3.13:3.46:4.04:-3.12:3.28:3.86:-3.47:3.33:3.31:|-4.10:3.76:2.64:-3.63:3.89:3.32:-3.33:3.29:3.54:-3.37:4.13:3.69:-3.22:4.33:3.72:-2.78:3.97:4.28:-3.08:3.71:4.10:-2.76:4.74:3.92:-2.64:4.20:4.31:-3.09:4.57:3.76:-2.12:4.14:4.49:-2.39:4.10:4.48:-2.51:4.62:4.09:-2.40:4.83:4.00:-1.93:4.88:4.09:-2.01:4.34:4.39:|-0.85:0.91:0.46:-0.76:0.93:-0.04:-1.28:0.12:-0.04:-1.46:0.01:0.11:-1.56:0.03:0.55:-1.07:0.70:0.60:-1.10:0.92:1.20:-0.96:0.91:0.88:-1.47:0.19:0.84:-1.85:0.15:1.31:-1.51:0.90:1.78:-1.31:0.85:1.40:-1.67:0.17:1.03:-2.08:0.11:1.50:-2.33:0.22:1.79:-1.76:0.85:1.95:-2.49:0.34:2.05:-2.85:0.53:2.26:-2.27:1.23:2.51:-1.91:1.05:2.22:-3.25:0.67:2.44:-3.69:0.77:2.52:-3.09:1.55:2.82:-2.66:1.37:2.69:-3.79:2.03:2.86:-3.35:1.82:2.90:-3.96:1.04:2.61:-4.28:0.83:2.50:-4.64:1.00:2.48:-4.11:1.83:2.73:|-0.62:2.57:3.60:0.05:2.21:3.33:-0.79:2.67:3.37:-1.31:2.97:3.69:0.40:2.02:2.98:0.16:2.27:2.33:-0.12:2.39:2.75:-0.43:2.50:3.02:0.79:1.81:2.81:1.13:1.61:2.39:0.57:2.09:2.15:0.77:2.04:1.34:0.55:2.11:1.79:1.11:1.65:2.03:1.74:1.20:0.95:1.86:1.14:0.30:1.19:1.79:0.30:1.11:1.84:0.88:1.44:1.42:1.56:|-1.66:5.62:4.12:-1.58:5.87:4.13:-1.40:6.08:4.00:-1.57:5.56:4.00:-1.46:6.50:4.17:-1.55:6.62:4.28:-1.45:6.73:4.21:-1.30:6.40:4.00:-1.49:6.20:4.12:-1.67:6.47:4.37:-1.60:6.54:4.31:-1.76:7.10:4.69:-1.62:7.01:4.46:-1.72:6.90:4.53:-1.78:6.87:4.58:-1.83:6.87:4.69:-1.80:7.06:4.75:-2.07:7.00:5.07:-1.89:7.09:4.86:-1.90:6.91:4.81:-2.24:6.50:5.25:-2.19:6.84:5.18:-2.12:6.67:5.02:-2.11:6.56:4.99:-2.12:6.37:5.06:-2.22:6.39:5.22:-2.15:5.95:5.07:-2.24:6.24:5.23:-2.12:6.22:5.08:-2.07:6.18:4.96:-2.03:6.06:4.79:-2.09:5.90:4.97:|-2.06:6.26:4.92:-2.03:6.25:4.77:-2.01:6.14:4.74:-2.01:6.44:4.74:-2.03:6.33:4.77:-2.06:6.34:4.92:-2.06:6.40:4.94:-2.05:6.59:4.87:-2.02:6.51:4.77:-1.91:6.69:4.69:-1.98:6.62:4.75:-2.03:6.70:4.85:-2.07:6.87:5.04:-1.92:6.77:4.76:-1.66:6.62:4.39:-1.80:6.66:4.54:-1.81:6.74:4.61:-1.79:6.77:4.60:-1.73:6.76:4.49:-1.64:6.65:4.38:-1.86:5.69:4.57:-1.82:5.88:4.47:-1.71:5.89:4.32:-1.69:5.81:4.27:-1.77:5.56:4.26:-1.86:5.62:4.51:-1.96:5.96:4.64:-1.89:5.90:4.55:-1.92:5.71:4.65:-1.97:5.69:4.73:-2.07:5.79:4.90:-2.00:5.93:4.73:|-1.96:6.22:4.64:-1.94:6.33:4.62:-1.75:6.05:4.38:-1.87:6.04:4.52:-1.94:6.11:4.61:-2.07:5.39:4.03:-2.06:5.45:4.12:-1.85:5.43:4.12:-1.76:5.37:4.01:-1.72:5.30:3.98:-1.80:5.17:3.99:-2.03:5.31:3.99:-2.44:5.05:3.89:-2.20:5.26:3.95:-1.98:5.11:3.99:-1.95:5.53:4.51:-1.86:5.48:4.26:-2.08:5.48:4.26:-2.16:5.50:4.33:-2.22:5.49:4.56:-2.03:5.53:4.59:-2.12:5.69:4.90:-2.03:5.59:4.72:-2.22:5.53:4.71:-2.29:5.54:4.76:-2.34:5.61:4.93:-2.19:5.69:4.95:-2.29:6.12:5.23:-2.20:5.84:5.07:-2.35:5.76:5.06:-2.43:5.85:5.10:-2.53:6.21:5.26:|-2.37:6.21:5.29:-2.28:6.78:5.26:-2.34:6.45:5.32:-2.50:6.44:5.30:-2.52:6.56:5.27:-2.41:6.93:5.15:-2.29:6.90:5.23:-1.98:7.14:4.93:-2.16:7.05:5.14:-2.29:7.08:5.08:-2.26:7.14:4.98:-2.01:7.25:4.75:-1.93:7.19:4.84:-1.83:7.23:4.49:-1.69:7.07:4.17:-1.62:7.07:4.35:-1.66:7.09:4.48:-1.80:7.18:4.71:-1.86:7.25:4.63:-1.36:6.59:4.02:-1.51:6.91:4.23:-1.55:6.95:4.04:-1.54:6.94:3.97:-1.45:6.91:3.93:-1.34:6.59:3.98:-2.37:5.62:4.18:-2.23:5.50:4.15:-2.24:5.46:4.03:-2.27:5.46:4.00:-2.36:5.56:3.91:-2.39:5.65:4.12:-2.42:5.68:4.32:|-2.53:5.73:4.51:-2.36:5.54:4.52:-2.30:5.54:4.29:-2.55:5.73:4.67:-2.44:5.62:4.87:-2.38:5.55:4.69:-2.60:6.12:5.14:-2.49:5.77:4.98:-2.61:5.87:4.78:-2.67:5.98:4.74:-2.70:6.18:4.80:-2.65:6.22:5.09:-2.52:6.81:5.07:-2.61:6.43:5.17:-2.67:6.39:4.88:-2.65:6.47:4.76:-2.55:6.76:4.67:-2.50:6.89:4.95:-2.13:7.20:4.70:-2.36:7.06:4.93:-2.42:6.94:4.66:-2.37:6.93:4.51:-2.16:7.01:4.34:-2.08:7.18:4.56:-2.04:7.02:4.22:-2.02:6.98:4.14:-1.80:7.06:4.11:-1.95:7.19:4.44:-2.00:6.93:4.00:-1.96:6.95:3.89:-1.77:7.01:3.97:-2.18:6.86:4.13:|-2.20:6.91:4.22:-2.40:6.82:4.39:-2.31:6.72:4.15:-2.53:6.66:4.46:-2.63:6.36:4.55:-2.49:6.40:4.25:-2.43:6.56:4.22:-2.54:6.10:4.27:-2.52:6.25:4.24:-2.66:6.21:4.53:-2.68:6.13:4.61:-2.64:5.93:4.55:-2.56:6.02:4.35:-2.49:5.79:4.28:-2.52:5.93:4.26:-2.60:5.84:4.47:-2.44:5.73:4.08:-2.40:5.65:3.88:-2.47:5.81:3.85:-2.47:5.89:3.89:-2.49:5.95:4.12:-2.47:5.80:4.14:-2.49:6.08:4.08:-2.48:6.02:3.86:-2.45:6.24:3.88:-2.47:6.23:4.05:-2.42:6.41:3.88:-2.35:6.60:3.88:-2.37:6.56:4.02:-2.43:6.40:4.04:-2.17:6.82:4.01:-2.30:6.68:4.03:|-2.27:6.72:3.88:-2.22:6.78:3.86:-2.07:6.90:3.87:-2.10:6.86:3.97:-2.67:5.05:3.81:-3.03:4.89:3.69:-2.51:5.35:3.81:-2.43:5.25:3.88:-2.61:5.98:3.75:-2.62:5.76:3.72:-3.08:5.13:3.63:-3.11:6.41:3.51:-3.03:7.22:3.46:-2.61:6.57:3.70:-2.67:6.38:3.69:-3.13:5.53:3.55:-3.07:5.00:3.64:-2.61:5.63:3.72:-2.56:5.47:3.76:-2.03:7.20:3.76:-2.18:7.09:3.75:-2.62:7.75:3.56:-1.68:7.78:3.70:-1.76:7.24:3.83:-2.72:9.88:3.59:-2.81:10.71:3.67:-1.86:10.73:3.96:-1.74:9.68:3.85:-1.74:9.05:3.73:-1.94:8.36:3.64:-2.86:8.32:3.43:-2.91:9.19:3.45:|-2.24:12.97:4.34:-2.15:12.25:4.17:-3.10:12.22:3.89:-3.22:12.81:4.03:-3.31:13.45:4.15:-2.92:14.02:4.43:-2.33:13.57:4.47:|-1.58:7.00:3.91:-1.68:7.01:3.96:-1.86:6.98:3.88:|-4.41:14.25:3.60:-3.96:13.79:3.89:-3.87:13.17:3.78:-4.11:13.18:3.59:-4.86:13.85:3.03:-4.64:14.26:3.38:-4.84:12.90:2.94:-4.96:13.53:2.96:-4.16:12.84:3.48:-4.48:11.42:2.81:-4.58:12.01:2.91:-3.89:11.95:3.44:-3.79:11.36:3.33:-3.69:10.53:3.23:-4.34:10.58:2.71:-4.11:8.29:2.58:-4.21:9.16:2.58:-3.56:9.11:3.11:-3.51:8.24:3.08:-4.08:7.45:2.51:-3.43:6.39:3.26:-3.45:5.50:3.30:-3.94:6.40:2.67:-3.37:7.20:3.24:-4.21:5.04:2.30:-4.16:5.86:2.40:-3.71:4.96:3.09:-3.59:4.59:3.28:-3.71:4.38:3.21:-4.10:4.67:2.51:-4.35:4.13:2.26:|-4.28:4.55:2.25:-3.90:4.27:2.96:-4.54:3.20:2.28:-4.40:3.66:2.29:-3.80:3.22:2.99:-3.66:2.98:3.10:-3.94:2.65:2.84:-4.44:2.96:2.44:-5.54:1.77:1.95:-4.88:2.66:2.13:-4.41:2.35:2.57:-4.41:1.98:2.60:-4.95:1.15:2.36:-5.47:1.45:1.98:|-5.67:14.31:2.18:-5.30:13.88:2.60:-5.22:13.27:2.61:-5.26:12.81:2.30:-5.15:12.22:2.18:-5.45:12.28:1.48:-5.55:12.79:1.49:-5.80:13.41:1.43:-5.78:13.88:1.87:|-5.03:10.14:1.48:-5.17:10.96:1.44:-4.87:10.90:2.14:-4.74:10.06:2.05:-4.90:9.19:1.39:-4.45:6.70:1.96:-4.48:5.88:1.84:-4.69:6.00:1.28:-4.68:6.75:1.30:-4.47:7.54:2.03:-4.70:7.54:1.35:-4.56:8.41:2.01:|-4.55:4.65:1.74:-4.63:4.23:1.77:-4.85:4.37:1.20:-4.76:4.76:1.17:-5.19:3.65:1.11:-5.00:4.06:1.12:-4.77:3.91:1.68:-4.72:3.71:1.85:-4.89:3.27:1.87:-5.18:3.46:1.30:-5.27:2.73:1.70:-5.86:1.88:1.50:-6.11:2.09:1.06:-5.55:2.92:1.14:|-6.08:14.35:0.24:-6.02:13.85:0.82:-5.82:13.24:0.91:|-4.86:7.69:0.71:-4.82:6.90:0.65:-4.85:6.87:0.09:-4.88:7.67:0.09:-4.82:6.15:0.63:-4.84:5.40:0.61:-4.90:5.44:0.07:-4.85:6.12:0.07:-4.89:4.85:0.61:-4.99:4.47:0.64:-5.06:4.53:0.07:-4.96:4.89:0.07:-5.14:4.07:0.65:-5.35:3.67:0.65:-5.42:3.71:0.08:-5.21:4.14:0.08:-5.69:3.06:0.62:-6.25:2.24:0.54:-6.25:2.33:0.06:-5.78:3.11:0.06:|3.55:14.95:0.60:3.05:15.00:0.51:3.52:15.60:0.09:2.88:15.33:-0.07:3.42:15.72:-0.07:2.87:15.07:0.34:2.98:14.97:0.85:3.53:14.94:0.94:3.30:15.51:1.43:3.08:15.59:1.52:2.50:15.08:1.23:2.73:14.99:0.92:2.52:15.06:1.83:2.45:15.07:1.45:3.02:15.59:1.74:3.12:15.52:1.94:2.95:14.95:2.29:2.65:15.01:2.03:|0.05:14.84:3.73:0.36:14.97:3.43:0.62:15.30:4.19:0.52:15.19:4.37:0.10:14.65:4.49:-0.02:14.78:3.99:-0.59:14.97:4.62:-0.30:14.71:4.05:-0.18:14.59:4.55:-0.72:14.67:3.74:-0.43:14.73:3.85:-0.73:15.02:4.51:-0.99:14.95:4.53:-1.47:14.44:3.97:-0.98:14.61:3.78:-1.71:14.31:4.63:-1.65:14.37:4.19:-1.17:14.84:4.67:-2.62:14.67:4.42:-2.02:14.32:4.13:-2.08:14.26:4.57:-2.47:14.40:3.55:-2.12:14.35:3.87:-2.75:14.74:4.24:-3.02:14.72:4.13:-3.17:14.27:3.41:-2.74:14.39:3.44:-3.63:14.08:3.97:-3.40:14.20:3.55:-3.21:14.61:4.19:|-4.35:14.48:3.47:-3.68:14.18:3.36:-3.93:14.05:3.82:-3.93:14.43:2.93:-3.68:14.26:3.14:-4.36:14.59:3.27:-4.54:14.60:3.07:-4.38:14.26:2.36:-4.10:14.43:2.74:-5.01:14.11:2.75:-4.61:14.20:2.36:-4.75:14.50:3.06:-5.60:14.55:2.06:-4.82:14.21:2.11:-5.23:14.12:2.50:-5.03:14.49:1.63:-4.77:14.28:1.89:-5.58:14.65:1.85:-5.19:14.47:-0.09:-5.08:14.33:0.26:-5.87:14.70:-0.10:-4.60:14.90:-0.09:-4.77:14.40:0.26:-4.88:14.52:-0.09:-4.18:14.65:0.44:-4.60:14.44:0.39:-4.42:14.94:0.04:-4.22:15.01:-0.07:-3.79:14.74:-0.07:-3.97:14.73:0.32:|-4.41:14.91:1.05:-4.60:14.43:0.65:-4.17:14.64:0.69:-4.84:14.56:1.28:-4.76:14.40:0.79:-4.58:14.88:1.20:-4.51:14.85:1.44:-4.51:14.34:1.79:-4.77:14.55:1.53:-4.09:14.39:1.87:-4.34:14.32:1.88:-4.34:14.84:1.53:-4.19:14.88:1.44:-3.71:14.53:1.53:-3.93:14.44:1.78:-3.95:14.68:0.85:-3.71:14.58:1.29:-4.19:14.93:1.21:-3.57:14.90:2.50:-3.86:14.51:2.59:-4.13:14.34:2.22:-3.44:14.34:3.00:-3.69:14.51:2.79:-3.39:14.90:2.69:-3.17:14.90:2.78:-2.78:14.44:3.10:-3.22:14.34:3.08:-2.29:14.62:2.44:-2.54:14.50:2.94:-2.94:14.96:2.61:|-2.98:15.01:2.31:-2.72:14.69:1.73:-2.33:14.66:2.14:-3.33:14.59:1.64:-2.97:14.67:1.61:-3.23:14.99:2.19:-1.93:14.99:3.15:-2.29:14.51:3.08:-2.04:14.64:2.58:-1.91:14.41:3.67:-2.26:14.46:3.35:-1.90:14.93:3.42:-1.62:14.98:3.47:-1.14:14.62:3.52:-1.63:14.45:3.71:-1.07:14.80:2.98:-1.00:14.69:3.33:-1.48:15.06:3.28:-1.67:15.06:3.08:-1.78:14.70:2.50:-1.27:14.82:2.77:-0.60:15.10:3.13:-0.78:14.72:3.29:-0.85:14.82:2.94:-0.37:14.76:3.55:-0.66:14.71:3.45:-0.48:15.08:3.29:-0.28:15.14:3.23:0.14:14.95:3.20:-0.17:14.82:3.49:|-0.20:15.00:2.51:0.13:14.98:2.95:-0.29:15.19:2.98:1.78:15.38:1.95:2.12:14.98:2.01:1.67:14.98:2.20:1.46:15.39:1.73:1.05:15.06:1.69:1.13:15.02:1.45:1.36:15.02:1.36:1.95:15.05:1.34:1.68:15.39:1.65:2.06:15.60:0.89:2.48:15.02:0.77:2.25:15.08:1.07:1.75:15.44:0.11:2.35:15.09:0.52:1.93:15.69:0.65:1.60:15.71:0.65:1.00:15.20:0.54:1.41:15.46:0.12:1.12:15.08:1.10:0.93:15.14:0.79:1.52:15.63:0.90:2.11:15.71:-0.07:2.40:15.11:0.35:1.80:15.44:-0.07:2.61:15.32:-0.07:2.60:15.08:0.35:2.32:15.68:-0.07:0.87:15.68:-0.06:|1.23:15.46:-0.06:0.82:15.20:0.36:0.35:15.64:1.26:0.64:15.12:0.87:0.83:15.08:1.19:0.87:15.07:1.37:0.78:15.11:1.61:0.39:15.63:1.44:-0.03:15.11:2.00:0.17:15.64:1.60:0.55:15.11:1.77:|-2.95:15.34:-0.08:-2.79:14.92:0.31:-3.30:14.84:-0.08:-2.18:14.94:-0.08:-2.51:14.95:0.31:-2.67:15.37:-0.08:-2.06:15.31:0.93:-2.36:14.94:0.56:-2.03:14.94:0.17:-2.60:14.79:1.24:-2.50:14.90:0.83:-2.20:15.26:1.20:-2.11:15.23:1.47:-2.11:14.73:1.93:-2.50:14.75:1.52:-1.30:14.99:1.32:-1.81:14.79:1.88:-1.81:15.28:1.42:-1.79:15.33:1.02:-1.76:14.98:0.26:-1.29:15.03:0.92:-1.08:15.65:0.01:-1.11:15.09:0.66:-1.58:15.03:0.01:-0.24:15.12:0.01:-0.78:15.13:0.67:-0.75:15.67:0.01:0.59:15.14:0.36:0.31:15.10:-0.06:0.64:15.59:-0.06:|-3.54:14.62:1.22:-3.78:14.72:0.78:-3.49:15.09:0.92:-3.29:15.09:1.06:-2.99:14.70:1.32:-3.34:14.62:1.36:-2.74:14.87:0.75:-2.83:14.76:1.17:-3.14:15.14:0.91:-3.28:15.16:0.64:-3.39:14.81:0.10:-2.87:14.88:0.49:-0.89:15.06:1.46:-0.55:15.06:2.02:-1.01:15.41:2.00:-0.08:15.11:0.28:-0.08:15.64:1.09:-0.61:15.13:0.94:-1.17:14.88:2.57:-1.68:14.76:2.30:-1.29:15.31:2.28:-1.01:15.38:2.27:-0.55:15.02:2.29:-0.89:14.93:2.57:0.35:15.02:2.86:0.01:15.03:2.42:0.56:15.36:2.61:0.93:15.36:2.41:0.97:15.04:1.99:1.28:15.01:2.29:|1.53:15.38:1.91:1.43:15.01:2.16:1.12:15.04:1.86:1.38:15.06:1.20:1.78:15.60:0.99:1.97:15.08:1.18:1.90:15.38:1.76:2.17:15.04:1.46:2.24:15.02:1.84:0.48:15.12:0.63:0.20:15.64:1.01:0.19:15.11:0.21:0.09:15.06:2.20:0.67:15.06:1.97:0.64:15.37:2.38:-0.43:14.98:2.46:-0.52:15.16:2.93:-0.77:14.89:2.73:-0.33:15.11:1.89:-0.67:15.11:1.34:-0.14:15.64:1.49:-1.17:15.00:1.47:-1.29:15.34:2.00:-1.68:14.80:2.03:-3.52:14.53:1.74:-3.42:14.94:2.28:-3.74:14.46:1.99:-3.90:14.41:2.08:-3.58:14.90:2.37:-4.15:14.33:2.09:-3.62:14.77:0.10:|-3.51:15.13:0.64:-3.80:14.75:0.50:-5.99:14.60:0.12:-5.26:14.26:0.47:-5.92:14.11:0.73:-5.83:14.09:1.06:-5.21:14.26:0.82:-5.77:14.54:1.51:-5.64:14.66:1.60:-5.02:14.33:0.89:-5.10:14.51:1.38:|5.11:5.42:-0.15:4.99:5.57:0.01:4.99:5.65:-0.15:|1.11:15.25:4.04:1.44:14.94:2.96:1.58:14.73:3.69:1.82:14.73:3.50:1.69:14.93:2.78:2.13:15.27:3.33:1.90:14.89:2.32:2.34:14.88:2.14:2.72:14.78:2.44:2.66:14.89:2.64:2.33:15.31:3.11:1.89:14.94:2.56:0.64:15.03:2.88:0.85:15.35:2.63:1.20:15.00:2.51:0.65:15.01:3.21:1.21:14.99:2.84:0.92:15.35:3.99:|-4.92:1.08:0.59:-2.51:0.08:0.56:-2.41:0.12:0.11:-3.22:0.36:-0.05:-5.63:1.62:-0.04:-5.62:1.55:0.45:-5.62:1.47:1.00:-5.44:1.18:1.43:-3.50:0.36:1.23:-2.77:0.20:1.09:-2.60:0.12:0.80:-5.00:1.11:0.83:-3.80:0.34:2.30:-3.35:0.25:2.22:-2.99:0.20:2.00:-3.26:0.24:2.02:-4.43:0.60:2.31:-4.07:0.43:2.32:-5.26:1.04:1.80:-4.74:0.75:2.18:-3.57:0.31:1.90:-3.09:0.22:1.71:-2.84:0.16:1.43:-4.93:0.79:1.65:|3.66:15.37:-0.57:3.66:14.72:-1.06:3.52:14.06:-1.14:3.23:15.30:-2.43:3.04:14.68:-2.77:2.91:13.98:-2.69:3.05:13.97:-2.41:3.50:14.68:-1.63:3.35:15.29:-2.14:3.36:13.60:-1.56:3.56:14.27:-1.50:3.06:13.55:-2.27:2.37:14.92:-3.72:2.06:14.36:-3.87:2.06:13.66:-3.71:2.58:13.76:-3.15:2.69:14.48:-3.23:1.53:14.02:-4.26:1.08:14.56:-4.63:1.10:13.31:-4.33:1.20:12.58:-4.13:1.54:13.32:-4.10:0.69:14.36:-4.82:0.22:13.78:-4.83:0.26:13.07:-4.63:0.35:12.36:-4.45:0.79:12.37:-4.31:0.68:13.10:-4.48:-0.84:14.26:-5.17:-1.38:13.68:-5.02:|-1.30:13.08:-4.87:-1.20:12.36:-4.70:-0.31:12.42:-4.57:-0.39:13.12:-4.77:-0.43:13.84:-4.97:|2.93:12.06:-2.12:3.15:12.14:-1.57:3.23:12.96:-1.63:2.93:12.91:-2.34:2.51:12.98:-3.05:2.00:12.88:-3.62:2.12:12.16:-3.35:2.31:11.91:-3.10:2.67:11.89:-2.58:2.66:12.74:-2.78:1.39:11.85:-3.90:1.85:11.87:-3.57:1.71:12.60:-3.83:0.86:10.09:-4.18:0.93:11.05:-4.10:0.49:11.03:-4.26:0.67:9.78:-4.26:-0.60:9.32:-4.34:0.18:8.56:-4.29:0.38:8.91:-4.31:0.35:9.17:-4.30:0.16:10.43:-4.28:-1.21:11.13:-4.47:-1.09:10.08:-4.36:-0.31:11.19:-4.38:1.12:10.08:-4.09:1.43:10.27:-3.91:1.17:11.03:-3.99:1.81:10.38:-3.62:2.18:10.48:-3.26:|2.01:11.15:-3.38:1.83:11.37:-3.55:1.36:11.35:-3.88:1.59:10.59:-3.75:2.52:10.50:-2.80:2.78:10.49:-2.29:2.73:11.16:-2.41:2.60:11.39:-2.63:2.23:11.41:-3.15:2.36:10.73:-3.00:2.99:10.44:-1.76:3.14:10.22:-1.22:3.17:11.19:-1.33:3.11:11.48:-1.56:2.89:11.41:-2.11:2.91:10.73:-1.97:3.31:11.81:-0.88:3.42:12.25:-0.49:3.44:12.81:-0.49:3.53:13.65:-0.49:3.63:14.25:0.02:3.68:14.93:-0.48:3.44:13.59:-1.06:3.37:12.77:-1.00:3.29:10.36:-0.34:3.21:9.91:-0.74:3.22:9.71:-0.34:3.20:9.55:-0.81:3.25:9.38:-0.87:3.28:9.09:-0.59:|3.31:8.83:-0.41:3.22:9.35:-0.41:3.04:9.91:-1.83:3.17:9.68:-1.35:3.12:9.86:-1.29:2.98:10.07:-1.83:2.74:10.22:-2.42:2.47:10.24:-2.92:2.56:10.10:-2.92:2.68:10.06:-2.76:2.90:10.01:-2.25:2.83:10.17:-2.24:2.16:10.18:-3.34:1.80:10.08:-3.71:1.96:9.96:-3.70:2.12:9.96:-3.59:2.41:10.04:-3.22:2.30:10.17:-3.20:1.47:9.91:-3.97:1.15:9.72:-4.15:1.32:9.59:-4.23:1.52:9.50:-4.23:1.85:9.20:-4.29:1.83:9.70:-3.98:1.64:9.81:-3.94:0.94:9.47:-4.25:0.74:9.15:-4.30:0.95:9.09:-4.36:1.07:9.15:-4.37:1.22:9.40:-4.34:1.05:9.52:-4.23:|0.68:7.63:-4.33:-0.19:7.22:-4.37:-0.08:6.91:-4.34:0.68:6.97:-4.36:1.21:7.00:-4.41:1.23:7.51:-4.40:0.87:7.99:-4.35:1.14:7.88:-4.37:0.85:8.25:-4.35:1.06:8.55:-4.36:0.99:8.86:-4.38:0.77:8.92:-4.33:1.56:8.40:-4.34:1.62:8.57:-4.43:1.25:8.76:-4.41:1.16:8.72:-4.39:1.24:8.41:-4.36:1.47:8.35:-4.34:1.43:9.19:-4.39:1.28:8.94:-4.41:1.65:8.75:-4.45:1.75:8.89:-4.44:2.05:9.08 ln=LDText.Split (cc,"|" ) GraphicsWindow.BackgroundColor="teal GraphicsWindow.Width=dw GraphicsWindow.Height=dh view3D = LD3DView.AddView(dw,dh,"true") 'Will not clip to size if window rescaled LD3DView.AddDirectionalLight (view3D,"gold",-1 ,-1 ,-1) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#55888888") LD3DView.ResetCamera(view3D,0,10,10, -1, -1, -1, "","","") LD3DView.AutoControl ("true" "true", -1 .25) nrmz="0 0 1: 0 0 1: 0 0 1: 0 0 1: 0 0 1: 0 0 1 indices = "0 1 2 3 4 5 ii=1 ta[0]=1 rt="" args=0 txtr="0 0 :1 0 :1 1"'<<<<---------------texture mapping for triangles im=ImageList .LoadImage ("e:\sknn.jpg")'<<<<<--------------------------place ur desired skin bitmap LDImage.EffectGamma (im 2.5) mfacets() GraphicsWindow.Title=(ix-1) +" nodes / facets:"+fct ya=15 r35=20 ai=1 aa=45 LDEvents.MouseWheel=mww GraphicsWindow.KeyDown=kdd cs=LD3DView.AddSphere (view3D .055 30 "red" "E") rottc() Sub addnd'--------------------------------------------------------------creates 3d nodes for rightside hemisphere al=ldtext.Split (args[1] ":") For f=1 To Array.GetItemCount (al) ag=ldtext.Split (al[f] " ") rt="" For r=1 To 3 rt=rt+(ldarray.GetValue (lsx ag[r]))+": rt=rt+ldarray.GetValue (lsz ag[r])+": rt=rt+(ldarray.GetValue (lsy ag[r]))+": EndFor o1=LD3DView.AddGeometry(view3D,rt,indices,nrmz,"White","D") LD3DView.AddImage (view3D o1 txtr im "D") EndFor endsub Sub addnd1'-------------------------------------------------------------------------------------idem for left hemisph. al=ldtext.Split (args[1] ":") For f=1 To Array.GetItemCount (al) ag=ldtext.Split (al[f] " ") rt="" For r=1 To 3 rt=text.Append (rt ldarray.GetValue (lsx ag[r])+":") rt=text.Append (rt ldarray.GetValue (lsz ag[r])+":") rt=text.Append (rt (-.4-ldarray.GetValue (lsy ag[r]))+":") EndFor o1=LD3DView.AddGeometry(view3D,rt,indices,nrmz,"White","D") LD3DView.ReverseNormals (view3D o1) LD3DView.AddImage (view3D o1 txtr im "D") EndFor endsub Sub addnd2'-------------------------------------------------------------------------3d nodes for concat. l-r hemisph. ag=ldtext.Split (args[1] " ") 'TextWindow.WriteLine (ag) rt="" For r=1 To 2 rt=text.Append (rt ldarray.GetValue (lsx ag[r])+":") rt=text.Append (rt ldarray.GetValue (lsz ag[r])+":") rt=text.Append (rt (ldarray.GetValue (lsy ag[r]))+":") EndFor r=2 rt=text.Append (rt ldarray.GetValue (lsx ag[r])+":") rt=text.Append (rt ldarray.GetValue (lsz ag[r])+":") rt=text.Append (rt (-.4-ldarray.GetValue (lsy ag[r]))+":") o1=LD3DView.AddGeometry(view3D,rt,indices,nrmz,"White","D") If rvn then LD3DView.ReverseNormals (view3D o1) endif LD3DView.AddImage (view3D o1 txtr im "D") rt="" For r=2 To 1 Step -1 rt=text.Append (rt ldarray.GetValue (lsx ag[r])+":") rt=text.Append (rt ldarray.GetValue (lsz ag[r])+":") rt=text.Append (rt (-.4-ldarray.GetValue (lsy ag[r]))+":") EndFor r=1 rt=text.Append (rt ldarray.GetValue (lsx ag[r])+":") rt=text.Append (rt ldarray.GetValue (lsz ag[r])+":") rt=text.Append (rt (ldarray.GetValue (lsy ag[r]))+":") o1=LD3DView.AddGeometry(view3D,rt,indices,nrmz,"White","D") If rvn then LD3DView.ReverseNormals (view3D o1) endif LD3DView.AddImage (view3D o1 txtr im "D") EndSub Sub make2tr'-------------------------------------------------------------------------2 triangles at once = 1 square al=ldtext.Split (ldtext.Replace (args[1] ":" " ") " ") ret=al[1]+" " ret=text.Append (ret, al[2]+" ") ret=text.Append (ret, al[3]+":") ret=text.Append (ret, al[1]+" ") ret=text.Append (ret, al[3]+" ") ret=text.Append (ret, al[4]+":") 'TextWindow.WriteLine (ret) return=ret fct=fct+2 EndSub Sub makectr1 all1=ldtext.Split (ldtext.Replace (args[1] ":" " ") " ") ww=":" t1="" For zx=2 to array.GetItemCount (all1)-2 Step 2 t1=t1+LDCall.Function ("make2tr" all1[zx-1]+ww+all1[zx]+ww+all1[zx+2]+ww+all1[zx+1]) endfor ldcall.Function( "addnd" t1) ldcall.Function( "addnd1" t1) endsub Sub make4tr'-------------------------------------------------------------------------makes 4 triang.=2 squares at once all1=ldtext.Split (ldtext.Replace (args[1] ":" " ") " ") ww=":" t1=LDCall.Function ("make2tr" all1[1]+ww+all1[2]+ww+all1[3]+ww+all1[4]) t1=t1+LDCall.Function ("make2tr" all1[4]+ww+all1[3]+ww+all1[5]+ww+all1[6]) return=t1 endsub Sub make9tr'--------------------------------------------------------------------------------------makes 9 square at once all=ldtext.Split (args[1] " ") ww=":" t11=LDCall.Function ("make4tr" all[9]+ww+all[10]+ww+all[6]+ww+all[5]+ww+all[2]+ww+all[1]) t11=t11+LDCall.Function ("make4tr" all[10]+ww+all[11]+ww+all[7]+ww+all[6]+ww+all[3]+ww+all[2]) t11=t11+LDCall.Function ("make4tr" all[9]+ww+all[13]+ww+all[14]+ww+all[10]+ww+all[15]+ww+all[11]) t11=t11+LDCall.Function ("make4tr" all[11]+ww+all[12]+ww+all[8]+ww+all[7]+ww+all[4]+ww+all[3]) t11=t11+LDCall.Function ("make2tr" all[15]+ww+all[16]+ww+all[12]+ww+all[11]) return=t11 endsub Sub fmake atx=LDText.Split (ft "|") For qw=1 to Array.GetItemCount(atx) tt=tt+LDCall.Function (ftf atx[qw]) endfor endsub Sub mfacets'---------------------------------------------------------------------------------makes nodes & facets lsx=LDArray.Create (2000) lsz=LDArray.Create (2000) lsy=LDArray.Create (2000) ix=1 For x=1 To Array.GetItemCount (ln) l1=LDText.Split(ln[x] ":") For f=1 to Array.GetItemCount (l1) step 3 If (ix>755 And ix<940) Or ix>1100 Then Goto nxx endif If sffm then sf[ix]=LD3DView.AddSphere (view3D .03 4 LDColours.HSLtoRGB (ix 1 .5) "D") LD3DView.TranslateGeometry (view3D sf[ix] l1[f] l1[f+1] l1[f+2]) endif LDarray.SetValue (lsx ix l1[f]) LDarray.SetValue (lsz ix l1[f+1]) LDarray.SetValue (lsy ix l1[f+2]) nxx: ix=ix+1 endfor Endfor tt="" ftf="make2tr"'square ' 4--3 ' 1--2 ft ="299 306 307 305|147 152 151 150|100 101 57 58|68 41 40 42|133 132 136 134|132 140 137 136|140 139 138 137|134 136 99 135|136 137 95 99|137 138 94 95|189 190 132 133|190 187 140 132|187 188 139 140|58 57 62 59|97 98 63 64| ft=ft+"98 96 67 63|85 86 69 70|91 92 66 67|92 85 70 66|99 95 96 98|135 99 98 97|96 95 91 67|95 94 92 91|355 354 357 356|401 402 354 355|400 399 402 401|404 403 406 405|403 400 401 406| ft=ft+"405 406 361 362|406 401 355 361|42 40 19 43|43 19 18 20|45 68 42 44|44 42 43 25|25 43 20 24|47 25 24 26|46 44 25 47|65 45 44 46|30 47 26 29|61 46 47 30|31 32 35 36|35 32 27 34| ft=ft+"35 34 39 38|36 35 38 37|31 30 29 32|24 20 21 23|20 18 17 21|18 11 8 17|26 24 23 22|29 26 22 28|32 29 28 27|60 61 30 31|54 60 31 36|56 54 36 37|70 69 14 71|66 70 71 41|67 66 41 68| ft=ft+"63 67 68 45|64 63 45 65|59 62 61 60|62 64 65 61|330 359 356 327|431 428 399 400|129 126 131 130|417 418 440 441| ft=ft+"392 393 380 381|309 112 113 311|310 309 311 48|493 491 490 476|984 315 316 967|1050 1049 1051 1044|1045 1005 1001 1049|1080 1077 1074 1075 fmake() 'single triangles ' 3 ' 1--2 tt=tt+":311 53 48:103 130 102:143 144 89:150 79 87:178 173 148:174 152 147:155 83 151:69 86 14:105 100 58:107 105 58:1077 1055 1074:1008 1005 1045:314 304 309:54 59 60:57 64 62:52 48 53:48 52 49:1061 1056 1065:" tt=tt+"403 431 400:65 46 61:19 11 18:19 10 11:15 10 19:40 15 19:71 15 40:41 71 40:75 76 13:13 76 12:14 76 13:74 76 14:14 13 15: tt=tt+"14 15 71:15 13 12:15 12 10:73 72 74:72 78 75:72 75 74:72 78 75:7 2 6:6 3 5:6 5 4:" ftf="make9tr"'grid 3x3, nodes: ' 1---2---3---4 ' 5---6---7---8 ' 9--10--11--12 ' 13--14--15--16 ft="124 127 126 131 200 197 198 194 201 196 195 193 243 239 240 234|263 267 268 272 265 264 269 271 288 283 284 279 286 289 282 285|646 652 653 658 661 650 651 656 662 649 648 655 713 714 709 710| ft=ft+"633 632 639 638 672 673 668 669 671 670 667 666 725 726 721 722|515 516 512 508 514 513 511 510 528 529 526 527 531 530 525 524| ft=ft+"1034 992 994 979 1035 996 997 978 1042 995 998 969 1043 1000 999 968|1072 1069 1050 1049 1071 1070 1048 1045 1076 1073 1047 1046 1075 1074 1055 1052| ft=ft+"1045 1008 1006 955 1046 1011 1007 959 1052 1010 1012 954 1053 1017 1013 960|1000 999 968 971 1002 1003 975 972 1001 1004 974 973 1005 1009 965 966| ft=ft+"1058 1059 1020 687 1061 1060 1019 1024 1065 1062 1026 1027 1064 1063 1030 1029|1080 1077 1055 1052 1079 1078 1054 1053 1084 1081 1057 1058 1083 1082 1056 1061| ft=ft+"381 378 423 420 380 379 422 421 385 382 427 424 384 383 426 425|272 273 275 276 271 270 274 277 279 280 281 352 285 278 351 353| ft=ft+"688 686 689 685 1021 1022 679 674 1023 678 677 676 732 727 728 725|603 604 607 608 606 605 609 610 635 636 641 642 632 639 638 643| ft=ft+"608 611 612 615 610 614 613 618 642 644 645 652 643 647 646 650|615 616 619 620 618 617 622 621 652 653 658 659 650 651 656 657 fmake() ftf="make4tr"' grid 2 x 1 'nodes: 6--5 ' 4--3 ' 1--2 ft ="49 313 310 48|226 224 225 229 181 182|227 226 229 228 182 183|236 231 232 235 186 191|231 230 233 232 185 186|230 227 228 233 183 185|298 252 253 300 306 299|146 145 87 88 89 144|142 184 179 141 180 146|10 12 7 11 9 8|7 12 76 2 77 1|75 78 77 76|2 1 3 6|7 2 4 9|108 109 129 104 130 103|92 94 138 93 143 89|86 85 92 90|153 157 158 83| ft=ft+"114 115 110 111 109 106|106 109 108 107 104 105|105 104 103 100 102 101|377 374 371 372 370 373|373 370 368 369 367 364|364 367 366 365 362 363|363 362 361 359 355 356| ft=ft+"968 971 970 969 977 978|978 977 976 979 982 980|123 124 127 128 126 129|1053 1059 1020 1016 687 1018|479 480 553 554 552 559|559 552 558 563 574 562|1018 687 688 1014 690 1013| ft=ft+"286 482 469 289 466 282|482 483 468 469 467 466|409 404 405 408 362 367|410 413 407 412 368 370|413 409 408 407 367 368|417 410 412 411 370 371|416 417 411 415 371 374| ft=ft+"356 357 326 327 329 328|328 329 160 161 159 165|131 133 134 130 135 102|102 135 92 101 64 57|320 297 301 319 302 303|297 298 300 301 299 302|315 319 317 316 303 312| ft=ft+"314 303 302 304 299 305|474 475 457 472 449 471|459 458 457 475 448 449|409 433 430 404 431 403|417 441 432 413 433 410|381 378 375 376 374 377|378 423 419 375 415 374| ft=ft+"423 420 418 419 416 415|398 397 396 395 384 385|394 398 395 393 385 380|438 439 444 445 443 442|439 421 424 444 425 443|446 449 448 447 453 450|394 447 450 398 451 397| ft=ft+"420 421 439 440 438 441|473 472 471 470 390 388|377 386 387 376 391 381|491 492 489 490 461 459|459 461 462 458 453 448|1029 731 732 1028 1023 1027|1027 1023 1021 1024 688 687| ft=ft+"504 518 519 503 498 502|502 498 499 501 468 483|977 37 38 976 39 982|971 51 56 970 37 977|973 313 49 972 51 971|967 316 312 974 313 973|1041 1042 1035 1036 1034 1037| ft=ft+"1044 1051 1043 1040 1042 1041|1087 1086 1085 1088 1082 1083|1086 1064 1065 1085 1056 1082|1049 1001 1002 1051 1000 1043|115 117 121 116 120 119|113 112 118 114 117 115| ft=ft+"110 115 116 122 119 125|109 110 122 123 125 124|293 296 295 294 291 292|292 291 290 287 286 288|86 87 79 80 84 81|79 150 151 84 83 82|14 86 80 74 81 73|188 184 142 139 143 138| ft=ft+"180 181 177 178 176 173|165 159 164 162 163 166|166 163 168 167 170 171|171 170 169 175 174 172|189 193 191 190 186 187|187 186 185 188 183 184|170 153 154 169 152 174| ft=ft+"164 156 157 163 153 170|180 178 148 146 149 145|153 83 155 154 151 152|92 93 89 90 87 86|143 142 141 144 146 88|49 52 55 51 54 56|52 107 58 55 59 54|311 113 106 53 107 52| ft=ft+"324 322 320 325 319 321|296 298 297 323 322 324|308 120 121 307 117 305|305 117 118 304 112 309|312 303 314 313 309 310|1008 1006 1009 1005 955 956| fmake() ldcall.Function( "addnd" tt) 'right hemisphere ldcall.Function( "addnd1" tt)'left hemisphere rvn="false"'for head backside ft="1087 1088|1088 1083|1083 1084|1084 1079|1079 1080|1080 1075|1075 1076|1076 1071|1071 1072|1036 1037|1041 1036|1040 1041|1044 1040|1050 1044 ftf="addnd2 fmake() rvn="true"'reverses normals for texture (draws on opposite side) ftf="addnd2"'concatenation l-r hemispheres ft="5 4|3 5|1 3|442 428|425 443|443 442|452 451|451 397|397 396|396 384|384 383|383 426|426 425|428 399|399 402|402 354|354 357|357 326|326 329|329 160|160 159|159 164|164 156|156 157|157 158|158 83|83 82|82 84|84 81|81 73|77 1|78 77|72 78|73 72 fmake() ftf="makectr1"'ladders ' n-1.. n ' 3--- 4 ' 1--- 2 ft="479 481 480 290 553 291 552 323 558 294|243 244 239 238 240 237 234 241|253 251 248 254 249 250|288 265 287 260 292 261 294 256 293 257 298 252|265 263 260 266 261 259 256 262 257 255 252 258 253 251|181 180 182 179 183 184|176 172 173 174 148 147 149 150 145 87|732 731 727 730 728 729 725 724 726 723 721 720 722 719 718 717 713 716 714 712 709 715 710 711 708 707 703 706 704 705|454 472 478 473 455 456 282 285|489 489 490 488 461 460 462 463 453 452 450 451|441 438 437 436 432 435 433 434 430 429 431 428|347 344 348 350 341 349 342 340 337 343 338 339 336 335 331 334 332 330 333 327|344 377 350 372 349 373 340 364 343 365|339 365 335 358 334 359|540 521 522 504 523 503 505 502 506 501 500 483 484 482 479 481|690 693 691 692 696 695 694 698 699 697 700 702 fmake() EndSub Sub sset ' ----------------------------------------------------------------------------------moves 3d cursor GraphicsWindow.Title =ii px=ldarray.GetValue(lsx ii) py=ldarray.GetValue(lsy ii) pz=ldarray.GetValue(lsz ii) LD3DView.ModifyObject (view3D sf[ii] "H") LD3DView.ModifyObject (view3D sf[oi] "S") oi=ii LD3DView.TranslateGeometry(view3D cs px pz py) 'lsxx[ii] lsxz[ii] lsxy[ii] 'Addtube (view3D LDList.GetAt (lss ii) .1 10 "red" "E") EndSub Sub rottc '---------------------------------------------------------------- rotates around model full circle For aa=0 To 360 Step .5 If GraphicsWindow.LastKey="Space" Then aa=aa-.5 else px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") endif Program.Delay (15) EndFor EndSub Sub kdd '-----------------------------------------------------------------------------------keyboard handling lk= text.ConvertToLowerCase (GraphicsWindow.LastKey) 'GraphicsWindow.Title =lk If (lk="up") then ii=ii-1 If ii<1 Then ii=1 endif sset() ElseIf lk="d1" then TextWindow.Write ("Node: ") ii=TextWindow.ReadNumber() ElseIf lk="down" then ii=ii+1 sset() elseIf lk="return" then GraphicsWindow.Title ="add "+ai lin[ai]=ii ai=ai+1 Goto xx ElseIf lk="home" then ii=1 sset() EndIf GraphicsWindow.Title =ii xx: EndSub Sub mww If GraphicsWindow.LastKey="Space" then ya=ya+ LDEvents.LastMouseWheelDelta elseIf GraphicsWindow.LastKey="LeftCtrl" then r35=r35+ LDEvents.LastMouseWheelDelta/2 Else aa=aa+LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title =aa endif px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") EndSub End>BGX735.sb< Start>BHC136.sb< ''Virus Game Prototype Arena (CoreWar Emulator) ''By DaCodeDude TextWindow.Title = "Virus Arena - Alpha 0.0.1" TextWindow.WriteLine("Virus Arena - Alpha 0.0.1 (CoreWar Emulator)") TextWindow.Pause() ''Not Implemented yet: ''Hard core players don't need this anyway :P :D ''Virus1 Only Memory ''virus1priv[1] = "" ''virus1priv[2] = "" ''virus1priv[3] = "" ''virus1priv[4] = "" TextWindow.WriteLine("Virus loading:") ''Open Virus1 virus1file = "C:\Users\Valued Customer\Desktop\Projects\Small Basic\Virus Game\vir\virus1.txt" ''Replace with select file and load file for distribution ready version virus1code = "" filelength = 0 ''Load each line of virus 1's code into temporary array ' The following line could be harmful and has been automatically commented. ' thisLine = File.ReadLine(virus1file, 1) While (thisLine <> "EndVirus") filelength = filelength + 1 virus1code[filelength] = thisLine ' The following line could be harmful and has been automatically commented. ' thisLine = File.ReadLine(virus1file, filelength + 1) EndWhile ''Check virus 1 data [debug, 2 lines] TextWindow.WriteLine("Virus 1: " + virus1code) TextWindow.WriteLine("") ''Get virus 1's # of commmands virus1length = Array.GetItemCount(virus1code) ''Verify # of commands in virus 1 [debug, 2 lines] TextWindow.WriteLine(virus1length) TextWindow.WriteLine("") ''Create memory areana virus1startpoint = 1 ''Verify startpoint for virus 1 [debug, 2 lines] TextWindow.WriteLine("Virus 1 start point: " + virus1startpoint + ".") TextWindow.WriteLine("") ''Load virus 1 commands into memory array from its array tempnum = 0 While (tempnum <> virus1length) tempnum = tempnum + 1 memory[tempnum] = virus1code[tempnum] EndWhile ''Load rest of memory While (tempnum <> 100) tempnum = tempnum + 1 memory[tempnum] = "DAT 0, 0" EndWhile ''Verify memory [debug, 2 lines] TextWindow.WriteLine(memory) TextWindow.WriteLine("") ''Begin the running of the Virtual Memory and Code Interpreter percycle = 500 ''To be customizable as to run game at multiple speeds. i.e. for watching a virus for debugging/testing or running fast for quick tournement runs maxnumcycles = 1000 ''Maximum number of cycles a round, also customizable numcycles = 0 virus1exec = virus1startpoint ''virus1exec is the next execution point, here it initializes as the start point of virus 1 '' Remember virus1startpoint is also the virus's program execution start point While (numcycles <> maxnumcycles) virus1step = memory[virus1exec] ''Load virus 1 command from memory array ''Verify each command to run [debug 2 lines] TextWindow.WriteLine(virus1step) TextWindow.Pause() ExecVirus1Command() numcycles = numcycles + 1 virus1exec = virus1exec + 1 ''Move to ExecVirus1Command sub once more commands are implemented EndWhile Sub ExecVirus1Command ''Find command and execute instruction relating to the command. Command modifiers and other none math related commands not yet implemented. code = Text.GetSubText(virus1step, 1, 3) If (code = "DAT") Then ''Check for process destruction command winlose = "Virus 1 died" ElseIf (code = "NOP") Then ''Check for the do nothing command ''Does nothing except let let execution of virus continue to the next address ElseIf (code = "ADD") Then ''Check for variable adding command ''temp code till GetABValues Sub is completed GetABValues() ''Check A and B values [debug 3 lines] TextWindow.WriteLine("AValue = " + AValue) TextWindow.WriteLine("BValue = " + BValue) TextWindow.WriteLine("") ElseIf (code = "SUB") Then ''Check for variable subtracting command ''temp code till GetABValues Sub is completed ElseIf (code = "MUL") Then ''Check for variable multiplying command ''temp code till GetABValues Sub is completed ElseIf (code = "DIV") Then ''Check for variable dividing command ''temp code till GetABValues Sub is completed Else ''Catchall for unkown data TextWindow.WriteLine("Memory Array Error: Incompatible Data: '" + virus1step + "'") TextWindow.WriteLine("Error Causes: (Incorrect virus code) Or (Program Error).") EndIf EndSub Sub GetABValues ''Get the AValue and the BValue, Also check for Type modifiers (*, #, @, etc...) for each value i = 0 varloc = 5 ''AValue retrieve While (i <> 1) If (Text.GetSubText(virus1step, varloc, 1) = ",") Then i = 1 Else AValue = Text.Append(AValue, Text.GetSubText(virus1step, varloc, 1)) EndIf varloc = varloc + 1 EndWhile i = 0 varloc = varloc + 1 ''BValue retrieve While (i <> 1) If (Text.GetSubText(virus1step, varloc, 1) = "") Then i = 1 Else BValue = Text.Append(BValue, Text.GetSubText(virus1step, varloc, 1)) EndIf varloc = varloc + 1 EndWhile EndSub End>BHC136.sb< Start>BHC311.sb< GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Width =1200 GraphicsWindow.Height =800 GraphicsWindow.Left =10 GraphicsWindow.Top =10 GraphicsWindow.BrushColor="white GraphicsWindow.PenWidth=0 Turtle.Speed =10 Turtle.Show () Turtle.Angle=0 GraphicsWindow.Clear () LDEvents.MouseWheel =mww args=0 scc=1 c40=50 Turtle.PenUp () ddd=ldtext.Split ("380 300 v 580 300 a 680 300 s 820 250 w" " ") dodrw() GraphicsWindow.BrushColor ="black c40=30 ox=10 oy=10 dodrw() ww= LDShapes.GetAllShapes () ii=10000 While "true For f=1 to Array.GetItemCount (ww) ii=ii+1 cc=LDShapes.GetColour (ww[f]) 'TextWindow.Write (cc[1]+"; ") If cc[1]="#FFFFFFFF" Then else if of>0 then ' LDShapes.BrushColour (ww[of] "black") endif of=f 'cl="#FFFFFF" 'while cl="#FFFFFF" or cl="#FFFFFFFF" cl=LDColours.HSLtoRGB (Math.Remainder (ii 360) 1 .4) 'endwhile LDShapes.BrushColour (ww[f] cl) 'LDShapes.AnimateOpacity (ww[f] 500 3) LDShapes.ZIndex (ww[f] ii+f) ' TextWindow.Write ("*") Program.Delay (30) endif EndFor endwhile Sub dodrw For w=1 to Array.GetItemCount (ddd) Step 3 x300=ddd[w] y400=ddd[w+1] LDCall.Function ("dcch" ddd[w+2]) endfor EndSub Sub dcch 'f i j q r v x z cd=args[1] if cd="m" then aa=-1 LDCall.Function4("ldrw",x300,y400 100 0) ldcall.Function5( "cdrw" x300 y400-100 0 36, 5) LDCall.Function4("ldrw",-1,0 95 0) aa=1 ldcall.Function5( "cdrw" x300 y400-100 0 36, 5) LDCall.Function4("ldrw",-1,0 95 0) elseif cd="w" then aa=-1 LDCall.Function4("ldrw",x300,y400-100 100 180) ldcall.Function5( "cdrw" x300 y400 0 36, -5) Turtle.Angle=0 LDCall.Function4("ldrw",-1,0 95 0) aa=1 ldcall.Function5( "cdrw" x300 y400 0 36, -5) Turtle.Angle=0 LDCall.Function4("ldrw",-1,0 95 0) elseif cd="a" then aa=-1 LDCall.Function4("ldrw",x300,y400 100 0) ldcall.Function5( "cdrw" x300 y400-100 0 36, 5) LDCall.Function4("ldrw",-1,0 95 0) LDCall.Function4("ldrw",x300 y400-50 70, -90) elseif cd="b" then aa=1 ldcall.Function5( "cdrw" x300 y400-80 0 72, 6.5) LDCall.Function4("ldrw",-1,0 100 0) elseif cd="d" then aa=-1 ldcall.Function5( "cdrw" x300 y400-80 0 72, 6.5) LDCall.Function4("ldrw",-1,0 100 0) elseif cd="c" then aa=-1 ldcall.Function5( "cdrw" x300 y400-80, -45 55, 6.5) elseif cd="e" then aa=-1 ldcall.Function5( "cdrw" x300 y400-80, -45 55, 6.5) Turtle.Angle=0 Turtle.Move (50) Turtle.Angle=-90 Turtle.Move(60) LDCall.Function4("ldrw",-1,0 50 0) elseif cd="g" then aa=-1 ldcall.Function5( "cdrw" x300 y400-80, -45 55, 6.5) Turtle.Angle=0 LDCall.Function4("ldrw",-1,0 35 0) Turtle.Angle=-90 LDCall.Function4("ldrw",-1,0 40 0) elseif cd="h" then aa=-1 LDCall.Function4("ldrw",x300,y400 100 0) ldcall.Function5( "cdrw" x300 y400-100 0 36, 5) LDCall.Function4("ldrw",-1,0 95 0) Turtle.Angle=0 LDCall.Function4("ldrw",-1,0 200 0) elseif cd="n" then aa=-1 LDCall.Function4("ldrw",x300,y400 100 0) ldcall.Function5( "cdrw" x300 y400-100 0 36, 5) LDCall.Function4("ldrw",-1,0 95 0) elseif cd="o" then aa=1 ldcall.Function5( "cdrw" x300 y400-80 0 72, 6.5) elseif cd="p" then aa=1 ldcall.Function5( "cdrw" x300 y400-80 0 72, 5) Turtle.Angle=180 LDCall.Function4("ldrw",-1,0 105 0) elseif cd="s" then aa=-1 ldcall.Function5( "cdrw" x300 y400-80, -45 45, 4) aa=1 ldcall.Function5( "cdrw" ,-1 0, 0 45, 4.3) elseif cd="y" then aa=-1 LDCall.Function4("ldrw",x300,y400-100 100 180) ldcall.Function5( "cdrw" x300 y400 0 36, -5) Turtle.Angle=0 LDCall.Function4("ldrw",-1,0 95 0) Turtle.Angle=180 LDCall.Function4("ldrw",-1,0 200 0) elseif cd="u" then aa=-1 LDCall.Function4("ldrw",x300,y400-100 100 180) ldcall.Function5( "cdrw" x300 y400 0 36, -5) Turtle.Angle=0 LDCall.Function4("ldrw",-1,0 95 0) elseif cd="t" then aa=-1 LDCall.Function4("ldrw",x300+50,y400 200 0) LDCall.Function4("ldrw",x300 y400-150 100 90) elseif cd="l" then aa=-1 LDCall.Function4("ldrw",x300+50,y400 200 0) elseif cd="k" then aa=-1 LDCall.Function4("ldrw",x300+50,y400 200 0) LDCall.Function4("ldrw",x300+50,y400-70 120 45) LDCall.Function4("ldrw",x300+50,y400-85 120 135) elseif cd="v" then aa=-1 LDCall.Function4("ldrw",x300,y400 170 25) LDCall.Function4("ldrw",x300,y400 170, -25) elseif cd="x" then aa=-1 LDCall.Function4("ldrw",x300,y400 190 35) LDCall.Function4("ldrw",x300+110,y400 190, -35) elseif cd="z" then aa=-1 LDCall.Function4("ldrw",x300+50,y400 200 0) LDCall.Function4("ldrw",x300+50,y400-70 120 45) LDCall.Function4("ldrw",x300+50,y400-85 120 135) EndIf EndSub Sub ldrw If args[1]>=0 then Turtle.x=args[1] Turtle.Y=args[2] Turtle.Angle =args[4] EndIf For x=1 To args[3] Step 3 sset() Program.Delay (5) Turtle.Move (3) EndFor EndSub Sub sset sh= Shapes.AddEllipse (c40 c40) Shapes.Move (sh Turtle.X+ox Turtle.y+ox) LDShapes.AnimateOpacity (sh 1200 3) EndSub Sub cdrw if args[1]>=0 then Turtle.x=args[1] Turtle.Y=args[2] Turtle.Angle =args[3] endif For x=1 To args[4] 'GraphicsWindow.FillEllipse (Turtle.X Turtle.y c40 c40) sset() Program.Delay (20) Turtle.Angle=Turtle.Angle+5*aa Turtle.Move (args[5]) EndFor EndSub Sub mww If Mouse.IsLeftButtonDown Then an=an+ LDEvents.LastMouseWheelDelta *3 else scc=scc+ LDEvents.LastMouseWheelDelta/10 endif LDGraphicsWindow.Reposition (scc scc 0 0 an) EndSub End>BHC311.sb< Start>BHC496.sb< 'Events Controls.ButtonClicked = OnButtonClicked LDControls.FileDropped = OnFileDropped LDControls.MediaPlayerEnded = OnMediaPlayerEnded Timer.Tick = OnTick Timer.Interval = 100 Initialisation() Playing = 1 While Playing = 1 EndWhile Program.End() Sub Initialisation GraphicsWindow.Top = 1 GraphicsWindow.Left = 1 gw = 720 gh = 640 GraphicsWindow.Width = gw GraphicsWindow.Height = gh player = LDControls.AddMediaPlayer(gw,gh-100) volume = 0.5 LDControls.MediaPlayerVolume(player,volume) play = Controls.AddButton("Play",4,gh-40) stop = Controls.AddButton("Stop",47,gh-40) pause = Controls.AddButton("Pause",90,gh-40) volumeDown = Controls.AddButton("Vol-",141,gh-40) volumeUp = Controls.AddButton("Vol+",180,gh-40) FullDisplay = Controls.AddButton("FD",225,gh-40) NormalDisplay = Controls.AddButton("ND",255,gh-40) Off = Controls.AddButton("Off",290,gh-40) applySpeed = Controls.AddButton("Apply",650,gh-80) applyTime = Controls.AddButton("Apply",650,gh-40) speed = Controls.AddTextBox(485,gh-80) time = Controls.AddTextBox(485,gh-40) fileInfo = Shapes.AddText("Drop a media file HERE") speedInfo = Shapes.AddText("Playback Speed") timeInfo = Shapes.AddText("Time ("+")") Shapes.Move(fileInfo,10,gh-75) Shapes.Move(speedInfo,325,gh-75) Shapes.Move(timeInfo,325,gh-35) Controls.SetTextBoxText(speed,"1") Controls.SetTextBoxText(time,"0") LDControls.AllowDrop(fileInfo) LDShapes.AnimateOpacity(fileInfo,1000,0) gwf = Desktop.Width - 30 ghf = Desktop.Height - 80 'komma[1] = "." number with "." komma[1] = "," EndSub 'Initialisation Sub OnButtonClicked button = Controls.LastClickedButton If (button = play) Then LDControls.MediaPlayerPlay(player) ElseIf (button = stop) Then LDControls.MediaPlayerStop(player) ElseIf (button = pause) Then LDControls.MediaPlayerPause(player) ElseIf (button = applySpeed) Then LDControls.MediaPlayerSpeed(player,Controls.GetTextBoxText(speed)) ElseIf (button = applyTime) Then LDControls.MediaPlayerSeek(player,1000*Controls.GetTextBoxText(time)) ElseIf (button = volumeUp) Then volume = volume + 0.1 If (volume > 1) Then volume = 1 EndIf LDControls.MediaPlayerVolume(player,volume) ElseIf (button = volumeDown) Then volume = volume - 0.1 If (volume < 0) Then volume = 0 EndIf LDControls.MediaPlayerVolume(player,volume) ElseIf (button = FullDisplay) Then GraphicsWindow.Width = gwf GraphicsWindow.Height = ghf LDControls.MediaPlayerStretch(player, "Fill") ElseIf (button = NormalDisplay) Then gw = 720 gh = 640 GraphicsWindow.Width = gw GraphicsWindow.Height = gh LDControls.MediaPlayerStretch(player, "None") ElseIf (button = Off) Then Playing = 0 EndIf EndSub Sub OnMediaPlayerEnded LDControls.MediaPlayerStop(player) EndSub Sub OnFileDropped If (LDControls.LastDropShape = fileInfo) Then files = LDControls.LastDropFiles LDControls.MediaPlayerLoad(player,files[1]) LDControls.MediaPlayerPlay(player) EndIf EndSub Sub OnTick pp1 = LDText.Split(LDControls.MediaPlayerPosition(player), komma) po = Math.Round(pp1[1]/1000) pp2 = LDText.Split(LDControls.MediaPlayerPlayTime(player), komma) pl = Math.Round(pp2[1]/1000) Shapes.SetText(timeInfo, "Time ("+po+" of "+pl+" sec)") EndSub End>BHC496.sb< Start>BHD456.sb< un=5 u=un*7.5 ii=7 GraphicsWindow.Title="Football Field GraphicsWindow.BackgroundColor="tan GraphicsWindow.Width=u*16 grn1="LimeGreen grn2="green 'TPR924 GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="ForestGreen q=Shapes.AddRectangle(u*16 u*11) Shapes.Move(q 0 u/2.2) For f=1 To 14 For r=0 To 8 If Math.Remainder(f 2)=1 Then GraphicsWindow.BrushColor=grn2 Else GraphicsWindow.BrushColor=grn1 EndIf If f>1 and f<7 and r>1 and r<7 Then If Math.Remainder(f+r 2)=1 Then GraphicsWindow.BrushColor=grn1 Else GraphicsWindow.BrushColor=grn2 EndIf EndIf ss[f][r+1]=Shapes.AddRectangle(u u) Shapes.Move(ss[f][r+1] f*u r*u+50) LDShapes.AnimateZoom(ss[f][r+1] 750/ii 5 1.3 1.3) LDShapes.AnimateOpacity(ss[f][r+1] 550/ii 7) Program.Delay(75/ii) EndFor EndFor GraphicsWindow.PenWidth=2 GraphicsWindow.PenColor="white GraphicsWindow.BrushColor="transparent rr=Shapes.AddRectangle(u*14 u*9) Shapes.Move(rr u 50) rr=Shapes.AddLine(u*8 50 u*8 50+u*9) cc=Shapes.AddEllipse(18.3*un 18.3*un) LDShapes.Centre(cc u*8 u*4.5+50) rr=Shapes.AddRectangle(un*16.5 un*40) LDShapes.Centre(rr u*2.1 u*4.5+50) rr=Shapes.AddRectangle(un*16.5 un*40) LDShapes.Centre(rr u*13.9 u*4.5+50) rr=Shapes.AddRectangle(un*6 un*18) LDShapes.Centre(rr u*1.4 u*4.5+50) rr=Shapes.AddRectangle(un*6 un*18) LDShapes.Centre(rr u*14.6 u*4.5+50) LDEvents.MouseWheel=mww GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="white ee= Shapes.AddEllipse(7 7) LDShapes.Centre(ee u*8 u*4.5+50) ee= Shapes.AddEllipse(7 7) LDShapes.Centre(ee u*2.5 u*4.5+50) ee= Shapes.AddEllipse(7 7) LDShapes.Centre(ee u*13.5 u*4.5+50) args=0 GraphicsWindow.PenWidth=2 LDCall.Function5("arcc", -57 57 un*18.3/2 u*2.5 u*4.5+50) LDCall.Function5("arcc", 180-57 57+180 un*18.3/2 u*13.5 u*4.5+50) LDCall.Function5("arcc", 0, 90 u/4 u 50) LDCall.Function5("arcc", 270, 360 u/4 u 50+u*9) LDCall.Function5("arcc", 90, 180 u/4 u*15 50) LDCall.Function5("arcc", 180, 270 u/4 u*15 50+u*9) zz=1 GraphicsWindow.PenColor="black Shapes.AddLine(u 50 u-10 30) Shapes.AddLine(u*15 50 u*15-10 30) Shapes.AddLine(u 50+u*9 u-10 30+u*9) Shapes.AddLine(u*15 50+u*9 u*15-10 30+u*9) GraphicsWindow.BrushColor="red GraphicsWindow.PenWidth=0 tt=Shapes.AddTriangle(0 0 25 7 7 14) Shapes.Move(tt u-10 30) tt=Shapes.AddTriangle(0 0 25 7 7 14) Shapes.Move(tt u*15-10 30) tt=Shapes.AddTriangle(0 0 25 7 7 14) Shapes.Move(tt u-10 30+u*9) tt=Shapes.AddTriangle(0 0 25 7 7 14) Shapes.Move(tt u*15-10 30+u*9) LDGraphicsWindow.Reposition(zz zz 70*zz 60*zz 0) Timer.Tick=ttt Timer.Interval=25 Sub arcc rd=args[3] For r= args[1] To args[2] step 3 nx=LDMath.Cos(r)*rd+args[4] ny=LDMath.Sin(r)*rd+args[5] If r>args[1] Then Shapes.AddLine(ox oy nx ny) EndIf ox=nx oy=ny EndFor EndSub Sub ttt inn=inn+1 ss=(ldmath.Sin(inn)+1.5)/5+.5 LDGraphicsWindow.Reposition(ss ss/1.05 70*ss 60*ss ss/2*90-35) EndSub Sub mww Timer.Pause() zz=zz+LDEvents.LastMouseWheelDelta/10 LDGraphicsWindow.Reposition(zz zz 70*zz 60*zz 0) EndSub End>BHD456.sb< Start>BHK073.sb< 'Simon by Yoc. Published with the id : MFF438 'Canvas GraphicsWindow.Title = "Simon" GraphicsWindow.CanResize = "no" GraphicsWindow.BackgroundColor = "white" GraphicsWindow.Width = "400" GraphicsWindow.Height = "430" 'red square GraphicsWindow.BrushColor = "red" red_square=Shapes.AddRectangle(200,200) 'blue_square GraphicsWindow.BrushColor = "blue" blue_square = Shapes.AddRectangle(200,200) Shapes.Move(blue_square,200,0) 'green_square GraphicsWindow.BrushColor = "green" green_square = Shapes.AddRectangle(200,200) Shapes.Move(green_square,0,200) 'yellow_square GraphicsWindow.BrushColor = "yellow" yellow_square = Shapes.AddRectangle(200,200) Shapes.Move(yellow_square,200,200) 'Initialization count = 1 how_many_clicks = 0 lost = "no" difficulty = 1000 'Events detection GraphicsWindow.MouseDown = OnMouseClick GraphicsWindow.MouseUp = OnMouseRelease 'Main loop While lost="no" DisplayScore() Program.Delay(1000) 'We create and show the color sequence OnCreateSequence() how_many_clicks = 0 While how_many_clicks < count 'We listen to mouse clicks with OnMouseClick and we check for mistakes endwhile count = count + 1 If difficulty > 200 Then difficulty = difficulty - 50 EndIf EndWhile Sub OnCreateSequence 'We create the color sequence and highlight it 'We add a new random color to the array sequence[count]=Math.GetRandomNumber(4) 'For each array element, we highlight the corresponding color For i = 1 To count selected_color = sequence[i] OnHighLightColor() Program.Delay(difficulty) OnMouseRelease() Program.Delay(difficulty/5) EndFor endsub Sub OnMouseClick how_many_clicks = how_many_clicks + 1 'We get mouse coordonates x=GraphicsWindow.MouseX y=GraphicsWindow.MouseY 'We detect clicked color If x < 200 And y < 200 Then cliked_color = 1 'red EndIf If x > 200 And y < 200 Then cliked_color = 2 'blue EndIf If x < 200 And y > 200 Then cliked_color = 3 'green EndIf If x > 200 And y > 200 Then cliked_color = 4 'yellow EndIf 'We highlight the corresponing color selected_color = cliked_color OnHighLightColor() If cliked_color <> sequence[how_many_clicks] Then lost="yes" WeLost() endif EndSub Sub OnHighLightColor 'Which color do we have to take care of ? If selected_color = 1 then 'red selected_shape = red_square EndIf If selected_color = 2 then 'blue selected_shape = blue_square EndIf If selected_color = 3 then 'green selected_shape = green_square EndIf If selected_color = 4 then 'yellow selected_shape = yellow_square EndIf 'We highlight the corresponding color Shapes.SetOpacity(selected_shape,30) EndSub Sub OnMouseRelease Shapes.SetOpacity(selected_shape,100) endsub Sub DisplayScore GraphicsWindow.BrushColor = "white" GraphicsWindow.FillRectangle(175, 405, 70, 20) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(180, 405, "Score: " + (count-1)) EndSub Sub WeLost GraphicsWindow.ShowMessage("Lost ! Your score : " + (count-1),"Simon") Program.End() EndSub End>BHK073.sb< Start>BHK748.sb< 'sets up the screen and buttons and stuff GraphicsWindow.Title ="Lottery by SkidMarcUK" GraphicsWindow.BackgroundColor = "darkgreen" GraphicsWindow.FontSize = 40 GraphicsWindow.BrushColor = "black" GraphicsWindow.PenColor = "black" button1 = Controls.Addbutton("click here to spin balls",70,330) Controls.SetSize(button1,500,70) Controls.ButtonClicked = lotto GraphicsWindow.FontSize = 100 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(100,10,"LOTTERY") Sound.PlayBellRing() Timer.Interval =1000 Timer.tick = ha 'added this sub to change colour of logo. 'needed a break from trying to to work out how to get it to check for numbers 'coming out twice sub ha GraphicsWindow.FontSize = 100 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(90,0,"LOTTERY") endsub 'main program sub lotto Timer.Pause() Controls.SetButtonCaption(button1,"GOOD LUCK") 'main loop For mainloop= 1 To 25 Sound.PlayClick() 'gets number and checks array too see if they have a come out already '(i think) pos=-90 For n=1 To 6 pos=pos+100 x=Math.GetRandomNumber (49) check=Array.ContainsValue(number,x) While check= "True" x=Math.GetRandomNumber (49) check=Array.ContainsValue(number,x) endwhile 'adds checked number to array number[n]=x 'draws the balls GraphicsWindow.BrushColor = "white" If number[n] > 10 Then GraphicsWindow.BrushColor = "blue" endif If number[n] > 19 Then GraphicsWindow.BrushColor = "hotpink" endif If number[n] > 29 Then GraphicsWindow.BrushColor = "springgreen" EndIf If number[n] > 39 Then GraphicsWindow.BrushColor = "yellow" endif GraphicsWindow.FillEllipse (pos,160,110,110) GraphicsWindow.DrawEllipse (pos,160,110,110) GraphicsWindow.BrushColor = "black" 'checks for single digit number and centres text in ball 'this was the last thing i changed If number[n] < 10 Then s=18 Else s=0 endif GraphicsWindow.FontSize = 60 GraphicsWindow.DrawText (15+pos+s,177,number[n]) EndFor Sound.PlayBellRing() EndFor Controls.SetButtonCaption(button1,"click here to spin balls") Timer.Resume() EndSub End>BHK748.sb< Start>BHL817.sb< GraphicsWindow.Left = 0 TextWindow.Left = 810 headings[1] = "Index" headings[2] = "Car" headings[3] = "Price" dataview = LDControls.AddDataView(GraphicsWindow.Width,GraphicsWindow.Height,headings) LDControls.DataViewSetColumnComboBox(dataview,2,"1=Mazda;2=Ford;3=Fiat;") LDControls.DataViewSelectionChanged = OnDataViewSelectionChanged LDControls.DataViewSetRow(dataview,1,"1=1;2=Fiat;3=1000;") LDControls.DataViewSetRow(dataview,2,"1=2;2=Ford;3=2000;") LDControls.DataViewSetRow(dataview,10,"1=3;2=Mazda;3=1500;") LDControls.DataViewSaveAsCSV(dataview,Program.Directory+"\data.csv","False") Program.Delay(1000) LDControls.DataViewSetRow(dataview,3,"1=3;2=Mazda;3=1800;") Program.Delay(1000) data = LDControls.DataViewGetValue(dataview,1,2) LDControls.DataViewSetValue(dataview,2,2,data) Program.Delay(1000) LDControls.DataViewDeleteRow(dataview,1) Program.Delay(1000) TextWindow.WriteLine("DataViewGetFocus "+LDControls.DataViewGetFocus(dataview)) Program.Delay(1000) LDControls.DataViewSetFocus(dataview,2,1) Program.Delay(1000) TextWindow.WriteLine("DataViewGetRow "+LDControls.DataViewGetRow(dataview,2)) Program.Delay(1000) LDControls.DataViewSort(dataview,3,"True") LDControls.DataViewAllowSort(dataview,"False") Program.Delay(1000) TextWindow.WriteLine("DataViewRowCount "+LDControls.DataViewRowCount(dataview)) Program.Delay(1000) LDControls.DataViewClear(dataview) Program.Delay(1000) LDControls.DataViewReadFromCSV(dataview,Program.Directory+"\data.csv","True") Sub OnDataViewSelectionChanged TextWindow.WriteLine("LastDataView "+LDControls.LastDataView) TextWindow.WriteLine("DataViewGetSelected "+LDControls.DataViewGetSelected(dataview)) EndSub End>BHL817.sb< Start>BHM208.sb< ' program by yvan leduc July 24 th 2016 ' jupiter moons orbit., orbital resonance ' http://lasp.colorado.edu/education/outerplanets/moons_galilean.php 'Program no: PWN670 ' program no: MKP026 ' program no: XFP964 ' program no : KNK444 ' program no: ZWJ544 ' program no: TJK275 GraphicsWindow.Width=1366 GraphicsWindow.height=768 GraphicsWindow.top=0 GraphicsWindow.left=0 dark_blue=GraphicsWindow.GetColorFromRGB(0,0,50) io_color=GraphicsWindow.GetColorFromRGB(250,250,145) europa_color=GraphicsWindow.GetColorFromRGB(50,170,210) ganymede_color=GraphicsWindow.GetColorFromRGB(200,75,170) callisto_color=GraphicsWindow.GetColorFromRGB(55,154,35) gray=GraphicsWindow.GetColorFromRGB(75,75,75) lightgray=GraphicsWindow.GetColorFromRGB(175,175,175) GraphicsWindow.BrushColor=lightgray GraphicsWindow.FontSize=20 GraphicsWindow.BackgroundColor=dark_blue date = Shapes.AddText("") GraphicsWindow.FontSize=12 radian_value=Shapes.AddText("") Shapes.Move(date,900, 50) Shapes.Move(radian_value,900, 80) GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor=io_color GraphicsWindow.DrawBoundText(900,150,500,"Io") GraphicsWindow.BrushColor=europa_color GraphicsWindow.DrawBoundText(900,170,500,"Europa") GraphicsWindow.BrushColor=ganymede_color GraphicsWindow.DrawBoundText(900,190,500,"Ganymede") GraphicsWindow.BrushColor="gray" GraphicsWindow.FontSize=10 GraphicsWindow.DrawBoundText (1000,600,500,"Jupiter's Moons orbits programmed by Yvan Leduc @ 2016") GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor=lightgray ga_d=0 start_day=LDDateTime.FromOADate(42214.41) ' for 2016/07/29 at 10:00 hre Shapes.SetText(date,days) GraphicsWindow.BrushColor = io_color io = Shapes.AddEllipse(8,8) GraphicsWindow.BrushColor = europa_color eu = Shapes.AddEllipse(10,10) GraphicsWindow.BrushColor = ganymede_color ga = Shapes.AddEllipse(10,10) Rx_io = 105 ' distance IO to Jupiter , radius x for and ellipse ( 422,000 km ) ( 422/4=105) Ry_io = 105-(105*0.0041) ' radius y for and ellipse IO Eccentricity 0.0041 Rx_eu = 167.75 ' distance Europa to Jupiter 671,000 km ( 671/4=167.75) Ry_eu = 167.75-(167.75*0.009) ' Europa Eccentricity 0.009 Rx_ga = 267.5 ' distance Ganymede to Jupiter 1,070,000 km Ry_ga = 267.5-(267.5*0.0013) ' Ganymede Eccentricity 0.0013 ' center of all orbits and Jupiter place h=500 k=350 jupiter=ImageList.LoadImage("https://social.msdn.microsoft.com/Forums/getfile/903129") GraphicsWindow.DrawresizedImage(jupiter,500-30,350-30,60,60) radian=6.2831853071796 io_startup_position_offset=1.75 eu_startup_position_offset=-0.59 ga_startup_position_offset=-1.05 ' The relationship between the orbital periods of Io, Europa, and Ganymede is an example of a resonance ' More generally, we say that two orbits are resonant when the ratio of their periods is a ratio of whole numbers ' In the case of Jupiter's satellites, it's likely that Io, Europa, and Ganymede developed their resonance as a result of gravitational attraction ' To see that Io and Europa really do complete four and two orbits, respectively, each time Ganymede completes one orbit, we would have to observe Jupiter much more often than once a week. While radian <> -10 radian = radian -0.001 ' IO orbit ' Io 422,000 km (262,200 mi) distance from Jupiter radian_io=radian-io_startup_position_offset ' to set startup position as for for for 2016/07/29 at 6:00 hre x_io = (Rx_io*math.cos(radian_io*7.155) + h ) ' io 1.769 days for 1 orbit y_io = (Ry_io*math.sin(radian_io*7.155) + k) Shapes.Move(io,x_io,y_io) GraphicsWindow.SetPixel(x_io,y_io,gray) ' EUROPA orbit ' Europa 671,000 km (417,000 mi) distance from Jupiter radian_eu=radian-eu_startup_position_offset ' to set startup position as for forfor 2016/07/29 at 6:00 hre x_eu = Rx_eu*math.cos(radian_eu*3.551) + h ' europa 3.551 days for 1 orbit y_eu = Ry_eu*math.sin(radian_eu*3.551) + k Shapes.Move(eu,x_eu,y_eu) GraphicsWindow.SetPixel(x_eu,y_eu,gray) ' GANYMEDE orbit ' Ganymede 1,070,000 km (665,000 mi) distance from Jupiter ' Ganymede exactly 7 days, 3 hours, and 43 minutes to complete one orbit around Jupiter radian_ga=radian+ga_startup_position_offset ' to set startup position as for for for 2016/07/29 at 6:00 hre x_ga = Rx_ga*math.cos(radian_ga*1.769) + h ' ganymede 7.155 days for 1 orbit y_ga = Ry_ga*math.sin(radian_ga*1.769) + k Shapes.Move(ga,x_ga,y_ga) GraphicsWindow.SetPixel(x_ga,y_ga,gray) ga_d=ga_d+0.0019 start_day=LDDateTime.FromOADate(42214.41) ' for 2016/07/29 at 10:00 hre days=lddatetime.Add(start_day,ga_d) Shapes.SetText(date,days) Shapes.SetText(radian_value,radian) Program.Delay(10) ' to slow viewing orbit endwhile End>BHM208.sb< Start>BHN895.sb< ' SmallBasic Version 1.2 ' Program: FilledEllipseTurtle ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/0059173a-594e-4da4-afa6-e9c6ac9241fa/challenge-of-the-month-september-2018 ' ImportURL: http://smallbasic.com/program/? ' SBOnline: http://smallbasic-publicwebsite-dev.azurewebsites.net/Program/view.aspx? ' Extension: --- ' Comment: Draw a filled ellispse with the turtle (DON'T use the Shapes or Controls methods) ' https://social.msdn.microsoft.com/Forums/en-US/b9ab0f8c-469e-41f5-85d4-f6bd070cdefc/challenge-of-the-month-december-2015 ' Variables: ' ToDo: '=============================================================================== cx = GraphicsWindow.Width/2 ' 312 cy = GraphicsWindow.Height/2 ' 221 Turtle.Speed = 10 a = 200 b = 150 VertUpCart() a = 150 b = 200 HorzRightCart() 'Turtle.Show() ' //////////////////// SUBs //////////////////// ' vertical up-lines between -a and +a, lineStart kartes. x;y(x) Sub VertUpCart 'Turtle.Hide() For x = -a To a 'If x = 0 Then ' GraphicsWindow.PenColor = "Lime" 'EndIf y = b * Math.SquareRoot(1 - x*x/a/a) Turtle.X = cx + x Turtle.Y = cy + y Turtle.Move(2*y) ' default direction up/north EndFor EndSub ' horiz. right-lines between +b and -b, lineStart kartes. x(y);y Sub HorzRightCart 'Turtle.Show() Turtle.Turn(90) ' not if hidden 'Turtle.Hide() GraphicsWindow.PenColor = "Yellow" For y = -b To b 'If y = 0 Then ' GraphicsWindow.PenColor = "Blue" 'EndIf x = a * Math.SquareRoot(1 - y*y/b/b) Turtle.X = cx - x Turtle.Y = cy + y Turtle.Move(2*x) EndFor EndSub End>BHN895.sb< Start>BHP119.sb< CR = 13 LF = 10 nln1=text.GetCharacter (cr)+text.GetCharacter(lf) nln= " \par" GraphicsWindow.Width =1600 GraphicsWindow.Height=800 LDControls.RichTextBoxFontBackground ="teal LDControls.RichTextBoxFontSize=18 LDControls.RichTextBoxFontFamily ="Lucida console rst: GraphicsWindow.Clear () rr=LDControls.AddRichTextBox (1600 800) LDControls.RichTextBoxDefault (rr) sFile = LDDialogs.OpenFile ("All files (*.*)|*.*" "e:\") ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' sBuf = File.ReadContents(sFile) iDec = Text.GetLength(sBuf) LDControls .RichTextBoxSetText (rr "File: "+sfile+nln1+"File length (bytes): " + iDec "false"+nln1) LDControls.RichTextBoxSetText (rr nln1 "true") iPtr = 1 c = " " in="\cf9\highlight2\f0\fs26 " in1="\cf3\highlight2\f0\fs26 " ff="true GraphicsWindow.title="Hex dump While c <> "" If Math.Remainder(iPtr, 32 * 8) = 1 or ff Then GraphicsWindow.title=text.GetLength (LDControls.RichTextBoxGetText (rr)) If ff then ff="false else ' The following line could be harmful and has been automatically commented. ' File.WriteContents("e:\txt.rtf" tx+"}" ) 'LDControls.RichTextBoxSetText (rr nln1 "true") LDControls.RichTextBoxLoad (rr "e:\txt.rtf" "true") endif tx="{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Lucida console;}{\f1\fnil\fcharset0 Calibri;}} tx=tx+"{\colortbl ;\red255\green85\blue0;\red0\green128\blue128;\red255\green170\blue0;\red255\green255\blue0;\red170\green255\blue0;\red85\green255\blue0;\red0\green255\blue0;\red0\green255\blue85;\red0\green255\blue170;\red0\green255\blue255;\red0\green170\blue255;\red0\green85\blue255;\red0\green0\blue255;\red0\green0\blue0;} tx=tx+"{\*\generator Riched20 6.3.9600}\viewkind4\uc1 " tx=text.append(tx nln+in1+":::: +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 0123456789ABCDEF0123456789ABCDEF"+nln ) ' tx=text.append(tx in+":::: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------++++++++++++++++"+nln ) EndIf iDec = Math.Floor((iPtr - 1) / 16) shex=ldmath.Decimal2Base (iDec 16) tx=text.append(tx in) If Text.GetLength(sHex) = 1 Then tx=text.append(tx "00" ) ElseIf Text.GetLength(sHex) = 2 Then tx=text.append(tx "0" ) EndIf tx=text.append(tx sHex ) tx=text.append(tx "0 " ) iSave = iPtr For i = 1 To 32 c = Text.GetSubText(sBuf, iPtr, 1) If c = "" Then sHex = " " Else iDec = Text.GetCharacterCode(c) shex=ldmath.Decimal2Base (iDec 16) If Text.GetLength(sHex) = 1 Then sHex = Text.Append("0" sHex) ElseIf Text.GetLength(shex)>2 then shex= Text.GetSubTextToEnd(shex Text.GetLength(shex)-1) EndIf EndIf tx=text.append(tx sHex + " " ) iPtr = iPtr + 1 EndFor tx=text.append(tx " " ) iPtr = iSave For i = 1 To 32 c = Text.GetSubText(sBuf, iPtr, 1) iDec = Text.GetCharacterCode(c) If idec<32 or idec>127 Or idec=92 or idec=123 or idec=125 Then tx=text.append(tx "." ) Else tx=text.append(tx c ) EndIf iPtr = iPtr + 1 EndFor tx=text.append(tx nln ) EndWhile ' The following line could be harmful and has been automatically commented. ' File.WriteContents("e:\txt.rtf" tx+"}" ) LDControls.RichTextBoxLoad (rr "e:\txt.rtf" "true") GraphicsWindow.title="Hex dump - press F1 to open new file GraphicsWindow.KeyDown =kdd rss="true While rss Program.Delay (5) EndWhile Goto rst Sub kdd If GraphicsWindow.LastKey="F1" Then rss="false endif endsub End>BHP119.sb< Start>BHR665.sb< ' SmallBasic Version 1.2 ' Program: FSWatcher ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/3a05614a-352f-4040-b4a2-70f8a7954088/sb-backup-file ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Comment: ' ' Variables: ' ToDo: ' ================================================================================ watchDir = Program.Directory backDir = Program.Directory +"\Backup" ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(backDir) <> "True" Then ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(backDir) EndIf ' Create a GW and minimize it GraphicsWindow.Title = "FSWatcher [Running]" 'LDGraphicsWindow.Icon = "SB" LDGraphicsWindow.State = 1 'LDGraphicsWindow.ShowInTaskbar = "" '' perhaps place icon in SysTray (eg. RBTray, TrayIt, Trayconizer) LDEvents.FilePath = watchDir LDEvents.FileFilter = "*.exe" ' Default "*.*" LDEvents.FileChange = OnFileChange While "True" ' keep running If bExeChg Then bExeChg = "" lastSB = LDText.Replace(lastFile, ".exe",".sb") ' The following line could be harmful and has been automatically commented. ' newName = LDFile.GetFile(lastSB) +"_"+ Clock.Date +"_"+ Clock.Time newName = LDText.Replace(newName, ".","-") newName = LDText.Replace(newName, ":","-") newPath = backDir +"\"+ newName +".sb" ' The following line could be harmful and has been automatically commented. ' File.CopyFile(lastSB, newPath) lastFile = "" lastSB = "" newName = "" newPath = "" Else Program.Delay(20) EndIf EndWhile ' ////////// EVENT \\\\\\\\\\ Sub OnFileChange lastType = LDEvents.LastFileChangeType If (lastType = "Changed" Or lastType = "Created") Then lastFile = LDEvents.LastFileChanged bExeChg = "True" EndIf EndSub End>BHR665.sb< Start>BHR707.sb< ' Pictionary - French ' Version 0.9 ' Copyright © 2017-2019 Nonki Takahashi. The MIT License. ' Last update 2019-04-19 GraphicsWindow.Title = "Pictionary" SB_Workaround() gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" ' initialize shapes for flag Shapes_Init_Flag() angle = 0 ' dummy ' add shapes scale = 1 iMin = 1 iMax = Array.GetItemCount(shape) Shapes_Add() ' initialize shapes Shapes_Init_Caption() ' add shapes iMax = Array.GetItemCount(shape) Shapes_Add() Sub Shapes_Init_Caption ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 414 ' x offset shY = 358 ' y offset shape = "" shape[1] = "func=text;x=0;y=0;text=French;fn=Trebuchet MS;fs=50;fb=True;pw=0;bc=Black;" EndSub Sub Shapes_Init_Flag ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 0 ' x offset shY = 0 ' y offset shape = "" shape[1] = "pw=0;bc=#ED2939;func=rect;width=120;height=240;x=119;y=94;" shape[2] = "pw=0;bc=#FFF;func=rect;width=120;height=240;x=239;y=94;" shape[3] = "pw=0;bc=#002395;func=rect;width=120;height=240;x=359;y=94;" EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_Add ' Shapes | add shapes as shapes data ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - 1 if same scale ' return shWidth, shHeight - total size of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param iMin, iMax - shape indices to add ' return shWidth, shHeight - total size of shapes For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub End>BHR707.sb< Start>BHV039.sb< ctt = 10 gw=900 args=0 GraphicsWindow.Title ="Marco Polo Text Journey, 1271AD GraphicsWindow.Width=900 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor="teal GraphicsWindow.FontName="lucida console GraphicsWindow.FontSize =16 GraphicsWindow.BrushColor="white cpp= 1 GraphicsWindow.FontBold ="false ctt=1 JL = 300 C = 2 W = 30 M = 5 FP = 5 BSK = 99 DT = 0 'Initial quantities of stuff Sub360() Sub3560() 'Display the scenario Sub720() 'Purchase initial supplies Sub600() 'Input hunting skill level XD = "Press Enter to begin your trek!" Sub3760() ' 'Main program LN220: J = J + 1 pdate() 'Next two-month segment DT = DT + D If DT > 6000 Then Goto LN3360 'Reached end of trip? EndIf D = 40 + BA * 20 + Math.Floor(100 * Math.GetRandomNumber(999)/1000) LDCall.Function("wln" "You have traveled "+ DT+ " miles.") LDCall.Function("wln" "Here is what you now have: ") Sub3200() Sub910() 'Check for no jewels or clothes Sub1020() 'Check for sickness If BSK = J Then BSK = 99 BL = B BA = BA + 1 'Camel recover yet? EndIf If J > 1 AND JL > 1 Then Sub1190() 'Barter for supplies EndIf If C = 0 Then Sub1400() 'No clothes? EndIf Sub1500() 'Eating routine If DZ = 0 AND Math.GetRandomNumber(999)/1000 < .18 Then Sub3020() '18% chance to hunt for food EndIf LDCall.Function("wln" "") Sub1780() 'Desert sections If DZ = 0 Then Sub1940() 'Event happens EndIf Sub3110() Goto LN220 ' Sub Sub360 'Subroutine to TextWindow.WriteLine( initial scenario XD = "The Journey of Marco Polo-1271" Sub3760() LDCall.Function("wln" "") LDCall.Function("wln" " Starting from Venice in 1271 you travel by sailing ship to the") LDCall.Function("wln" "port of Armenia. Upon arrival, you prepare for a 6000-mile trek to") LDCall.Function("wln" "the court of the Great Kublai Khan in Shang-tu, Cathay. Having set") LDCall.Function("wln" "aside " +JL+ " precious jewels to finance your planned 3-year trip, you") LDCall.Function("wln" "must barter for the following supplies in Armenia:") LDCall.Function("wln" " * Camels (Sturdier animals will cost more. You will probably") LDCall.Function("wln" " want 8 to 10 camels to carry your many supplies.") LDCall.Function("wln" " * Food (You must barter for food as you travel along. However,") LDCall.Function("wln" " prices tend to be lower in port cities, so you should pack") LDCall.Function("wln" " in a good supply at the start.") LDCall.Function("wln" " * Oil for lamps and cooking (Over much of the trip, you will be") LDCall.Function("wln" " able to use wood to build fires. However, in the Persian,") LDCall.Function("wln" " Lop, and Gobi deserts you will need oil.)") LDCall.Function("wln" "") LDCall.Function("wln" " From Venice you have also packed clothing, weapons (crossbows),") LDCall.Function("wln" "and medicines (balms and unguents); however, your provisions will be") LDCall.Function("wln" "depleted as you go along and you must replenish them. The selection") LDCall.Function("wln" "and price of supplies is quite different in various regions, so you") LDCall.Function("wln" "must barter wisely. As a merchant, you are not skilled in fishing") LDCall.Function("wln" "or hunting, although occasionally you might be able to try to get") LDCall.Function("wln" "some food in this way.") Sub3720() GraphicsWindow .Clear() ctt=1 EndSub ' Sub Sub600 'Subroutine to initialize hunting skill level SArray[1] = "SPLAT" SArray[2] = "SPRONG" SArray[3] = "TWACK" SArray[4] = "ZUNK" FArray[1] = "wild boar" FArray[2] = "big stag" FArray[3] = "black bear" LDCall.Function("wln" "") LDCall.Function("wln" "Before you begin your journey, please rank your skill with") LDCall.Function("wln" "the crossbow on the following scale:") LDCall.Function("wln" " (1) Can hit a charging boar at 300 paces") LDCall.Function("wln" " (2) Can hit a deer at 50 paces") LDCall.Function("wln" " (3) Can hit a sleeping woodchuck at 5 paces") LDCall.Function("wln" " (4) Occasionally hit own foot when loading") LN680: ttx="How do you rank yourself? " HX = LDCall.Function("rddn" ttx) If HX > 0 AND HX < 5 Then LDCall.Function("wln" "") Goto LN719 EndIf LDCall.Function("wln" "Please enter 1, 2, 3, or 4") Goto LN680 LN719: EndSub ' Sub Sub720 'Subroutine to get initial supplies cpp=1 LDCall.Function("wln" " After three months at sea, you have arrived at the seaport of") LDCall.Function("wln" "Laiassus, Armenia. There are many merchants in the port city and") LDCall.Function("wln" "you can easily get the supplies you need. Several traders offer you") A1 = 17 A2 = 24 LDCall.Function("wln" "camels at prices between " +A1 +" and " +A2+ " jewels each.") ttx= "How much do you want to pay for a camel? " A = LDCall.Function("rddn" ttx ) BA = A LDCall.Function("wln" "You will need at least 7 camels, but not more than 12.") A1 = 7 A2 = 12 ttx= "How many camels do you want to buy? A = LDCall.Function("rddn" ttx) Sub3790() B = A JL = JL - BA * B A2 = 3 * B - 6 'Camels?number, cost, amount they can carry LDCall.Function("wln" " One large sack of food costs 2 jewels. You will need at least") LDCall.Function("wln" "8 sacks to get to Babylon (Baghdad); you can carry max sacks: "+ A2) A1 = 8 ttx= "How many sacks do you want? A = LDCall.Function("rddn" ttx) Sub3790() F = A JL = JL - A * 2 A2 = 3 * B - A 'Food & cost, amount of oil camels can carry LDCall.Function("wln" " A skin of oil costs 2 jewels each. You should have at least 6") LDCall.Function("wln" "full skins for cooking in the desert. Your camels can carry skins:" +A2) A1 = 5 ttx= "How many skins do you want? A = LDCall.Function("rddn" ttx) Sub3790() BL = B L = A JL = JL - 2 * L 'Oil-amount and cost EndSub ' Sub Sub910 'Subroutine to check for being out of jewels and clothes If JL > 15 Then Goto LN980 'Still have a few jewels? EndIf LDCall.Function("wln" "You have only "+ JL+ " jewels with which to barter." ) If B > 2 Then Goto LN950 EndIf LN940: LDCall.Function("wln" "You push on with your "+ B+ " camels.") Goto ln1019 LN950: txx="Would you like to sell a camel? AD = LDCall.Function("rdd" txx+" (Y/n)") getyn() If AD = "N" Then Goto LN940 EndIf RN = Math.Floor(8 + 9 * Math.GetRandomNumber(999)/1000) LDCall.Function("wln" "You get " +RN+ " jewels for your best camel.") JL = JL + RN B = B - 1 BL = BL - 1 'Add jewels, subtract camel LN980: If C > 0 Then Goto ln1019 'Have some clothes? EndIf LDCall.Function("wln" "You should try to replace that tent you have been wearing as a") LDCall.Function("wln" "robe. It is badly torn and the Tartars find it insulting.") LN1019: EndSub ' Sub Sub1020 'Subroutine to deal with sickness If PSK > 0 Then PSKT = PSKT + PSK PSK = 0 'Sickness total EndIf If PWD > 0 Then PWDT = PWDT + PWD PWD = 0 'Injuries total EndIf If FE = 3 Then PFD = PFD + .4 EndIf If PSKT + PWDT + PFD < 3 Then Goto ln1189 EndIf If Math.GetRandomNumber(999)/1000 > .7 Then Goto ln1189 '70% chance of delay due to recurring illness EndIf LDCall.Function("wln" "As a result of sickness, injuries, and poor eating, you must stop") LDCall.Function("wln" "and regain your health. You trade a few jewels to stay in a hut.") RN = Math.Floor(1 + 3.2 * Math.GetRandomNumber(999)/1000) If RN > 3 Then Goto LN1160 '6% chance of dying EndIf LDCall.Function("wln" "You grow steadily stronger, but it is " +RN * 2 +" months until you") LDCall.Function("wln" "are again fit to travel.") PSKT = 0 PWDT = 0 PFD = 0 J = J + RN M = Math.Floor(M / 2) F = F / 2 If F < 3 Then F = 3 EndIf If JL > 20 Then JL = JL - 10 ELSE JL = Math.Floor(JL / 2) 'Costs money for lodging EndIf pdate() Goto ln1189 LN1160: For I = 1 To 2500 endfor Goto ln1189 LDCall.Function("wln" "You stay for " +RN+ " months but grow") LDCall.Function("wln" "steadily weaker and finally pass away.") J = J + RN Sub3280() ln1189: EndSub ' Sub Sub1190 'Subroutine to barter for supplies cpp=1 LDCall.Function("wln" "You have jwls:" +JL) txx="Do you want to barter here? AD = LDCall.Function("rdd" txx+" (Y/n)") getyn() If AD = "N" Then Goto LN1380 EndIf RN = Math.Floor(17 + 8 * Math.GetRandomNumber(999)/1000) cpp=1 LDCall.Function("wln" "Camels cost "+ RN+ " jewels here. ") A1 = 0 A2 = Math.Floor(JL / RN) ttx="How many do you want? A = LDCall.Function("rddn" ttx) Sub3790() B = B + A BL = BL + A BA = BA - A 'Lower quality animals along route JL = JL - A * RN RN = Math.Floor(2 + 4 * Math.GetRandomNumber(999)/1000) cpp=1 LDCall.Function("wln" "Sacks of food cost " +RN+ " jewels. ") LN1260: A2 = (Math.Floor(JL / RN)) ttx="How many do you want? A = LDCall.Function("rddn" ttx) Sub3790() F = F + A If F + L > 3 * BL Then cpp=1 LDCall.Function("wln" "Camels can't carry that much.") F = F - A GOTO LN1260 EndIf JL = JL - A * RN RN = Math.Floor(2 + 4 * Math.GetRandomNumber(999)/1000) cpp=1 LDCall.Function("wln" "Skins of oil cost "+ RN+ " jewels. ") LN1290: A2 = (Math.Floor(JL / RN)) ttx="How many do you want? A = LDCall.Function("rddn" ttx) Sub3790() L = L + A If F + L > 3 * BL Then cpp=1 LDCall.Function("wln" "Camels can't carry that much.") L = L - A GOTO LN1290 EndIf JL = JL - A * RN RN = Math.Floor(8 + 8 * Math.GetRandomNumber(999)/1000) LDCall.Function("wln" "A set of clothes costs jwls:"+ RN) ttx="How many do you want? A = LDCall.Function("rddn" ttx) Sub3790() C = C + A JL = JL - A * RN cpp=1 LDCall.Function("wln" "You can get a bottle of balm for 2 jewels. ") A2 = JL / 2 ttx="How many do you want? A = LDCall.Function("rddn" ttx) Sub3790() JL = JL - 2 * A M = M + A A2 = JL RN = Math.Floor(6 + 6 * Math.GetRandomNumber(999)/1000) cpp=1 LDCall.Function("wln" "You can get " +RN+ " arrows for 1 jewel.") ttx= "How many jewels do you want to spend on arrows? A = LDCall.Function("rddn" ttx) Sub3790() JL = JL - A W = W + RN * A If C > 1 Then CZ = 0 EndIf LN1380: cpp=1 LDCall.Function("wln" "") LDCall.Function("wln" "Here is what you now have:") Sub3200() EndSub ' Sub Sub1400 'Subroutine to deal with no clothes cpp=1 LDCall.Function("wln" "") LDCall.Function("wln" "You were warned about getting more modest clothes.") LDCall.Function("wln" "Furthermore, your sandals are in shreds.") If CZ = 1 Then Goto LN1470 EndIf cpp=1 LDCall.Function("wrt" "The Tartars chase you from town and ") If Math.GetRandomNumber(999)/1000 > .2 Then LDCall.Function("wln" "warn you not to return.") CZ = 1 Goto ln1499 EndIf LN1450: LDCall.Function("wln" "stone you.") LDCall.Function("wrt" "You are badly wounded and vow to get") LDCall.Function("wln" "new clothes as soon as possible.") PWD = 1.5 CZ = 1 Goto ln1499 LN1470: LDCall.Function("wln" "Word has been received about your disreputable appearance.") LDCall.Function("wrt" "The people are not willing to deal with you and they ") Goto LN1450 ln1499: Endsub ' Sub Sub1500 'Subroutine to eat If F < 3 Then Goto LN1650 'Out of food? EndIf LN1520: cpp=1 LDCall.Function("wln" "On the next stage of your journey, how do you want to eat:") LDCall.Function("wln" " (1) Reasonably well (can walk further; Less chance of sickness)") LN1540: LDCall.Function("wln" " (2) Adequately, or (3) Poorly? ") A =LDCall.Function("rddn" "Answer 1, 2 or 3 please ...") If A > 0 AND A < 4 Then Goto LN1560 EndIf LDCall.Function("wln" "That's not a choice. Now then, (1) Well, ") Goto LN1540 LN1560: FE = 6 - A If FE <= F Then Goto LN1580 EndIf LDCall.Function("wln" "You don't have enough food to eat that well. Try again.") Goto LN1520 LN1580: FR = Math.Floor(.5 + 10 * (F - FE)) / 10 If FR > 3 Then Goto LN1630 EndIf If FR = 1 Then XD = "" ELSE XD = "s" EndIf cpp=1 LDCall.Function("wln" "Your food reserve will then be just " +FR+ " sack"+ XD) If A = 3 Then Goto LN1630 EndIf txx= "Do you want to change your mind about how much you will eat? AD = LDCall.Function("rdd" txx+" (Y/n)") getyn() If AD = "Y" Then Goto LN1520 EndIf LN1630: F = F - FE D = D - (A - 1) * 50 FQ = FP + FE FP = FE Goto LN1779 ' LN1650: 'Out of food section cpp=1 LDCall.Function("wln" "You don't have enough food to go on.") If JL < 15 Then Goto LN1730 EndIf LDCall.Function("wln" "You should have bought food at the market. Now it will cost you") RN = Math.Floor(5 + 4 * Math.GetRandomNumber(999)/1000) LDCall.Function("wrt" RN +" jewels per sack. ") A1 = 1 A2 = (Math.Floor(JL / RN)) txx= " How many sacks do you want? A = LDCall.Function("rddn" txx) Sub3790() F = F + A JL = JL - A * RN If F >= 3 Then Goto ln1779 EndIf cpp=1 LDCall.Function("wln" "You still don't have enough food and there is nothing to hunt.") LN1730: If B < 1 Then Goto LN1760 ELSE cpp=1 txx="Do you want to eat a camel? " AD = LDCall.Function("rdd" txx+" (Y/n)") EndIf getyn() If AD = "N" Then Sub3280() ELSE B = B - 1 RN = Math.Floor(3 + 2 * Math.GetRandomNumber(999)/1000) F = F + RN EndIf cpp=1 LDCall.Function("wln" "You manage to get about " +RN+ " sacks of food out of it.") Goto ln1520 LN1760: LDCall.Function("wln" "You don't even have a camel left to eat.") Sub3280() ' game over ln1779: Endsub ' Sub Sub1780 'Subroutine for desert sections DZ = 0 If DT < 2100 OR DT > 5900 Then Goto ln1919 'No desert at far ends EndIf If DT > 2600 AND DT < 4100 Then Goto ln1919 'Tigris River Valley EndIf If DT > 4600 AND DT < 5400 Then Goto ln1919 'No desert in middle EndIf If DT < 4100 Then XD = "Dasht-e-Kavir (Persian)" GOTO LN1840 EndIf If DT > 5399 Then XD = "Gobi (Cathay)" ELSE XD = "Taklimakan (Lop)" EndIf LN1840: LDCall.Function("wln" "You are in the " +XD+ " desert.") If L >= 3 Then L = L - 3 LDCall.Function("wln" "Use 3 skins of oil for cooking.") GOTO ln1900 EndIf LDCall.Function("wln" "You ran out of oil for cooking.") If L > 1 Then IF Math.GetRandomNumber(999)/1000 > .5 THEN L = 0 GOTO ln1900 endif EndIf LDCall.Function("wln" "You get horribly sick from eating raw and undercooked food.") L = 0 PSK = 1 D = D - 80 M = M - 1 LN1900: JJJ= Math.Floor(1 + 7 * Math.GetRandomNumber(999)/1000) If (JJJ = 1) Then Sub2250() ElseIf (JJJ = 2) Then Sub2310() ElseIf (JJJ = 3) Then Sub2420() ElseIf (JJJ = 4) Then Sub2450() ElseIf (JJJ = 5) Then Sub2480() ElseIf (JJJ = 6) Then Sub2510() ElseIf (JJJ = 7) Then Sub1920() EndIf LN1910: DZ = 1 Sub3110() ln1919: EndSub Sub Sub1920 LDCall.Function("wln" "You get through this stretch of desert without mishap!") DZ = 1 Sub3110() EndSub ' Sub Sub1940 'Subroutine to deal with special events RN = Math.Floor(EPT * Math.GetRandomNumber(999)/1000) For I = 1 To 14 'Iterate thru possible events If RN <= EPArray[i] then Goto LN1941 endif endfor i=14 ln1941: If I > 10 Then Goto LN1990 EndIf If (I = 1) Then Sub2000() ElseIf (I = 2) Then Sub2250() ElseIf (I = 3) Then Sub2310() ElseIf (I = 4) Then Sub2340() ElseIf (I = 5) Then Sub2360() ElseIf (I = 6) Then Sub2380() ElseIf (I = 7) Then Sub2400() ElseIf (I = 8) Then Sub2420() ElseIf (I = 9) Then Sub2450() ElseIf (I = 10) Then Sub2480() EndIf LN1990: If (I - 10 = 1) Then Sub2540() ElseIf (I - 10 = 2) Then Sub2570() ElseIf (I - 10 = 3) Then Sub2600() ElseIf (I - 10 = 4) Then Sub2660() EndIf EndSub Sub Sub2000 cpp=1 LDCall.Function("wln" "A camel injures its leg. Do you want to (1) Nurse it along or") LN2010: LDCall.Function("wln" "(2) Abandon it, or (3) Sell it? ") A = LDCall.Function("rddn" "1 / 2 / 3 ?") If A = 1 Then Goto LN2040 ElseIf A = 2 THEN goto ln2050 ElseIf A = 3 THEN goto ln2090 EndIf cpp=1 LDCall.Function("wln" "That is not a choice. Answer (1) to Nurse it along, ") Goto LN2010 LN2040: BSK = J + 2 Sub2120() Goto ln2121 LN2050: B = B - 1 sub2120() FC = 3 * BL - F - L If FC <= 0 Then Goto ln2121 EndIf LDCall.Function("wln" "You kill the camel for food.") If FC > 2 Then FC = 3 EndIf F = F + FC If FC = 1 Then XD = "" ELSE XD = "s" EndIf LDCall.Function("wln" "You get the equivalent of " +FC+ " sack"+ XD+ " of food.") Goto ln2121 LN2090: B = B - 1 LDCall.Function("wln" "It is a poor beast and you can get only 10 jewels for it.") JL = JL + 10 Sub2120() LN2121: EndSub ' Sub Sub2120 'Exceed load carrying capacity of camels? BL = B If BSK <= J Then BL = B - .6 BA = BA - 1 'If sick camel reduce load, speed EndIf If F + L <= 3 * BL Then Goto ln2249 EndIf LDCall.Function("wln" "You have too large a load for your camels.") FC = Math.Floor(F + L - 3 * BL + .9) LN2160: If FC = 1 Then XD = "" ELSE XD = "s" EndIf LDCall.Function("wln" "You'll have to sell " +FC+ " sack"+ XD +" of food or skin"+ XD+ " of oil.") FS = Math.Floor(FC / 2) LS = FC - FS 'How much to sell of food and oil LN2190: If LS > L Then LS = LS - 1 FS = FS + 1 GOTO ln2190 EndIf LN2200: If FS > F Then FS = FS - 1 LS = LS + 1 GOTO ln2200 EndIf F = F - FS L = L - LS JL = JL + FS + LS 'Decrease food and oil, add jewels cpp=1 LDCall.Function("wrt" "You sell " +FS+ " of food, " +LS+ " of oil for which you get only") LDCall.Function("wln" (FS + LS)+ " jewel" +XD+ ".") LN2249: EndSub ' Sub Sub2250 cpp=1 LDCall.Function("wln" "One of your camels is very sick and can't carry a full load.") LN2260: LDCall.Function("wln" "Want to (1) Keep it with you, (2) Slaughter it, or (3) Sell it? ") A = LDCall.Function("rddn" "1 / 2 / 3 ?") If A = 1 Then Goto LN2290 ELSEIF A = 2 THEN 'taken from ln2050 above - can't call line from subroutine B = B - 1 sub2120() FC = 3 * BL - F - L If FC <= 0 Then Goto ln2309 EndIf LDCall.Function("wln" "You kill the camel for food.") If FC > 2 Then FC = 3 EndIf F = F + FC If FC = 1 Then XD = "" ELSE XD = "s" EndIf LDCall.Function("wln" "You get the equivalent of " +FC+ " sack"+ XD+ " of food.") Goto ln2309 B = B - 1 LDCall.Function("wln" "It is a poor beast and you can get only 10 jewels for it.") JL = JL + 10 Sub2120() Goto ln2309 ELSEIF A = 3 THEN B = B - 1 LDCall.Function("wln" "It is a poor beast and you can get only 10 jewels for it.") JL = JL + 10 Sub2120() Goto ln2309 EndIf cpp=1 LDCall.Function("wln" "That is not a choice. Again, please.") Goto LN2260 LN2290: BSK = J + 2 Sub2120() LN2309: EndSub ' Sub Sub2310 cpp=1 LDCall.Function("wln" "Long stretch with bad water. Costs time to find clean wells.") D = D - 50 EndSub Sub Sub2340 cpp=1 LDCall.Function("wln" "You get lost trying to find an easier route.") D = D - 100 EndSub Sub Sub2360 cpp=1 LDCall.Function("wln" "Heavy rains completely wash away the route.") D = D - 90 EndSub ' Sub Sub2380 cpp=1 LDCall.Function("wln" "Some of your food rots in the humid weather.") F = F - 1 EndSub ' Sub Sub2400 cpp=1 LDCall.Function("wln" "Marauding animals got into your food supply.") F = F - 1 EndSub ' Sub Sub2420 cpp=1 LDCall.Function("wln" "A fire flares up and destroys some of your food and clothes.") F = F - .4 C = C - 1 Sub3110() If L < 1 Then Goto ln2421 ELSE L = L - .5 Goto LN2421 EndIf LN2421: EndSub ' Sub Sub2450 cpp=1 LDCall.Function("wln" "Two camels wander off. You finally find them after spending") LDCall.Function("wln" "several days searching for them.") D = D - 20 EndSub ' Sub Sub2480 cpp=1 LDCall.Function("wln" "You get a nasty burn from an oil fire.") PWD = .5 Sub2840() EndSub ' Sub Sub2510 cpp=1 LDCall.Function("wln" "High winds, sand storms, and ferocious heat slow you down.") D = D - 70 EndSub ' Sub Sub2540 cpp=1 LDCall.Function("wln" "A gash in your leg looks infected. It hurts like the blazes.") Sub2840() D = D - 50 PWD = .7 EndSub ' Sub Sub2570 cpp=1 LDCall.Function("wln" "Jagged rocks tear your sandals and clothing. You'll have to get") LDCall.Function("wln" "replacements as soon as you can.") C = C - 1 D = D - 30 EndSub ' Sub Sub2600 RN = Math.GetRandomNumber(999)/1000 * FQ If RN < 2 Then Goto LN2610 ELSE IF RN < 3.5 THEN Sub2630() ELSE Goto ln2629 endif endif LN2610: LDCall.Function("wln" "All of you have horrible stomach cramps and intestinal disorders") LDCall.Function("wln" "and are laid up for over a month.") D = D - 275 LN2629: EndSub Sub Sub2630 LDCall.Function("wln" "You're running a high fever and your muscles feel like jelly.") LDCall.Function("wln" "Your party slows down for you.") PSK = .7 D = D - 125 EndSub ' Sub Sub2660 LDCall.Function("wln" "Blood-thirsty bandits are attacking your small caravan!") LDCall.Function("wln" "You grab your crossbow... ") Sub3620() If W > 5 Then Goto LN2700 ELSE LDCall.Function("wln" "You try to drive them off, but you run out") EndIf LDCall.Function("wln" "of arrows. They grab some jewels and food.") F = F - 1 Goto LN2720 LN2700: If SR <= 1 Then Goto LN2810 ELSE IF SR <= 3 THEN goto LN2780 EndIf EndIf LDCall.Function("wln" "Better stick to trading; your aim is terrible.") LN2720: If Math.GetRandomNumber(999)/1000 > .8 Then Goto LN2750 '80% chance of surviving attack EndIf LDCall.Function("wln" "They are savage, evil barbarians ? they kill you and take") LDCall.Function("wln" "your remaining camels and jewels.") JL = 0 B = 0 Goto LN3320 LN2750: LDCall.Function("wln" "You caught a knife in the shoulder. That's going to take quite") LDCall.Function("wln" "a while to heal.") Sub2840() PWD = 1.5 JL = JL - 10 W = W - 4 - 2 * SR Sub3110() Goto LN2828 LN2780: LDCall.Function("wln" "With practice you could shoot the crossbow, but most of your shots") LDCall.Function("wln" "missed. An iron mace got you in the chest. They took some jewels.") PWD = 1 JL = JL - 5 Sub2840() W = W - 3 - 2 * SR Sub3110() Goto LN2828 LN2810: LDCall.Function("wln" "Wow! Sensational shooting. You drove them off with no losses.") W = W - 4 LN2828: EndSub ' Sub Sub2840 'Subroutine to deal with using balm RN = Math.Floor(1 + 2 * Math.GetRandomNumber(999)/1000) If RN > 1 Then XD = "s" ELSE XD = "" EndIf If Math.GetRandomNumber(999)/1000 > .5 Then XAD = "balm" ELSE XAD = "unguent" EndIf M = M - RN If M < 0 Then M = 0 GOTO LN2890 EndIf LDCall.Function("wln" "You use "+ RN+ " bottle"+ XD +" of "+ XAD +" treating your wound.") Goto LN3019 LN2890: LDCall.Function("wln" "You need more " +XAD+ " to treat your wound." ) If JL < 8 Then Goto LN2940 EndIf LDCall.Function("wln" "Fortunately, you find some nomads who offer to sell you 2 bottles") LDCall.Function("wln" "of "+ XAD +" for the outrageous price of 4 jewels each.") txx= "Do you want to buy it? AD = LDCall.Function("rdd" txx+" (Y/n)") getyn() If AD = "N" Then Goto LN2950 EndIf LDCall.Function("wln" "It works well and you're soon feeling better.") M = 0 JL = JL - 8 Goto ln3019 LN2940: LDCall.Function("wln" "But, alas, you don't have enough jewels to buy any.") LN2950: LDCall.Function("wln" "Your wound is badly infected, ") If Math.GetRandomNumber(999)/1000 < .8 Then Goto LN3000 EndIf LDCall.Function("wln" "but you keep going anyway.") LDCall.Function("wln" "") LDCall.Function("wln" "Unfortunately, the strain is too much for you and, after weeks of") LDCall.Function("wln" "agony, you succumb to your wounds and die in the wilderness.") Goto LN3320 LN3000: LDCall.Function("wln" "but you push on for the next village.") PWD = 3 ln3019: EndSub ' Sub Sub3020 'Subroutine to hunt for food If W < 15 Then LDCall.Function("wln" "You don't have enough arrows to hunt for food." ) Goto LN3009 EndIf LDCall.Function("wln" "There goes a " +FArray[Math.Floor(1 + 3 * Math.GetRandomNumber(999)/1000)] + "_ ") W = W - 15 Sub3620() If SR <= 1 Then Goto LN3080 ELSE IF SR <= 3 THEN Goto LN3070 EndIf EndIf LDCall.Function("wln" "Were you too excited? All your shots went wild.") Goto LN3009 LN3070: LDCall.Function("wln" "Not bad; you finally brought one down.") FA = 2 Goto LN3090 LN3080: LDCall.Function("wln" "With shooting that good, the Khan will want you in his army.") FA = 3 LN3090: LDCall.Function("wln" "Your hunting yields "+FA +" sacks of food.") F = F + FA LN3009: EndSub ' Sub Sub3110 'Subroutine to check for zero quantities If JL < 0 Then JL = 0 'Can't have negative jewels EndIf If F < 0 Then F = 0 'or food EndIf If L < 0 Then L = 0 'or oil EndIf If C < 0 Then C = 0 'or clothing EndIf If M < 0 Then M = 0 'or medicine EndIf If W < 0 Then W = 0 'or arrows EndIf EndSub ' Sub Sub3200 'Subroutine to LDCall.Function("wln" inventory LDCall.Function("wln" "Jewel Camel Balms and") LDCall.Function("wln" "Sacks Skins Food Oil Clothes Unguents Arrows") Sub3110() cpp= 1 LDCall.Function("wrt" JL) cpp= 7 LDCall.Function("wrt" B) cpp= 12 LDCall.Function("wrt" F) cpp= 17 LDCall.Function("wrt" L) cpp= 25 LDCall.Function("wrt" C) cpp= 33 LDCall.Function("wrt" M) cpp= 42 LDCall.Function("wrt" W) LDCall.Function("wln" "") LDCall.Function("wln" "") EndSub ' Sub Sub3280 'End game - out of food LDCall.Function("wln" "You keep going as long as you can, trying to find berries and") LDCall.Function("wln" "edible plants. But this is barren country and you fall ill and,") LDCall.Function("wln" "after weeks of suffering, you collapse into eternal sleep.") LN3320: LDCall.Function("wln" "") J = J + 1 pdate() LDCall.Function("wln" "You had the following left at the end:") Sub3200() LDCall.Function("wln" "You traveled for "+ J * 2+ " months!") LDCall.Function("wln" "") LDCall.Function("wln" "Sorry, you didn't make it to Shang-tu.") Goto LN3490 ' LN3360: 'End of trip section Sub3110() 'Can't have negative jewels at end For I = 1 To 3000 EndFor GraphicsWindow .Clear() cpp= 1 ctt=1 For I = 1 To 10 XD = "CONGRATULATIONS !" ctt = 12 Sub3760() Program.Delay(100) GraphicsWindow .Clear() ctt=1 Program.Delay(50) EndFor GraphicsWindow .Clear() ctt=1 LDCall.Function("wln" "You have been traveling for " +J * 2 +" months !") LDCall.Function("wln" "") LDCall.Function("wln" "You are ushered into the court of the Great Kublai Khan.") LDCall.Function("wln" "He surveys your meager remaining supplies:") Sub3200() LDCall.Function("wln" "... and marvels that you got here at all. He is disappointed") LDCall.Function("wln" "that the Pope did not see fit to send the 100 men of learning") LDCall.Function("wln" "that he requested and, as a result, keeps the three of you as") LDCall.Function("wln" "his personal envoys for the next 21 years. Well done!") LDCall.Function("wln" "") ' LN3490: LDCall.Function("wln" "") ttx= "Press Enter to End" AD = LDCall.Function("rdd" ttx) Program.End() endsub ' Sub pdate 'Subroutine to print MO = J While MO>6 MO = MO - 6 EndWhile YR = 1271 + Math.Floor(J / 6) LDCall.Function("wln" "") GraphicsWindow .Clear() ctt=1 cpp= 1 LDCall.Function("wln" "Date: " + MOD[mo] +" "+ YR ) LDCall.Function("wln" "=================") EndSub ' Sub Sub3560 'Subroutine to read event probabilities EPArray[1] =6 EPArray[2] =10 EPArray[3] =14 EPArray[4] =20 EPArray[5] =26 EPArray[6] =32 EPArray[7] =38 EPArray[8] =42 EPArray[9] =46 EPArray[10] =47 EPArray[11] =53 EPArray[12] =61 EPArray[13] =79 EPArray[14] =89 EPT = EPArray[14] MOD[1] = "March" MOD[2] = "May" MOD[3] = "July" MOD[4] = "September" MOD[5] = "November" MOD[6] = "January" EndSub ' Sub Sub3620 'Subroutine to shoot crossbow RN = 1 + Math.Floor(4 * Math.GetRandomNumber(999)/1000) 'print random shooting word 's1 is seconds S1 = 60 * Clock.Minute + Clock.Second 'Start timer LN3650: LDCall.Function("wrt" "Type : " +SArray[RN] +" ") XD = LDCall.Function("rdd" "?") If XD = SArray[RN] Then Goto LN3680 EndIf For I = 1 To Text.GetLength(XD) 'Iterate through letters for possible lowercase If Text.getsubtext(SArray[RN], I, 1)<>Text.GetCharacter(Text.GetCharacterCode(Text.GetSubText(XD, I, 1)) - 32) Then Goto LN3700 EndIf endFor LN3680: S2 = 60 * Clock.Minute + Clock.Second 'End timer SR = S2 - S1 - HX Goto LN3719 'Shooting response LN3700: cpp=1 LDCall.Function("wln" "That's not it. Try again. ") Goto LN3650 ln3719: EndSub ' Sub Sub3720 'Subroutine to hit enter key XD = "Press any Enter to continue." LDCall.Function("rdd" xd) RN = RN + 1 EndSub Sub rdd return= FCDialogs.AskForTextLine (args[1]) EndSub Sub rddn return= FCDialogs.AskForTextLine (args[1]) EndSub Sub wln gx=cpp*10 gy= ctt*20 ctt=ctt+1 GraphicsWindow.DrawBoundText (gx gy gw-gx args[1]) EndSub Sub wrt gx=cpp*10 gy= ctt*20 cpp=cpp+ Text.GetLength (args[1]) GraphicsWindow.DrawText (gx gy args[1]) EndSub Sub Sub3760 'Subroutine to LDCall.Function("wln" a centered line cpp= (35 - Text.GetLength(XD)/2) LDCall.Function("wln" XD) EndSub ' Sub Sub3790 'Subroutine to check if answer entered is in range LN3800: If A >= A1 AND A <= A2 Then Goto LN3839 EndIf If A < A1 Then XD = "few" ELSE XD = "many" EndIf cpp=1 LDCall.Function("wrt" "That is too " +XD) LDCall.Function("wln" " Your answer please? ") A = LDCall.Function("rddn" ttx ) Goto LN3800 LN3839: EndSub ' Sub getyn 'Subroutine to process a yes/no answer stt: ad=text.ConvertToUpperCase (text.GetSubText (ad 1 1)) If AD = "Y" OR AD = "N" Then Goto xxx EndIf AD = LDCall.Function("rdd" "Don't understand answer. Enter Y/N please... ") Goto stt xxx: EndSub End>BHV039.sb< Start>BHV757.sb< 'Krueg -- Gun Slinger -- 2012 ' Use your mouse to aim ' Left click to fire ' Right click to reload GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.Top = 5 GraphicsWindow.Left = 5 GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "White" 'path = "file://C:/Users/krueg/Documents/SmallBasic/MyProjects/GunSlinger/" path = "http://www.krueg.com/sb/" storeback = ImageList.LoadImage(path + "storeback.png") back = Shapes.AddImage(storeback) bgil[1] = ImageList.LoadImage(path + "elvis.png") bgi[1] = Shapes.AddImage(bgil[1]) Shapes.Move(bgi[1],810,610) bgw[1] = 62 'Bad guy width bgh[1] = 147 'Bad guy height bgwa[1] = 80 'Bad guy waist bgkx1[1] = 5 'Bad guy kill zone left bgkx2[1] = 40 'Bad guy kill zone right bgky1[1] = 0 'Bad guy kill zone top bgky2[1] = 75 'Bad guy kill zone bottom bgil[2] = ImageList.LoadImage(path + "jcash.png") bgi[2] = Shapes.AddImage(bgil[2]) Shapes.Move(bgi[2],810,610) bgw[2] = 56 bgh[2] = 60 bgwa[2] = 60 bgkx1[2] = 5 bgkx2[2] = 55 bgky1[2] = 0 bgky2[2] = 55 bgil[3] = ImageList.LoadImage(path + "andy.png") bgi[3] = Shapes.AddImage(bgil[3]) Shapes.Move(bgi[3],810,610) bgw[3] = 150 bgh[3] = 150 bgwa[3] = 70 bgkx1[3] = 40 bgkx2[3] = 95 bgky1[3] = 0 bgky2[3] = 75 bgil[4] = ImageList.LoadImage(path + "paco.png") bgi[4] = Shapes.AddImage(bgil[4]) Shapes.Move(bgi[4],810,610) bgw[4] = 73 bgh[4] = 100 bgwa[4] = 80 bgkx1[4] = 5 bgkx2[4] = 50 bgky1[4] = 5 bgky2[4] = 85 bgil[5] = ImageList.LoadImage(path + "randy.png") bgi[5] = Shapes.AddImage(bgil[5]) Shapes.Move(bgi[5],810,610) bgw[5] = 43 bgh[5] = 80 bgwa[5] = 80 bgkx1[5] = 5 bgkx2[5] = 30 bgky1[5] = 0 bgky2[5] = 75 storefront = ImageList.LoadImage(path + "storefront.png") store = Shapes.AddImage(storefront) bullethole = ImageList.LoadImage(path + "hole.png") hole = Shapes.AddImage(bullethole) Shapes.Move(hole,810,610) killhole = ImageList.LoadImage(path + "killshot.png") killshot = Shapes.AddImage(killhole) Shapes.Move(killshot,810,610) round = ImageList.LoadImage(path + "bullet1.png") gunradius = Shapes.AddEllipse(100,100) Shapes.SetOpacity(gunradius,80) Shapes.Move(gunradius,357,510) bulletbox = Shapes.AddRectangle(100,40) Shapes.SetOpacity(bulletbox,80) Shapes.Move(bulletbox,230,550) 'Box showing your bullets left pistol = ImageList.LoadImage(path + "pistol.png") gun = Shapes.AddImage(pistol) crosshair = ImageList.LoadImage(path + "crosshair.png") cross = Shapes.AddImage(crosshair) Begin: bgs = .014 'Bad guy speed bgp = 150 'Bad guy pause bspd = 100 'Bullet delay bc = 6 'Bullet count gx = 400 'Gun X-position gy = 520 'Gun Y-position Mouse.HideCursor() Mouse.MouseX = 400 'Start mouse here Mouse.MouseY = 100 target() 'Draw target reload() 'Load bullets GraphicsWindow.MouseMove = target GraphicsWindow.MouseDown = OnMouseClick score = 0 alive = 3 'Player is alive bgd = "over setbadguy() debug = "o n" If debug = "on" Then debug1() EndIf While alive > 0 'Main Game Loop If debug = "on" Then debug2() EndIf movebadguy() If balive > 20 Then 'Show bullet when alive bullet() EndIf If balive > 0 And balive < 20 Then 'Show bullet hole hit hit() EndIf If holealive > 1 Then holepause() EndIf If killshotlife > 1 Then killshotpause() EndIf GraphicsWindow.Title = "Gun Slinger -- Score - " + score + " Misses Left - " + alive + " Krueg 2012" EndWhile GraphicsWindow.MouseMove = disable GraphicsWindow.MouseDown = disable Mouse.ShowCursor() GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "Black" replay = Controls.AddButton("Play Again",500,550) Controls.SetSize(replay,95,30) shutdown = Controls.AddButton("Quit",600,550) Controls.SetSize(shutdown,95,30) Controls.ButtonClicked = OnButtonPress wait: If game = "shutdown" Then Program.End() EndIf If game = "replay" Then Controls.Remove(replay) Controls.Remove(shutdown) Controls.ButtonClicked = disable game = "" Goto Begin EndIf Goto wait Sub disable 'Disable mouse contol to rocket EndSub Sub OnButtonPress If Controls.LastClickedButton = replay Then game = "replay" EndIf If Controls.LastClickedButton = shutdown Then game = "shutdown" EndIf EndSub Sub setbadguy bg = Math.GetRandomNumber(5) 'Pick random bad guy bgl = Math.GetRandomNumber(9) 'Pick random bad guy location bgs = bgs + .0001 'Increase bad guy speed EndSub Sub movebadguy If bgl = 1 Then 'Bad guy location #1 If bgd = "over" Then bgx = 20 'Bad guy X Position bgy = 86 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 86 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 86 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then bgy = bgy + bgs bgz = bgz - .0005 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 86 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #1 If bgl = 2 Then 'Bad guy location #2 If bgd = "over" Then bgx = 150 'Bad guy X Position bgy = 86 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 86 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 86 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 86 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #2 If bgl = 3 Then 'Bad guy location #3 If bgd = "over" Then bgx = 250 'Bad guy X Position bgy = 86 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 86 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 86 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 86 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #3 If bgl = 4 Then 'Bad guy location #4 If bgd = "over" Then bgx = 65 - bgw[bg]/2 'Bad guy X Position bgy = 480 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 480 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 480 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 480 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #4 If bgl = 5 Then 'Bad guy location #5 If bgd = "over" Then bgx = 122 - bgw[bg]/2 'Bad guy X Position bgy = 480 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 480 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 480 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 480 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #5 If bgl = 6 Then 'Bad guy location #6 If bgd = "over" Then bgx = 205 - bgw[bg]/2 'Bad guy X Position bgy = 490 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 490 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 490 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 490 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #6 If bgl = 7 Then 'Bad guy location #7 If bgd = "over" Then bgx = 265 - bgw[bg]/2 'Bad guy X Position bgy = 495 'Bad guy start Y position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgy = bgy - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy < 495 - bgwa[bg] Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgy = bgy + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgy > 495 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 495 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #7 If bgl = 8 Then 'Bad guy location #8 If bg = 3 Then 'Don't show this bad guy setbadguy() Goto jump EndIf If bgd = "over" Then bgy = 525 - bgwa[bg] 'Bad guy start Y position bgx = 370 - bgw[bg]/2 'Bad guy X Position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgx = bgx + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgx > 440 Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgx = bgx + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgx > 520 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 525 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #8 If bgl = 9 Then 'Bad guy location #9 If bg = 3 Then 'Dont show this bad guy setbadguy() Goto jump EndIf If bgd = "over" Then bgy = 520 - bgwa[bg] 'Bad guy start Y position bgx = 570 - bgw[bg]/2 'Bad guy X Position bgd = "up" EndIf If bgd = "up" Then 'Bad guy up bgx = bgx + bgs Shapes.Move(bgi[bg],bgx,bgy) If bgx > 650 Then bgd = "pause" bgwait = 0 EndIf EndIf If bgd = "pause" Then 'Bad guy pause bgwait = bgwait + bgs If bgwait > bgp Then bgd = "down" EndIf EndIf If bgd = "down" Then 'Bad guy down bgx = bgx - bgs Shapes.Move(bgi[bg],bgx,bgy) If bgx < 570 Then bgd = "over" Shapes.Move(bgi[bg],810,610) alive = alive - 1 setbadguy() EndIf EndIf If bgd = "fall" Then 'Bad guy fall bgy = bgy + bgs bgz = bgz - .001 Shapes.Zoom(bgi[bg],bgz,bgz) Shapes.Move(bgi[bg],bgx,bgy) If bgy > 520 Then bgd = "over" Shapes.Move(bgi[bg],810,610) Shapes.Zoom(bgi[bg],1,1) bgz = 1 setbadguy() EndIf EndIf EndIf 'End location #9 jump: EndSub Sub target tx = GraphicsWindow.MouseX 'Target X-position ty = GraphicsWindow.MouseY 'Target Y-position If ty > 500 Then 'Keep target above the gun ty = 500 EndIf Shapes.Move(cross,tx-16,ty-16) 'Draw crosshairs ga = Math.GetDegrees(Math.ArcTan((gx+4-tx)/(gy+28-ty))) Shapes.Rotate(gun,-ga) 'Rotate gun to crosshairs Shapes.Move(gun,gx,gy) 'Draw gun EndSub Sub OnMouseClick If Mouse.IsLeftButtonDown Then fire() ElseIf Mouse.IsRightButtonDown Then reload() EndIf EndSub Sub fire If bc = 0 Then 'Out of bullets? Goto skip EndIf Shapes.Remove(shell) shell = Shapes.AddImage(round) ftx = tx - 3 'Bullet's destination fty = ty - 13 fdist = Math.SquareRoot((gx+4-ftx)*(gx+4-ftx)+(gy+28-fty)*(gy+28-fty)) fdistratio = fdist / bspd bangle = ga fxs = (gx + 4 - ftx)/fdist 'Amount bullet will move fys = (gy + 28 - fty)/fdist balive = fdist-60 Shapes.Remove(br[bc]) bc=bc-1 skip: EndSub Sub bullet balive = balive - fdistratio 'Move bullet to next position Shapes.Rotate(shell,-bangle) Shapes.Move(shell,ftx+fxs*balive,fty+fys*balive) EndSub Sub hit balive=0 Shapes.Remove(shell) 'Remove the bullet If ftx-4 > bgx+bgkx1[bg] And ftx-4 < bgx+bgkx2[bg] And fty+6 > bgy+bgky1[bg] And fty+6 < bgy+bgky2[bg] Then Shapes.Move(killshot,ftx-4,fty+6) 'Draw red bullet hole bgd = "fall" killshotlife = 500 score = score + 10 Else Shapes.Move(hole,ftx-4,fty+6) 'Draw the bullet hole holealive = 2000 EndIf EndSub Sub holepause holealive = holealive - 1 If holealive < 2 Then Shapes.Move(hole,810,610) EndIf EndSub Sub killshotpause killshotlife = killshotlife - 1 If killshotlife < 2 Then Shapes.Move(killshot,810,610) EndIf EndSub Sub reload For bc = 1 To 6 'Bullet count Shapes.Remove(br[bc]) 'Remove old before adding new br[bc] = Shapes.AddImage(path + "bullet1.png") Shapes.Rotate(br[bc],15) Shapes.Move(br[bc],225+bc*15,555) EndFor bc = 6 EndSub Sub debug1 TextWindow.Top = 5 TextWindow.Left = 820 TextWindow.BackgroundColor = "Black" EndSub Sub debug2 TextWindow.Clear() TextWindow.WriteLine("Target X = " + tx + " ftx = " + ftx) TextWindow.WriteLine("Target Y = " + ty + " fty = " + fty) TextWindow.WriteLine("bc = " + bc + " fdistratio = " + fdistratio) TextWindow.WriteLine("") TextWindow.WriteLine("bg = " + bg + " bgx = " + bgx) TextWindow.WriteLine("bgd = " + bgd + " bgy = " + bgy) TextWindow.WriteLine("bgl = " + bgl + " bgw[bg] = " + bgw[bg]) TextWindow.WriteLine("") EndSub End>BHV757.sb< Start>BJC282.sb< 'rotating emeraud ' program no: HSV355-0 ' PROGRAM no: GraphicsWindow.Width=800 GraphicsWindow.Height =700 GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.Title ="emeraud" view3D = LD3DView.AddView(800,700,"false") GraphicsWindow.BackgroundColor ="black" rubis=GraphicsWindow.GetColorFromRGB(255,100,255) emeraud=GraphicsWindow.GetColorFromRGB(0,200,255) glass=GraphicsWindow.GetColorFromRGB(0,155,155) 'LD3DView.AddAmbientLight (view3D, emeraud) LD3DView.AddDirectionalLight(view3D,rubis,-45,-80,-100) 'ld3dview.AddSpotLight(view3d,glass,45,15,85,45,15,85,5,510) icc=ld3dview.AddIcosahedron(view3D, 2 , "#99C5F1F9", "E") LD3DView.AutoControl ("true" "true" ,-1 .3) While "true i=i+1 LD3DView.RotateGeometry2 (view3D,icc, 2, 4, 8 ,i) Program.Delay(20) endwhile End>BJC282.sb< Start>BJD645.sb< ' Challenge of the month October 2013 flat-directory viewer by NaochanON GraphicsWindow.MouseMove=Onmousemove GraphicsWindow.MouseDown=Onmousedown AtoZ_Directory() Sub onmousedown MX= GraphicsWindow.MouseX MY= GraphicsWindow.MouseY If 25"+CRLF+" ") DirListUp() FileListUp() EndSub Sub onmousemove MY=GraphicsWindow.MouseY MX=GraphicsWindow.MouseX If 25") Shapes.Move(SubDirGlst[i],85,50+25*(i-1)) GraphicsWindow.BrushColor="Red" SubDirRlst[i]=Shapes.AddText("<"+text.GetSubTextToEnd(Subdir[i],Len+1)+">") Shapes.Move(SubDirRlst[i],85,50+25*(i-1)) Shapes.SetOpacity(SubDirRlst[i],0) EndFor EndSub Sub FileListUp ' The following line could be harmful and has been automatically commented. ' FLST= File.GetFiles(PGD) AllFiles="" For j=1 To Array.GetItemCount(FLST) AllFiles=AllFiles+text.GetSubTextToEnd(FLST[j],Len+1)+CRLF EndFor Controls.SetTextBoxText(MBOX,AllFiles) EndSub Sub AtoZ_Directory GraphicsWindow.BackgroundColor="Lightcyan" GraphicsWindow.Width=1150 GraphicsWindow.Height=700 GraphicsWindow.FontSize=20 GraphicsWindow.BrushColor="Navy" CRLF= Text.GetCharacter(13)+Text.GetCharacter(10) SMSG= Shapes.AddText(" ") ' for current directory shapes.SetText(SMSG," "+CRLF+" ") MBOX= Controls.AddMultiLineTextBox(500,50) Controls.SetSize(MBOX,550,600) For i=65 To 90 ' search root directories A: to Z: a= file.GetDirectories(Text.GetCharacter(i)+":\") If a<>"FAILED" Then DL=DL+1 MainDir[DL]=Text.GetCharacter(i)+":\" GraphicsWindow.BrushColor="Green" Gdrive[DL] =Shapes.AddText(MainDir[DL]) Shapes.Move(Gdrive[DL],25,50+25*(DL-1)) GraphicsWindow.BrushColor="Red" Rdrive[DL] =Shapes.AddText(MainDir[DL]) Shapes.Move(Rdrive[DL],25,50+25*(DL-1)) Shapes.SetOpacity(Rdrive[DL],0) EndIf EndFor ' EndSub End>BJD645.sb< Start>BJD695.sb< max_col = 50 max_row = 50 init() While 1=1 Program.Delay(20) EndWhile Program.End() sub init GraphicsWindow.Title = "Small Basic Calc Table writen by MartMen 05/2016" GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GWW = Desktop.Width - 70 GWH = Desktop.Height - 70 GraphicsWindow.Width = GWW GraphicsWindow.Height = GWH MaMe_Len = 3 MaMe_Character = " " 'LDGraphicsWindow.PauseUpdates() For col = 1 To max_col MaMe_Text = col MaMe_right_justified() Temp = Text.Append("Col.: ", MaMe_Text_Return) headtitle[col] = Temp EndFor CreateData() dv = LDControls.AddDataView(GWW,GWH,headtitle) 'UpdateDataView() UpdateRows() 'LDGraphicsWindow.ResumeUpdates() LDControls.DataViewAllowUserEntry(dv,"False") EndSub 'init Sub MaMe_right_justified MaMe_Error = "" If (MaMe_Len + 1) > (Text.GetLength(MaMe_Text)) Then If MaMe_Character = "" Then MaMe_Character = " " EndIf MaMe_Temp = "" MaMe_Text_Return = "" For i = 1 To MaMe_Len MaMe_Temp = Text.Append(MaMe_Temp, MaMe_Character) EndFor MaMe_Text_Return = Text.Append(MaMe_Temp, MaMe_Text) MaMe_Text_Return = Text.GetSubTextToEnd(MaMe_Text_Return,(Text.GetLength(MaMe_Text_Return) - MaMe_Len)+1) Else MaMe_Error = MaMe_Text + " are more as " + MaMe_Len + " character" EndIf EndSub 'MaMe_right_justified Sub CreateData For i = 1 To max_row data[i] = " " EndFor EndSub Sub UpdateDataView For n = 1 To max_row 'row[1] = data[n] LDControls.DataViewSetRow(dv, n, "1="+data[n]) ' row) EndFor EndSub Sub UpdateRows For n = 1 To max_row For r = 1 To max_col row[r] = data[n] EndFor LDControls.DataViewSetRow(dv, n, row) EndFor EndSub End>BJD695.sb< Start>BJH503.sb< ' The following line could be harmful and has been automatically commented. ' ff=File.ReadContents("e:\bann.svm") GraphicsWindow.Title="SVM Renderer bbb=LDShapes.BrushGradient("1=tan;2=brown" "DD") LDGraphicsWindow.BackgroundBrush(bbb) hlw="true VT = Text.GetCharacter(9) CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) WQ = Text.GetCharacter(34) scale=4 not="true=false;false=true LDEvents.MouseWheel=mww GraphicsWindow.KeyDown=kkd rendd() Sub kkd lk=text.ConvertToLowerCase( GraphicsWindow.LastKey) If lk="left" Then ox=ox-20 ElseIf lk="right" Then ox=ox+20 ElseIf lk="up" Then oy=oy-20 ElseIf lk="down" Then oy=oy+20 EndIf LDGraphicsWindow.Reposition(zz zz ox, oy 0) EndSub Sub mww zz=zz+LDEvents.LastMouseWheelDelta/10 LDGraphicsWindow.Reposition(zz zz ox, oy 0) GraphicsWindow.Title=zz EndSub Sub rendd For q=1 To Array.GetItemCount(ff) If Array.ContainsIndex(ff[q] "d") Then buf=(ff[q]["d"]) Parse_d() EndIf EndFor EndSub Sub AddArcPoints ' param large_arc_flag = 1 if angle > 180° param swp_flag = 1 if positive angle _x = (ps["x"] + pe["x"]) / 2 _y = (ps["y"] + pe["y"]) / 2 dx = (ps["x"] - pe["x"]) dy = (ps["y"] - pe["y"]) d = Math.SquareRoot(dx * dx + dy * dy) da = 10 r = d / 2 k = rx / r If k < 1 Then match = "False" Else _d = k * d _r = _d / 2 If large_arc_flag = sweep_flag Then cx = _x - (dy / 2) * (k * r * Math.Sin(Math.ArcCos(1 / k))) / r cy = _y + (dx / 2) * (k * r * Math.Sin(Math.ArcCos(1 / k))) / r Else cx = _x + (dy / 2) * (k * r * Math.Sin(Math.ArcCos(1 / k))) / r cy = _y - (dx / 2) * (k * r * Math.Sin(Math.ArcCos(1 / k))) / r EndIf cc=ldMath.Convert2Radial(cx cy ps["x"] ps["y"]) as = cc[2] cc=ldMath.Convert2Radial(cx cy pe["x"] pe["y"]) ae = cc[2] If sweep_flag = 1 Then If ae < as Then ae = ae + 360 EndIf For a = as To ae Step da x = cx + rx * LDMath.Cos(a) y = cy + ry * LDMath.Sin(a) AddPoint() EndFor If a < ae + da Then x = cx + rx * LDMath.Cos(ae) y = cy + ry * LDMath.Sin(ae) AddPoint() EndIf Else ' sweep_flag = 0 If as < ae Then as = as + 360 EndIf For a = as To ae Step -da x = cx + rx * LDMath.Cos(a) y = cy + ry * LDMath.Sin(a) AddPoint() EndFor If ae - da < a Then x = cx + rx * LDMath.Cos(ae) y = cy + ry * LDMath.Sin(ae) AddPoint() EndIf EndIf xo = x yo = y EndIf EndSub Sub AddCubicPoints nC = nC + 1 _c[nC] = "x=" + x1 + ";y=" + y1 + ";" nc = nC + 1 _c[nC] = "x=" + x2 + ";y=" + y2 + ";" nc = nC + 1 _c[nC] = "x=" + x + ";y=" + y + ";" For t = 0 To 1 Step 0.05 x1 = (1 - t) * _c[nC - 3]["x"] + t * _c[nC - 2]["x"] y1 = (1 - t) * _c[nC - 3]["y"] + t * _c[nC - 2]["y"] x2 = (1 - t) * _c[nC - 2]["x"] + t * _c[nC - 1]["x"] y2 = (1 - t) * _c[nC - 2]["y"] + t * _c[nC - 1]["y"] x3 = (1 - t) * _c[nC - 1]["x"] + t * _c[nC]["x"] y3 = (1 - t) * _c[nC - 1]["y"] + t * _c[nC]["y"] x12 = (1 - t) * x1 + t * x2 y12 = (1 - t) * y1 + t * y2 x23 = (1 - t) * x2 + t * x3 y23 = (1 - t) * y2 + t * y3 x = (1 - t) * x12 + t * x23 y = (1 - t) * y12 + t * y23 AddPoint() EndFor xo = x yo = y EndSub Sub AddPoint If _points <> "" Then _points = _points + " " EndIf _points = _points + x + "," + y EndSub Sub AddQuadPoints nQ = nQ + 1 _q[nQ] = "x=" + x1 + ";y=" + y1 + ";" nQ = nQ + 1 _q[nQ] = "x=" + x + ";y=" + y + ";" For t = 0 To 1 Step 0.05 x1 = (1 - t) * _q[nQ - 2]["x"] + t * _q[nQ - 1]["x"] y1 = (1 - t) * _q[nQ - 2]["y"] + t * _q[nQ - 1]["y"] x2 = (1 - t) * _q[nQ - 1]["x"] + t * _q[nQ]["x"] y2 = (1 - t) * _q[nQ - 1]["y"] + t * _q[nQ]["y"] x = (1 - t) * x1 + t * x2 y = (1 - t) * y1 + t * y2 AddPoint() EndFor xo = x yo = y EndSub Sub Parse_Arc _p = p char = "Aa" Parse_Char() If match Then cmd = c EndIf matchA = "False" ps = "x=" + xo + ";y=" + yo + ";" ' start point While match Parse_Space() Parse_Point() ' rx, ry If match Then rx = x ry = y Parse_Space() Parse_Number() ' x-axis-rotation EndIf If match Then x_axis_rotation = number Parse_Space() char = "01" Parse_Char() ' large-arc-flag EndIf If match Then large_arc_flag = c Parse_Space() char = "01" Parse_Char() ' sweep-flag EndIf If match Then sweep_flag = c Parse_Space() Parse_Point() ' end point EndIf If match Then If cmd = "a" Then x = xo + x y = yo + y EndIf matchA = "True" pe = "x=" + x + ";y=" + y + ";" AddArcPoints() EndIf EndWhile If Not[matchA] Then p = _p Else points[nPoints] = points[nPoints] + " " + _points match = "True" EndIf EndSub Sub Parse_Char match = "False" c = Text.GetSubText(buf, p, 1) If (p <= len) And Text.IsSubText(char, c) Then match = "True" p = p + 1 EndIf EndSub Sub Parse_ClosePath char = "Zz" Parse_Char() If match Then closed[nPoints] = "True" xo = xz yo = yz cmd = c EndIf EndSub Sub Parse_Cubic _p = p char = "CcSs" Parse_Char() If match Then cmd = c EndIf matchC = "False" If Text.IsSubText("Cc", cmd) Then _c = "" nC = 1 _c[nC]["x"] = xo _c[nC]["y"] = yo While match Parse_Space() Parse_Point() ' control point 1 If match Then If cmd = "c" Then x = xo + x y = yo + y EndIf x1 = x y1 = y Parse_Space() Parse_Point() ' control point 2 If cmd = "c" Then x = xo + x y = yo + y EndIf EndIf If match Then x2 = x y2 = y Parse_Space() Parse_Point() ' end point If cmd = "c" Then x = xo + x y = yo + y EndIf EndIf If match Then matchC = "True" AddCubicPoints() EndIf EndWhile Else ' S or s Parse_Space() Parse_Point() ' end point If match Then If cmd = "s" Then x = xo + x y = yo + y EndIf x1 = _c[nC]["x"] + (_c[nC]["x"] - _c[nC - 1]["x"]) y1 = _c[nC]["y"] + (_c[nC]["x"] - _c[nC - 1]["x"]) AddCubicPoints() EndIf EndIf If Not[matchC] Then p = _p Else points[nPoints] = points[nPoints] + " " + _points match = "True" EndIf EndSub Sub Render_Polygon For iPts = 1 To nPts _pt = LDText.Split(pts[iPts], ",") pt[iPts][1] = Math.Round(_pt[1] * scale) pt[iPts][2] = Math.Round(_pt[2] * scale) EndFor nShp = nShp + 1 shp[nShp] = LDShapes.AddPolygon(pt) If hlw Then LDShapes.BrushColour(shp[nShp] "transparent") LDShapes.PenWidth(shp[nShp] .6) LDShapes.PenColour(shp[nShp] "black") EndIf Shapes.Move(shp[nShp], 0 0)'xL, yT) EndSub Sub Parse_LineTo _p = p char = "LlHhVv" Parse_Char() If match Then cmd = c _points = "" EndIf matchL = "False" If Text.IsSubText("Ll", cmd) Then While match Parse_Space() Parse_Point() If match Then matchL = "True" If cmd = "l" Then x = xo + x y = yo + y EndIf AddPoint() xo = x yo = y EndIf EndWhile Else ' cmd is subtext of "HhVv" While match Parse_Space() Parse_Number() If match Then matchL = "True" If cmd = "H" Then x = number y = yo ElseIf cmd = "h" Then x = xo + number y = yo ElseIf cmd = "V" Then x = xo y = number ElseIf cmd = "v" Then x = xo y = yo + number EndIf AddPoint() xo = x yo = y EndIf EndWhile EndIf If Not[matchL] Then p = _p Else points[nPoints] = points[nPoints] + " " + _points match = "True" EndIf EndSub Sub Parse_MoveTo _p = p char = "Mm" Parse_Char() If match Then cmd = c _points = "" EndIf matchM = "False" While match Parse_Space() Parse_Point() If match Then matchM = "True" If cmd = "m" Then x = xo + x y = yo + y EndIf AddPoint() xo = x yo = y xz = x yz = y EndIf EndWhile If Not[matchM] Then p = _p Else match = "True" nPoints = nPoints + 1 points[nPoints] = _points closed[nPoints] = "False" EndIf EndSub Sub Parse_Number _p = p matchN = "False" char = "-" Parse_Char() If match Then number = "-" Else number = "" EndIf match = "True" char = "0123456789" While match Parse_Char() If match Then number = Text.Append(number, c) matchN = "True" EndIf EndWhile char = "." Parse_Char() If match Then number = Text.Append(number, c) EndIf char = "0123456789" While match Parse_Char() If match Then number = Text.Append(number, c) matchN = "True" EndIf EndWhile If Not[matchN] Then p = _p Else match = "True" EndIf EndSub Sub Parse_Point _p = p match = "False" Parse_Number() If match Then x = number Parse_Space() match = "True" EndIf If match Then Parse_Number() EndIf If match Then y = number Else p = _p EndIf EndSub Sub Parse_Quadratic _p = p char = "QqTt" Parse_Char() If match Then cmd = c EndIf matchQ = "False" If Text.IsSubText("Qq", cmd) Then _q = "" nQ = 1 _q[nQ]["x"] = xo _q[nQ]["y"] = yo While match Parse_Space() Parse_Point() ' control point If cmd = "q" Then x = xo + x y = yo + y EndIf x1 = x y1 = y If match Then Parse_Space() Parse_Point() ' end point If cmd = "q" Then x = xo + x y = yo + y EndIf EndIf If match Then matchQ = "True" AddQuadPoints() EndIf EndWhile Else ' T or t Parse_Space() Parse_Point() ' end point If match Then If cmd = "t" Then x = xo + x y = yo + y EndIf x1 = _q[nQ]["x"] + (_q[nQ]["x"] - _q[nQ - 1]["x"]) y1 = _q[nQ]["y"] + (_q[nQ]["x"] - _q[nQ - 1]["x"]) AddQuadPoints() EndIf EndIf If Not[matchQ] Then p = _p Else points[nPoints] = points[nPoints] + " " + _points match = "True" EndIf EndSub Sub Parse_d'--------------paths--------- match = "False" len = Text.GetLength(buf) p = 1 points = "" closed = "" nPoints = 0 xo = 0 yo = 0 While p <= len Parse_Space() Parse_MoveTo() If Not[match] Then Parse_LineTo() EndIf If Not[match] Then Parse_Cubic() EndIf If Not[match] Then Parse_Quadratic() EndIf If Not[match] Then Parse_Arc() EndIf If Not[match] Then Parse_ClosePath() EndIf EndWhile ' SVG_SetAttr() For iPoints = 1 To nPoints pt = "" pts = LDText.Split(points[iPoints], " ") nPts = Array.GetItemCount(pts) Render_Polygon() EndFor EndSub Sub Parse_Space match = "False" While (p <= len) And Text.IsSubText(" ," + VT + CR + LF, Text.GetSubText(buf, p, 1)) match = "True" p = p + 1 EndWhile EndSub End>BJH503.sb< Start>BJJ539.sb< ' Copyright 2014 Abhishek Sathiabalan arg = ProgramPlus.ArgumentCount errcount = 0 pa = 0 count = 0 If arg = 0 then LDProcess.Start(Program.Directory +"\" + "TCPServer.exe","") Program.End() else password = ProgramPlus.GetArgument(1) endIf TextWindow.Title = "Server Client " path = Program.Directory + "\" +"Log"+ "\" + "Log.txt" TextWindow.ForegroundColor = "Gray" TextWindow.WriteLine("") TextWindow.WriteLine(" ╔════════════════════════════════════════════╗") TextWindow.WriteLine(" ║ This window outputs messages to the server ║") TextWindow.WriteLine(" ║ as well as connections and disconnections ║") TextWindow.WriteLine(" ╚════════════════════════════════════════════╝") TextWindow.WriteLine("") Timer.Interval = 10 Timer.Tick = Tick TextWindow.Left = 1000 TextWindow.Top = 1 Sub Tick count = count + 1 ' The following line could be harmful and has been automatically commented. ' msg = File.ReadLine(path,1) ' The following line could be harmful and has been automatically commented. ' color = File.ReadLine(path,2) ' The following line could be harmful and has been automatically commented. ' a = File.ReadLine(path,3) TextWindow.Title = "Server Client " + a + ";" + pa + ";"' + count If color = 1 Then TextWindow.ForegroundColor = "Green" ElseIf color = 2 then TextWindow.ForegroundColor = "Red" ElseIf color = 3 then TextWindow.ForegroundColor = "Yellow" ElseIf color = 4 then TextWindow.ForegroundColor = "Blue" ElseIf color = 5 then TextWindow.ForegroundColor = "White" EndIf If errcount > 10 Then TextWindow.ForegroundColor = "WHITE" TextWindow.WriteLine("Error: System Corruption /Bad Password.") TextWindow.WriteLine("Server Restart /Server Client Suggested") TextWindow.WriteLine("Server Client Paused") TextWindow.WriteLine("Press any button to continue") errcount = 0 TextWindow.PauseWithoutMessage() ProgramPlus.End() EndIf If a = pa + 1 Then pa = a msg = LDEncryption.AESDecrypt(msg,password) TextWindow.WriteLine(msg) If msg = "" Then errcount = errcount + 2 TextWindow.WriteLine("Possible Bad Password") EndIf ElseIf a > pa then TextWindow.ForegroundColor = "White" temp = pa + 1 TextWindow.WriteLine("Error: Possible Corruption.") TextWindow.WriteLine("Expected Value : " + temp) TextWindow.WriteLine("Given Value : " + a ) TextWindow.ForegroundColor = "Gray" pa = a errcount = errcount + 1 EndIf EndSub End>BJJ539.sb< Start>BJK155.sb< 'FloodFill example - for some theory see http://en.wikipedia.org/wiki/Flood_fill 'Draw regions with left mouse button and fill with right mouse button gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp mouseMove = 0 mouseDown = 0 rightClick = 0 While ("True") If (mouseDown = 1 And mouseMove = 1) Then xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY GraphicsWindow.DrawLine(xMLast,yMLast,xM,yM) xMLast = xM yMLast = yM mouseMove = 0 ElseIf (rightClick = 1) Then fillRegion() rightClick = 0 EndIf Program.Delay(20) EndWhile Sub fillRegion Stack.PushValue("X",xMLast) Stack.PushValue("Y",yMLast) colOld = GraphicsWindow.GetPixel(xMLast,yMLast) colFill = GraphicsWindow.PenColor While (Stack.GetCount("X") > 0) x = Stack.PopValue("X") y = Stack.PopValue("Y") If (GraphicsWindow.GetPixel(x,y) <> colFill) Then 'We could have multiple entries in the stack at x,y so only process those we haven't dealt with GraphicsWindow.SetPixel(x,y,colFill) If (x > 0) Then If (GraphicsWindow.GetPixel(x-1,y) = colOld) Then Stack.PushValue("X",x-1) Stack.PushValue("Y",y) EndIf EndIf If (x < gw-1) Then 'X pixels go from 0 to gw-1 If (GraphicsWindow.GetPixel(x+1,y) = colOld) Then Stack.PushValue("X",x+1) Stack.PushValue("Y",y) EndIf EndIf If (y > 0) Then If (GraphicsWindow.GetPixel(x,y-1) = colOld) Then Stack.PushValue("X",x) Stack.PushValue("Y",y-1) EndIf EndIf If (y < gh-1) Then ''Y pixels go from 0 to gh-1 If (GraphicsWindow.GetPixel(x,y+1) = colOld) Then Stack.PushValue("X",x) Stack.PushValue("Y",y+1) EndIf EndIf EndIf EndWhile EndSub Sub OnMouseMove mouseMove = 1 EndSub Sub OnMouseDown GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() xMLast = GraphicsWindow.MouseX yMLast = GraphicsWindow.MouseY If (Mouse.IsLeftButtonDown) Then mouseDown = 1 ElseIf (Mouse.IsRightButtonDown) Then rightClick = 1 EndIf EndSub Sub OnMouseUp mouseDown = 0 EndSub End>BJK155.sb< Start>BJL054.sb< ' Hello world! code = "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." 'this program adds two single-digit numbers and displays the result correctly if the result also has only one digit 'code = ",>++++++[<-------->-],[<+>-]<." ' input single characters and output them in reverse order ' code = ",[>,]<[.<]" 'print first 10 Fibonacci numbers 'code = "++++++++++>+>>>>++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-<-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<<-]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<+>>[-]]<<<<<<<]>>>>>[++++++++++++++++++++++++++++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++++++++++++++++++++++++++++++++++++++++++++++.[-]<<<<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<[-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]" 'sierpinski triangle 'code = ">++++[<++++++++>-]>++++++++[>++++<-]>>++>>>+>>>+<<<<<<<<<<[-[->+<]>[-<+>>>.<<]>>>[[->++++++++[>++++<-]>.<<[->+<]+>[->++++++++++<<+>]>.[-]>]]+<<<[-[->+<]+>[-<+>>>-[->+<]++>[-<->]<<<]<<<<]++++++++++.+++.[-]<]" p=1 For b=1 to text.GetLength(code) If text.GetSubText(code, b, 1)=">" or text.GetSubText(code, b, 1)="<" Then p = p + text.GetCharacterCode(text.GetSubText(code, b, 1)) - 61 ElseIf text.GetSubText(code, b, 1)="+" or text.GetSubText(code, b, 1)="-" Then a[p]=a[p] + 44 - text.GetCharacterCode(text.GetSubText(code, b, 1)) Elseif text.GetSubText(code, b, 1)="." then TextWindow.Write(Text.GetCharacter(a[p])) Elseif text.GetSubText(code, b, 1)="," then a[p]=text.GetCharacterCode(TextWindow.Read()) Elseif text.GetSubText(code, b, 1)="[" and a[p]>0 then Stack.PushValue("b",b-1) Elseif text.GetSubText(code, b, 1)="[" and a[p]<=0 then w=1 While w>0 b=b+1 If text.GetSubText(code, b, 1)="[" or text.GetSubText(code, b, 1)="]" Then w=w+92-text.GetCharacterCode(text.GetSubText(code, b, 1)) EndIf Endwhile elseif text.GetSubText(code, b, 1)="]" then b=Stack.popValue("b") EndIf EndFor End>BJL054.sb< Start>BJQ268.sb< ' Flag of Sweden ' Copyright © 2020 Nonki Takahashi. The MIT License. GraphicsWindow.Title = "Flag of Sweden" SB_Workaround() scale = 598/ 16 GraphicsWindow.Width = 16 * scale GraphicsWindow.Height = 10 * scale Shapes_Init_Sweden() angle = 0 name = "Sweden" Sprite_Add() Sub SB_RotateWorkaround ' Small Basic | rotate workaround For Silverlight ' param shp - current shape ' param x, y - original coordinate ' param _alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(_alpha) - y1 * Math.Sin(_alpha) + ox y = x1 * Math.Sin(_alpha) + y1 * Math.Cos(_alpha) + oy EndSub Sub SB_Workaround ' Small Basic | workaround for Silverlight / SBD ' return silverlight - "True" if in remote ' return sbd - "True" if Small Basic Desktop color = GraphicsWindow.GetPixel(0, 0) sbd = "False" If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" _gw = GraphicsWindow.Width _gh = GraphicsWindow.Height If (_gw = 624) And (_gh = 441) Then sbd = "True" EndIf EndIf EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | calculate total width and height of shapes ' param shape[] - shape array ' return shWidth, shHeight - total size of shapes For i = 1 To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init_Sweden ' Shapes | initialize sample shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 0 ' x offset shY = 0 ' y offset shape = "" shape[1] = "func=rect;width=16;height=10;pw=0;bc=#006aa7;" shape[2] = "func=rect;x=5;width=2;height=10;pw=0;bc=#fecc00;" shape[3] = "func=rect;y=4;width=16;height=2;pw=0;bc=#fecc00;" EndSub Sub Sprite_Add ' Sprite | add shapes to a sprite ' param name - sprite name ' param shX, shY - origin of shape array ' param scale - to resize ' param shape[] - shape array ' param nSprite - number of sprite ' return nSprite - updated number of sprite ' return sprite[] - sprite array Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nSprite = nSprite + 1 spr = "" spr["name"] = name spr["x"] = shX spr["y"] = shY spr["angle"] = 0 spr["dir"] = 1 Shapes_CalcWidthAndHeight() spr["width"] = shWidth spr["height"] = shHeight spr["cx"] = shWidth / 2 spr["cy"] = shHeight / 2 s = scale spr["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If Text.IsSubText("text|btn", shp["func"]) Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] If shp["fb"] = "False" Then GraphicsWindow.FontBold = "False" Else GraphicsWindow.FontBold = "True" EndIf EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If sbd And (shp["func"] = "line") Then shp["wx"] = x shp["wy"] = y ElseIf silverlight And Text.IsSubText("tri|line", shp["func"]) Then _alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor spr["shape"] = shape sprite[nSprite] = spr y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>BJQ268.sb< Start>BJS360.sb< 'Written by Thaelmann-Pioniere r=20 d=r*2 Turtle.Speed=10 Turtle.PenUp() Turtle.MoveTo(100,100) Turtle.Angle=90 Turtle.PenDown() GraphicsWindow.BrushColor="Black" GraphicsWindow.FontName="Times New Roman" GraphicsWindow.FontSize=48 GraphicsWindow.FontBold="False" GraphicsWindow.DrawText(300,20,"C") For i = 1 To 6 drawbond() Turtle.Turn(60) drawatom() EndFor Turtle.Angle=150 Turtle.Move(r+50+r) Turtle.Angle=90 For i = 1 To 6 drawbond2() Turtle.Turn(60) drawatom() EndFor Turtle.PenUp() Turtle.Angle=150 Turtle.Move(r+50) drawatom() direction=-30 x=Turtle.X y=Turtle.Y GraphicsWindow.PenColor="Blue" GraphicsWindow.PenWidth=2 For i = 1 To 3 Turtle.Angle=direction distance=30 For a = 1 To 2 Turtle.PenUp() Turtle.Move(r) Turtle.PenDown() Turtle.Move(distance) Turtle.PenUp() Turtle.Move(r) distance=distance+25 EndFor Turtle.PenUp() Turtle.MoveTo(x,y) direction=direction+120 EndFor direction=direction+60 GraphicsWindow.PenColor="Silver" GraphicsWindow.PenWidth=10 For i = 1 To 3 Turtle.Angle=direction distance=30 For a = 1 To 2 Turtle.PenUp() Turtle.Move(r) Turtle.PenDown() Turtle.Move(distance) Turtle.PenUp() Turtle.Move(r) distance=distance+20 EndFor Turtle.PenUp() Turtle.MoveTo(x,y) direction=direction+120 EndFor Turtle.Hide() Sub drawatom GraphicsWindow.BrushColor="black" GraphicsWindow.FillEllipse(Turtle.X-r,Turtle.Y-r,d,d) EndSub Sub drawbond GraphicsWindow.PenColor="Blue" Turtle.PenUp() Turtle.Move(r) Turtle.PenDown() Turtle.Move(r+100) Turtle.PenUp() Turtle.Move(r) EndSub Sub drawbond2 GraphicsWindow.PenColor="Silver" GraphicsWindow.PenWidth=10 Turtle.PenUp() Turtle.Move(r) Turtle.PenDown() Turtle.Move(r+10) Turtle.PenUp() Turtle.Move(r) EndSub End>BJS360.sb< Start>BJW569.sb< GraphicsWindow.Width=1600 GraphicsWindow.Height=900 GraphicsWindow.Top =10 GraphicsWindow.Left=10 GraphicsWindow.Title ="Double bridge GraphicsWindow.BackgroundColor="darkblue view3D = LD3DView.AddView(900,900,"true") LD3DView.AddDirectionalLight (view3D,"#77aaaa00",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 3) sl=LD3DView.AddspotLight(view3D,"white",5,25, 5 ,-1 ,-1 ,-1 90 150) LD3DView.AddAmbientLight(view3D,"#77555555") LD3DView.ResetCamera(view3D,-30,15,30, 5, 0, -3, "","","") for ff=0 To 54 Step .2 d20=ldmath.Sin (ff*10)*5+8 f=(ff-9)*2 h5=ldmath.Sin (ff*10)*6 s2=(d20)+":"+h5+":"+f+":" s22=(30-d20)+":"+h5+":"+f+":" p2=p2+s2 p21=p21+s22 LD3DView.AddTube(view3D s2+s22 .5 10 "gold" "D") ' d20=d20+1 endfor LD3DView.AddTube(view3D p2 1 10 "cyan" "D") LD3DView.AddTube(view3D p21 1 10 "cyan" "D") cc=LD3DView.AddCone (view3D 20 18 1.5 40 "lightgray" "D") LD3DView.TranslateGeometry (view3D cc, 14, -1, -25) LD3DView.AddDirectionalLight (view3D "Red" 10 30 10) rtt=1 f5=45 ldEvents.MouseWheel=mww GraphicsWindow.KeyDown =kdd ya=22 r35=95 While "true For aa=0 To 360 Step .5 If rtt=1 then px= LDMath.Cos(aa) py= LDMath.sin (aa) LD3DView.ResetCamera(view3D, px*r35,ya,py*r35, -px, -.5, -py, "","","") Program.Delay (22) Else aa=aa-.5 endif EndFor EndWhile Sub kdd rtt= 1-rtt endsub Sub mww r35=r35+ LDEvents.LastMouseWheelDelta *3 EndSub End>BJW569.sb< Start>BJW864.sb< ' Challenge of the month November 2012 Triangle area by NaochanON ' X^2+y^2=a^2 ........... ① ' (c-x)^2+y^2=b^2 .......... ② ' ② - ① = (c-x)^2 - x^2 = b^2 - a^2 therefore 2cX=(a^2 -b^2+c^2) ---> X= (a^2 -b^2+c^2) /2c ' Y = sqr(a^2 - x^2) GraphicsWindow.BackgroundColor="lightcyan" GraphicsWindow.PenColor="Red" GraphicsWindow.FontSize=16 GraphicsWindow.Title=" Mark 3 points by using mouse " GraphicsWindow.MouseDown=mousedown Sub mousedown For j=1 To 6 Shapes.Remove(shape[j]) EndFor MM=MM+1 mxy[MM]="X="+(GraphicsWindow.MouseX)+";Y="+(GraphicsWindow.MouseY) ' mouse X,Y el[MM]=shapes.AddEllipse(4,4) shapes.move(el[mm],mxy[mm]["X"]-2,mxy[mm]["Y"]-2) ' point marks If MM=3 Then Calc_area() MM=0 For i=1 To 3 Shapes.Remove(el[i]) ' remove marks Endfor EndIf EndSub Sub Calc_area '--------------- 3 points ----------------------------- msg= "Points X1,Y1="+mxy[1]["X"]+" , "+ mxy[1]["Y"]+" X2,Y2="+mxy[2]["X"]+" , "+ mxy[2]["Y"]+" X3,Y3="+mxy[3]["X"]+" , "+ mxy[3]["Y"] GraphicsWindow.Title=msg '--------------- shape triangle ----------------------------- GraphicsWindow.BrushColor="Yellow" Shape[1]= Shapes.AddTriangle(mxy[1]["X"],mxy[1]["Y"],mxy[2]["X"],mxy[2]["Y"],mxy[3]["X"],mxy[3]["Y"]) Shapes.SetOpacity(Shape[1],50) '--------------- triangle length area ----------------------------- a2=Math.Power((mxy[1]["X"]-mxy[2]["X"]),2) + Math.Power((mxy[1]["Y"]-mxy[2]["Y"]),2) b2=Math.Power((mxy[2]["X"]-mxy[3]["X"]),2) + Math.Power((mxy[2]["Y"]-mxy[3]["Y"]),2) c2=Math.Power((mxy[3]["X"]-mxy[1]["X"]),2) + Math.Power((mxy[3]["Y"]-mxy[1]["Y"]),2) a=math.Floor(math.SquareRoot(a2)*100)/100 b=math.Floor(math.SquareRoot(b2)*100)/100 c=math.Floor(math.SquareRoot(c2)*100)/100 X=(a2-b2+c2)/2/c Y=math.SquareRoot(a2-X*X) cx=mxy[3]["X"]+(c-x)/c*(mxy[1]["X"]-mxy[3]["X"]) cY=mxy[3]["Y"]+(c-x)/c*(mxy[1]["Y"]-mxy[3]["Y"]) Shape[2]=Shapes.AddLine(mxy[2]["X"],mxy[2]["Y"],CX,CY) ' height line S=c*Y/2 ' Area '--------------- marks ----------------------------------------------- GraphicsWindow.BrushColor="Navy" shape[3]= Shapes.AddText("a") Shapes.Move(shape[3],(mxy[1]["X"]+mxy[2]["X"])/2,(mxy[1]["Y"]+mxy[2]["Y"])/2-10) shape[4]= Shapes.AddText("b") Shapes.Move(shape[4],(mxy[2]["X"]+mxy[3]["X"])/2-10,(mxy[2]["Y"]+mxy[3]["Y"])/2) shape[5]= Shapes.AddText("c") Shapes.Move(shape[5],(mxy[1]["X"]+mxy[3]["X"])/2+5,(mxy[1]["Y"]+mxy[3]["Y"])/2-5) shape[6]= Shapes.AddText("Y") Shapes.Move(shape[6],(mxy[2]["X"]+cx)/2-10,(mxy[2]["Y"]+cy)/2) '--------------- results --------------------------------------------------- msg2=" Length a:(X1y1 - X2y2) = "+a+Text.GetCharacter(10)+ " Length b:(X2y2 - X3y3) = "+b+Text.GetCharacter(10)+ " Length c:(X1y1 - X3y3) = "+c+Text.GetCharacter(10) msg2=msg2+ " Y= "+math.Floor(Y*10)/10 +Text.GetCharacter(10)+"Area S = Y*C/2= "+math.Floor(S*10)/10 Shapes.Remove(Shapes[7]) Shapes[7]=Shapes.AddText(msg2) Shapes.Move(shape[7],-100,300) Shapes.Animate(shape[7],20,5,2000) EndSub End>BJW864.sb< Start>BJX729.sb< 'v 1.1.0 'Creado por Gustavo Cerda Nilo, Octubre 2016 '---------------------------------------------------------- 'v 1.0 '---------------------------------------------------------- 'publicada en http://smallbasic.com/smallbasic.com/program/?QNX227 'solamente tiene modo de dos jugadores '---------------------------------------------------------- 'v 1.1 '---------------------------------------------------------- 'Se agrega modo para un jugador y se mantiene el de dos jugadores 'modo un jugador con ia al azar, no reacciona a jugadas del usuario 'Se agrega interfaz inicial para escoger uno o dos jugadores 'Se agrega boton para reiniciar el juego o volver al menu principal 'la cpu siempre inicia primero y juega con la figura de circulos rojos 'Visita codigogx.blogspot.cl '====== INTERFAZ ======================================= Sub menu GraphicsWindow.CanResize = "no" GraphicsWindow.Width = 370 GraphicsWindow.Height = 300 'figuras forndo GraphicsWindow.PenWidth = 5 GraphicsWindow.PenColor = "gainsboro" GraphicsWindow.DrawEllipse(180,0,100,100)'circulo superior GraphicsWindow.DrawLine(0,80,100,50)'X izquierda GraphicsWindow.DrawLine(10,0,10,170) GraphicsWindow.DrawLine(260,150,260,300)'X derecha GraphicsWindow.DrawLine(180,280,370,220) 'letras titulo GraphicsWindow.FontSize = 33 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(130,50,"SMALL") GraphicsWindow.FontSize = 32 GraphicsWindow.DrawText(160,90,"TIC") GraphicsWindow.FontSize = 24 GraphicsWindow.DrawText(165,130,"TAC") GraphicsWindow.FontSize = 18 GraphicsWindow.DrawText(170,160,"TOE") 'lineas horizontales y verticales GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "black" v1 = Shapes.AddLine(0,190,150,0) v2 = Shapes.AddLine(130,300,350,0) h1 = Shapes.AddLine(30,0,370,190) h2 = Shapes.AddLine(0,190,170,300) Shapes.SetOpacity(v1,10) Shapes.SetOpacity(v2,10) Shapes.SetOpacity(h1,10) Shapes.SetOpacity(h2,10) 'ubicacion y control de botones btnPlay1 = Controls.AddButton("1 Jugador",70,210) btnPlay2 = Controls.AddButton("2 Jugadores",200,210) Controls.ButtonClicked = Botones EndSub Sub Botones ultimoBtn = Controls.LastClickedButton If ultimoBtn = btnPlay1 Then GraphicsWindow.MouseDown = clicX2 inter() inicio() jugadas() EndIf If ultimoBtn = btnPlay2 Then GraphicsWindow.MouseDown = clicX inicio() EndIf EndSub '============== fin interfaz ===================================== Sub inicio GraphicsWindow.Clear() interruptor = 1 'GraphicsWindow.MouseDown = clicX GraphicsWindow.Width = 370 GraphicsWindow.Height = 300 GraphicsWindow.PenWidth = 2 GraphicsWindow.PenColor = "Green" GraphicsWindow.CanResize = "no" 'lineas horizontales GraphicsWindow.DrawLine(80,110,290,110) GraphicsWindow.DrawLine(80,170,290,170) 'lineas verticales GraphicsWindow.DrawLine(150,60,150,220) GraphicsWindow.DrawLine(220,60,220,220) 'Matriz de 3 x 3 de ceros 'X = 1 'O = 9 '11 12 13 '21 22 23 '31 32 33 For fila = 1 To 3 For columna = 1 To 3 matriz[fila][columna] = 0 EndFor EndFor EndSub Sub clicX If Math.Remainder(interruptor,2) <> 0 Then figuraX() EndIf If Math.Remainder(interruptor,2) = 0 Then figuraO() EndIf EndSub Sub inter interruptor = interruptor + 1 If interruptor = 10 Then Reinicio() EndIf EndSub Sub FiguraX GraphicsWindow.PenColor = "Blue" gmX = GraphicsWindow.MouseX gmY = GraphicsWindow.MouseY 'ubicacion 1,1 If gmX >= 85 And gmX <= 145 And gmY >= 65 And gmY <= 105 Then If matriz[1][1] = 0 Then GraphicsWindow.DrawLine(100,70,130,100) GraphicsWindow.DrawLine(100,100,130,70) matriz[1][1] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 1,2 If gmX >= 155 And gmX <= 215 And gmY >= 65 And gmY <= 105 Then If matriz[1][2] = 0 Then GraphicsWindow.DrawLine(170,70,200,100) GraphicsWindow.DrawLine(170,100,200,70) matriz[1][2] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 1,3 If gmX >= 225 And gmX <= 285 And gmY >= 65 And gmY <= 105 Then If matriz[1][3] = 0 Then GraphicsWindow.DrawLine(240,70,270,100) GraphicsWindow.DrawLine(240,100,270,70) matriz[1][3] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 2,1 If gmX >= 85 And gmX <= 145 And gmY >= 115 And gmY <= 165 Then If matriz[2][1] = 0 Then GraphicsWindow.DrawLine(100,125,130,155) GraphicsWindow.DrawLine(100,155,130,125) matriz[2][1] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 2,2 If gmX >= 155 And gmX <= 215 And gmY >= 115 And gmY <= 165 Then If matriz[2][2] = 0 Then GraphicsWindow.DrawLine(170,125,200,155) GraphicsWindow.DrawLine(170,155,200,125) matriz[2][2] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 2,3 If gmX >= 225 And gmX <= 285 And gmY >= 115 And gmY <= 165 Then If matriz[2][3] = 0 Then GraphicsWindow.DrawLine(240,125,270,155) GraphicsWindow.DrawLine(240,155,270,125) matriz[2][3] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 3,1 If gmX >= 85 And gmX <= 145 And gmY >= 175 And gmY <= 215 Then If matriz[3][1] = 0 Then GraphicsWindow.DrawLine(100,180,130,210) GraphicsWindow.DrawLine(100,210,130,180) matriz[3][1] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 3,2 If gmX >= 155 And gmX <= 215 And gmY >= 175 And gmY <= 215 Then If matriz[3][2] = 0 Then GraphicsWindow.DrawLine(170,180,200,210) GraphicsWindow.DrawLine(170,210,200,180) matriz[3][2] = 1 inter() SumaMatriz() EndIf EndIf 'ubicacion 3,3 If gmX >= 225 And gmX <= 285 And gmY >= 175 And gmY <= 215 Then If matriz[3][3] = 0 Then GraphicsWindow.DrawLine(240,180,270,210) GraphicsWindow.DrawLine(240,210,270,180) matriz[3][3] = 1 inter() SumaMatriz() EndIf EndIf EndSub Sub FiguraO GraphicsWindow.PenColor = "Red" gwX = GraphicsWindow.MouseX gwY = GraphicsWindow.MouseY 'ubicacion 1,1 If gwX >= 85 And gwX <= 145 And gwY >= 65 And gwY <= 105 Then If matriz[1][1] = 0 Then GraphicsWindow.DrawEllipse(100,70,30,30)'ubicacion 1,1 matriz[1][1] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 1,2 If gwX >= 155 And gwX <= 215 And gwY >= 65 And gwY <= 105 Then If matriz[1][2] = 0 Then GraphicsWindow.DrawEllipse(170,70,30,30) matriz[1][2] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 1,3 If gwX >= 225 And gwX <= 285 And gwY >= 65 And gwY <= 105 Then If matriz[1][3] = 0 Then GraphicsWindow.DrawEllipse(240,70,30,30) matriz[1][3] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 2,1 If gwX >= 85 And gwX <= 145 And gwY >= 115 And gwY <= 165 Then If matriz[2][1] = 0 Then GraphicsWindow.DrawEllipse(100,125,30,30) matriz[2][1] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 2,2 If gwX >= 155 And gwX <= 215 And gwY >= 115 And gwY <= 165 Then If matriz[2][2] = 0 Then GraphicsWindow.DrawEllipse(170,125,30,30) matriz[2][2] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 2,3 If gwX >= 225 And gwX <= 285 And gwY >= 115 And gwY <= 165 Then If matriz[2][3] = 0 Then GraphicsWindow.DrawEllipse(240,125,30,30) matriz[2][3] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 3,1 If gwX >= 85 And gwX <= 145 And gwY >= 175 And gwY <= 215 Then If matriz[3][1] = 0 Then GraphicsWindow.DrawEllipse(100,180,30,30) matriz[3][1] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 3,2 If gwX >= 155 And gwX <= 215 And gwY >= 175 And gwY <= 215 Then If matriz[3][2] = 0 Then GraphicsWindow.DrawEllipse(170,180,30,30) matriz[3][2] = 9 inter() SumaMatriz() EndIf EndIf 'ubicacion 3,3 If gwX >= 225 And gwX <= 285 And gwY >= 175 And gwY <= 215 Then If matriz[3][3] = 0 Then GraphicsWindow.DrawEllipse(240,180,30,30) matriz[3][3] = 9 inter() SumaMatriz() EndIf EndIf EndSub Sub SumaMatriz'Y raya final**************************************************** 'raya horizontal superior If matriz[1][1] + matriz[1][2] + matriz[1][3] = 3 Or matriz[1][1] + matriz[1][2] + matriz[1][3] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(50,85,320,85) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() Else Sound.PlayChimes() EndIf 'raya horizontal media If matriz[2][1] + matriz[2][2] + matriz[2][3] = 3 Or matriz[2][1] + matriz[2][2] + matriz[2][3] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(50,140,320,140) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf 'raya horizontal inferior If matriz[3][1] + matriz[3][2] + matriz[3][3] = 3 Or matriz[3][1] + matriz[3][2] + matriz[3][3] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(50,195,320,195) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf 'raya vertical izquierda If matriz[1][1] + matriz[2][1] + matriz[3][1] = 3 Or matriz[1][1] + matriz[2][1] + matriz[3][1] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(115,30,115,250) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf 'raya vertical centro If matriz[1][2] + matriz[2][2] + matriz[3][2] = 3 Or matriz[1][2] + matriz[2][2] + matriz[3][2] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(185,30,185,250) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf 'raya vertical derecha If matriz[1][3] + matriz[2][3] + matriz[3][3] = 3 Or matriz[1][3] + matriz[2][3] + matriz[3][3] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(255,30,255,250) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf 'raya diagonal sup. izq. a der. If matriz[1][1] + matriz[2][2] + matriz[3][3] = 3 Or matriz[1][1] + matriz[2][2] + matriz[3][3] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(90,60,280,220) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf 'raya diagonal inf. izq. a der. If matriz[3][1] + matriz[2][2] + matriz[1][3] = 3 Or matriz[3][1] + matriz[2][2] + matriz[1][3] = 27 Then GraphicsWindow.PenWidth = 5 GraphicsWindow.DrawLine(90,220,280,60) interruptor = 0 RellenaMatriz() Reinicio() Sound.PlayBellRing() EndIf EndSub 'Detener clic********************************************************* Sub RellenaMatriz For fila = 1 To 3 For columna = 1 To 3 matriz[fila][columna] = 2 EndFor EndFor EndSub '------------------------------------------------------------------------------------------- 'Boton reiniciar '------------------------------------------------------------------------------------------- Sub Reinicio GraphicsWindow.FontSize = 12 reiniciar = Controls.AddButton("Reiniciar Partida",70,260) menuPrincipal = Controls.AddButton("Menu Principal",200,260) Controls.ButtonClicked = BtnReinicio EndSub Sub BtnReinicio ultimoBtnReinicio = Controls.LastClickedButton If ultimoBtnReinicio = reiniciar Then GraphicsWindow.Clear() inter() inicio() jugadas() EndIf If ultimoBtnReinicio = menuPrincipal Then GraphicsWindow.Clear() menu() EndIf EndSub '============================================== '1 play ia Sub clicX2 If Math.Remainder(interruptor,2) = 0 Then figuraX() EndIf If Math.Remainder(interruptor,2) <> 0 Then jugadas() EndIf EndSub '----------------------------------------------------------------------------------------------------- 'Jugadas de la cpu '----------------------------------------------------------------------------------------------------- Sub jugadas If interruptor = 1 Then primeraJugada_esquinas() ElseIf interruptor = 3 then segundaJugada_esquinas() elseIf interruptor = 5 then terceraJugada_esquinas() elseIf interruptor = 7 then cuartaJugada_esquinas() elseIf interruptor = 9 then quintaJugada_esquinas() EndIf EndSub '========== 1ra jugada..... Sub primeraJugada_esquinas Azar() EndSub '========== 2da jugada..... Sub segundaJugada_esquinas Azar() EndSub '========== 3ra jugada.....********************** Sub terceraJugada_esquinas Azar() EndSub '========== 4ta jugada.....********************************* Sub cuartaJugada_esquinas Azar() EndSub '========== 5ta jugada..... Sub quintaJugada_esquinas Azar() EndSub '---------------------------------------------------------------------------------------- 'Funcion para que la cpu escoja una casilla al azar sin IA '---------------------------------------------------------------------------------------- Sub Azar volver: casilla = Math.GetRandomNumber(9) comprobar = 0 While comprobar = 0 If casilla = 1 Then If matriz[1][1] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(100,70,30,30)'ubicacion 1,1 matriz[1][1] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 2 then If matriz[1][2] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(170,70,30,30)'ubicacion 1,2 matriz[1][2] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 3 then If matriz[1][3] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(240,70,30,30)'ubicacion 1,3 matriz[1][3] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 4 then If matriz[2][1] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(100,125,30,30)'ubicacion 2,1 matriz[2][1] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 5 then If matriz[2][2] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(170,125,30,30)'ubicacion 2,2 matriz[2][2] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 6 then If matriz[2][3] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(240,125,30,30)'ubicacion 2,3 matriz[2][3] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 7 then If matriz[3][1] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(100,180,30,30)'ubicacion 3,1 matriz[3][1] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 8 then If matriz[3][2] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(170,180,30,30)'ubicacion 3,2 matriz[3][2] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf ElseIf casilla = 9 then If matriz[3][3] = 0 Then GraphicsWindow.PenColor = "Red" GraphicsWindow.DrawEllipse(240,180,30,30)'ubicacion 3,3 matriz[3][3] = 9 inter() SumaMatriz() comprobar = 1 Else Goto volver EndIf EndIf EndWhile EndSub 'Fin funcion Azar menu() End>BJX729.sb< Start>BJZ474.sb< 'Elementice GraphicsWindow.Width=770 GraphicsWindow.Height=510 GraphicsWindow.Left=0 GraphicsWindow.Top=0 GraphicsWindow.BackgroundColor="DarkGray" GraphicsWindow.Title="Elementice v0.1" 'Cards cardsforsession=40 the="The " ofl="Of " 'presets vstr1[1]="Amulet " vstr1[2]="Shield " vstr1[3]="Sword " vstr1[4]="Helmet " vstr1[5]="Omen " vstr1[6]="Covenant " 'subsets vstr2[1]="Aaron " vstr2[2]="Death " vstr2[3]="Frost " vstr2[4]="Fire " vstr2[5]="Wind " vstr2[6]="Stone " vstr2[7]="Sabrina " vstr2[8]="Pain " vstr2[9]="Wood " vstr2[10]="Delphi " vstr2[11]="Martosi " vstr2[12]="Ancients " 'damage vals aa=10 ad=50 af=15 afi=15 aw=15 as=15 asa=35 amp=75 aw=15 ade=25 am=25 ata=80 'defense sa=25 sd=1 sf=35 sfi=45 sw=10 ss=50 ssa=25 smp=60 sw=5 sde=35 sm=35 sta=80 'sword sa=45 sd=80 sf=25 sfi=35 sw=10 ss=15 ssa=45 smp=75 sw=10 sde=35 sm=35 sta=80 'helmet ha=25 hd=45 hf=15 hfi=25 hw=10 hs=10 hsa=25 hmp=65 hw=5 hde=30 hm=30 hta=80 'magic damage oa=5 od=25 of=10 ofi=10 ow=10 os=10 osa=5 omp=30 ow=5 ode=60 om=60 ota=80 'magic restore ca=15 cd=50 cf=10 cfi=10 cw=10 cs=10 csa=15 cmp=45 cw=5 cde=60 cm=60 cta=80 enemy=program.Directory+"\enemy.jpg" player=program.Directory+"\player.jpg" card=program.Directory+"\card_back.jpg" GraphicsWindow.PenWidth=5 GraphicsWindow.PenColor="lightgray" GraphicsWindow.DrawRectangle(8,8,85,85) GraphicsWindow.DrawRectangle(678,418,85,85) GraphicsWindow.PenColor="black" GraphicsWindow.DrawLine(0,255,770,255) GraphicsWindow.DrawResizedImage(enemy,10,10,80,80) GraphicsWindow.DrawResizedImage(player,680,420,80,80) GraphicsWindow.MouseMove=movemouse GraphicsWindow.MouseDown=downmouse Controls.ButtonClicked=clickedbutton GraphicsWindow.BrushColor="Black" GraphicsWindow.DrawResizedImage(card,500,200,70,100) addcardsforsession=Shapes.AddText(cardsforsession) Shapes.Move(addcardsforsession,525,180) doDealEnemy() Sub doDealEnemy ecx=120 ecy=10 For e=1 To 5 GraphicsWindow.DrawResizedImage(card,ecx,ecy,70,100) get1stvale=math.GetRandomNumber(6) get2ndvale=math.GetRandomNumber(12) getcardname1[e]=vstr1[get1stvale] getcardname2[e]=vstr2[get2ndvale] ecx=ecx+100 EndFor doDealPlayer() endsub Sub doDealPlayer GraphicsWindow.PenWidth=5 GraphicsWindow.PenColor="Black" pcx=570 pcy=400 For i=1 To 5 GraphicsWindow.BrushColor="LightGray" GraphicsWindow.Fillrectangle(pcx,pcy,70,100) GraphicsWindow.DrawRectangle(pcx,pcy,70,100) get1stvalp=math.GetRandomNumber(6) get2ndvalp=math.GetRandomNumber(12) getcardname1[i]=vstr1[get1stvalp] getcardname2[i]=vstr2[get2ndvalp] pcx=pcx-100 EndFor doWrite() endsub GraphicsWindow.PenColor="Black" GraphicsWindow.PenWidth=3 GraphicsWindow.DrawRectangle(690,10,30,200) GraphicsWindow.PenColor="Black" GraphicsWindow.PenWidth=3 GraphicsWindow.DrawRectangle(730,10,30,200) GraphicsWindow.BrushColor="LimeGreen" GraphicsWindow.FillRectangle(690,10,30,200) GraphicsWindow.BrushColor="Aqua" GraphicsWindow.FillRectangle(730,10,30,200) GraphicsWindow.PenColor="Black" GraphicsWindow.PenWidth=3 GraphicsWindow.DrawRectangle(10,300,30,200) GraphicsWindow.PenColor="Black" GraphicsWindow.PenWidth=3 GraphicsWindow.DrawRectangle(50,300,30,200) GraphicsWindow.BrushColor="LimeGreen" GraphicsWindow.FillRectangle(10,300,30,200) GraphicsWindow.BrushColor="Aqua" GraphicsWindow.FillRectangle(50,300,30,200) Sub doWrite GraphicsWindow.BrushColor="Black" For w=1 To 5 GraphicsWindow.FontSize=13 line1x=575 line1y=405 GraphicsWindow.DrawText(line1x,line1y,the) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname1[1]) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,ofl) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname2[1]) line1x=line1x-100 line1y=405 GraphicsWindow.DrawText(line1x,line1y,the) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname1[2]) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,ofl) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname2[2]) line1x=line1x-100 line1y=405 GraphicsWindow.DrawText(line1x,line1y,the) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname1[3]) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,ofl) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname2[3]) line1x=line1x-100 line1y=405 GraphicsWindow.DrawText(line1x,line1y,the) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname1[4]) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,ofl) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname2[4]) line1x=line1x-100 line1y=405 GraphicsWindow.DrawText(line1x,line1y,the) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname1[5]) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,ofl) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname2[5]) endfor endsub Sub movemouse GraphicsWindow.PenColor="Red" GraphicsWindow.PenWidth=3 mx=graphicswindow.MouseX my=graphicswindow.MouseY If mx>570 And mx<640 And my>400 And my<500 Then GraphicsWindow.DrawRectangle(565,395,80,110) else GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="DarkGray" GraphicsWindow.DrawRectangle(565,395,80,110) EndIf GraphicsWindow.PenColor="Red" If mx>470 And mx<540 And my>400 And my<500 Then GraphicsWindow.DrawRectangle(465,395,80,110) else GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="DarkGray" GraphicsWindow.DrawRectangle(465,395,80,110) EndIf GraphicsWindow.PenColor="Red" If mx>370 And mx<440 And my>400 And my<500 Then GraphicsWindow.DrawRectangle(365,395,80,110) else GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="DarkGray" GraphicsWindow.DrawRectangle(365,395,80,110) EndIf GraphicsWindow.PenColor="Red" If mx>270 And mx<340 And my>400 And my<500 Then GraphicsWindow.DrawRectangle(265,395,80,110) else GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="DarkGray" GraphicsWindow.DrawRectangle(265,395,80,110) EndIf GraphicsWindow.PenColor="Red" If mx>170 And mx<240 And my>400 And my<500 Then GraphicsWindow.DrawRectangle(165,395,80,110) else GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="DarkGray" GraphicsWindow.DrawRectangle(165,395,80,110) EndIf GraphicsWindow.PenColor="Red" EndSub enemyhealth=100 playerhealth=100 enemymagic=100 playermagic=100 playercards=5 enemycards=5 whosturn=math.GetRandomNumber(2) If whosturn=1 Then enemymove() EndIf If whosturn=2 Then playermove() EndIf Sub playermove EndSub Sub enemymove EndSub Sub downmouse If mx>570 And mx<640 And my>400 And my<500 And Mouse.IsLeftButtonDown Then pcx=570 pcy=400 i=1 line1x=575 line1y=405 docardops() EndIf If mx>470 And mx<540 And my>400 And my<500 And Mouse.IsLeftButtonDown Then pcx=470 pcy=400 i=2 line1x=475 line1y=405 docardops() EndIf If mx>370 And mx<440 And my>400 And my<500 And Mouse.IsLeftButtonDown Then pcx=370 pcy=400 i=3 line1x=375 line1y=405 docardops() EndIf If mx>270 And mx<340 And my>400 And my<500 And Mouse.IsLeftButtonDown Then pcx=270 pcy=400 i=4 line1x=275 line1y=405 docardops() EndIf If mx>170 And mx<240 And my>400 And my<500 And Mouse.IsLeftButtonDown Then pcx=170 pcy=400 i=5 line1x=175 line1y=405 docardops() EndIf endsub sub docardops GraphicsWindow.BrushColor="Black" playcard=Controls.AddButton("Play Card",5,240) discard=Controls.AddButton("Discard",85,240) cancel=Controls.AddButton("Cancel",153,240) EndSub Sub clickedbutton If Controls.LastClickedButton=cancel Then Controls.Remove(playcard) Controls.Remove(discard) Controls.Remove(cancel) EndIf If Controls.LastClickedButton=discard Then GraphicsWindow.BrushColor="LightGray" GraphicsWindow.Fillrectangle(pcx,pcy,70,100) GraphicsWindow.PenColor="black" GraphicsWindow.DrawRectangle(pcx,pcy,70,100) Controls.Remove(playcard) Controls.Remove(discard) Controls.Remove(cancel) get1stvalp=math.GetRandomNumber(6) get2ndvalp=math.GetRandomNumber(12) getcardname1[i]=vstr1[get1stvalp] getcardname2[i]=vstr2[get2ndvalp] GraphicsWindow.FontSize=13 GraphicsWindow.BrushColor="black" line1x=line1x line1y=line1y GraphicsWindow.DrawText(line1x,line1y,the) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname1[i]) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,ofl) line1y=line1y+14 GraphicsWindow.DrawText(line1x,line1y,getcardname2[i]) cardsforsession=cardsforsession-1 Shapes.Remove(addcardsforsession) addcardsforsession=Shapes.AddText(cardsforsession) Shapes.Move(addcardsforsession,525,180) endif If Controls.LastClickedButton=playcard Then dogetfirst() EndIf endsub Sub dogetfirst i=i If getcardname2[i]=vstr2[10] Or getcardname2[i]=vstr2[4] Or getcardname2[i]=vstr2[7] then length=2 Else length=1 EndIf onstletter=Text.GetSubText(getcardname1[i],1,1) dosstletter=text.GetSubText(getcardname2[i],1,length) If getcardname2[i]=vstr2[8] Then dosstletter="mp" EndIf If getcardname2[i]=vstr2[12] Then dosstletter="ta" endif final=text.ConvertToLowerCase(onstletter)+text.ConvertToLowerCase(dosstletter) doPlay() endsub Sub doPlay If Text.StartsWith(final,"o") Then enemymagic=enemymagic-final EndIf EndSub End>BJZ474.sb< Start>BKD171.sb< GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.PenWidth=3 GraphicsWindow.Title ="Moving bags dw=900 dh=dw GraphicsWindow.width=dw+400 GraphicsWindow.Height=dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 cx=110 cy=110 LDPhysics.Reset() for n=0 to 5 a1[n] = LDPhysics.AddMovingAnchor(cx-100+n*210,cy-100) a2[n] = LDPhysics.AddMovingAnchor(cx-100+n*210,cy+100) a3[n] = LDPhysics.AddMovingAnchor(cx+100+n*210,cy+100) a4[n] = LDPhysics.AddMovingAnchor(cx+100+n*210,cy-100) LDPhysics.RopeColour=GraphicsWindow.GetColorFromRGB(0,0,0) LDPhysics.Addrope(a1[n],a2[n]) LDPhysics.Addrope(a2[n],a3[n]) LDPhysics.Addrope(a3[n],a4[n]) LDPhysics.Addrope(a4[n],a1[n]) GraphicsWindow.BrushColor= LDColours.HSLtoRGB (n*50 1 0.7) For m = 1 To 20 ball[n][m] = Shapes.AddEllipse(30+m,30+m) LDPhysics.AddMovingShape(ball[n][m],0,1,0) LDPhysics.SetPosition(ball[n][m],cx-40+n*210+m*2,cy-40+m*2,0) EndFor endfor deg =0 LDPhysics.SetGravity(0,0) for m=0 to 200 LDPhysics.DoTimestep() EndFor While 1=1 LDPhysics.DoTimestep() LDPhysics.SetGravity(LDMath.Sin(deg)*100,LDMath.cos(deg)*100) deg=deg+0.5 Program.Delay(10) EndWhile End>BKD171.sb< Start>BKG332.sb< 'Frantic Clicks. Click the box to earn points. Box moves faster with each click. Ten misses and its game over 'Submitted by codingCat (Matthew L. Parets) for the 50 Line Challenge 'Initial Setup ----------------------------------------------------------------------------------------------------- boxSize = 50 'build and set the box (50 easy, 25 hard, 10 crazy) box = Shapes.AddRectangle(boxSize,boxSize) GraphicsWindow.MouseDown = onMouseClick 'tell windows to call when mouse is clicked onIntervalTick() 'Move the box from the starting place miss = 0 'Inital game state and score score = 0 Timer.Tick = onIntervalTick 'Set up timer to auto jump the box Timer.Interval = 2000 displayScore() Sub onMouseClick 'Called by windows when mouse is clicked ----------------------------------------- Mx = GraphicsWindow.MouseX 'Location of mouse cursor My = GraphicsWindow.MouseY Sx = Shapes.GetLeft(box) 'Location of box Sy = Shapes.GetTop(box) closeX = Mx - Sx 'How close is mouse and box closeY = My - Sy If (closeX > 0) And (closeY > 0) then 'Greater than zero? - In front of box If (closeX < boxSize) And (closeY < boxSize) Then 'Less than box size? - Inside of box Timer.Interval = Timer.Interval - 50 'Game speeds up score = score + ((100-(miss * 10)) * (2000 - Timer.Interval)) miss = 0 displayScore() onIntervalTick() EndIf EndIf EndSub Sub onIntervalTick 'Called by windows each time the interval elapses ---------------------------- newX = Math.GetRandomNumber(GraphicsWindow.Width - boxSize) newY = Math.GetRandomNumber(GraphicsWindow.Height - boxSize) Shapes.Move(box,newX,newY) 'New Location for the box miss = miss + 1 displayScore() If miss > 10 Then 'Ten misses and the game is over Timer.Interval = 100000000 'Stop the timer GraphicsWindow.ShowMessage(msg,"Game Over") Program.End() EndIf EndSub Sub displayScore 'Called to update the score and status on the title line of the window.--------- msg = "Score: " + score + " - Speed: " + Timer.Interval For i = 1 To miss msg = msg + "." EndFor GraphicsWindow.Title = msg EndSub End>BKG332.sb< Start>BKM132-0.sb< ' Word List 0.9 ' Copyright (c) 2010-2014 Nonki Takahashi. ' ' History: ' 0.9 2014-05-13 Translated to English (209 lines, BKM132-0) ' 0.8 2010-06-29 Added operator to delimiter (208 lines) ' 0.7 2010-06-23 Removed performance test, rewrote comments (205 lines, BKM132) ' 0.6 2010-06-14 Performance upgrade (313 lines, program ID HBQ757) ' 0.5 2010-06-12 Added performance test (232 lines, program ID XLQ213) ' 0.4 2010-06-10 Completed (175 lines, program ID XFX546) ' 0.3 2010-06-09 Output word list (111 lines, program ID LDG385) ' 0.2 2010-05-05 Under debbuging (37 lines) ' 0.1 2010-05-05 Initial version: only pseudo code (11 lines) ' ' character code for tab TAB = 9 ' character code for double quotation mark WQUOTE = 34 ' initialze word list pointer ptr[0] = 1 ' get filename from keyboard TextWindow.Write("File name? ") filename = TextWindow.Read() ' initialize line number lno = 1 ' initialize word number wno = 0 ' read a line from input file ' The following line could be harmful and has been automatically commented. ' line = File.ReadLine(filename, lno) ' repeat the block in { } until EOF comes While (line <> "") ' { ' write the line with line number TextWindow.WriteLine(lno + " " + line) ' get separator between words from line GetSeparator() ' get a word from line GetWord() ' repeat the block in { } until EOL comes While (word <> "") ' { ' register given word to the word list InsertWordList() ' get separator between words from line GetSeparator() ' get a word from line GetWord() ' } EndWhile ' count up line number lno = lno + 1 ' read a line from input file ' The following line could be harmful and has been automatically commented. ' line = File.ReadLine(filename, lno) ' } EndWhile ' print the word list PrintWordList() Sub GetWord ' Get word from line ' param line ' work c - character ' return line - remaining characters in the line ' return word word = "" While (line <> "") c = Text.GetSubText(line, 1, 1) If (c = " " Or Text.GetCharacterCode(c) = TAB Or c = "," Or c = ";" Or c = ":" Or c = ".") Then Goto endword ElseIf (Text.GetCharacterCode(c) = WQUOTE Or c = "(" Or c = ")" Or c = "[" Or c = "]") Then Goto endword ElseIf (c = "<" Or c = ">" Or c = "+" Or c = "-" Or c = "*" Or c = "/" Or c = "=") Then Goto endword Else line = Text.GetSubText(line, 2, Text.GetLength(line) - 1) word = word + c EndIf EndWhile endword: EndSub Sub GetSeparator ' Get separator between words in line ' param line ' work s - separator ' work space - "True" if there is space, tab or other delimiters ' return separator separator = "" space = "False" While (line <> "") s = Text.GetSubText(line, 1, 1) While (s = " " Or Text.GetCharacterCode(s) = TAB) line = Text.GetSubText(line, 2, Text.GetLength(line) - 1) s = Text.GetSubText(line, 1, 1) space = "True" EndWhile If (Text.GetCharacterCode(s) = WQUOTE Or s = "," Or s = ";" Or s = ":" Or s = "." Or s = "(" Or s = ")" Or s = "[" Or s = "]" Or s ="<" Or s = ">" Or s = "+" Or s = "-" Or s = "*" Or s = "/" Or s = "=") Then line = Text.GetSubText(line, 2, Text.GetLength(line) - 1) separator = separator + s Else Goto endseparator EndIf EndWhile endseparator: If (separator = "" And space) Then separator = " " EndIf EndSub Sub InsertWordList ' Insert a word to the word list ' param word ' param ptr - pointer to the next entry in word list ' param wordlist - array for word list ' param lnolist - array for line number list ' param wno - registered number of words ' work lastptr - pointer to the previous entry ' work currentptr - pointer to the current entry ' work i - index for word list ' work j - counter for entry ' return ptr - updated pointer to next entry in word list ' return wordlist - updated array for word list ' return lnolist - updated array for line number list ' return wno - updated number of words lastptr = 0 currentptr = ptr[lastptr] For j = 1 To wno i = currentptr ' compare word and wordlist[i] CompareWord() ' if word < wordlist[i] then If (cwresult = "<") Then Goto exitiwl EndIf lastptr = currentptr currentptr = ptr[lastptr] EndFor exitiwl: ' insert word and line number at index i ptr[lastptr] = wno + 1 ptr[wno + 1] = currentptr wordlist[wno + 1] = word lnolist[wno + 1] = lno wno = wno + 1 EndSub Sub PrintWordList ' Print word list to display (text window) ' param ptr - pointer to the next entry in word list ' param wordlist - array for word list ' param lnolist - array for line number list ' param wno - registered number of words ' work i - index to word list ' work j - counter for entry ' work currentword ' work lower - word converted into lower case letters ' work lastptr - pointer to the previous entry in word list ' word currentptr - pointer to the current entry lastptr = 0 currentptr = ptr[lastptr] currentword = "" For j = 1 To wno i = currentptr lower = Text.ConvertToLowerCase(wordlist[i]) If (lower = currentword) Then ' output only line numbers while continuing the current word TextWindow.Write(", " + lnolist[i]) Else ' output word ... line number when new word appears TextWindow.WriteLine("") TextWindow.Write(wordlist[i] + " ... " + lnolist[i]) currentword = lower EndIf lastptr = currentptr currentptr = ptr[lastptr] EndFor TextWindow.WriteLine("") EndSub Sub CompareWord ' Compare word with wordlist[i] ' param word ' param wordlist - array for word list ' param i - index to the word list ' work k - character position in the word to compare ' work l, l1, l2 - length of words to compare ' work w1, w2 - words to compare ' work c1, c2 - characters to compare ' return cwresult - result: ">", "=" or "<" w1 = Text.ConvertToLowerCase(word) w2 = Text.ConvertToLowerCase(wordlist[i]) l1 = Text.GetLength(w1) l2 = Text.GetLength(w2) l = Math.Min(l1, l2) For k = 1 To l c1 = Text.GetCharacterCode(Text.GetSubText(w1, k, 1)) c2 = Text.GetCharacterCode(Text.GetSubText(w2, k, 1)) If (c1 > c2) Then cwresult = ">" Goto cwexit ElseIf (c1 < c2) Then cwresult = "<" Goto cwexit EndIf EndFor If (l1 > l2) Then cwresult = ">" ElseIf (l1 < l2) Then cwresult = "<" Else cwresult = "=" EndIf cwexit: EndSub End>BKM132-0.sb< Start>BKM188.sb< 'Challenge of the Month - January 2019 - GUI Challenge 'White an interface with buttons to move backwards and forwards through a list of 'options. 'Each time the an option is selected new options are presented from the list. 'The list could be anything, perhaps the colours of the rainbow. 'Add an image or description of the currently selected item. 'Try using partially transparent buttons covering textboxes to change the buttons' text. gw = 300 gh = 200 GraphicsWindow.Hide() GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) /2 GraphicsWindow.Top = (Desktop.Height - gh) /2 GraphicsWindow.Title = "GUI Challenge January 2019" GraphicsWindow.Show() GraphicsWindow.KeyUp = ExitProgram Colours = "1=Red;2=Blue;3=Green;4=Magenta;5=Purple" current = 1 UpdateVariables() DrawButtons() Controls.ButtonClicked = ButtonClicked 'This line is calling the Sub ButtonClicked '***IMPORTANT: You can only declare an event ONCE! Sub ExitProgram If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf EndSub Sub DrawButtons GraphicsWindow.BrushColor = "Black" Button1 = Controls.AddButton("Previous", 50, 30) Button2 = Controls.AddButton("Next", 50, 130) GraphicsWindow.BrushColor = Colours[current] CurrentColour = Shapes.AddText(Colours[current]) Shapes.Move(CurrentColour, 50, 80) Shapes.SetText(CurrentColour, "The current colour is: " + Colours[current]) EndSub Sub UpdateVariables If current = 0 Then current = Array.GetItemCount(Colours) EndIf If current > Array.GetItemCount(Colours) Then current = 1 EndIf PreviousButton = current - 1 NextButton = current + 1 If PreviousButton = 0 Then PreviousButton = Array.GetItemCount(Colours) ElseIf NextButton > Array.GetItemCount(Colours) Then NextButton = 1 EndIf EndSub Sub ButtonClicked 'For this sub we don't call it by adding a line of code: ButtonClicked() 'rather we call it by Controls.ButtonClicked = ButtonClicked (Line 27) If Controls.GetButtonCaption(Controls.LastClickedButton) = "Previous" Then 'The reason Line 61 is written like that is because there's a bit of a bug with Controls and 'Variables. Small Basic won't use the Variable name you called the Controls.AddButton 'It will call them Button1, Button2 in the order that you write the code. 'So to overcome this use: Controls.GetButtonCaption(Controls.LastButtonClicked = "" 'Don't forget - you can use a Property as input to an Operator! current = current - 1 ElseIf Controls.GetButtonCaption(Controls.LastClickedButton) = "Next" Then 'The reason Line 68 is written like that is because there's a bit of a bug with Controls and 'Variables. Small Basic won't use the Variable name you called the Controls.AddButton 'It will call them Button1, Button2 in the order that you write the code. 'So to overcome this use: Controls.GetButtonCaption(Controls.LastButtonClicked = "" 'Don't forget - you can use a Property as input to an Operator! current = current + 1 EndIf UpdateVariables() Controls.Remove(Button1) Controls.Remove(Button2) Shapes.Remove(CurrentColour) DrawButtons() EndSub End>BKM188.sb< Start>BKM742.sb< size=400 GraphicsWindow.Width=SIZE*2 GraphicsWindow.Height=SIZE*2 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="white zz=1 nn="false not="true=false;false=true nt="0=false;2=false;1=true tt=100 m1[256][176]=2 mm=LDFastArray.CreateFromValues(m1) qcc[ 0]="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~oooo~~~~oooo~~~~oooooooooooooooo~~~~oooo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 1]="~~oooo~~~ooooo~~~~oooo~~~oooo~~~~oooooo~~oooooo~~$ooooo~~~oooo~~~o$~~@o~~~oooo~~~o$~~@o~~~~~~$o~~~oooo~~~@oooo~~~oooooo~ooooooo~~o$~~~~~~o~~~@o~~o~~~~o~~o$~~o@~~ooooo~~~ooooo~~~o$~~@o~~o$~~@o~@o~~~$o~o$~~~~o@~ooooo~~~~oo$~~~~~oooo~~~~oooo~~~~oooo~~~oooooo~~~oooo~ ~~oooo~~~~oooo~~~oooooo~~~~~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o~o~~~~~o~~~~~~~~~~o~~~~~~o~~~~~~o~~~~~~oo~~~~~oooo~~~~~~~~~~~~~~oooooooooooo~~~~oooooooo~~~~oooooooo~~o~~o~~~~~~~o~~~~o~~o~~~~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 2]="~o$~~@o~~o$~~@o~~o$~~@o~~o$~@o~~~o$~~~~~~o$~~~~~~~~$o~~~~o$~~$o~~o$~~@o~~o$~~@o~~o$~~@o~~~~~~$o~~o$~~~~~@o~~~$o~~~~~~o$~~~$o~~~~~o$~~~~~~oo~~@o~~oo~~oo~~o$~o@~~~o$~~@o~~o$~~@o~~o$~~@o~~o$~~@o~~@o~$o~~~o$~~o@~o~~~~~o~~o~o$~~~~o~~~$o~~o$~~@o~~o@~~$o~~o$~~~~~~o$~~~~~~o@~~$o~~o$~~oo~~~~~~~o~~~~oo~~~~~o~~~~~~~~~~~~~~~~~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o~o~~~ooooo~~~~~~~o~~~~~~o~~~~~~~~o~~~~o~~o~~~o~~~~o~~~o~~~o~~~~~oooooooooooo~~~~oooooooo~~~~oooooooo~~~oo~~~~~~~o~~~~~~oo~~~~~~o~~~~~oooo~~~~~~~o~~~~~~~~~~~~~~~o~~~~~~~~~~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 3]="~o$~~@o~~ooooo~~~o$~~~~~~o$~~@o~~ooooo~~~ooooo~~~~~$o~~~~o$~~$o~~o$~~@o~~o$~~~~~~oooooo~~~~~~$o~~~oooo~~@o~~~$o~~~~~o$~~~~$o~~~~~o$~~~~~~o$o~@o~~o$oo@o~~ooo@~~~~o$~~@o~~o$~~@o~~o$~~@o~~o$~~@o~~~@oo~~~~~o$o@~~o~ooo~o~~~~o$~~~~~~~~$o~~~oooo~~~o@~~$o~~ooooo~~~ooooo~~~~~~oo~~~o$~o@o~~~~~~o~~~~o~o~~~~~~o~~~~~oooooo~~~~~o~~~~~~~~~~~~~~~o~~~~~~~~~~~~~~o~o~~o~~o~~~~~~~~o~~~~~~o~~~~~~~~~~o~~o~~~~o~~~~~~~o~~~~o~o~~~~~~oooooooooooo~~~~oooooooo~~~~oooooooo~~oooo~~~~oooo~~~~oooo~~~ooooo~~~o$~~o~~~~~o~~~~~~~~~~~~~~~~o~~~~oooooo~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~ qcc[ 4]="~oooooo~~o$~~@o~~o$~~~~~~o$~~@o~~o$~~~~~~o$~~~~~~~~$o~~~~o$~~$o~~o$~~@o~~o$~ooo~~o$~~@o~~o@~~$o~~~~~~$o~@o~o~$o~~~~o$~~~~~$o~~~~~o$~~~~~~o@$o@o~~o$~~@o~~o$$o~~~~ooooo~~~ooooo~~~o$~~@o~~o$~~@o~~~$oo~~~~~~o$~~~o~o~~~o~~~~o$~~~~~oooo~~~o$~~@o~~~ooooo~~~~~~$o~~o$~~@o~~~~~~$o~~o$o~@o~~~~~o~~~~o~~o~~~~~~~o~~~~~~~~~~~~~ooooo~~~ooooo~~~~~~~~~~~~~~~~~~~~~~~~~~ooooo~~~~~o~~~~~~~o~~~~~~~~~~o~~~~~~~~~~~~~oo~~~ooooooo~~~~oooooooooooo~~~~oooooooo~~~~oooooooo~o$~~@o~~o$~~@o~~o$~~~~~~~~$o~~~~o$~~@o~~~o~~~~~~~~~~~~~~~~~o~~~o~o~~o~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 5]="~o$~~@o~~o$~~@o~~o$~~@o~~o$~@o~~~o$~~~~~~o$~~~~~~~~$o~~~~o$~~$o~~o$~~@o~~o$~~@o~~o$~~@o~~o@~~$o~~o$~~$o~@o~~o$o~~~o$~~~~~~$o~~~~~o$~~~~~~o@~$oo~~o$~~@o~~o$~$o~~~o$~~~~~~o$~@o~~~~o$@o~~~o$oo@o~~$o~@o~~~~~o$~~~o~ooo~o~~~~o$~~~~o$~~~~~~o$~~@o~~~~~~$o~~o@~~$o~~o$~~@o~~o@~~$o~~oo~~@o~~~~o~~~~~oooooo~~~~o~~~~~oooooo~~~~~o~~~~~~~~~~~~~~~o~~~~~~~o~~~~~~~~~~~~~~o~~o~~~o~~~~~~~~o~~~~~~~~~~o~~~~~~~~~~~~o~~~~~~~o~o~~oooo~~~~oooo~~~~oooooooooooooooo~~~~oooo~o$~~~~~~o$~~~~~~~oooo~~~~$o~~~~ooo$~@o~~~~o~~~~~~~~~~~~~~~~o~~~~~o~~o~~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 6]="~o$~~@o~~ooooo~~~~oooo~~~oooo~~~~oooooo~~o$~~~~~~$ooooo~~~oooo~~~~oooo~~~~oooo~~~o$~~@o~~~oooo~~~~oooo~~~@oooo~~~oooooo~~~$o~~~~~oooooo~~o@~~$o~~o$~~@o~~o$~~$o~~o$~~~~~~o$~~@o~~~~oo~~~~~o~~o~~$o~~~@o~~~~o$~~~o~~~~~o~~ooooo$~~oooooo~~~oooo~~~@oooo~~~~oooo~~~~oooo~~~~oooo~~~~oooo~~~~~o~~~~~~~~o~~~~~o~~~~~~~~~~~~~~~~~o~~~~~~~~~~~~~~~~~~~~~~~o~~~~~~~~~~~~ooooo~~~o~~~~~~~~~~o~~~~~~~~o~~~~~~~~~~~~~~~~~~~~o~~~o~oooo~~~~oooo~~~~oooooooooooooooo~~~~oooo~o$~~@o~~o$~~@o~~~~~~@o~~$o~~~~~~o$~~o~~~~~~o~~~~~~oo~~~~~~~~~~~~~o~~o~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~ qcc[ 7]="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ooooo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o~~~~~~~~~~~~~~~o~~~~o~~~~~~~~~~~~o~~~~~~o~~~~~~~~~~~~~~o~~~~~~~~~~~~oooo~~~~oooo~~~~oooooooooooooooo~~~~oooo~~oooo~~~~oooo~~~ooooo~~~ooooo~~~oooo~~~~~~~~~~~~~~oo~~~~~~~o~~~~~o~~o~~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 8]="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~oooo~~~~oooo~~~~oooooooooooooooo~~~~oooo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o~o~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[ 9]="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[10]="~~~oo~~~~~ooo~~~~~~oo~~~~~ooo~~~~~oooo~~~~oooo~~~~~~o~~~~~~oo~~~~~o~~o~~~~~ooo~~~~o~~o~~~~~~~o~~~~~ooo~~~~~oo~~~~~oooo~~~ooooo~~~~o~~~~~~~o~~o~~~o~~~o~~~~o~~o~~~~ooo~~~~~ooo~~~~~o~~o~~~~o~~~o~~~o~~~o~~~o~~~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[11]="~~o~~o~~~~o~~o~~~~o~~o~~~~o~~o~~~~o~~~~~~~o~~~~~~~~~o~~~~~o~~o~~~~o~~o~~~~o~~~~~~~o~~o~~~~~~~o~~~~o~~~~~~~o~~o~~~~~~~o~~~~~o~~~~~~o~~~~~~~oo~o~~~oo~oo~~~~o~o~~~~~o~~o~~~~o~~o~~~~o~~o~~~~o~~~o~~~~o~o~~~~~o~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[12]="~~oooo~~~~ooo~~~~~o~~~~~~~o~~o~~~~ooo~~~~~ooo~~~~~~~o~~~~~o~~o~~~~o~~o~~~~o~oo~~~~oooo~~~~~~~o~~~~~oo~~~~~o~~o~~~~~~o~~~~~~o~~~~~~o~~~~~~~o~oo~~~o~o~o~~~~oo~~~~~~ooo~~~~~ooo~~~~~o~~o~~~~o~~~o~~~~~o~~~~~~~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[13]="~~o~~o~~~~o~~o~~~~o~~o~~~~o~~o~~~~o~~~~~~~o~~~~~~~~~o~~~~~o~~o~~~~o~~o~~~~o~~o~~~~o~~o~~~~o~~o~~~~~~~o~~~~o~oo~~~~~o~~~~~~~o~~~~~~o~~~~~~~o~~o~~~o~~~o~~~~o~o~~~~~o~~~~~~~o~o~~~~~o~o~~~~~o~o~o~~~~o~o~~~~~~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[14]="~~o~~o~~~~ooo~~~~~~oo~~~~~ooo~~~~~oooo~~~~o~~~~~~~~~o~~~~~~oo~~~~~~oo~~~~~~ooo~~~~o~~o~~~~~oo~~~~~ooo~~~~~~o~o~~~~oooo~~~~~o~~~~~~oooo~~~~o~~o~~~o~~~o~~~~o~~o~~~~o~~~~~~~o~~o~~~~~o~~~~~~~o~o~~~~o~~~o~~~~~o~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qcc[15]="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ccc["o"]=1 ccc["~"]=0 ccc["#"]=0 ccc["@"]=0 For y=1 To 176 For x=1 To 256 pcc=qcc[Math.Remainder(y 16)] pc=Text.GetSubText(pcc x 1) LDFastArray.Set2D(mm x y ccc[pc]) EndFor EndFor GraphicsWindow.Title="ZX Screen test cc="0=darkblue;1=white While 1=1 k=k+1 For x=1 To 256 For y=1 To 175 rr=nt[Math.Remainder(k+math.floor((x-1)/8)+Math.Remainder(Math.Floor((y)/8) 2) 2)] If rr Then GraphicsWindow.BrushColor=cc[ LDFastArray.Get2D(mm x y)] Else GraphicsWindow.BrushColor=cc[1-LDFastArray.Get2D(mm x y)] EndIf GraphicsWindow.FillRectangle(x*2 y*2 2 2) EndFor EndFor EndWhile End>BKM742.sb< Start>BKM804.sb< ' Sum of Digits ' ' Write a program to recrsively sum all the digits in a number ' There is a pattern for any number divisible by 9 ' ' For example 561096 : 5+6+1+0+9+6 = 27 : 2+7 = 9 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' While "True" TextWindow.WriteLine("Write a number to sum all his digits.") NumberGivenFromTheUser = TextWindow.ReadNumber() NumberLength = Text.GetLength(NumberGivenFromTheUser) Divisor = Math.Power(10, NumberLength - 1) x[0] = NumberGivenFromTheUser / Divisor For k = 0 To NumberLength DigitNo[k + 1] = Math.Floor(x[k]) x[k + 1] = (x[k] - DigitNo[k + 1]) * 10 EndFor For l = 1 To NumberLength TextWindow.Write(DigitNo[l]) If l < NumberLength Then TextWindow.Write("+") EndIf EndFor TextWindow.Write("=") sum = 0 For m = 1 To NumberLength sum = sum + DigitNo[m] EndFor While Text.GetLength(sum) > 1 TextWindow.WriteLine(sum) NumberLength = Text.GetLength(sum) Divisor = Math.Power(10, NumberLength - 1) x[0] = sum / Divisor For k = 0 To NumberLength DigitNo[k + 1] = Math.Floor(x[k]) x[k + 1] = (x[k] - DigitNo[k + 1]) * 10 EndFor For l = 1 To NumberLength TextWindow.Write(DigitNo[l]) If l < NumberLength Then TextWindow.Write("+") EndIf EndFor TextWindow.Write("=") sum = 0 For m = 1 To NumberLength sum = sum + DigitNo[m] EndFor EndWhile TextWindow.WriteLine(sum) TextWindow.WriteLine("") EndWhile End>BKM804.sb< Start>BKN968.sb< init() generate() ord=LDText.Split ("5 6 4 0 3 1 2 7 8 9 10 " " ") 'hang order r170=100 LDEvents.MouseWheel =mww LD3DView.AutoControl ("true" "true", -1 1) p100=50 GraphicsWindow.KeyDown =kdd For x=0 to 10 LD3DView.ModifyObject (view3D sh[x] "H") endfor While 1=1 'mainloop If pa Then else n=n+2 deg=deg-1 x=ldMath.Sin(n)*r170 z=ldmath.Cos(n)*r170 LD3DView.ResetCamera(view3D,x,za,z,-x*5,0,-z*5,"","","") Program.Delay(p100/1.5) If sx<=16000 then sx=sx+p100 io=math.Floor (sx/2000-2) If sx>2000 then LD3DView.ModifyObject (view3D sh[ord[io]] "S") endif ElseIf sx<=25000 then sx=sx+p100 io=math.Floor (sx/2000-2) LD3DView.ModifyObject (view3D sh[ord[io]] "S") Else LD3DView.ModifyObject (view3D sh[10] "S") EndIf endif EndWhile Sub cc ' draws 3d circle pp="" For q=0 To 360 Step 5 pp=pp+(5+bx+LDMath.Cos(q)*2)+":"+(5+LDMath.sin(q)*2)+":0:" EndFor sh[0]=LDCall.Function("tset" pp) endsub Sub tset 'generates 3d tubeline oo=LD3DView.addtube(view3d,args[1],.6,20,cll,"D") LD3DView.TranslateGeometry (view3d oo bx ty td) return=oo EndSub Sub mww 'mousewheel elevation za=za+ LDEvents.LastMouseWheelDelta*2 EndSub Sub kdd 'keyhandling If GraphicsWindow.LastKey="Escape" Then pa="true" GraphicsWindow.Title ="Pause" Else pa="false" GraphicsWindow.Title ="Orbiting..." EndIf EndSub Sub generate cll="gray" bx=0 pp="0:0:0 0:25:0 8:25:0" LDCall.Function("tset" pp) cll="gold" bx=1 ty=13 pp="0:1:0 5:5:0 10 1 0" sh[1]=LDCall.Function("tset" pp) bx=0.5 ty=16.5 cc() bx=1 ty=8 pp="0:1:0 5:8:0 10 1 0" sh[2]=LDCall.Function("tset" pp) bx=5.9 ty=15.5 pp="0:0:0 0 4 0" sh[3]=LDCall.Function("tset" pp) bx=5.9 ty=23.5 pp="0:0:0 0 2 0" sh[4]=LDCall.Function("tset" pp) bx=-5 ty=-2 pp="0:1:0 5:5:0 10 1 0" cll="gray sh[5]=LDCall.Function("tset" pp) bx=0 ty=-2 pp="0:1:-5 0:5:0 0 1 5" sh[6]=LDCall.Function("tset" pp) cll="gold sh[7]=LD3DView.AddSphere(view3D .5 12 cll "D") LD3DView.TranslateGeometry (view3D sh[7] 1.1 13.6 0) sh[8]=LD3DView.AddSphere(view3D .5 12 cll "D") LD3DView.TranslateGeometry (view3D sh[8] 11 13.6 0) sh[9]=LD3DView.AddSphere(view3D .5 12 cll "D") LD3DView.TranslateGeometry (view3D sh[9] 11 9 0) sh[10]=LD3DView.AddSphere(view3D .5 12 cll "D") LD3DView.TranslateGeometry (view3D sh[10] 1.1 9 0) endsub Sub init dw=1200 dh=800 td=0 ty=0 GraphicsWindow.BackgroundColor ="Darkblue" GraphicsWindow.Width = dw GraphicsWindow.Height = dh GraphicsWindow.Top=0 GraphicsWindow.Left=0 GraphicsWindow.Title ="3D Hangman" args=0 T_x=0 T_y=-40 T_Angle=180 deg=44/7/360 view3D = LD3DView.AddView(dw,dh,"True") LD3DView.AddDirectionalLight(view3D,"Yellow",-1,-1,-1) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#50111111") LD3DView.ResetCamera(view3D,0,0,170, 0,0,-1,"","","") EndSub End>BKN968.sb< Start>BKP701.sb< GraphicsWindow.BackgroundColor ="LightGray GraphicsWindow.Left =10 GraphicsWindow.top=10 GraphicsWindow.Width=900 GraphicsWindow.Height=800 GraphicsWindow.Title ="Spliner GraphicsWindow.MouseDown=mddw LDDialogs.AddRightClickMenu ("1=DrawSpline;2=NewSpline;3=Clean;4=Gradient","") LDDialogs.RightClickMenu=rmmn mfact() args=0 nct=0 grad=0 cpts=100 bb="" bb="100 100 200 300 400 50 160 100 drwnod=1 b=ldtext.Split (bb," ") dospln() bb="" nww=1 nsl=0 GraphicsWindow.KeyDown=kddw Sub kddw lky= GraphicsWindow.LastKey If lky="Tab" Then If nsl>0 then GraphicsWindow.BrushColor="Green GraphicsWindow.fillEllipse (b[nsl]-3,b[nsl+1]-3,6,6) nsl=nsl+2 Else nsl=1 endif If nsl>nct*2 Then nsl=1 endif GraphicsWindow.BrushColor="Red GraphicsWindow.fillEllipse (b[nsl]-3,b[nsl+1]-3,6,6) ox=b[nsl] oy=b[nsl+1] elseIf lky="Escape" Then GraphicsWindow.BrushColor="Green GraphicsWindow.fillEllipse (b[nsl]-3,b[nsl+1]-3,6,6) nsl=0 endif EndSub sub mfact fact[0] = 1.0 fact[1] = 1.0 fact[2] = 2.0 fact[3] = 6.0 fact[4] = 24.0 fact[5] = 120.0 fact[6] = 720.0 fact[7] = 5040.0 fact[8] = 40320.0 fact[9] = 362880.0 fact[10] = 3628800.0 fact[11] = 39916800.0 fact[12] = 479001600.0 fact[13] = 6227020800.0 fact[14] = 87178291200.0 fact[15] = 1307674368000.0 fact[16] = 20922789888000.0 fact[17] = 355687428096000.0 fact[18] = 6402373705728000.0 fact[19] = 121645100408832000.0 fact[20] = 2432902008176640000.0 lxx=20 endsub Sub dospln npts = Array.GetItemCount (b) / 2 ' int icount, jcount ' step, t icount = 1 t = 0 stepp = 1.0 / (cpts - 1) for i1 = 0 to cpts-2 ' TextWindow.WriteLine ("i1:"+i1) if ((1 - t) < 5/1000000) Then t = 1.0 endif jcount = 1 p[icount][1] = 0.0 p[icount][2] = 0.0 for i = 0 to npts basis = ldcall.Function3 ("stein",npts - 1, i, t) p[icount][1] =p[icount][1]+ basis * b[jcount] p[icount][2] =p[icount][2]+ basis * b[jcount + 1] jcount = jcount +2 endfor icount =icount+ 1 t =t+ stepp endfor If drwnod=1 then GraphicsWindow.PenWidth=1 GraphicsWindow.PenColor="green GraphicsWindow.BrushColor="Green For x=3 to npts*2 Step 2 GraphicsWindow.BrushColor="Green If x=nsl*2 Then GraphicsWindow.BrushColor="red endif GraphicsWindow.fillEllipse (b[x]-3,b[x+1]-3,6,6) GraphicsWindow.DrawLine(b[x],b[x+1],b[x-2],b[x-1]) endfor drwnod=0 EndIf If grad=1 Then brr= LDShapes.BrushGradient("1=red;2=Orange;3=yellow","") LDShapes.BrushGradientPolygon (brr,p) else GraphicsWindow.PenWidth=2 GraphicsWindow.PenColor="Green pp=LDShapes.AddPolygon (p) LDShapes.PenColour (pp,"Blue") LDShapes.BrushColour (pp,"Cyan") Shapes.SetOpacity (pp,50) LDShapes.PenWidth (pp,3) endif EndSub sub Ni'(int n, int i) ln=args[1] li=args[2] If ln>lxx Or li>lxx Then TextWindow.WriteLine ("High!"+ln+"|"+li) EndIf a1 = fact[ln] a2 = fact[li] a3 = fact[ln - li] return= a1/ (a2 * a3) ' TextWindow.WriteLine (return ) endsub '// Calculate Bernstein basis sub stein'(int n, int i, t) qn=args[1] qi=args[2] qt=args[3] 'i /* t^i */ 'ni /* (1 - t)^i */ '/* Prevent problems with pow */ if (qt = 0.0) and (qi = 0) Then ti = 1.0 else ti = Math.Power(qt, qi) EndIf if (qn = qi) and (qt = 1.0) then tni = 1.0 else tni = Math.Power((1 - qt), (qn - qi)) EndIf '//Bernstein basis bas = ldcall.Function2 ("Ni",qn, qi) * ti * tni return= bas ' TextWindow.WriteLine ("bs:"+bas) endsub Sub rmmn grad=0 ld= LDDialogs.LastRightClickMenuItem If ld=2 Then bb="" nww=1 nsl=0 Shapes.Remove (pp) GraphicsWindow.Clear () GraphicsWindow.BrushColor="Green nct=0 elseIf ld=1 Then Shapes.Remove (pp) If nww=1 then b=ldtext.Split (bb," ") nww=0 endif If nsl>0 then GraphicsWindow.Clear () drwnod=1 endif dospln () elseIf ld=3 Then GraphicsWindow.Clear () dospln () elseIf ld=4 Then grad=1 Shapes.Remove (pp) dospln () endif EndSub Sub mddw If Mouse.IsLeftButtonDown And nct0 Then GraphicsWindow.BrushColor="Green GraphicsWindow.fillEllipse (ox-3,oy-3,6,6) b[nsl]=xx b[nsl+1]=yy GraphicsWindow.BrushColor="White GraphicsWindow.fillEllipse (xx-3,yy-3,6,6) else GraphicsWindow.fillEllipse (xx-3,yy-3,6,6) If nct>0 Then GraphicsWindow.PenWidth=1 GraphicsWindow.DrawLine (xx,yy,ox,oy) EndIf nct=nct+1 bb=text.Append (bb,xx+" ") bb=text.Append (bb,yy+" ") endif ox=xx oy=yy endif endsub End>BKP701.sb< Start>BKP938.sb< ctr=1 mytext=file.readline("myconfig.txt",ctr) while mytext<> "" mytext=file.readline("myconfig.txt",ctr) Textwindow.writeline(mytext) Draw[ctr]=mytext Textwindow.writeline("Draw["+ctr+"] ="+ Draw[ctr]) Textwindow.writeline("form= : "+Draw[ctr]["form"]) Textwindow.writeline("heigth : "+ Draw[ctr]["heigth"]) ctr=ctr+1 Endwhile Textwindow.writeline("Number of lines in array Draw : "+Array.GetItemCount(Draw) ) End>BKP938.sb< Start>BKQ436-0.sb< num = Math.GetRandomNumber(40) ' number of lines spd = Math.GetRandomNumber(5) ' speed GraphicsWindow.PenWidth=2 r1=Math.GetRandomNumber(6)+spd r2=Math.GetRandomNumber(6)+spd r3=Math.GetRandomNumber(6)+spd r4=Math.GetRandomNumber(6)+spd For line=num To 1 Step -1 lines[line]["x1"]=0 lines[line]["y1"]=0 lines[line]["x2"]=GraphicsWindow.Width lines[line]["y2"]=GraphicsWindow.Height lines[line]["vx1"]=r1 'Math.GetRandomNumber(6) lines[line]["vy1"]=r2 'Math.GetRandomNumber(6) lines[line]["vx2"]=r3 'Math.GetRandomNumber(6) lines[line]["vy2"]=r4 'Math.GetRandomNumber(6) lines[line][0]=Shapes.AddLine(lines[line]["x1"],lines[line]["y1"],lines[line]["x2"],lines[line]["y2"]) lines[line]["clr"]=GraphicsWindow.GetRandomColor() ' line colour lines[line]["dlay"]=line*2+200 ' delay EndFor While "True" For line=1 To num If (lines[line]["x1"]+lines[line]["vx1"]>GraphicsWindow.Width) Or (lines[line]["x1"]+lines[line]["vx1"]<0) Then lines[line]["vx1"]=-lines[line]["vx1"] EndIf If (lines[line]["y1"]+lines[line]["vy1"]>GraphicsWindow.Height) Or (lines[line]["y1"]+lines[line]["vy1"]<0) Then lines[line]["vy1"]=-lines[line]["vy1"] EndIf If (lines[line]["x2"]+lines[line]["vx2"]>GraphicsWindow.Width) Or (lines[line]["x2"]+lines[line]["vx2"]<0) Then lines[line]["vx2"]=-lines[line]["vx2"] EndIf If (lines[line]["y2"]+lines[line]["vy2"]>GraphicsWindow.Height) Or (lines[line]["y2"]+lines[line]["vy2"]<0) Then lines[line]["vy2"]=-lines[line]["vy2"] EndIf ' delay each lines movement to prevent them all moving at the same time If lines[line]["dlay"]=0 Then lines[line]["x1"]=lines[line]["x1"]+lines[line]["vx1"] lines[line]["y1"]=lines[line]["y1"]+lines[line]["vy1"] lines[line]["x2"]=lines[line]["x2"]+lines[line]["vx2"] lines[line]["y2"]=lines[line]["y2"]+lines[line]["vy2"] Shapes.Remove(lines[line][0]) GraphicsWindow.PenColor=lines[line]["clr"] lines[line][0] = Shapes.AddLine(lines[line]["x1"],lines[line]["y1"],lines[line]["x2"],lines[line]["y2"]) Else lines[line]["dlay"] = lines[line]["dlay"] - 1 EndIf EndFor 'Program.Delay(10) EndWhile End>BKQ436-0.sb< Start>BKQ436.sb< x1=0 y1=0 x2=GraphicsWindow.Width y2=GraphicsWindow.Height vx1=Math.GetRandomNumber(6) vy1=Math.GetRandomNumber(6) vx2=Math.GetRandomNumber(6) vy2=Math.GetRandomNumber(6) 'line = Shapes.AddLine(x1,y1,x2,y2) 'GraphicsWindow.PenColor="Black" ' GraphicsWindow.PenWidth=1 While "True" ' Draw over the line smoothing pixels (draw fat and on ends) GraphicsWindow.PenWidth=3 GraphicsWindow.PenColor="White" GraphicsWindow.DrawLine(x1,y1,x2,y2) GraphicsWindow.BrushColor="White" GraphicsWindow.FillRectangle(x1-2,y1-2,4,4) If (x1+vx1>GraphicsWindow.Width) Or (X1+vx1<0) Then vx1=-vx1 EndIf If (y1+vy1>GraphicsWindow.Height) Or (y1+vy1<0) Then vy1=-vy1 EndIf If (x2+vx2>GraphicsWindow.Width) Or (X2+vx2<0) Then vx2=-vx2 EndIf If (y2+vy2>GraphicsWindow.Height) Or (y2+vy2<0) Then vy2=-vy2 EndIf 'GraphicsWindow.Clear() x1=x1+VX1 x2=x2+VX2 Y1=Y1+VY1 Y2=Y2+VY2 GraphicsWindow.PenColor="Black" GraphicsWindow.PenWidth=1 GraphicsWindow.DrawLine(x1,y1,x2,y2) Program.Delay(40) EndWhile End>BKQ436.sb< Start>BKS854.sb< i=1 ss=80 GraphicsWindow.Width =ss*9 GraphicsWindow.Height =ss*6 GraphicsWindow.PenWidth=0 GraphicsWindow.Title ="Flags of the World For y=0 To 5 For x=0 To 8 rr[i]=Shapes.AddRectangle (ss ss) Shapes.Move (rr[i] x*ss y*ss) LDShapes.BrushColour (rr[i] LDColours.HSLtoRGB (x*15 1 .4+y/50)) i=i+1 EndFor EndFor args=0 ff=Shapes.AddText ("Flags of the World") LDEffect.DropShadow (ff "") LDShapes.Font (ff "Calibri" 44 "true" "true") LDShapes.PenColour (ff "white") LDShapes.Centre (ff GraphicsWindow.Width/2 GraphicsWindow.Height/2) Program.Delay (1555) Sub lmk rs="" For y=2 To 4 For x=1 To 18 rs=text.Append (rs args[y]+" ") EndFor EndFor rs=rs+args[1] return=rs EndSub Sub lm2 rs="" For y=2 To 3 For x=1 To 27 rs=text.Append (rs args[y]+" ") EndFor EndFor rs=rs+args[1] return=rs EndSub Sub cmk rs="" For y=1 To 5 For x=2 To 4 For o=1 To 3 rs=text.Append (rs args[x]+" ") EndFor EndFor EndFor rs=rs+"0 0 0 0 0 0 0 0 0 "+args[1] return=rs EndSub ' 1 2 3 4 5 6 7 8 clm=ldtext.Split ("White Black Yellow Red Orange Green Blue #00bbdd Brown" " ") clm[0]="gray fld[4]="4 4 1 4 4 4 4 4 4:4 4 1 4 4 4 4 4 4:1 1 1 1 1 1 1 1 1:4 4 1 4 4 4 4 4 4:4 4 1 4 4 4 4 4 4:0 0 0 0 0 0 0 0 0:* fld[5]=LDText.Replace (fld[4] 1 8) fld[5]=LDText.Replace (fld[5] 4 1) fld[5]=LDText.Replace (fld[5] "*" "Finland") fld[6]=LDText.Replace (fld[4] 1 3) fld[6]=LDText.Replace (fld[6] 4 8) fld[6]=LDText.Replace (fld[6] "*" "Sweden") fld[7]=LDText.Replace (fld[4] 1 7) fld[7]=LDText.Replace (fld[7] "*" "Norway") fld[4]=LDText.Replace (fld[4] "*" "Denmark") fld [0]=ldcall.Function4 ("lmk" "Austria" 4 1 4) fld [1]=ldcall.Function4 ("lmk" "Holland/Croatia" 4 1 7) fld [2]=ldcall.Function4 ("lmk" "Slovenia/Russia/Slovakia" 1 7 4) fld [3]=ldcall.Function4 ("lmk" "Serbia" 4 7 1) fld [8]=ldcall.Function4 ("cmk" "Italy" 6 1 4) fld [9]=ldcall.Function4 ("cmk" "France" 7 1 4) fld[10]=ldcall.Function4 ("cmk" "Belgium" 2 3 4) fld[11]=ldcall.Function4 ("cmk" "Ireland" 6 1 5) fld[12]=ldcall.Function4 ("cmk" "Vatican" 0 3 1) fld[21]=ldcall.Function4 ("cmk" "Romania/Andorra/Moldova" 7 3 4) fld[15]=ldcall.Function4 ("lmk" "Hungary" 4 1 6) fld[16]=ldcall.Function4 ("lmk" "Bulgaria" 1 6 4) fld[21]=ldcall.Function4 ("lmk" "Armenia" 4 7 3) fld[13]=ldcall.Function4 ("lmk" "Estonia" 8 2 1) fld[14]=ldcall.Function4 ("lmk" "Luxembourg" 4 1 8) fld[17]=ldcall.Function4 ("lmk" "Germany" 2 4 3) fld[18]=ldcall.Function4 ("lmk" "Lithuania" 3 6 4) fld[19]=ldcall.Function4 ("lmk" "Belarus" 4 4 6) fld[20]=ldcall.Function4 ("lmk" "Azerbaijan" 8 4 6) fld[25]=ldcall.Function3 ("lm2" "San_Marino" 1 8) fld[22]=ldcall.Function3 ("lm2" "Poland" 1 4) fld[23]=ldcall.Function3 ("lm2" "Monaco" 4 1) fld[24]=ldcall.Function3 ("lm2" "Liechtenstein" 8 4) fld[26]=ldcall.Function3 ("lm2" "Ukraine" 8 3) For x=0 To Array.GetItemCount (fld)-1 flm[x+1]=ldtext.Split (ldtext.Replace (fld[x] ":" " ") " ") EndFor 'TextWindow.WriteLine (flm[5]) While "true For x= 1 To Array.GetItemCount (flm) For y=1 To 54 LDShapes.BrushColour (rr[y] clm[flm[x][y]]) LDShapes.AnimateOpacity (rr[y] 250 5) program.Delay (25) EndFor Shapes.SetText (ff flm[x][55]) LDShapes.Centre (ff GraphicsWindow.Width/2 GraphicsWindow.Height-55) Program.Delay (2555) EndFor EndWhile End>BKS854.sb< Start>BKV253.sb< loop: TextWindow.Write("Enter any number to find whether it has perfect square root or not : ") num1 = TextWindow.ReadNumber() num = num1 odd = 1 count = 1 While num <> 0 steps[count] = num - odd TextWindow.WriteLine("Step "+count+" : "+num+" - "+odd+" = "+steps[count]) num = steps[count] If num < 0 Then TextWindow.WriteLine("This number does not have perfect square root") Goto loop ElseIf num = 0 Then TextWindow.WriteLine("Yes This number has perfect square root") TextWindow.WriteLine("Sqrt("+num1+") = "+count) Else odd = odd + 2 count = count + 1 EndIf EndWhile Goto loop End>BKV253.sb< Start>BKW100-0.sb< ' Define button clicked ewent to start the subroutine OnButtonClicked Controls.ButtonClicked = OnButtonClicked ' Define the program window to maximum GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Height = Desktop.Height GraphicsWindow.Width = Desktop.Width ' The main program ' Define skip for loop MainLoop = 1 IDWindow = "" ' Loop ending if MainLoop <> 1 While MainLoop = 1 'programcode before show the message ' Define Message Titel = "Message" Message = "Click Button ''Close Message'' " + Text.GetCharacter(13) Message = Message + "to close the Message" XWinPosition = 50 YWinPosition = 150 WinHeight = 240 WinWidth = 210 'ShowMessage ShowMessage() 'programcode after message Program.Delay(1000) 'Wait 1 sec for new popop message window EndWhile 'Mainloop Sub ShowMessage IDProgramWindow = LDWindows.CurrentID If (IDWindow = "") Then IDWindow = LDWindows.Create() EndIf LDWindows.CurrentID = IDWindow 'Set Window LDWindows.Active = IDWindow 'Bring to top GraphicsWindow.Clear() If FirstMessage = "" Then ' Define the button "Close Message" ButtonCloseMessage = Controls.AddButton("Close Message", -100, -100) Controls.HideControl(ButtonCloseMessage) ' Define the multilinetext for the Message MultiLineTextMessage = Controls.AddMultiLineTextBox(-1000, -1000) Controls.HideControl(MultiLineTextMessage) Else FirstMessage = 1 EndIf GraphicsWindow.Left = XWinPosition GraphicsWindow.Top = YWinPosition GraphicsWindow.Height = WinHeight GraphicsWindow.Width = WinWidth GraphicsWindow.Title = Titel GraphicsWindow.CanResize = "False" Controls.Move(MultiLineTextMessage, 5, 5) Controls.SetSize(MultiLineTextMessage, WinWidth - 10, WinHeight - 40) Controls.SetTextBoxText(MultiLineTextMessage, Message) Controls.Move(ButtonCloseMessage, WinWidth / 2 - 50, WinHeight - 30) Controls.ShowControl(MultiLineTextMessage) Controls.ShowControl(ButtonCloseMessage) Wait = 1 While Wait = 1 If OBC = 1 Then OBC = 0 if Controls.LastClickedButton = ButtonCloseMessage Then 'Controls.HideControl(ButtonCloseMessage) 'Controls.HideControl(MultiLineTextMessage) GraphicsWindow.Hide() LDWindows.CurrentID = IDProgramWindow 'Use CurrentID NOT Active to set the current window (Active is just the one on top) Wait = 0 EndIf EndIf EndWhile EndSub Sub OnButtonClicked OBC = 1 EndSub End>BKW100-0.sb< Start>BKW100.sb< ' Define button clicked ewent to start the subroutine OnButtonClicked Controls.ButtonClicked = OnButtonClicked ' Define the program window to maximum GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Height = Desktop.Height GraphicsWindow.Width = Desktop.Width ' The main program ' Define skip for loop MainLoop = 1 ' Loop ending if MainLoop <> 1 While MainLoop = 1 'programcode before show the message ' Define Message Titel = "Message" Message = "Click Button ''Close Message'' " + Text.GetCharacter(13) Message = Message + "to close the Message" XWinPosition = 50 YWinPosition = 150 WinHeight = 240 WinWidth = 210 'ShowMessage ShowMessage() 'programcode after message EndWhile 'Mainloop Sub ShowMessage IDProgramWindow = LDWindows.CurrentID IDWindow = LDWindows.Create() LDWindows.Active = IDWindow If FirstMessage = "" Then ' Define the button "Close Message" ButtonCloseMessage = Controls.AddButton("Close Message", -100, -100) Controls.HideControl(ButtonCloseMessage) ' Define the multilinetext for the Message MultiLineTextMessage = Controls.AddMultiLineTextBox(-1000, -1000) Controls.HideControl(MultiLineTextMessage) Else FirstMessage = 1 EndIf GraphicsWindow.Left = XWinPosition GraphicsWindow.Top = YWinPosition GraphicsWindow.Height = WinHeight GraphicsWindow.Width = WinWidth GraphicsWindow.Title = Titel GraphicsWindow.CanResize = "False" Controls.Move(MultiLineTextMessage, 5, 5) Controls.SetSize(MultiLineTextMessage, WinWidth - 10, WinHeight - 40) Controls.SetTextBoxText(MultiLineTextMessage, Message) Controls.Move(ButtonCloseMessage, WinWidth / 2 - 50, WinHeight - 30) Controls.ShowControl(MultiLineTextMessage) Controls.ShowControl(ButtonCloseMessage) Wait = 1 While Wait = 1 If OBC = 1 Then OBC = 0 if Controls.LastClickedButton = ButtonCloseMessage Then Controls.HideControl(ButtonCloseMessage) Controls.HideControl(MultiLineTextMessage) 'LDWindows.Close(IDWindow) LDWindows.Active = IDProgramWindow EndIf EndIf EndWhile EndSub Sub OnButtonClicked OBC = 1 EndSub End>BKW100.sb< Start>BLD217.sb< GraphicsWindow.Width = 1288 GraphicsWindow.Height = 666 GraphicsWindow.BackgroundColor = "skyblue" ' Panda ' scale = 2.8 x0 = 150 * scale y0 = 50 * scale GraphicsWindow.PenWidth = 0 GraphicsWindow.PenWidth = 1 ' Ears GraphicsWindow.BrushColor = "Bisque" oEarLeft= Shapes.AddEllipse(20 * scale, 25 * scale) Shapes.Move(oEarLeft, x0, y0) Shapes.Rotate(oEarLeft, -45) oEarRight = Shapes.AddEllipse(20 * scale, 25 * scale) Shapes.Move(oEarRight, x0 + 60 * scale, y0 + 22) Shapes.Rotate(oEarRight, 45) ' Chest GraphicsWindow.BrushColor = "darkslategray" oChest = Shapes.AddEllipse(40 * scale, 25 * scale) Shapes.Move(oChest, x0 + 45, y0 + 68 * scale) ' Body GraphicsWindow.BrushColor = "Bisque" oBody = Shapes.AddEllipse(60 * scale, 45 * scale) Shapes.Move(oBody, x0 + 6 * scale, y0 + 80 * scale) ' Legs GraphicsWindow.BrushColor = "darkslategray" oLegLeft = Shapes.AddEllipse(30 * scale, 15 * scale) Shapes.Move(oLegLeft, x0 + 5 * scale, y0 + 128 * scale) Shapes.Rotate(oLegLeft, 120) oLegRight = Shapes.AddEllipse(30 * scale, 15 * scale) Shapes.Move(oLegRight, x0 + 30 * scale, y0 + 128 * scale) Shapes.Rotate(oLegRight, -80) ' Feets GraphicsWindow.BrushColor = "darkslategray" oFootLeft = Shapes.AddEllipse(25 * scale, 15 * scale) Shapes.Move(oFootLeft, x0 - 10 * scale, y0 + 140.5 * scale) Shapes.Rotate(oFootLeft, 5) oFootRight = Shapes.AddEllipse(25 * scale, 15 * scale) Shapes.Move(oFootRight, x0 + 22 * scale, y0 + 145.5 * scale) Shapes.Rotate(oFootRight, -5) ' Sholders GraphicsWindow.BrushColor = "darkslategray" oSholderLeft = Shapes.AddEllipse(40 * scale, 15 * scale) Shapes.Move(oSholderLeft, x0 - 10 * scale, y0 + 76 * scale) Shapes.Rotate(oSholderLeft, -60) oSholderRight = Shapes.AddEllipse(45 * scale, 15 * scale) Shapes.Move(oSholderRight, x0 + 40 * scale, y0 + 76 * scale) Shapes.Rotate(oSholderRight, 60) ' Arms GraphicsWindow.BrushColor = "darkslategray" oArmLeft = Shapes.AddEllipse(20 * scale, 10 * scale) Shapes.Move(oArmLeft, x0 - 15 * scale, y0 + 94.5 * scale) Shapes.Rotate(oArmLeft, 20) oArmRight = Shapes.AddEllipse(20 * scale, 10 * scale) Shapes.Move(oArmRight, x0 + 68 * scale, y0 + 94.5 * scale) Shapes.Rotate(oArmRight, -20) ' Face GraphicsWindow.BrushColor = "bisque" oFace = Shapes.AddEllipse(75 * scale, 75 * scale) Shapes.Move(oFace, x0 + scale, y0) ' Nose GraphicsWindow.BrushColor = "darkslategray" GraphicsWindow.pencolor = "red" GraphicsWindow.penwidth = 4 oNose = Shapes.AddTriangle(0, 0, 8 * scale, 0, 4 * scale, 3 * scale) Shapes.Move(oNose, x0 + 16 * scale, y0 + 22 * scale) ' Eyes GraphicsWindow.BrushColor = "darkslategray" GraphicsWindow.PenColor = "red"'"DimGray" GraphicsWindow.PenWidth = 2 oEyeLeft = Shapes.AddEllipse(11 * scale, 7 * scale) Shapes.Move(oEyeLeft, x0 + 7 * scale, y0 + 12 * scale) Shapes.Rotate(oEyeLeft, -60) oEyeRight = Shapes.AddEllipse(11 * scale, 7 * scale) Shapes.Move(oEyeRight, x0 + 22 * scale, y0 + 12 * scale) Shapes.Rotate(oEyeRight, 60) GraphicsWindow.PenWidth = 2 GraphicsWindow.BrushColor = "snow" GraphicsWindow.PenColor = "red"'"DimGray" GraphicsWindow.PenWidth = 2 oEyeLeft2 = Shapes.AddEllipse(4 * scale, 4 * scale) Shapes.Move(oEyeLeft2, x0 + 12 * scale, y0 + 11 * scale) oEyeRight2 = Shapes.AddEllipse(4 * scale, 4 * scale) Shapes.Move(oEyeRight2, x0 + 24 * scale, y0 + 11 * scale) ' Mouth GraphicsWindow.PenColor = "darkslategray" GraphicsWindow.PenWidth = 2 oMouthLeft = Shapes.AddLine(0, 1.5 * scale, 4 * scale, 0) Shapes.Move(oMouthLeft, x0 + 16 * scale, y0 + 26.5 * scale) oMouthRight = Shapes.AddLine(0, 0, 4 * scale, 1.5 * scale) Shapes.Move(oMouthRight, x0 + 20 * scale, y0 + 26.5 * scale) ' Blink start While "True" Program.Delay(2900) Shapes.HideShape(oEyeLeft2) Shapes.HideShape(oEyeRight2) Program.Delay(100) Shapes.ShowShape(oEyeLeft2) Shapes.ShowShape(oEyeRight2) EndWhile End>BLD217.sb< Start>BLF563.sb< ' SmallBasic Version 1.0 ' Funktion: TWMaximize ' Autor: Pappa Lapub ' Herkunft: https://social.msdn.microsoft.com/Forums/en-US/71121904-5997-4bd3-bbcf-e12dffe9d01d/textwindow ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Kommentar: ' ' Variablen: ' ' -------------------------------------------------------------------------------- lf = Text.GetCharacter(10) qu = Text.GetCharacter(34) TextWindow.Show() CSExt() LDInline.Call("TW.Maximize", "") TextWindow.WriteLine("Hallo TW max" +lf) ' ////////// SUB \\\\\\\\\\ Sub CSExt cs = "using System;" cs = cs+"using System.Diagnostics;" cs = cs+"using System.Runtime.InteropServices;" cs = cs+"using System.Threading;" cs = cs+"public class TW {" cs = cs+"[DllImport(" +qu+ "user32.dll" +qu+ ")]" cs = cs+"static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);" cs = cs+"public static void Maximize() {" cs = cs+"Process twProcess = Process.GetCurrentProcess();" cs = cs+"ShowWindow(twProcess.MainWindowHandle, 3); } }" res = LDInline.IncludeCS(cs, "","") If res <> "SUCCESS" Then TextWindow.WriteLine(res+ " (Virt. Compilation failed). ABORTED!" +lf) TextWindow.Pause() Program.End() EndIf EndSub End>BLF563.sb< Start>BLK714.sb< GraphicsWindow.BackgroundColor = "Gainsboro" GraphicsWindow.PenColor = "Ivory" GraphicsWindow.BrushColor = "LightCyan" hGap = 30 vGap = 30 dropLength = 45 columns = GraphicsWindow.Width / hGap rows = GraphicsWindow.Height / (dropLength + vGap) For r = 1 To rows For c = 1 To columns dCount = dCount + 1 X = c * hGap Y = (r-1) * (vGap + dropLength) + Math.GetRandomNumber(60) drop[dCount] = Shapes.AddEllipse(5, dropLength- Math.GetRandomNumber(dropLength/2)) Shapes.Rotate(drop[dCount] 10) Shapes.Move(drop[dCount], X, Y) EndFor EndFor GraphicsWindow.ShowMessage("You just added " + dCount + " rain drops", "SETUP COMPLETE") While 0=0 For i = 1 To dCount If Shapes.GetTop(drop[i]) > GraphicsWindow.Height Then Shapes.Move(drop[i], Shapes.GetLeft(drop[i]), 0) EndIf If Shapes.GetLeft(drop[i]) < 1 Then Shapes.Move(drop[i], GraphicsWindow.Width - Math.GetRandomNumber(10), Shapes.GetTop(drop[i])) EndIf EndFor For i = 1 To dCount Shapes.Move(drop[i] Shapes.GetLeft(drop[i])-1, Shapes.GetTop(drop[i]) + Math.GetRandomNumber(50)+10) EndFor Program.Delay(1) EndWhile End>BLK714.sb< Start>BLM252.sb< targetTotal = 489.69 iterMax = 1000 valNum = 37 For i = 1 To valNum ' The following line could be harmful and has been automatically commented. ' val[i] = File.ReadLine(Program.Directory+"\values.txt",i) EndFor 'Assume value can only be used once For incNum = 1 To valNum-1 'Included numbers inc = "" incTotal = 0 For i = 1 To incNum inc[i] = val[i] incTotal = incTotal+inc[i] EndFor incDev = Math.Abs(incTotal-targetTotal) 'Excluded numbers exc = "" excNum = valNum-incNum For i = incNum+1 To valNum exc[i-incNum] = val[i] EndFor swap = 1 iter = 0 While (iter < iterMax And incDev > 0 And swap = 1) iter = iter + 1 swap = 0 'Test all combinations of included and excluded numbers to see if we can do better For i = 1 To incNum For j = 1 To excNum newDev = Math.Abs(incTotal-inc[i]+exc[j]-targetTotal) If (newDev < incDev) Then incTotal = incTotal-inc[i]+exc[j] incDev = newDev swap = 1 temp = inc[i] inc[i] = exc[j] exc[j] = temp EndIf EndFor EndFor EndWhile 'Output the results TextWindow.ForegroundColor = "Red" TextWindow.WriteLine("Best answer for "+incNum+" numbers in "+iter+" iterations is "+incTotal+" deviation "+(incTotal-targetTotal)) TextWindow.ForegroundColor = "White" For i = 1 To incNum TextWindow.Write(inc[i]+" ") EndFor TextWindow.WriteLine("") EndFor End>BLM252.sb< Start>BMC418.sb< GraphicsWindow.Width = 924 GraphicsWindow.Height = 768 korrx=-36 Path = "http://smallbasic.com/drop/soko" image[0] = ImageList.LoadImage( Path + "/sokocute00.png") image[1] = ImageList.LoadImage( Path + "/sokocutess.png") image[2] = ImageList.LoadImage( Path + "/sokocutegg.png") For x=3 To 7 image[x] = ImageList.LoadImage( Path + "/sokocute0"+x+".png") EndFor background = ImageList.LoadImage( Path + "/sokocuteff.png") image["A"] = ImageList.LoadImage( Path + "/sokocute0a.png") image["B"] = ImageList.LoadImage( Path + "/sokocute0b.png") GraphicsWindow.DrawImage(background, 0, 0) stage=0 initlevels() levelload() Sub LevelLoad cryst = 0 posx = 4 posy = 4 moves = 0 For i = 0 To 15 For p = 1 To Text.GetLength(block[stage][i]) bck = Text.GetSubText(block[stage][i], p, 1) If bck = "X" Then posy = i posx = p-1 bck = 0 block[stage][i]=text.getsubtext(block[stage][i] 1 p-1)+"0"+text.getsubtexttoend(block[stage][i] p+1) EndIf If bck = 2 Then ground[i][p-1] = 0 ElseIf bck = "C" Then 'crystal on gras' ground[i][p-1] = "A" ElseIf bck = "D" Then 'crystal on wood' ground[i][p-1] = "B" Else ground[i][p-1] = bck EndIf EndFor EndFor For i = 0 To 15'------------load the water first' For p = 1 To Text.GetLength(block[stage][i]) bck = Text.GetSubText(block[stage][i], p, 1) If bck = 3 Then lsh[i][p-1] = Shapes.AddImage(image[bck]) Shapes.move(lsh[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0) EndIf EndFor EndFor For i = 0 To 15 For p = 1 To Text.GetLength(block[stage][i]) bck = Text.GetSubText(block[stage][i], p, 1) If bck = "X" Then posy = i posx = p-1 bck = 0 ElseIf bck = "Y" Then posy = i posx = p-1 bck = "A" ElseIf bck = "Z" Then posy = i posx = p-1 bck = "B" EndIf If bck = 2 Then ground[i][p-1] = 0 ElseIf bck = "C" Then ground[i][p-1] = "A" ElseIf bck = "D" Then ground[i][p-1] = "B" Else ground[i][p-1] = bck EndIf If bck = "C" Then level[i][p-1] = 2 ElseIf bck = "D" Then level[i][p-1] = 2 Else level[i][p-1] = bck EndIf If bck = "C" Then 'crystal on gras' lsh[i][p-1] = Shapes.AddImage(image["A"]) Shapes.move(lsh[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0) ElseIf bck = "D" Then 'crystal on wood' lsh[i][p-1] = Shapes.AddImage(image["B"]) Shapes.move(lsh[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0) ElseIf bck < 2 Then lsh[i][p-1] = Shapes.AddImage(image[bck]) Shapes.move(lsh[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0) ElseIf bck = 2 Then lsh[i][p-1] = Shapes.AddImage(image["0"]) Shapes.move(lsh[i][p-1], (p-1) * 50 + korrx, (i) * 40 - 0) EndIf EndFor EndFor For i = 0 To 15 For p = 1 To Text.GetLength(block[stage][i]) blockcode = Text.GetSubText(block[stage][i], p, 1) If (blockcode = 2) Then crystalimg[cryst] = Shapes.AddImage(image[2]) chestarray[i][p-1] = cryst Shapes.move(crystalimg[cryst] , (p-1) * 50 + korrx, (i) * 40 - 0) cryst = cryst + 1 EndIf EndFor EndFor player1 = Shapes.AddImage(Path + "/sokocutep2.png") Shapes.Move(player1, (posx) * 50 + korrx, (posy) * 40 - 0) For i = 0 To 15'---------------------------load the walls' For p = 1 To Text.GetLength(block[stage][i]) bck = Text.GetSubText(block[stage][i], p, 1) If bck >= 4 Then lsh[i][p-1] = Shapes.AddImage(image[bck]) Shapes.move(lsh[i][p-1], (p-1) * 50 + korrx, i * 40 ) EndIf EndFor EndFor player2 = Shapes.AddImage(Path + "/sokocutep1.png") Shapes.Move(player2, (posx) * 50 + korrx, (posy) * 40 - 0) xplayer = Shapes.GetLeft(player1) yplayer = Shapes.GetTop(player1) TextWindow.WriteLine("STAGE 1") TextWindow.WriteLine("SB online Soko v0.1") TextWindow.WriteLine("Click here To start") GraphicsWindow.KeyDown=GGG GraphicsWindow.KeyUp=uuu posx=13 posy=10 kuu="true" EndSub Sub uuu kuu="true" EndSub Sub GGG ll=text.ConvertToLowerCase( GraphicsWindow.LastKey) If kuu Then If ll="%" Then If Text.GetSubText(block[stage][posy], posx-1, 1)<3 Then xplayer=xplayer-50 posx=posx-1 EndIf ElseIf ll="'" Then If Text.GetSubText(block[stage][posy], posx+1, 1)<3 Then xplayer=xplayer+50 posx=posx+1 EndIf ElseIf ll="&" Then If Text.GetSubText(block[stage][posy-1], posx, 1)<3 Then yplayer=yplayer-40 posy=posy-1 EndIf ElseIf ll="(" Then If Text.GetSubText(block[stage][posy+1], posx, 1)<3 Then yplayer=yplayer+40 posy=posy+1 EndIf EndIf kuu="false" EndIf Shapes.animate(player1, xplayer, yplayer 255) Shapes.animate(player2, xplayer, yplayer 255) EndSub Sub InitLevels block[0][0] ="...................." block[0][1] ="...................." block[0][2] ="...................." block[0][3] =".....66666.........." block[0][4] =".....60006.........." block[0][5] =".....62006.........." block[0][6] ="...66600266........." block[0][7] ="...60020206........." block[0][8] =".6660606606AA555555." block[0][9] =".600060660666700115." block[0][10]=".60200200000X000115." block[0][11]=".666660666066700115." block[0][12]=".....60000066555555." block[0][13]=".....6666666........" block[0][14]="...................." block[0][15]="...................." EndSub End>BMC418.sb< Start>BMC859.sb< ' solving quadratic equation ' by yvan leduc, March 4th, 2016, program no: FTN740, ' initiliaze mid_blue=GraphicsWindow.GetColorFromRGB (0,0,175) salmon=GraphicsWindow.GetColorFromRGB (255,200,100) mid_green=GraphicsWindow.GetColorFromRGB (0,200,0) mid_red=GraphicsWindow.GetColorFromRGB (200,0,0) start() Sub start ' construction des fenetres et boites GraphicsWindow.Clear() GraphicsWindow.Title = "solving quadratic equation" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height = 768 GraphicsWindow.Width = 1366 GraphicsWindow.BackgroundColor = salmon dessin() GraphicsWindow.FontSize = 45 GraphicsWindow.BrushColor=mid_blue GraphicsWindow.DrawText(50, 10, "Solving Quadratic Equation") GraphicsWindow.FontSize = 18 GraphicsWindow.BrushColor="blue" GraphicsWindow.DrawboundText(700, 50,400, "fill the boxes with value and press compute button") GraphicsWindow.DrawboundText(700, 100,400, "try: a = 3 b = -5 c = -8") buttonclicked = 0 GraphicsWindow.FontSize = 18 ' formula ax2+bx+c=0 ' formula x= -b +- racine de b2-4ac/2a ' enter the value for a GraphicsWindow.BrushColor = mid_blue GraphicsWindow.DrawBoundText (10,150,300," Enter the value for 'a' ") box1 = Controls.AddTextBox(300, 150) Controls.setTextBoxtext(box1,"") 'enter the value for b GraphicsWindow.BrushColor = mid_green GraphicsWindow.DrawBoundText (10,200,300," Enter the value for 'b' ") box2 = Controls.AddTextBox(300, 200) Controls.setTextBoxtext(box2,"") 'enter the value for c GraphicsWindow.BrushColor = mid_red GraphicsWindow.DrawBoundText (10,250,300," Enter the value for 'c' ") box3= Controls.AddTextBox(300, 250) Controls.setTextBoxtext(box3,"") endsub GraphicsWindow.FontSize = 25 GraphicsWindow.BrushColor = "red" button = Controls.AddButton("Compute", 510, 175) GraphicsWindow.FontSize = 18 Controls.ButtonClicked = Click Sub Click If Controls.LastClickedButton = button Then a=Controls.getTextBoxText(box1) b=Controls.getTextBoxText(box2) c=Controls.getTextBoxText(box3) ' calculate the positive value for x delta=(Math.Power(b,2))-(4*a*c) If delta < 0 Then GraphicsWindow.FontSize =35 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText (410,450,"quadratic irrationnal") GraphicsWindow.FontSize =35 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText (410,500,"value for delta is negative") Program.Delay(2000) EndIf x1=Math.SquareRoot(delta) x2=-b+x1 x3=x2/(2*a) 'positive value for x GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize = 18 GraphicsWindow.DrawBoundText (10,300,300," ROOTS Value for +x ") value1=Controls.AddTextBox(300, 300) Controls.setTextBoxText(value1,x3) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = 22 GraphicsWindow.DrawText (100,450,"Value for delta = "+delta) ' calculate the negative value for x delta=(Math.Power(b,2))-(4*a*c) x4=Math.SquareRoot(delta) x5=-b-x4 x6=x5/(2*a) 'positive value for x GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = 18 GraphicsWindow.DrawBoundText (10,330,300," ROOTS Value for -x ") value2=Controls.AddTextBox(300, 330) Controls.setTextBoxText(value2,x6) buttonclicked = 1 EndIf EndSub ' loop until compute button is press buttonloop: If buttonclicked = 0 Then Goto buttonloop Else buttonclicked = 0 EndIf ' end of program Sub dessin ' pour dessiner la formule quadratique part[0]="x = " part[1]="-b" part[2]="±" part[3]="√" part[4]="b2-4ac" part[5]="_____________" part[6]="2a" GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize= 32 GraphicsWindow.DrawText( 500,320,part[0]) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize= 26 GraphicsWindow.DrawText( 570,300,part[1]) GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize= 24 GraphicsWindow.DrawText( 620,300,part[2]) GraphicsWindow.BrushColor = "white" GraphicsWindow.FontSize= 40 GraphicsWindow.DrawText( 670,280,part[3]) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize= 26 GraphicsWindow.DrawText( 720,300,part[4]) GraphicsWindow.BrushColor = "black" GraphicsWindow.FontSize= 26 GraphicsWindow.DrawText( 570,320,part[5]) GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize= 26 GraphicsWindow.DrawText( 620,350,part[6]) EndSub End>BMC859.sb< Start>BMF105.sb< GraphicsWindow.BackgroundColor = "Cyan" GraphicsWindow.Height = 230 GraphicsWindow.Width = 600 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 textbox = Controls.AddTextBox(0 0) 'add Shapes.Move(textbox 10 50) 'position then you can Get its position width = GraphicsWindow.Width - Shapes.GetLeft(textbox) *2 height = 40 Controls.SetSize(textbox width height) Controls.SetTextBoxText(textbox "Type Here") While 0=0 mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY txt = Controls.GetTextBoxText(textbox) If mseX > 10 And mseY > 50 And mseX < 10 + width And mseY < 50 + height And txt = "Type Here" And Mouse.IsLeftButtonDown Then Controls.SetTextBoxText(textbox "") EndIf Program.Delay(100) EndWhile End>BMF105.sb< Start>BMK418.sb< ' SmallBasic Version 1.2 ' Program: AlbumCover ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/50dd18d8-67c4-48c2-887b-54d299e0bbde/challenge-of-the-month-december-2017 ' ImportURL: http://smallbasic.com/program/? ' Extension: --- ' Comment: https://soundcloud.com/cantomamusic ' https://lengrecords.bandcamp.com/album/out-of-town ' https://lengrecords.bandcamp.com/album/out-of-town-the-remixes ' https://soundcloud.com/lengrecords ' Variables: ' ToDo: -> Polygons: 4 + 2*(n-1) , n: 1 .. nC '=============================================================================== ' Definables: w = 300 ' = gw/2, centX=centY '' adjust size bAlb = " " ' "True" '' init. Album view? ' No settings below... c = "1=#F25A2A;2=#ED413D;3=#EA212F;4=#8E257E;5=#5A2B87;6=#293386;" c = c +"7=#0D71B4;8=#27A8DE;9=#70CCD9;10=#B2E2E6;11=#CDEFF1;" nC = Array.GetItemCount(c) For n = 1 To nC c2[n] = c[nC-n+1] EndFor 'min = 4 'max = min + 2*(nC-1) tit = "Cantoma Out of town " ' on 'Leng' rx = "The Remixes" lf = Text.GetCharacter(10) px0 = 0.3 * w py0 = 0.17 * w r0 = w - px0 d = 0.7 * w / nC Not = "True= ; =True;" GraphicsWindow.CanResize = "" GraphicsWindow.Width = 2 * w GraphicsWindow.Height = 2 * w GraphicsWindow.Top = 20 GraphicsWindow.Left = Desktop.Width/2 - w GraphicsWindow.FontBold = "" GraphicsWindow.FontSize = 22 GraphicsWindow.FontName = "Liberation Sans" ' Mono" ' ?? 'Sound.Play(url) OnMouseDown() GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.KeyDown = OnKeyDown ' ////////// EVENTs \\\\\\\\\\ Sub OnMouseDown Reset() If bAlb Then Remixes() 'GraphicsWindow.DrawResizedImage("http://f4.bcbits.com/img/a2659570727_2.jpg", 0,0, 2*w,2*w) ' 350x350 '' http://f4.bcbits.com/img/a2659570727_10.jpg ' 1200x1200 Else Album() 'GraphicsWindow.DrawResizedImage("http://f4.bcbits.com/img/a0112188506_2.jpg", 0,0, 2*w,2*w) ' 350x350 '' http://f4.bcbits.com/img/a0112188506_10.jpg ' 1200x1200 EndIf EndSub Sub OnKeyDown If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf EndSub ' ////////// SUBs \\\\\\\\\\ Sub Album GraphicsWindow.BackgroundColor = "White" For n = 1 To nC GraphicsWindow.BrushColor = c2[n] GraphicsWindow.FillEllipse(px,py, 2*r,2*r) px = px + d py = py + d r = r - d EndFor GraphicsWindow.BrushColor = "#3A3A3A" GraphicsWindow.DrawText(w-140,1.7*w, Text.ConvertToUpperCase(tit)) GraphicsWindow.Title = tit 'LDGraphicsWindow.Icon = "C:\Program Files (x86)\Microsoft\Small Basic\Projects\Icons\SBRemixes.ico" EndSub Sub Remixes GraphicsWindow.BackgroundColor = "Black" For n = 1 To nC GraphicsWindow.BrushColor = c[n] GraphicsWindow.FillEllipse(px,py, 2*r,2*r) px = px + d py = py + d r = r - d EndFor GraphicsWindow.BrushColor = "#667475" GraphicsWindow.DrawText(w-140,1.7*w, Text.ConvertToUpperCase(tit)) GraphicsWindow.BrushColor = "#515257" GraphicsWindow.DrawText(w-80,1.8*w, Text.ConvertToUpperCase(rx)) GraphicsWindow.Title = tit + rx 'LDGraphicsWindow.Icon = "C:\Program Files (x86)\Microsoft\Small Basic\Projects\Icons\SBAlbum.ico" EndSub Sub Reset GraphicsWindow.Clear() px = px0 py = py0 r = r0 bAlb = Not[bAlb] EndSub End>BMK418.sb< Start>BMM203.sb< GraphicsWindow.Width = GraphicsWindow.Height * (16/9) diameter = 60 Y = GraphicsWindow.Height - diameter ball = Shapes.AddEllipse(diameter, diameter) dY = 0 powerBurst = 7 GraphicsWindow.DrawText(10, 10, "Press to Jump") GraphicsWindow.KeyDown = OnKeyDown While "True" 'Process key Event & Update Program If keyPressed = "Space" Then jumping = "True" keyPressed = "" EndIf 'Update Jump If jumping Then Jump() EndIf 'Update X & Y X = X + 1 Y = Y - dY 'Update Frame Shapes.Move(ball, X, Y) 'Frame Rate Program.Delay(Math.Max(0, 20 - (Clock.ElapsedMilliseconds - start))) '50 fps Else Delay(0) & any lag start = Clock.ElapsedMilliseconds EndWhile Sub OnKeyDown keyPressed = GraphicsWindow.LastKey EndSub Sub Jump If dY = 0 And Y = GraphicsWindow.Height - diameter Then dY = powerBurst EndIf dY = dY - 0.1 If dY = -powerBurst Then dY = 0 jumping = "False" EndIf EndSub End>BMM203.sb< Start>BMN061.sb< 'Challenge of the Month - January 2012 'Easy Challenge 1 'Write a program to write out the current date and time in this format: '20:06:34 Saturday 31/12/2011 gw = 400 gh = 100 GraphicsWindow.Hide() GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) /2 GraphicsWindow.Top = (Desktop.Height - gh) /2 GraphicsWindow.Title = "Date & Time" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Show() GraphicsWindow.KeyUp = ExitProgram Sub ExitProgram If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf EndSub While "True" If Clock.Hour >= 12 Then status = "PM" Else status = "AM" EndIf GraphicsWindow.BrushColor = "Red" GraphicsWindow.FontSize = 20 If Clock.Hour < 10 Then currentHour = Text.Append(0, Clock.Hour) EndIf If Clock.Hour >= 10 Then currentHour = Clock.Hour EndIf If Clock.Minute < 10 Then currentMinute = Text.Append(0, Clock.Minute) EndIf If Clock.Minute >= 10 Then currentMinute = Clock.Minute EndIf If Clock.Second < 10 Then currentSecond = Text.Append(0, Clock.Second) EndIf If Clock.Second >= 10 Then currentSecond = Clock.Second EndIf GraphicsWindow.DrawText(15, 35, currentHour + ":" + currentMinute + ":" + currentSecond + " " + status + " : " + Clock.WeekDay + " : " + Clock.Date) Program.Delay(1000) GraphicsWindow.Clear() EndWhile End>BMN061.sb< Start>BMR546.sb< GraphicsWindow.BackgroundColor="teal" GraphicsWindow.Title = "Pascal's Triangle 3D" GraphicsWindow.BackgroundColor="darkblue gw=1200 gh=900 level = 12 Init() GraphicsWindow.width=gw GraphicsWindow.Height=gh GraphicsWindow.Top=0 GraphicsWindow.Left=0 view3D = LD3DView.AddView(gw,gh,"True") LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10) LD3DView.AddDirectionalLight (view3D,"white" ,-1,-1,-1) LD3DView.AutoControl2 (1 1) For j = 1 To level _x = x For i = 1 To j If (i = 1) Or (i = j) Then p[j][i] = 1 Else p[j][i] = p[j - 1][i - 1] + p[j - 1][i] EndIf h = fs * 1.1 w = Text.GetLength(p[j][i]) * fs * 0.6 cc=LDColours.HSLtoRGB( (p[j][i]/460)*290 1 .5) hh=math.SquareRoot(p[j][i]/3) ss=LD3DView.AddCone(view3D .5 .5 hh 12 cc "D") LD3DView.TranslateGeometry(view3D ss x 0, -y) x = x + 2 * dx EndFor x = _x - dx y = y + dy EndFor Sub Init dy = 1 dx = 1 y = dy x =1 r = dy * 0.5 fs = r * 0.9 EndSub End>BMR546.sb< Start>BMW607.sb< GraphicsWindow.Width =1100 GraphicsWindow.Height =800 GraphicsWindow.FillEllipse (1 1 1 1) LDGraphicsWindow.BackgroundBrush(LDShapes.BrushGradient ("1=darkblue;2=black" "V")) dst="1=1e1a423b2a125bf2e1a419b2a115bf3e1a416b2a111bf4e1a410b2a103bf5e1a407b2a99bf6e1a399b2a93bf7e1a396b2a89bf8e1a387b2a84bf9e1a383b2a81bf10e1a375b2a76bf11e1a370b2a74bf12e1a361b2a69bf13e1a357b2a67bf14e1a347b2a64bf15e1a342b2a62bf16e1a333b2a59bf17e1a328b2a58bf18e1a318b2a56bf19e1a313b2a55bf20e1a303b2a56bf21e1a299b2a58bf22e1a290b2a62bf23e1a286b2a65bf24e1a277b2a70bf25e1a273b2a73bf26e1a265b2a79bf27e1a261b2a82bf28e1a253b2a87bf29e1a248b2a90bf30e1a240b2a96bf31e1a236b2a99bf32e1a228b2a104bf33e1a224b2a107bf34e1a215b2a113bf35e1a211b2a115bf36e1a203b2a121bf37e1a199b2a123bf38e1a190b2a129bf39e1a186b2a131bf40e1a178b2a137bf41e1a173b2a139bf42e1a165b2a145bf43e1a161b2a148bf44e1a156b2a157bf45e1a154b2a162bf46e1a151b2a171bf47e1a150b2a176bf48e1a148b2a186bf49e1a147b2a191bf50e1a145b2a201bf51e1a145b2a205bf52e1a144b2a215bf53e1a144b2a220bf54e1a143b2a230bf55e1a143b2a235bf56e1a144b2a245bf57e1a144b2a250bf58e1a145b2a260bf59e1a146b2a265bf60e1a148b2a275bf61e1a150b2a280bf62e1a153b2a289bf63e1a155b2a294bf64e1a159b2a303bf65e1a161b2a307bf66e1a167b2a316bf67e1a170b2a320bf68e1a177b2a327bf69e1a180b2a331bf70e1a188b2a337bf71e1a192b2a340bf72e1a200b2a346bf73e1a204b2a348bf74e1a214b2a352bf75e1a218b2a354bf76e1a228b2a357bf77e1a233b2a358bf78e1a243b2a359bf79e1a248b2a360bf80e1a258b2a360bf81e1a263b2a360bf82e1a273b2a359bf83e1a277b2a357bf84e1a287b2a356bf85e1a292b2a354bf86e1a302b2a351bf87e1a306b2a349bf88e1a315b2a345bf89e1a320b2a343bf90e1a329b2a339bf91e1a333b2a336bf92e1a342b2a331bf93e1a346b2a328bf94e1a354b2a323bf95e1a358b2a320bf96e1a366b2a314bf97e1a370b2a310bf98e1a377b2a304bf99e1a381b2a300bf100e1a388b2a294bf101e1a392b2a290bf102e1a399b2a283bf103e1a402b2a279bf104e1a409b2a271bf105e1a412b2a268bf106e1a418b2a259bf107e1a420b2a255bf108e1a426b2a247bf109e1a428b2a242bf110e1a433b2a234bf111e1a435b2a229bf112e1a438b2a220bf113e1a440b2a215bf114e1a442b2a205bf115e1a443b2a200bf116e1a444b2a190bf117e1a444b2a185bf118e1a444b2a175bf119e1a444b2a170bf120e1a442b2a160bf121e1a441b2a156bf122e1a438b2a146bf123e1a436b2a141bf;2=1e1a226b2a279bf2e1a233b2a272bf3e1a237b2a270bf4e1a245b2a264bf5e1a248b2a260bf6e1a254b2a252bf7e1a257b2a248bf8e1a262b2a239bf9e1a263b2a234bf10e1a265b2a224bf11e1a266b2a219bf12e1a266b2a209bf13e1a267b2a204bf14e1a267b2a194bf15e1a267b2a189bf16e1a267b2a179bf17e1a267b2a174bf18e1a267b2a164bf19e1a267b2a159bf20e1a267b2a149bf21e1a267b2a144bf22e1a267b2a134bf23e1a267b2a129bf24e1a267b2a119bf25e1a267b2a114bf26e1a274b2a109bf27e1a279b2a111bf28e1a279b2a121bf29e1a277b2a125bf30e1a275b2a135bf31e1a275b2a140bf32e1a274b2a150bf33e1a274b2a155bf34e1a274b2a165bf35e1a274b2a170bf36e1a274b2a180bf37e1a274b2a185bf38e1a274b2a195bf39e1a274b2a200bf40e1a274b2a210bf41e1a274b2a215bf42e1a274b2a225bf43e1a274b2a230bf44e1a274b2a240bf45e1a274b2a245bf46e1a274b2a255bf47e1a274b2a260bf48e1a274b2a270bf49e1a274b2a275bf50e1a274b2a285bf51e1a274b2a290bf52e1a274b2a300bf53e1a274b2a305bf54e1a267b2a311bf55e1a262b2a309bf56e1a253b2a305bf57e1a248b2a303bf58e1a240b2a298bf59e1a236b2a295bf60e1a229b2a287bf61e1a231b2a282bf62e1a239b2a276bf63e1a243b2a273bf64e1a250b2a267bf65e1a254b2a263bf66e1a260b2a255bf67e1a263b2a251bf68e1a267b2a242bf69e1a270b2a238bf70e1a279b2a236bf71e1a283b2a239bf72e1a292b2a241bf73e1a297b2a240bf74e1a307b2a236bf75e1a311b2a234bf76e1a320b2a230bf77e1a325b2a229bf78e1a335b2a227bf79e1a340b2a227bf80e1a350b2a228bf81e1a355b2a230bf82e1a364b2a234bf83e1a368b2a237bf84e1a375b2a244bf85e1a375b2a249bf86e1a372b2a258bf87e1a369b2a263bf88e1a364b2a271bf89e1a361b2a275bf90e1a354b2a283bf91e1a351b2a286bf92e1a343b2a293bf93e1a339b2a296bf94e1a331b2a301bf95e1a327b2a304bf96e1a317b2a308bf97e1a313b2a309bf98e1a303b2a311bf99e1a298b2a310bf100e1a295b2a302bf101e1a295b2a297bf102e1a295b2a287bf103e1a296b2a282bf104e1a296b2a272bf105e1a296b2a267bf106e1a296b2a257bf107e1a296b2a252bf108e1a304b2a246bf109e1a309b2a243bf110e1a318b2a239bf111e1a323b2a238bf112e1a332b2a235bf113e1a337b2a235bf114e1a347b2a236bf115e1a352b2a238bf116e1a361b2a243bf117e1a364b2a246bf118e1a362b2a256bf119e1a360b2a261bf120e1a354b2a269bf121e1a351b2a273bf122e1a344b2a280bf123e1a341b2a284bf124e1a333b2a290bf125e1a329b2a292bf126e1a320b2a297bf127e1a315b2a299bf128e1a305b2a301bf129e1a301b2a299bf130e1a294b2a293bf131e1a296b2a288bf132e1a300b2a279bf133e1a301b2a274bf134e1a302b2a264bf135e1a304b2a259bf136e1a310b2a252bf137e1a315b2a249bf138e1a324b2a245bf139e1a329b2a244bf140e1a339b2a244bf141e1a343b2a245bf142e1a352b2a249bf143e1a352b2a254bf144e1a347b2a263bf145e1a344b2a267bf146e1a338b2a275bf147e1a334b2a278bf148e1a326b2a284bf149e1a322b2a286bf150e1a312b2a291bf151e1a307b2a290bf152e1a300b2a284bf153e1a298b2a279bf154e1a303b2a271bf155e1a306b2a267bf156e1a313b2a260bf157e1a317b2a257bf158e1a326b2a253bf159e1a331b2a252bf160e1a341b2a254bf161e1a345b2a256bf;3=1e1a292b2a190bf2e1a294b2a180bf3e1a298b2a177bf4e1a308b2a180bf5e1a312b2a182bf6e1a322b2a184bf7e1a327b2a185bf8e1a337b2a185bf9e1a342b2a185bf10e1a352b2a183bf11e1a356b2a182bf12e1a366b2a179bf13e1a370b2a176bf14e1a379b2a171bf15e1a384b2a172bf16e1a388b2a181bf17e1a389b2a186bf18e1a391b2a195bf19e1a391b2a200bf20e1a390b2a210bf21e1a389b2a215bf22e1a386b2a224bf23e1a381b2a225bf24e1a373b2a219bf25e1a369b2a217bf26e1a360b2a212bf27e1a355b2a211bf28e1a345b2a209bf29e1a340b2a209bf30e1a330b2a210bf31e1a325b2a211bf32e1a315b2a213bf33e1a311b2a215bf34e1a301b2a219bf35e1a297b2a220bf36e1a291b2a213bf37e1a292b2a208bf38e1a295b2a198bf39e1a297b2a194bf40e1a304b2a187bf41e1a309b2a188bf42e1a318b2a190bf43e1a323b2a191bf44e1a333b2a191bf45e1a338b2a192bf46e1a348b2a191bf47e1a353b2a190bf48e1a363b2a187bf49e1a367b2a185bf50e1a377b2a182bf51e1a381b2a185bf52e1a382b2a195bf53e1a382b2a200bf54e1a382b2a210bf55e1a379b2a214bf56e1a370b2a214bf57e1a366b2a211bf58e1a358b2a206bf59e1a353b2a204bf60e1a343b2a202bf61e1a338b2a202bf62e1a328b2a203bf63e1a323b2a204bf64e1a314b2a206bf65e1a309b2a208bf66e1a299b2a209bf67e1a296b2a204bf68e1a300b2a196bf69e1a305b2a195bf70e1a314b2a197bf71e1a319b2a197bf72e1a329b2a198bf73e1a334b2a198bf74e1a344b2a198bf75e1a349b2a197bf76e1a359b2a194bf77e1a364b2a193bf78e1a373b2a195bf79e1a374b2a199bf80e1a368b2a206bf81e1a363b2a205bf;4=1e1a186b2a217bf2e1a189b2a207bf3e1a190b2a202bf4e1a192b2a192bf5e1a193b2a187bf6e1a195b2a178bf7e1a197b2a173bf8e1a201b2a164bf9e1a203b2a159bf10e1a209b2a151bf11e1a211b2a147bf12e1a217b2a139bf13e1a222b2a139bf14e1a228b2a146bf15e1a225b2a151bf16e1a221b2a160bf17e1a220b2a164bf18e1a219b2a174bf19e1a219b2a179bf20e1a218b2a189bf21e1a218b2a194bf22e1a218b2a204bf23e1a218b2a209bf24e1a218b2a219bf25e1a218b2a224bf26e1a218b2a234bf27e1a218b2a239bf28e1a216b2a249bf29e1a215b2a254bf30e1a213b2a264bf31e1a210b2a268bf32e1a200b2a266bf33e1a199b2a261bf34e1a198b2a251bf35e1a197b2a246bf36e1a194b2a237bf37e1a193b2a232bf38e1a192b2a222bf39e1a194b2a217bf40e1a196b2a207bf41e1a197b2a202bf42e1a199b2a193bf43e1a200b2a188bf44e1a203b2a178bf45e1a205b2a174bf46e1a209b2a165bf47e1a211b2a160bf48e1a216b2a152bf49e1a221b2a150bf50e1a228b2a157bf51e1a226b2a162bf52e1a218b2a168bf53e1a216b2a172bf54e1a212b2a182bf55e1a211b2a187bf56e1a211b2a196bf57e1a210b2a201bf58e1a210b2a211bf59e1a210b2a216bf60e1a210b2a226bf61e1a210b2a231bf62e1a209b2a241bf63e1a208b2a246bf64e1a206b2a256bf65e1a201b2a259bf66e1a193b2a254bf67e1a193b2a249bf68e1a197b2a240bf69e1a198b2a235bf70e1a199b2a225bf71e1a200b2a220bf72e1a202b2a210bf73e1a203b2a205bf;5=1e1a291b2a130bf2e1a294b2a120bf3e1a294b2a115bf4e1a303b2a111bf5e1a307b2a112bf6e1a317b2a116bf7e1a322b2a117bf8e1a331b2a121bf9e1a335b2a123bf10e1a344b2a128bf11e1a349b2a130bf12e1a357b2a136bf13e1a361b2a139bf14e1a367b2a147bf15e1a369b2a151bf16e1a364b2a159bf17e1a360b2a162bf18e1a351b2a166bf19e1a346b2a167bf20e1a336b2a168bf21e1a331b2a168bf22e1a322b2a166bf23e1a317b2a164bf24e1a308b2a160bf25e1a304b2a157bf26e1a298b2a149bf27e1a297b2a144bf28e1a298b2a134bf29e1a299b2a129bf30e1a304b2a121bf31e1a309b2a121bf32e1a318b2a124bf33e1a323b2a126bf34e1a332b2a130bf35e1a336b2a132bf36e1a345b2a138bf37e1a349b2a140bf38e1a357b2a147bf39e1a357b2a152bf40e1a349b2a158bf41e1a344b2a159bf42e1a334b2a159bf43e1a329b2a159bf44e1a320b2a156bf45e1a315b2a154bf46e1a308b2a147bf47e1a307b2a142bf48e1a308b2a132bf49e1a310b2a128bf50e1a318b2a123bf51e1a322b2a126bf52e1a328b2a134bf53e1a332b2a137bf;6=1e1a635b2a250bf2e1a637b2a240bf3e1a638b2a235bf4e1a638b2a225bf5e1a639b2a220bf6e1a639b2a210bf7e1a639b2a205bf8e1a640b2a195bf9e1a640b2a190bf10e1a643b2a180bf11e1a645b2a176bf12e1a649b2a167bf13e1a648b2a163bf14e1a638b2a159bf15e1a634b2a158bf16e1a624b2a154bf17e1a620b2a153bf18e1a610b2a150bf19e1a605b2a148bf20e1a596b2a145bf21e1a591b2a143bf22e1a582b2a140bf23e1a577b2a141bf24e1a567b2a144bf25e1a563b2a146bf26e1a553b2a150bf27e1a549b2a151bf28e1a539b2a154bf29e1a534b2a154bf30e1a526b2a158bf31e1a524b2a163bf32e1a524b2a173bf33e1a525b2a178bf34e1a527b2a188bf35e1a529b2a192bf36e1a532b2a202bf37e1a534b2a207bf38e1a531b2a216bf39e1a528b2a220bf40e1a522b2a228bf41e1a519b2a232bf42e1a513b2a240bf43e1a510b2a244bf44e1a505b2a253bf45e1a503b2a257bf46e1a499b2a267bf47e1a498b2a271bf48e1a495b2a281bf49e1a494b2a286bf50e1a494b2a296bf51e1a495b2a301bf52e1a496b2a311bf53e1a498b2a316bf54e1a502b2a325bf55e1a504b2a329bf56e1a510b2a337bf57e1a513b2a341bf58e1a519b2a349bf59e1a524b2a352bf60e1a534b2a352bf61e1a538b2a350bf62e1a547b2a346bf63e1a551b2a343bf64e1a559b2a337bf65e1a563b2a334bf66e1a571b2a328bf67e1a575b2a325bf68e1a583b2a318bf69e1a587b2a316bf70e1a595b2a322bf71e1a595b2a327bf72e1a598b2a337bf73e1a601b2a341bf74e1a608b2a348bf75e1a612b2a351bf76e1a622b2a351bf77e1a627b2a350bf78e1a636b2a345bf79e1a640b2a342bf80e1a648b2a336bf81e1a652b2a333bf82e1a655b2a325bf83e1a652b2a321bf84e1a645b2a314bf85e1a642b2a310bf86e1a640b2a300bf87e1a640b2a295bf88e1a639b2a285bf89e1a639b2a280bf;7=1e1a535b2a260bf2e1a539b2a251bf3e1a541b2a246bf4e1a545b2a237bf5e1a549b2a233bf6e1a558b2a234bf7e1a563b2a236bf8e1a572b2a240bf9e1a577b2a242bf10e1a585b2a248bf11e1a586b2a253bf12e1a587b2a262bf13e1a588b2a267bf14e1a588b2a277bf15e1a588b2a282bf16e1a584b2a291bf17e1a580b2a295bf18e1a573b2a302bf19e1a569b2a305bf20e1a561b2a310bf21e1a557b2a308bf22e1a551b2a300bf23e1a548b2a296bf24e1a544b2a286bf25e1a542b2a282bf26e1a541b2a272bf27e1a541b2a267bf28e1a544b2a257bf29e1a546b2a253bf30e1a551b2a245bf31e1a556b2a245bf32e1a566b2a247bf33e1a571b2a249bf34e1a576b2a257bf35e1a578b2a262bf36e1a579b2a271bf37e1a579b2a276bf38e1a575b2a286bf39e1a572b2a289bf40e1a565b2a297bf41e1a560b2a297bf42e1a554b2a289bf43e1a552b2a285bf44e1a549b2a275bf45e1a550b2a270bf46e1a552b2a260bf47e1a554b2a256bf48e1a564b2a257bf49e1a566b2a261bf50e1a569b2a270bf51e1a569b2a275bf52e1a564b2a284bf53e1a559b2a286bf54e1a550b2a284bf;8=1e1a541b2a195bf2e1a540b2a185bf3e1a539b2a180bf4e1a541b2a171bf5e1a546b2a170bf6e1a554b2a175bf7e1a558b2a178bf8e1a567b2a183bf9e1a571b2a185bf10e1a581b2a189bf11e1a584b2a193bf12e1a586b2a202bf13e1a586b2a207bf14e1a587b2a217bf15e1a587b2a222bf16e1a582b2a231bf17e1a578b2a233bf18e1a569b2a228bf19e1a567b2a224bf20e1a560b2a217bf21e1a556b2a214bf22e1a551b2a205bf23e1a549b2a201bf24e1a548b2a191bf25e1a547b2a186bf26e1a550b2a177bf27e1a556b2a177bf28e1a562b2a184bf29e1a566b2a188bf30e1a573b2a194bf31e1a575b2a199bf32e1a578b2a209bf33e1a578b2a214bf34e1a572b2a221bf35e1a567b2a220bf36e1a562b2a212bf37e1a560b2a207bf38e1a557b2a198bf39e1a556b2a193bf;9=1e1a953b2a230bf2e1a956b2a220bf3e1a956b2a215bf4e1a960b2a206bf5e1a963b2a202bf6e1a970b2a195bf7e1a974b2a192bf8e1a982b2a186bf9e1a987b2a186bf10e1a995b2a191bf11e1a997b2a196bf12e1a999b2a206bf13e1a1000b2a211bf14e1a1000b2a221bf15e1a1000b2a226bf16e1a1000b2a236bf17e1a1000b2a241bf18e1a1000b2a251bf19e1a1000b2a256bf20e1a1000b2a266bf21e1a1000b2a271bf22e1a1000b2a281bf23e1a1000b2a286bf24e1a1000b2a296bf25e1a1000b2a301bf26e1a996b2a310bf27e1a993b2a314bf28e1a993b2a324bf29e1a995b2a328bf30e1a1000b2a336bf31e1a1004b2a340bf32e1a1011b2a347bf33e1a1015b2a350bf34e1a1024b2a353bf35e1a1029b2a352bf36e1a1038b2a347bf37e1a1042b2a344bf38e1a1050b2a338bf39e1a1054b2a335bf40e1a1056b2a326bf41e1a1056b2a321bf42e1a1053b2a311bf43e1a1053b2a306bf44e1a1052b2a296bf45e1a1052b2a291bf46e1a1052b2a281bf47e1a1052b2a276bf48e1a1052b2a266bf49e1a1052b2a261bf50e1a1052b2a251bf51e1a1052b2a246bf52e1a1052b2a236bf53e1a1052b2a231bf54e1a1052b2a221bf55e1a1052b2a216bf56e1a1053b2a206bf57e1a1056b2a202bf58e1a1063b2a195bf59e1a1067b2a192bf60e1a1075b2a187bf61e1a1080b2a189bf62e1a1088b2a195bf63e1a1089b2a200bf64e1a1090b2a210bf65e1a1091b2a215bf66e1a1091b2a225bf67e1a1091b2a230bf68e1a1091b2a240bf69e1a1091b2a245bf70e1a1091b2a255bf71e1a1091b2a260bf72e1a1091b2a270bf73e1a1091b2a275bf74e1a1091b2a285bf75e1a1091b2a290bf76e1a1091b2a300bf77e1a1092b2a305bf78e1a1092b2a315bf79e1a1093b2a320bf80e1a1097b2a329bf81e1a1099b2a334bf82e1a1104b2a342bf83e1a1108b2a346bf84e1a1115b2a352bf85e1a1120b2a353bf86e1a1130b2a351bf87e1a1135b2a349bf88e1a1143b2a344bf89e1a1147b2a341bf90e1a1155b2a335bf91e1a1159b2a332bf92e1a1160b2a324bf93e1a1156b2a320bf94e1a1149b2a313bf95e1a1146b2a309bf96e1a1144b2a299bf97e1a1144b2a294bf98e1a1143b2a284bf99e1a1143b2a279bf100e1a1143b2a269bf101e1a1143b2a264bf102e1a1143b2a254bf103e1a1143b2a249bf104e1a1143b2a239bf105e1a1143b2a234bf106e1a1143b2a224bf107e1a1143b2a219bf108e1a1143b2a209bf109e1a1143b2a204bf110e1a1144b2a194bf111e1a1146b2a190bf112e1a1150b2a181bf113e1a1153b2a177bf114e1a1157b2a168bf115e1a1152b2a165bf116e1a1142b2a165bf117e1a1138b2a164bf118e1a1129b2a159bf119e1a1125b2a156bf120e1a1117b2a149bf121e1a1113b2a146bf122e1a1104b2a145bf123e1a1099b2a146bf124e1a1090b2a150bf125e1a1086b2a153bf126e1a1078b2a159bf127e1a1073b2a162bf128e1a1066b2a168bf129e1a1062b2a171bf130e1a1054b2a177bf131e1a1049b2a179bf132e1a1042b2a173bf133e1a1041b2a168bf134e1a1037b2a159bf135e1a1034b2a155bf136e1a1028b2a147bf137e1a1024b2a145bf138e1a1014b2a144bf139e1a1009b2a146bf140e1a1000b2a150bf141e1a996b2a153bf142e1a988b2a159bf143e1a984b2a162bf144e1a976b2a167bf145e1a971b2a170bf146e1a964b2a176bf147e1a959b2a178bf148e1a952b2a171bf149e1a951b2a166bf150e1a946b2a158bf151e1a943b2a154bf152e1a937b2a146bf153e1a932b2a144bf154e1a922b2a145bf155e1a918b2a146bf156e1a909b2a152bf157e1a905b2a155bf158e1a898b2a161bf159e1a894b2a165bf160e1a892b2a173bf161e1a895b2a177bf162e1a901b2a185bf163e1a903b2a190bf164e1a904b2a200bf165e1a905b2a205bf166e1a905b2a215bf167e1a905b2a220bf168e1a905b2a230bf169e1a905b2a235bf170e1a905b2a245bf171e1a905b2a250bf172e1a905b2a260bf173e1a905b2a265bf174e1a905b2a275bf175e1a905b2a280bf176e1a905b2a290bf177e1a905b2a295bf178e1a905b2a305bf179e1a903b2a309bf180e1a899b2a319bf181e1a899b2a324bf182e1a904b2a332bf183e1a907b2a336bf184e1a914b2a344bf185e1a917b2a347bf186e1a925b2a353bf187e1a930b2a353bf188e1a940b2a350bf189e1a944b2a347bf190e1a953b2a341bf191e1a956b2a338bf192e1a963b2a331bf193e1a963b2a326bf194e1a961b2a316bf195e1a959b2a311bf196e1a958b2a301bf197e1a958b2a296bf198e1a958b2a286bf199e1a958b2a281bf;10=1e1a846b2a230bf2e1a848b2a220bf3e1a849b2a215bf4e1a849b2a205bf5e1a850b2a200bf6e1a851b2a190bf7e1a853b2a186bf8e1a856b2a176bf9e1a855b2a171bf10e1a850b2a163bf11e1a846b2a159bf12e1a839b2a152bf13e1a836b2a149bf14e1a827b2a144bf15e1a822b2a144bf16e1a813b2a147bf17e1a808b2a149bf18e1a800b2a155bf19e1a796b2a158bf20e1a791b2a166bf21e1a791b2a171bf22e1a794b2a181bf23e1a795b2a185bf24e1a796b2a195bf25e1a796b2a200bf26e1a796b2a210bf27e1a796b2a215bf28e1a796b2a225bf29e1a796b2a230bf30e1a796b2a240bf31e1a796b2a245bf32e1a796b2a255bf33e1a796b2a260bf34e1a796b2a270bf35e1a796b2a275bf36e1a796b2a285bf37e1a796b2a290bf38e1a796b2a300bf39e1a796b2a305bf40e1a797b2a315bf41e1a798b2a320bf42e1a801b2a330bf43e1a803b2a334bf44e1a809b2a342bf45e1a812b2a346bf46e1a820b2a352bf47e1a825b2a353bf48e1a835b2a351bf49e1a839b2a349bf50e1a848b2a344bf51e1a852b2a341bf52e1a860b2a335bf53e1a864b2a331bf54e1a865b2a324bf55e1a861b2a320bf56e1a855b2a313bf57e1a853b2a308bf58e1a851b2a298bf59e1a850b2a293bf60e1a850b2a283bf61e1a850b2a278bf62e1a850b2a268bf63e1a850b2a263bf64e1a850b2a253bf65e1a850b2a248bf;11=1e1a730b2a230bf2e1a733b2a220bf3e1a733b2a215bf4e1a734b2a205bf5e1a735b2a200bf6e1a735b2a190bf7e1a735b2a185bf8e1a742b2a180bf9e1a747b2a179bf10e1a757b2a178bf11e1a762b2a178bf12e1a771b2a175bf13e1a774b2a170bf14e1a777b2a161bf15e1a777b2a156bf16e1a769b2a149bf17e1a765b2a148bf18e1a755b2a146bf19e1a750b2a145bf20e1a740b2a145bf21e1a736b2a141bf22e1a735b2a131bf23e1a735b2a126bf24e1a735b2a116bf25e1a735b2a111bf26e1a732b2a102bf27e1a727b2a102bf28e1a717b2a105bf29e1a713b2a108bf30e1a706b2a115bf31e1a703b2a119bf32e1a696b2a126bf33e1a693b2a130bf34e1a687b2a138bf35e1a683b2a142bf36e1a677b2a149bf37e1a674b2a153bf38e1a669b2a162bf39e1a672b2a167bf40e1a678b2a174bf41e1a679b2a179bf42e1a680b2a189bf43e1a681b2a194bf44e1a681b2a204bf45e1a681b2a209bf46e1a681b2a219bf47e1a681b2a224bf48e1a681b2a234bf49e1a681b2a239bf50e1a681b2a249bf51e1a681b2a254bf52e1a681b2a264bf53e1a681b2a269bf54e1a681b2a279bf55e1a681b2a284bf56e1a680b2a294bf57e1a678b2a298bf58e1a674b2a308bf59e1a675b2a313bf60e1a680b2a321bf61e1a683b2a325bf62e1a691b2a331bf63e1a695b2a334bf64e1a704b2a339bf65e1a708b2a342bf66e1a716b2a348bf67e1a720b2a351bf68e1a730b2a352bf69e1a735b2a350bf70e1a743b2a346bf71e1a748b2a343bf72e1a755b2a337bf73e1a759b2a333bf74e1a767b2a327bf75e1a769b2a322bf76e1a760b2a317bf77e1a756b2a315bf78e1a748b2a309bf79e1a744b2a306bf80e1a738b2a298bf81e1a737b2a293bf82e1a736b2a284bf83e1a735b2a279bf84e1a735b2a269bf85e1a735b2a264bf86e1a735b2a254bf87e1a735b2a249bf;12=1e1a310b2a226bf2e1a312b2a216bf3e1a313b2a211bf4e1a313b2a201bf5e1a312b2a196bf6e1a310b2a186bf7e1a309b2a181bf8e1a305b2a172bf9e1a303b2a168bf10e1a297b2a160bf11e1a294b2a156bf12e1a286b2a149bf13e1a282b2a147bf14e1a273b2a142bf15e1a268b2a142bf16e1a259b2a145bf17e1a254b2a148bf18e1a246b2a154bf19e1a243b2a157bf20e1a235b2a164bf21e1a231b2a167bf22e1a224b2a174bf23e1a219b2a174bf24e1a214b2a166bf25e1a213b2a161bf26e1a207b2a153bf27e1a204b2a149bf28e1a196b2a143bf29e1a191b2a143bf30e1a181b2a146bf31e1a177b2a148bf32e1a169b2a154bf33e1a165b2a157bf34e1a157b2a163bf35e1a154b2a167bf36e1a160b2a175bf37e1a164b2a178bf38e1a168b2a187bf39e1a169b2a192bf40e1a171b2a202bf41e1a171b2a207bf42e1a171b2a217bf43e1a171b2a222bf44e1a171b2a232bf45e1a171b2a237bf46e1a171b2a247bf47e1a171b2a252bf48e1a171b2a262bf49e1a171b2a267bf50e1a171b2a277bf51e1a171b2a282bf52e1a171b2a292bf53e1a167b2a295bf54e1a158b2a300bf55e1a155b2a304bf56e1a152b2a313bf57e1a155b2a318bf58e1a163b2a323bf59e1a167b2a326bf60e1a170b2a336bf61e1a170b2a341bf62e1a171b2a351bf63e1a171b2a356bf64e1a170b2a366bf65e1a168b2a370bf66e1a165b2a380bf67e1a163b2a384bf68e1a165b2a393bf69e1a170b2a394bf70e1a180b2a393bf71e1a184b2a391bf72e1a194b2a394bf73e1a198b2a397bf74e1a206b2a402bf75e1a210b2a405bf76e1a219b2a409bf77e1a224b2a411bf78e1a230b2a403bf79e1a230b2a398bf80e1a228b2a388bf81e1a227b2a383bf82e1a225b2a373bf83e1a223b2a368bf84e1a222b2a359bf85e1a222b2a354bf86e1a224b2a344bf87e1a229b2a342bf88e1a238b2a347bf89e1a242b2a350bf90e1a252b2a352bf91e1a257b2a350bf92e1a266b2a346bf93e1a270b2a343bf94e1a278b2a337bf95e1a282b2a334bf96e1a290b2a328bf97e1a294b2a326bf98e1a302b2a320bf99e1a306b2a317bf100e1a311b2a308bf101e1a312b2a303bf102e1a313b2a293bf103e1a313b2a288bf;13=1e1a472b2a226bf2e1a475b2a216bf3e1a475b2a211bf4e1a476b2a201bf5e1a477b2a196bf6e1a477b2a186bf7e1a476b2a181bf8e1a470b2a174bf9e1a466b2a171bf10e1a457b2a166bf11e1a452b2a164bf12e1a443b2a160bf13e1a439b2a158bf14e1a430b2a153bf15e1a425b2a151bf16e1a416b2a146bf17e1a412b2a144bf18e1a402b2a143bf19e1a398b2a144bf20e1a389b2a148bf21e1a384b2a151bf22e1a376b2a156bf23e1a371b2a159bf24e1a363b2a163bf25e1a358b2a165bf26e1a349b2a169bf27e1a344b2a171bf28e1a337b2a178bf29e1a336b2a183bf30e1a334b2a193bf31e1a333b2a198bf32e1a333b2a208bf33e1a332b2a213bf34e1a332b2a223bf35e1a332b2a228bf36e1a332b2a238bf37e1a332b2a243bf38e1a332b2a253bf39e1a332b2a258bf40e1a332b2a268bf41e1a332b2a273bf42e1a332b2a283bf43e1a332b2a288bf44e1a331b2a298bf45e1a329b2a302bf46e1a326b2a312bf47e1a329b2a316bf48e1a336b2a323bf49e1a340b2a325bf50e1a349b2a329bf51e1a354b2a331bf52e1a363b2a335bf53e1a368b2a337bf54e1a377b2a342bf55e1a381b2a344bf56e1a390b2a349bf57e1a394b2a352bf58e1a403b2a354bf59e1a408b2a353bf60e1a417b2a349bf61e1a422b2a347bf62e1a431b2a342bf63e1a435b2a340bf64e1a444b2a335bf65e1a449b2a333bf66e1a458b2a329bf67e1a463b2a328bf68e1a470b2a322bf69e1a473b2a317bf70e1a475b2a307bf71e1a476b2a302bf72e1a476b2a293bf73e1a477b2a288bf74e1a477b2a278bf75e1a477b2a273bf76e1a477b2a263bf77e1a477b2a258bf78e1a477b2a248bf79e1a477b2a243bf;14=1e1a219b2a225bf2e1a221b2a215bf3e1a222b2a210bf4e1a226b2a201bf5e1a230b2a198bf6e1a237b2a190bf7e1a241b2a187bf8e1a250b2a188bf9e1a255b2a190bf10e1a261b2a198bf11e1a262b2a203bf12e1a263b2a213bf13e1a264b2a218bf14e1a264b2a228bf15e1a264b2a233bf16e1a264b2a243bf17e1a264b2a248bf18e1a264b2a257bf19e1a264b2a262bf20e1a264b2a272bf21e1a264b2a277bf22e1a264b2a287bf23e1a264b2a292bf24e1a264b2a302bf25e1a263b2a307bf26e1a254b2a309bf27e1a249b2a307bf28e1a240b2a303bf29e1a235b2a301bf30e1a227b2a297bf31e1a225b2a292bf32e1a224b2a282bf33e1a223b2a277bf34e1a223b2a267bf35e1a223b2a262bf36e1a223b2a252bf37e1a223b2a247bf38e1a223b2a237bf39e1a224b2a232bf40e1a226b2a222bf41e1a227b2a217bf42e1a232b2a208bf43e1a235b2a204bf44e1a242b2a197bf45e1a247b2a198bf46e1a252b2a206bf47e1a254b2a211bf48e1a255b2a221bf49e1a256b2a226bf50e1a256b2a236bf51e1a256b2a241bf52e1a256b2a251bf53e1a256b2a256bf54e1a256b2a266bf55e1a256b2a271bf56e1a256b2a281bf57e1a256b2a286bf58e1a256b2a296bf59e1a252b2a299bf60e1a243b2a299bf61e1a239b2a296bf62e1a234b2a287bf63e1a232b2a282bf64e1a231b2a273bf65e1a230b2a268bf66e1a230b2a258bf67e1a230b2a253bf68e1a230b2a243bf69e1a231b2a238bf70e1a232b2a228bf71e1a233b2a223bf72e1a238b2a214bf73e1a240b2a210bf74e1a245b2a203bf75e1a241b2a200bf76e1a241b2a190bf77e1a245b2a186bf78e1a254b2a189bf79e1a258b2a193bf80e1a262b2a201bf81e1a262b2a206bf82e1a255b2a213bf83e1a253b2a218bf84e1a250b2a227bf85e1a249b2a232bf86e1a249b2a242bf87e1a249b2a247bf88e1a248b2a257bf89e1a248b2a262bf90e1a248b2a272bf91e1a248b2a277bf92e1a247b2a287bf93e1a243b2a290bf94e1a234b2a288bf95e1a233b2a283bf96e1a235b2a273bf97e1a236b2a268bf98e1a236b2a258bf99e1a237b2a253bf100e1a237b2a243bf101e1a238b2a238bf;15=1e1a380b2a244bf2e1a382b2a234bf3e1a383b2a229bf4e1a383b2a219bf5e1a384b2a214bf6e1a384b2a204bf7e1a384b2a199bf8e1a384b2a189bf9e1a387b2a185bf10e1a397b2a187bf11e1a401b2a189bf12e1a410b2a194bf13e1a415b2a196bf14e1a421b2a203bf15e1a422b2a207bf16e1a424b2a217bf17e1a424b2a222bf18e1a424b2a232bf19e1a424b2a237bf20e1a424b2a247bf21e1a424b2a252bf22e1a424b2a262bf23e1a424b2a267bf24e1a424b2a277bf25e1a424b2a282bf26e1a424b2a292bf27e1a424b2a297bf28e1a424b2a307bf29e1a421b2a311bf30e1a412b2a309bf31e1a407b2a306bf32e1a398b2a302bf33e1a394b2a300bf34e1a387b2a293bf35e1a386b2a288bf36e1a384b2a278bf37e1a384b2a273bf38e1a384b2a263bf39e1a384b2a258bf40e1a386b2a249bf41e1a387b2a244bf42e1a389b2a234bf43e1a389b2a229bf44e1a390b2a219bf45e1a390b2a214bf46e1a391b2a204bf47e1a391b2a199bf48e1a398b2a193bf49e1a403b2a195bf50e1a410b2a202bf51e1a412b2a206bf52e1a414b2a216bf53e1a415b2a221bf54e1a416b2a231bf55e1a416b2a236bf56e1a416b2a246bf57e1a416b2a251bf58e1a416b2a261bf59e1a416b2a266bf60e1a416b2a276bf61e1a416b2a281bf62e1a416b2a291bf63e1a416b2a296bf64e1a409b2a301bf65e1a404b2a300bf66e1a397b2a293bf67e1a395b2a288bf68e1a393b2a278bf69e1a392b2a274bf70e1a391b2a264bf71e1a392b2a259bf72e1a393b2a249bf73e1a394b2a244bf74e1a396b2a234bf75e1a396b2a229bf76e1a397b2a219bf77e1a397b2a214bf78e1a399b2a204bf79e1a404b2a203bf80e1a412b2a208bf81e1a412b2a213bf82e1a410b2a223bf83e1a409b2a228bf84e1a409b2a238bf85e1a408b2a243bf86e1a408b2a253bf87e1a408b2a258bf88e1a408b2a268bf89e1a408b2a273bf90e1a408b2a283bf91e1a408b2a287bf92e1a399b2a292bf93e1a395b2a289bf94e1a396b2a279bf95e1a397b2a274bf;16=1e1a214b2a225bf2e1a217b2a215bf3e1a217b2a210bf4e1a223b2a202bf5e1a226b2a198bf6e1a234b2a192bf7e1a238b2a189bf8e1a247b2a187bf9e1a251b2a190bf10e1a257b2a198bf11e1a258b2a203bf12e1a259b2a212bf13e1a259b2a217bf14e1a259b2a227bf15e1a259b2a232bf16e1a259b2a242bf17e1a259b2a247bf18e1a259b2a257bf19e1a259b2a262bf20e1a259b2a272bf21e1a259b2a277bf22e1a259b2a287bf23e1a259b2a292bf24e1a259b2a302bf25e1a260b2a307bf26e1a261b2a317bf27e1a262b2a322bf28e1a266b2a332bf29e1a268b2a336bf30e1a274b2a344bf31e1a277b2a348bf32e1a286b2a353bf33e1a291b2a353bf34e1a300b2a350bf35e1a305b2a347bf36e1a313b2a342bf37e1a317b2a339bf38e1a325b2a333bf39e1a328b2a329bf40e1a323b2a321bf41e1a319b2a317bf42e1a314b2a309bf43e1a313b2a304bf44e1a311b2a294bf45e1a311b2a289bf46e1a311b2a279bf47e1a311b2a274bf48e1a311b2a264bf49e1a311b2a259bf50e1a311b2a249bf51e1a311b2a244bf52e1a311b2a234bf53e1a311b2a229bf54e1a311b2a219bf55e1a311b2a214bf56e1a311b2a204bf57e1a311b2a199bf58e1a314b2a190bf59e1a316b2a185bf60e1a321b2a177bf61e1a324b2a173bf62e1a322b2a164bf63e1a317b2a163bf64e1a307b2a165bf65e1a303b2a163bf66e1a294b2a157bf67e1a290b2a154bf68e1a283b2a148bf69e1a278b2a145bf70e1a268b2a145bf71e1a264b2a147bf72e1a255b2a152bf73e1a251b2a155bf74e1a243b2a161bf75e1a239b2a164bf76e1a231b2a170bf77e1a227b2a173bf78e1a219b2a178bf79e1a214b2a175bf80e1a211b2a166bf81e1a209b2a161bf82e1a204b2a153bf83e1a200b2a149bf84e1a192b2a144bf85e1a187b2a144bf86e1a178b2a147bf87e1a173b2a150bf88e1a165b2a156bf89e1a162b2a159bf90e1a154b2a165bf91e1a151b2a170bf92e1a157b2a178bf93e1a160b2a182bf94e1a164b2a191bf95e1a165b2a196bf96e1a166b2a206bf97e1a166b2a211bf98e1a166b2a221bf99e1a166b2a226bf100e1a166b2a236bf101e1a166b2a241bf102e1a166b2a251bf103e1a166b2a256bf104e1a166b2a266bf105e1a166b2a271bf106e1a166b2a281bf107e1a166b2a286bf108e1a166b2a296bf109e1a166b2a301bf110e1a163b2a310bf111e1a160b2a314bf112e1a160b2a324bf113e1a162b2a329bf114e1a168b2a337bf115e1a171b2a341bf116e1a178b2a347bf117e1a182b2a351bf118e1a192b2a353bf119e1a197b2a351bf120e1a206b2a347bf121e1a210b2a344bf122e1a218b2a338bf123e1a221b2a335bf124e1a224b2a325bf125e1a223b2a320bf126e1a220b2a310bf127e1a220b2a305bf128e1a219b2a295bf129e1a219b2a290bf130e1a219b2a280bf131e1a219b2a275bf132e1a219b2a265bf133e1a219b2a260bf;17=1e1a402b2a244bf2e1a405b2a234bf3e1a405b2a229bf4e1a406b2a219bf5e1a407b2a214bf6e1a407b2a204bf7e1a407b2a199bf8e1a407b2a189bf9e1a410b2a186bf10e1a420b2a188bf11e1a423b2a191bf12e1a431b2a197bf13e1a436b2a198bf14e1a445b2a194bf15e1a449b2a191bf16e1a456b2a184bf17e1a459b2a180bf18e1a458b2a170bf19e1a455b2a166bf20e1a448b2a159bf21e1a444b2a156bf22e1a436b2a150bf23e1a432b2a147bf24e1a423b2a143bf25e1a418b2a143bf26e1a409b2a146bf27e1a404b2a148bf28e1a396b2a153bf29e1a391b2a156bf30e1a383b2a161bf31e1a378b2a163bf32e1a370b2a168bf33e1a365b2a171bf34e1a359b2a179bf35e1a358b2a183bf36e1a356b2a193bf37e1a356b2a198bf38e1a355b2a208bf39e1a355b2a213bf40e1a355b2a223bf41e1a355b2a228bf42e1a355b2a238bf43e1a355b2a243bf44e1a355b2a253bf45e1a355b2a258bf46e1a355b2a268bf47e1a355b2a273bf48e1a355b2a283bf49e1a355b2a288bf50e1a354b2a298bf51e1a353b2a303bf52e1a349b2a312bf53e1a350b2a317bf54e1a355b2a325bf55e1a359b2a328bf56e1a368b2a333bf57e1a372b2a336bf58e1a381b2a340bf59e1a386b2a343bf60e1a394b2a348bf61e1a398b2a350bf62e1a408b2a352bf63e1a413b2a351bf64e1a422b2a347bf65e1a427b2a345bf66e1a435b2a339bf67e1a439b2a337bf68e1a447b2a331bf69e1a451b2a328bf70e1a459b2a322bf71e1a458b2a318bf72e1a449b2a316bf73e1a444b2a315bf74e1a435b2a312bf75e1a430b2a310bf76e1a421b2a305bf77e1a416b2a303bf78e1a410b2a296bf79e1a409b2a291bf80e1a408b2a281bf81e1a407b2a276bf82e1a407b2a266bf83e1a407b2a261bf For o1=0 To 2 dst=ldtext.Replace ( dst "f" "\;") dst=ldtext.Replace ( dst "e" "\=") dst=ldtext.Replace ( dst "b" "\\\;") dst=ldtext.Replace ( dst "a" "\\\=") endfor bcc=LDShapes.BrushGradient ("1=gold;2=black" "V") bcc1=LDShapes.BrushGradient ("1=green;2=black" "V") ch=1 aa="*1!*6!*11!*9!*10!*12!*13!*16!*17! ct=Array.GetItemCount (dst) 'GraphicsWindow.Title =ct h20=200 for i1=1 To ct If Text.IsSubText (aa "*"+i1+"!") Then GraphicsWindow.BrushColor="#44ee0000 po[ch]= LDShapes.AddPolygon (dst[i1]) LDShapes.BrushShape(po[ch] bcc) If ch=6 then LDShapes.BrushShape(po[ch] bcc1) Else LDShapes.BrushShape(po[ch] bcc) endif LDEffect.DropShaddow (po[ch] "color=brown;Shadowdepth=7") LDShapes.AnimateOpacity (po[ch] 2500 5) ' Program.Delay (222) If ch>15 then Shapes.Move(po[ch] 300 0) If ch=16 then ch=ch+1 po[ch]= LDShapes.AddPolygon (dst[i1]) LDShapes.BrushShape(po[ch] bcc) LDEffect.DropShaddow (po[ch] "color=brown;Shadowdepth=7") Shapes.Rotate (po[ch] 180) Shapes.Move (po[ch], -50 450) LDShapes.AnimateOpacity (po[ch] 2500 5) ch=ch+1 po[ch]= LDShapes.AddPolygon (dst[i1]) LDShapes.BrushShape(po[ch] bcc) LDEffect.DropShaddow (po[ch] "color=brown;Shadowdepth=7") LDShapes.AnimateOpacity (po[ch] 2500 5) Shapes.Move (po[ch], 350 300) elseIf i1=17 then ch=ch+1 po[ch]= LDShapes.AddPolygon (dst[i1]) LDShapes.BrushShape(po[ch] bcc) Shapes.Move(po[ch] 450 0) LDEffect.DropShaddow (po[ch] "color=brown;Shadowdepth=7") GraphicsWindow.title="Mystery... LDShapes.AnimateOpacity (po[ch] 2500 5) ch=ch+1 po[ch]= LDShapes.AddPolygon (dst[i1]) LDShapes.BrushShape(po[ch] bcc) Shapes.Move(po[ch] 1050 300) LDShapes.AnimateOpacity (po[ch] 2500 5) LDEffect.DropShaddow (po[ch] "color=brown;Shadowdepth=7") GraphicsWindow.BrushColor="gold GraphicsWindow.PenWidth =0 ar=LDFigures.AddblockArrow (290 60 .3 60 "Right") Shapes.Rotate (ar, -45) Shapes.Move(ar 750 170) LDShapes.AnimateOpacity (ar 2500 5) ar=LDFigures.AddblockArrow (290 60 .3 60 "Right") Shapes.Rotate (ar, -45) Shapes.Move(ar 1350 470) LDShapes.AnimateOpacity (ar 2500 5) GraphicsWindow.PenWidth =4 endif ElseIf ch>5 then Shapes.Move(po[ch] h20 300) If ch>10 then h20=0 endif endif else GraphicsWindow.penColor= "black GraphicsWindow.PenWidth =4 cc=Array.GetItemCount (dst[i1]) 'GraphicsWindow.Title =cc xi=1 For x=1 To cc-1 ll= shapes.addline (dst[i1][x][1] dst[i1][x][2] dst[i1][x+1][1] dst[i1][x+1][2]) If ch>5 Then Shapes.Move(ll h20 300) endif xi=xi+1 EndFor endif ch=ch+1 EndFor aa=0 While "true r=Math.Remainder (aa 20)+1 LDEffect.DropShaddow (po[1] "color=brown;Shadowdepth="+math.Abs (r-10)) Program.Delay(25) 'LDEffect.Clear (pp1) LDGraphicsWindow.Reposition (ss ss 0 0 aa) aa=aa+1 ss=math.Abs(ldmath.Sin(aa))+.4 EndWhile End>BMW607.sb< Start>BMW841.sb< GraphicsWindow.Title="Turtle Fractals" WindowWidth=800 WindowHeight=600 GraphicsWindow.Width=WindowWidth GraphicsWindow.Height=WindowHeight GraphicsWindow.BackgroundColor = "lightblue" GraphicsWindow.BrushColor="green" GroundLevel = (WindowHeight/3) * 2 GraphicsWindow.FillRectangle(0,GroundLevel,WindowWidth,(WindowHeight-GroundLevel)) TurtleStartX = (WindowWidth/4) TurtleStartY = GroundLevel PositionTurtle() angle = 30 delta = 10 distance = 60 Turtle.Speed = 9 GraphicsWindow.PenColor = "green" GraphicsWindow.PenWidth = 7 DrawTree() TurtleStartX = (WindowWidth/4) * 2 TurtleStartY = GroundLevel PositionTurtle() angle = 30 delta = 10 distance = 80 Turtle.Speed = 9 GraphicsWindow.PenColor = "brown" GraphicsWindow.PenWidth = 8 DrawTree() TurtleStartX = (WindowWidth/4) * 3 TurtleStartY = GroundLevel PositionTurtle() angle = 30 delta = 10 distance = 70 Turtle.Speed = 9 GraphicsWindow.PenColor = "darkgreen" GraphicsWindow.PenWidth = 7 DrawTree() Sub PositionTurtle TurtleHeading = Turtle.Angle Turtle.PenUp() Turtle.MoveTo( TurtleStartX, TurtleStartY) Turtle.PenDown() Turtle.Angle = TurtleHeading Endsub Sub DrawTree If (distance > 0) Then Turtle.Move(distance) Turtle.Turn(angle) Stack.PushValue("distance", distance) distance = distance - delta GraphicsWindow.PenWidth = GraphicsWindow.PenWidth - 1 DrawTree() Turtle.Turn(-angle * 2) DrawTree() Turtle.Turn(angle) distance = Stack.PopValue("distance") Turtle.Move(-distance) GraphicsWindow.PenWidth = GraphicsWindow.PenWidth + 1 EndIf EndSub End>BMW841.sb< Start>BMZ132-0.sb< 'Sets up shape, events and starting variables 'Improvements by a65001 . Originial Code by Eagle Eye MaxLeft = Desktop.Width MaxBottom = Desktop.Height GraphicsWindow.BrushColor = "#809000FF" Main[1] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";z=1;r=0" GraphicsWindow.BrushColor = "#90ffaa00" Main[2] = "H=50;W=50;ID="+ Shapes.AddEllipse(50,50) +";z=1;r=0" GraphicsWindow.BrushColor = "#90ff0000" Main[3] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";z=1;r=0" 'Debug() GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseUp = MouseUp ZoomVal = 1 RotVal = 0 grp=0 'Main loop While ("True") If MouseState = 1 Then ox=Shapes.GetLeft (Main[NumReturn]["ID"]) oy=Shapes.Gettop (Main[NumReturn]["ID"]) dx=GraphicsWindow.MouseX - (Main[NumReturn]["W"] / 2) dy=GraphicsWindow.MouseY - (Main[NumReturn]["H"] / 2 ) If grp=0 then Shapes.move(ShapeReturn,dx ,dy ) 'Shapes.Move (ShapeReturn,dx ,dy ) else For x=1 To 3 oo=Main[x]["ID"] 'TextWindow.WriteLine (oo) Shapes.Move(oo,shapes.GetLeft (oo)+dx-ox, shapes.GetTop (oo)+dy-oy) EndFor endif EndIf If Zoom <>0 Then Main[NumReturn ]["Z"] = Main[NumReturn ]["Z"] + 0.0001*zoom EndIf Shapes.Zoom(ShapeReturn, Main[NumReturn ]["Z"], Main[NumReturn ]["Z"]) If Rot <>0 Then Main[NumReturn ]["R"] = Main[NumReturn ]["R"] + 0.0036*Rot Endif Shapes.Rotate(ShapeReturn, Main[NumReturn ]["R"]) EndWhile Sub MouseDown X = GraphicsWindow.MouseX Y = GraphicsWindow.MouseY If FCKeyboard.IsControlPressed And FCKeyboard.IsShiftPressed Then rot=-1 elseIf FCKeyboard.IsControlPressed Then rot=1 elseif FCKeyboard.IsAltPressed and FCKeyboard.IsShiftPressed then zoom=-1 ElseIf FCKeyboard.IsShiftPressed then grp=1 elseif FCKeyboard.IsAltPressed then zoom=1 Else zoom=0 grp=0 rot=0 EndIf For I = 1 To Array.GetItemCount(Main) 'Find Shape that was clicked OrigLeft = (Shapes.GetLeft(Main[i]["ID"])) OrigTop = (Shapes.GetTop(Main[i]["ID"])) If OrigLeft <= X And OrigLeft + Main[i]["W"] >= X And OrigTop <= Y And OrigTop + Main[i]["H"] >= Y Then NumReturn = I ShapeReturn = Main[i]["ID"] I = Array.GetItemCount(Main) + 2 EndIf EndFor If ShapeReturn <> "" Then state = "START" 'Debug() EndIf MouseState = 1 EndSub 'Events Sub MouseUp state = "END" 'Debug() ShapeReturn = "" MouseState = 0 Zoom = 0 Rot = 0 Endsub End>BMZ132-0.sb< Start>BMZ132-1.sb< 'Sets up shape, events and starting variables 'Improvements by a65001 . Originial Code by Eagle Eye 'Updated by Tryhest to support Shift, Ctrl, Alt keys. 'Updated by Nonki Takahashi not to use FC extensions. CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) help = "shift+drag moves all objs at once" + CRLF help = help + "ctrl+click obj rotates cw object" + CRLF help = help + "ctrl+shift+click rotates ccw" + CRLF help = help + "alt+click obj zooms in obj" + CRLF help = help + "alt+shift+click zooms out" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(400, 10, help) MaxLeft = Desktop.Width MaxBottom = Desktop.Height GraphicsWindow.BrushColor = "#809000FF" Main[1] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";z=1;r=0" GraphicsWindow.BrushColor = "#90ffaa00" Main[2] = "H=50;W=50;ID="+ Shapes.AddEllipse(50,50) +";z=1;r=0" GraphicsWindow.BrushColor = "#90ff0000" Main[3] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";z=1;r=0" 'Debug() GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseUp = MouseUp GraphicsWindow.KeyDown = KeyDown GraphicsWindow.KeyUp = KeyUp ZoomVal = 1 RotVal = 0 grp=0 'Main loop While ("True") If MouseState = 1 Then ox=Shapes.GetLeft (Main[NumReturn]["ID"]) oy=Shapes.Gettop (Main[NumReturn]["ID"]) dx=GraphicsWindow.MouseX - (Main[NumReturn]["W"] / 2) dy=GraphicsWindow.MouseY - (Main[NumReturn]["H"] / 2 ) If grp=0 then Shapes.move(ShapeReturn,dx ,dy ) 'Shapes.Move (ShapeReturn,dx ,dy ) else For x=1 To 3 oo=Main[x]["ID"] 'TextWindow.WriteLine (oo) Shapes.Move(oo,shapes.GetLeft (oo)+dx-ox, shapes.GetTop (oo)+dy-oy) EndFor endif EndIf If Zoom <>0 Then Main[NumReturn ]["Z"] = Main[NumReturn ]["Z"] + 0.0001*zoom EndIf Shapes.Zoom(ShapeReturn, Main[NumReturn ]["Z"], Main[NumReturn ]["Z"]) If Rot <>0 Then Main[NumReturn ]["R"] = Main[NumReturn ]["R"] + 0.0036*Rot Endif Shapes.Rotate(ShapeReturn, Main[NumReturn ]["R"]) EndWhile Sub MouseDown X = GraphicsWindow.MouseX Y = GraphicsWindow.MouseY If isControlPressed And isShiftPressed Then rot=-1 elseIf isControlPressed Then rot=1 elseif isAltPressed and isShiftPressed then zoom=-1 ElseIf isShiftPressed then grp=1 elseif isAltPressed then zoom=1 Else zoom=0 grp=0 rot=0 EndIf For I = 1 To Array.GetItemCount(Main) 'Find Shape that was clicked OrigLeft = (Shapes.GetLeft(Main[i]["ID"])) OrigTop = (Shapes.GetTop(Main[i]["ID"])) If OrigLeft <= X And OrigLeft + Main[i]["W"] >= X And OrigTop <= Y And OrigTop + Main[i]["H"] >= Y Then NumReturn = I ShapeReturn = Main[i]["ID"] I = Array.GetItemCount(Main) + 2 EndIf EndFor If ShapeReturn <> "" Then state = "START" 'Debug() EndIf MouseState = 1 EndSub 'Events Sub MouseUp state = "END" 'Debug() ShapeReturn = "" MouseState = 0 Zoom = 0 Rot = 0 Endsub Sub KeyDown Key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift " Then isShiftPressed = "True" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then isControlPressed = "True" ElseIf key = "System" Then isAltPressed = "True" EndIf EndSub Sub KeyUp Key = GraphicsWindow.LastKey If key = "LeftShift" Or key = "RightShift" Or key = "Shift " Then isShiftPressed = "False" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then isControlPressed = "False" ElseIf key = "System" Then isAltPressed = "False" EndIf EndSub End>BMZ132-1.sb< Start>BMZ132-4.sb< 'Sets up shape, events and starting variables 'Improvements by a65001 . Originial Code by Eagle Eye 'Updated by Tryhest to support Shift, Ctrl, Alt keys. 'Updated by Nonki Takahashi not to use FC extensions. CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) help = "shift+drag moves all objs at once" + CRLF help = help + "ctrl+click obj rotates cw object" + CRLF help = help + "ctrl+shift+click rotates ccw" + CRLF help = help + "alt+click obj zooms in obj" + CRLF help = help + "alt+shift+click zooms out" GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(400, 10, help) MaxLeft = Desktop.Width MaxBottom = Desktop.Height GraphicsWindow.BrushColor = "#809000FF" Main[1] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";z=1;r=0" GraphicsWindow.BrushColor = "#90ffaa00" Main[2] = "H=50;W=50;ID="+ Shapes.AddEllipse(50,50) +";z=1;r=0" GraphicsWindow.BrushColor = "#90ff0000" Main[3] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";z=1;r=0" 'Debug() GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseUp = MouseUp GraphicsWindow.KeyDown = KeyDown GraphicsWindow.KeyUp = KeyUp ZoomVal = 1 RotVal = 0 grp=0 'Main loop While ("True") If MouseState = 1 Then ox=Shapes.GetLeft (Main[NumReturn]["ID"]) oy=Shapes.Gettop (Main[NumReturn]["ID"]) dx=GraphicsWindow.MouseX - (Main[NumReturn]["W"] / 2) dy=GraphicsWindow.MouseY - (Main[NumReturn]["H"] / 2 ) If grp=0 then Shapes.move(ShapeReturn,dx ,dy ) 'Shapes.Move (ShapeReturn,dx ,dy ) else For x=1 To 3 oo=Main[x]["ID"] 'TextWindow.WriteLine (oo) Shapes.Move(oo,shapes.GetLeft (oo)+dx-ox, shapes.GetTop (oo)+dy-oy) EndFor endif EndIf If Zoom <>0 Then Main[NumReturn ]["Z"] = Main[NumReturn ]["Z"] + 0.0001*zoom EndIf Shapes.Zoom(ShapeReturn, Main[NumReturn ]["Z"], Main[NumReturn ]["Z"]) If Rot <>0 Then Main[NumReturn ]["R"] = Main[NumReturn ]["R"] + 0.0036*Rot Endif Shapes.Rotate(ShapeReturn, Main[NumReturn ]["R"]) EndWhile Sub MouseDown X = GraphicsWindow.MouseX Y = GraphicsWindow.MouseY If isControlPressed And isShiftPressed Then rot=-1 elseIf isControlPressed Then rot=1 elseif isAltPressed and isShiftPressed then zoom=-1 ElseIf isShiftPressed then grp=1 elseif isAltPressed then zoom=1 Else zoom=0 grp=0 rot=0 EndIf For I = 1 To Array.GetItemCount(Main) 'Find Shape that was clicked OrigLeft = (Shapes.GetLeft(Main[i]["ID"])) OrigTop = (Shapes.GetTop(Main[i]["ID"])) If OrigLeft <= X And OrigLeft + Main[i]["W"] >= X And OrigTop <= Y And OrigTop + Main[i]["H"] >= Y Then NumReturn = I ShapeReturn = Main[i]["ID"] I = Array.GetItemCount(Main) + 2 EndIf EndFor If ShapeReturn <> "" Then state = "START" 'Debug() EndIf MouseState = 1 EndSub 'Events Sub MouseUp state = "END" 'Debug() ShapeReturn = "" MouseState = 0 Zoom = 0 Rot = 0 Endsub Sub KeyDown Key = GraphicsWindow.LastKey GraphicsWindow.Title = key If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then isShiftPressed = "True" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then isControlPressed = "True" ElseIf key = "System" Or key = "A" Then isAltPressed = "True" EndIf EndSub Sub KeyUp Key = GraphicsWindow.LastKey GraphicsWindow.Title = "Small Basic Graphics Window" If key = "LeftShift" Or key = "RightShift" Or key = "Shift" Then isShiftPressed = "False" ElseIf key = "LeftCtrl" Or key = "RightCtrl" Then isControlPressed = "False" ElseIf key = "System" Then isAltPressed = "False" EndIf EndSub End>BMZ132-4.sb< Start>BMZ132.sb< 'Sets up shape, events and starting variables 'Improvements by a65001 . Originial Code by Eagle Eye MaxLeft = Desktop.Width MaxBottom = Desktop.Height GraphicsWindow.BrushColor = "Purple" Main[1] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";" GraphicsWindow.BrushColor = "Orange" Main[2] = "H=50;W=50;ID="+ Shapes.AddEllipse(50,50) +";" GraphicsWindow.BrushColor = "Red" Main[3] = "H=100;W=100;ID="+ Shapes.AddRectangle(100, 100) +";" Debug() GraphicsWindow.MouseDown = MouseDown GraphicsWindow.MouseUp = MouseUp ZoomVal = 1 RotVal = 0 'Main loop While ("True") If MouseState = 1 Then Shapes.Move(ShapeReturn,GraphicsWindow.MouseX - (Main[NumReturn]["W"] / 2 ) ,GraphicsWindow.MouseY - (Main[NumReturn]["W"] / 2 ) ) EndIf If Zoom = 1 Then ZoomVal = ZoomVal + 0.0001 ElseIf Zoom = -1 Then ZoomVal = ZoomVal - 0.0001 EndIf Shapes.Zoom(ShapeReturn, ZoomVal, ZoomVal) If Rot = 1 Then RotVal = RotVal + 0.0036 ElseIf Rot = -1 Then RotVal = RotVal - 0.0036 Endif Shapes.Rotate(ShapeReturn, RotVal) EndWhile Sub MouseDown X = GraphicsWindow.MouseX Y = GraphicsWindow.MouseY For I = 1 To Array.GetItemCount(Main) 'Find Shape that was clicked OrigLeft = (Shapes.GetLeft(Main[i]["ID"])) OrigTop = (Shapes.GetTop(Main[i]["ID"])) If OrigLeft <= X And OrigLeft + Main[i]["W"] >= X And OrigTop <= Y And OrigTop + Main[i]["H"] >= Y Then NumReturn = I ShapeReturn = Main[i]["ID"] I = Array.GetItemCount(Main) + 2 EndIf EndFor If ShapeReturn <> "" Then state = "START" Debug() EndIf MouseState = 1 EndSub 'Events Sub MouseUp state = "END" Debug() ShapeReturn = "" MouseState = 0 Zoom = 0 Rot = 0 Endsub Sub Debug TextWindow.Title = "Debug" TextWindow.ForegroundColor = "WHITE" If ShapeReturn <> "" Then TextWindow.Write("M : (" + X +"," + Y +")" ) TextWindow.CursorLeft = 16 TextWindow.Write(" SHAPE: (" + Shapes.GetLeft(ShapeReturn) +"," + Shapes.GetTop( ShapeReturn ) +") " ) 'Debug TextWindow.CursorLeft = 16 + 18 TextWindow.Write( "ID: " + ShapeReturn + " " + state + Text.GetCharacter(10) ) EndIf EndSub End>BMZ132.sb< Start>BNC399.sb< GraphicsWindow.Title = "Tokyo 2020/2021 Games Flag" SB_Workaround() Init() Shapes_Init_Olympic() name = "Olympic" scale = 1 / 2.3 Group_Add() x = 120 y = 80 i = nGroup Group_Move() OlympicFlag() Shapes_Init_Paralympic() name = "Paralympic" Group_Add() x = 470 y = 80 i = nGroup Group_Move() ParalympicFlag() Sub Init Not = "False=True;True=False;" gw = 810 gh = 540 GraphicsWindow.Width = gw GraphicsWindow.Height = gh EndSub Sub OlympicFlag lx = 110 ty = 300 oh = 160 ow = oh / 2 * 3 GraphicsWindow.DrawRectangle(lx, ty, ow, oh) w = oh / 30 r = oh / 6 - w / 2 GraphicsWindow.PenWidth = w color = "1=#0067C0;2=#FFD400;3=#000000;4=#008000;5=#ED1A3D;" x[1] = ow / 2 - 3 * r - 2 * w y[1] = ow / 4 + w / 2 x[2] = ow / 2 - 2 * r - w y[2] = ow / 4 + w / 2 + r x[3] = ow / 2 - r y[3] = ow / 4 + w / 2 x[4] = ow / 2 + w y[4] = ow / 4 + w / 2 + r x[5] = ow / 2 + r + 2 * w y[5] = ow / 4 + w / 2 GraphicsWindow.PenWidth = 0 For a = -315 To 135 If a = 45 Then a = 90 EndIf _a = Math.GetRadians(a) For i = 1 To 5 GraphicsWindow.BrushColor = color[i] cx = x[i] + r cy = y[i] + r px = lx + cx + r * Math.Cos(_a) - w / 2 py = ty + cy + r * Math.Sin(_a) - w / 2 GraphicsWindow.FillEllipse(px, py, w, w) EndFor EndFor EndSub Sub ParalympicFlag scale = 0.12 ox = 530 oy = 380 color = "1=#AA272F;2=#00549F;3=#008542;" cubic[1] = "1=210.134,447.59;2=196.926,453.403;3=-10.03,468.122;4=11.45,291.223;5=32.953,114.378;" cubic[1] = cubic[1] + "6=347.595,-9.82;7=406.157,11.982;8=327.769,52.1;9=165.435,84.083;10=104.464,264.128;" cubic[1] = cubic[1] + "11=44.363,441.763;12=208.664,445.142;13=210.134,447.59;" cubic[2] = "1=530.521,540.879;2=r-3.939,13.918;3=r-125.69,182.398;4=r-247.112,52.159;5=r-121.44,-130.145;" cubic[2] = cubic[2] + "6=r-14.026,-451.576;7=r40.431,-482.614;8=r-19.893,86.01;9=r-99.744,231.226;10=r-1.349,393.744;" cubic[2] = cubic[2] + "11=419.517,664.543;12=527.785,540.61;13=530.521,540.879;" cubic[3] = "1=794.25,272.876;2=r12.281,7.49;3=r143.059,168.887;4=r-13.811,252.746;5=r-156.787,83.881;" cubic[3] = cubic[3] + "6=r-438.813,-103.251;7=r-454.597,-163.974;8=r77.776,41.397;9=r196.933,156.35;10=r379.146,103.12;" cubic[3] = cubic[3] + "11=884.521,412.343;12=793.129,275.432;13=794.25,272.876;" For j = 1 To 3 points = "" GraphicsWindow.BrushColor = color[j] GetPoints() For i = 1 To (Array.GetItemCount(cubic[j]) - 1) / 3 For k = 0 To 1 Step 1 / 8 i1 = (i - 1) * 3 + 1 i2 = (i - 1) * 3 + 2 i3 = (i - 1) * 3 + 3 i4 = (i - 1) * 3 + 4 param = "1=" + i1 + ";2=" + i2 + ";3=1-2;" CalcMidPoint() param = "1=" + i2 + ";2=" + i3 + ";3=2-3;" CalcMidPoint() param = "1=" + i3 + ";2=" + i4 + ";3=3-4;" CalcMidPoint() param = "1=1-2;2=2-3;3=1-3;" CalcMidPoint() param = "1=2-3;2=3-4;3=2-4;" CalcMidPoint() param = "1=1-3;2=2-4;3=1-4;" CalcMidPoint() n = n + 1 points[n][1] = x["1-4"] points[n][2] = y["1-4"] EndFor EndFor GraphicsWindow.PenWidth = 0 Program.Delay(200) LDShapes.AddPolygon(points) n = 0 EndFor EndSub Sub CalcMidPoint ' param k - 0..1 x[param[3]] = x[param[1]] + k * (x[param[2]] - x[param[1]]) y[param[3]] = y[param[1]] + k * (y[param[2]] - y[param[1]]) EndSub Sub GetPoints GraphicsWindow.PenWidth = 2 For i = 1 To Array.GetItemCount(cubic[j]) p = cubic[j][i] c = Text.GetIndexOf(p, ",") x[i] = Text.GetSubText(p, 1, c - 1) y[i] = Text.GetSubTextToEnd(p, c + 1) If Text.StartsWith(x[i], "r") Then x[i] = Text.GetSubTextToEnd(x[i], 2) x[i] = xLast + x[i] y[i] = yLast + y[i] EndIf If Math.Remainder(i, 3) = 1 Then xLast = x[i] yLast = y[i] EndIf x[i] = x[i] * scale + ox y[i] = y[i] * scale + oy EndFor EndSub Sub Group_Add ' Group | add shapes to a group ' param name - group name ' param shX, shY, origin of shape array ' param scale - scale of group ' param shape[] - shape array ' param nGroup - number of group ' return nGroup - updated number of group ' return group - group array Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nGroup = nGroup + 1 grp = "" grp["name"] = name grp["x"] = shX grp["y"] = shY grp["angle"] = 0 grp["dir"] = 1 Shapes_CalcWidthAndHeight() grp["width"] = shWidth grp["cx"] = shWidth / 2 grp["height"] = shHeight s = scale grp["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If Text.IsSubText("text|btn", shp["func"]) Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] If shp["fb"] = "False" Then GraphicsWindow.FontBold = "False" Else GraphicsWindow.FontBold = "True" EndIf EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor grp["shape"] = shape group[nGroup] = grp y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Group_Move ' Group | Move a group ' param group[i] - group to move ' param x, y - position to move ' return group[i] - updated group grp = group[i] s = grp["scale"] grp["x"] = x grp["y"] = y shape = grp["shape"] n = Array.GetItemCount(shape) For j = 1 To n shp = shape[j] If silverlight And Text.IsSubText("tri|line", shp["func"]) Then _x = shp["wx"] _y = shp["wy"] Else _x = shp["rx"] _y = shp["ry"] EndIf Shapes.Move(shp["obj"], grp["x"] + _x * s, grp["y"] + _y * s) EndFor group[i] = grp EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param shape[] - shape array ' return shWidth, shHeight - total size of shapes For i = i To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init_Olympic ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 50 ' x offset shY = 50 ' y offset shape = "" shape[1] = "func=rect;x=249.99;y=441.33;width=47.77;height=47.77;angle=30;bc=#012063;pw=0;" shape[2] = "func=rect;x=244.62;y=383.07;width=58.51;height=33.78;angle=-45;bc=#012063;pw=0;" shape[3] = "func=rect;x=179.36;y=448.33;width=58.51;height=33.78;angle=45;bc=#012063;pw=0;" shape[4] = "func=rect;x=184.73;y=376.07;width=47.77;height=47.77;angle=-30;bc=#012063;pw=0;" shape[5] = "func=rect;x=97.81;y=448.34;width=65.26;height=17.48;angle=30;bc=#012063;pw=0;" shape[6] = "func=rect;x=68.54;y=383.67;width=58.51;height=33.78;angle=45;bc=#012063;pw=0;" shape[7] = "func=rect;x=73.91;y=311.4;width=47.77;height=47.77;angle=-30;bc=#012063;pw=0;" shape[8] = "func=rect;x=121.69;y=424.45;width=65.26;height=17.48;angle=60;bc=#012063;pw=0;" shape[9] = "func=rect;x=125.06;y=351.04;width=58.51;height=33.78;angle=75;bc=#012063;pw=0;" shape[10] = "func=rect;x=10.28;y=360.81;width=65.26;height=17.48;angle=60;bc=#012063;pw=0;" shape[11] = "func=rect;x=13.65;y=287.4;width=58.51;height=33.78;angle=75;bc=#012063;pw=0;" shape[12] = "func=rect;x=-21.75;y=241.25;width=65.26;height=17.48;angle=90;bc=#012063;pw=0;" shape[13] = "func=rect;x=10.88;y=232.51;width=65.26;height=17.48;angle=60;bc=#012063;pw=0;" shape[14] = "func=rect;x=34.77;y=208.62;width=65.26;height=17.48;angle=30;bc=#012063;pw=0;" shape[15] = "func=rect;x=70.77;y=256.99;width=58.51;height=33.78;angle=45;bc=#012063;pw=0;" shape[16] = "func=rect;x=27.77;y=139.18;width=47.77;height=47.77;angle=150;bc=#012063;pw=0;" shape[17] = "func=rect;x=78.92;y=178.81;width=58.51;height=33.78;angle=75;bc=#012063;pw=0;" shape[18] = "func=rect;x=55.03;y=89.66;width=58.51;height=33.78;angle=165;bc=#012063;pw=0;" shape[19] = "func=rect;x=116.92;y=115.29;width=47.77;height=47.77;angle=90;bc=#012063;pw=0;" shape[20] = "func=rect;x=97.81;y=34.17;width=65.26;height=17.48;angle=150;bc=#012063;pw=0;" shape[21] = "func=rect;x=166.44;y=26.02;width=58.51;height=33.78;angle=165;bc=#012063;pw=0;" shape[22] = "func=rect;x=228.33;y=51.65;width=47.77;height=47.77;angle=90;bc=#012063;pw=0;" shape[23] = "func=rect;x=106.55;y=66.8;width=65.26;height=17.48;angle=180;bc=#012063;pw=0;" shape[24] = "func=rect;x=166.44;y=91.29;width=58.51;height=33.78;angle=195;bc=#012063;pw=0;" shape[25] = "func=rect;x=217.36;y=2.14;width=65.26;height=17.48;angle=180;bc=#012063;pw=0;" shape[26] = "func=rect;x=277.25;y=26.62;width=58.51;height=33.78;angle=195;bc=#012063;pw=0;" shape[27] = "func=rect;x=336.92;y=34.17;width=65.26;height=17.48;angle=210;bc=#012063;pw=0;" shape[28] = "func=rect;x=328.18;y=66.8;width=65.26;height=17.48;angle=180;bc=#012063;pw=0;" shape[29] = "func=rect;x=336.92;y=99.44;width=65.26;height=17.48;angle=150;bc=#012063;pw=0;" shape[30] = "func=rect;x=275.03;y=91.29;width=58.51;height=33.78;angle=165;bc=#012063;pw=0;" shape[31] = "func=rect;x=400.56;y=97.8;width=47.77;height=47.77;angle=270;bc=#012063;pw=0;" shape[32] = "func=rect;x=338.67;y=137.43;width=58.51;height=33.78;angle=195;bc=#012063;pw=0;" shape[33] = "func=rect;x=427.82;y=161.32;width=58.51;height=33.78;angle=285;bc=#012063;pw=0;" shape[34] = "func=rect;x=376.67;y=186.95;width=47.77;height=47.77;angle=210;bc=#012063;pw=0;" shape[35] = "func=rect;x=456.48;y=241.25;width=65.26;height=17.48;angle=270;bc=#012063;pw=0;" shape[36] = "func=rect;x=427.22;y=289.62;width=58.51;height=33.78;angle=285;bc=#012063;pw=0;" shape[37] = "func=rect;x=376.07;y=315.26;width=47.77;height=47.77;angle=210;bc=#012063;pw=0;" shape[38] = "func=rect;x=423.85;y=232.51;width=65.26;height=17.48;angle=300;bc=#012063;pw=0;" shape[39] = "func=rect;x=370.7;y=256.99;width=58.51;height=33.78;angle=315;bc=#012063;pw=0;" shape[40] = "func=rect;x=424.45;y=360.81;width=65.26;height=17.48;angle=300;bc=#012063;pw=0;" shape[41] = "func=rect;x=371.3;y=385.3;width=58.51;height=33.78;angle=315;bc=#012063;pw=0;" shape[42] = "func=rect;x=336.92;y=448.34;width=65.26;height=17.48;angle=330;bc=#012063;pw=0;" shape[43] = "func=rect;x=313.04;y=424.45;width=65.26;height=17.48;angle=300;bc=#012063;pw=0;" shape[44] = "func=rect;x=280.4;y=415.71;width=65.26;height=17.48;angle=270;bc=#012063;pw=0;" shape[45] = "func=rect;x=316.41;y=351.04;width=58.51;height=33.78;angle=285;bc=#012063;pw=0;" shape[46] = "func=text;x=434.45;y=424.45;text=TM;fs=18.48;fn=Calibri;bc=#012063;" shape[47] = "func=text;x=-24.45;y=494.45;text=TOKYO 202①;fs=108.48;fn=Calibri;bc=#012063;" EndSub Sub Shapes_Init_Paralympic ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 50 ' x offset shY = 50 ' y offset shape = "" shape[1] = "func=rect;x=160.85;y=465.23;width=65.26;height=17.48;angle=30;bc=#012063;pw=0;" shape[2] = "func=rect;x=184.73;y=441.34;width=65.26;height=17.48;angle=60;bc=#012063;pw=0;" shape[3] = "func=rect;x=217.36;y=432.6;width=65.26;height=17.48;angle=270;bc=#012063;pw=0;" shape[4] = "func=rect;x=250;y=441.34;width=65.26;height=17.48;angle=300;bc=#012063;pw=0;" shape[5] = "func=rect;x=273.88;y=465.23;width=65.26;height=17.48;angle=150;bc=#012063;pw=0;" shape[6] = "func=rect;x=97.81;y=448.34;width=65.26;height=17.48;angle=30;bc=#012063;pw=0;" shape[7] = "func=rect;x=131.58;y=400.56;width=58.51;height=33.78;angle=45;bc=#012063;pw=0;" shape[8] = "func=rect;x=188.1;y=367.93;width=58.51;height=33.78;angle=75;bc=#012063;pw=0;" shape[9] = "func=rect;x=253.37;y=367.93;width=58.51;height=33.78;angle=285;bc=#012063;pw=0;" shape[10] = "func=rect;x=309.89;y=400.56;width=58.51;height=33.78;angle=-45;bc=#012063;pw=0;" shape[11] = "func=rect;x=336.92;y=448.34;width=65.26;height=17.48;angle=330;bc=#012063;pw=0;" shape[12] = "func=rect;x=68.54;y=383.67;width=58.51;height=33.78;angle=45;bc=#012063;pw=0;" shape[13] = "func=rect;x=136.95;y=328.3;width=47.77;height=47.77;angle=150;bc=#012063;pw=0;" shape[14] = "func=rect;x=226.1;y=304.41;width=47.77;height=47.77;angle=90;bc=#012063;pw=0;" shape[15] = "func=rect;x=315.26;y=328.3;width=47.77;height=47.77;angle=30;bc=#012063;pw=0;" shape[16] = "func=rect;x=372.93;y=383.67;width=58.51;height=33.78;angle=315;bc=#012063;pw=0;" shape[17] = "func=rect;x=10.28;y=360.81;width=65.26;height=17.48;angle=60;bc=#012063;pw=0;" shape[18] = "func=rect;x=73.91;y=311.4;width=47.77;height=47.77;angle=-30;bc=#012063;pw=0;" shape[19] = "func=rect;x=164.22;y=278.78;width=58.51;height=33.78;angle=165;bc=#012063;pw=0;" shape[20] = "func=rect;x=277.25;y=278.78;width=58.51;height=33.78;angle=195;bc=#012063;pw=0;" shape[21] = "func=rect;x=378.3;y=311.4;width=47.77;height=47.77;angle=210;bc=#012063;pw=0;" shape[22] = "func=rect;x=424.45;y=360.81;width=65.26;height=17.48;angle=300;bc=#012063;pw=0;" shape[23] = "func=rect;x=13.65;y=287.4;width=58.51;height=33.78;angle=75;bc=#012063;pw=0;" shape[24] = "func=rect;x=101.18;y=261.88;width=58.51;height=33.78;angle=165;bc=#012063;pw=0;" shape[25] = "func=rect;x=217.36;y=254.29;width=65.26;height=17.48;angle=180;bc=#012063;pw=0;" shape[26] = "func=rect;x=340.29;y=261.88;width=58.51;height=33.78;angle=195;bc=#012063;pw=0;" shape[27] = "func=rect;x=427.82;y=287.4;width=58.51;height=33.78;angle=285;bc=#012063;pw=0;" shape[28] = "func=rect;x=-21.75;y=241.25;width=65.26;height=17.48;angle=90;bc=#012063;pw=0;" shape[29] = "func=rect;x=51.65;y=223.88;width=47.77;height=47.77;angle=90;bc=#012063;pw=0;" shape[30] = "func=rect;x=154.33;y=237.4;width=65.26;height=17.48;angle=180;bc=#012063;pw=0;" shape[31] = "func=rect;x=280.4;y=237.4;width=65.26;height=17.48;angle=180;bc=#012063;pw=0;" shape[32] = "func=rect;x=400.56;y=223.88;width=47.77;height=47.77;angle=270;bc=#012063;pw=0;" shape[33] = "func=rect;x=456.48;y=241.25;width=65.26;height=17.48;angle=270;bc=#012063;pw=0;" shape[34] = "func=rect;x=14.25;y=176.59;width=58.51;height=33.78;angle=285;bc=#012063;pw=0;" shape[35] = "func=rect;x=102.8;y=198.25;width=58.51;height=33.78;angle=195;bc=#012063;pw=0;" shape[36] = "func=rect;x=338.67;y=198.25;width=58.51;height=33.78;angle=165;bc=#012063;pw=0;" shape[37] = "func=rect;x=427.22;y=176.59;width=58.51;height=33.78;angle=75;bc=#012063;pw=0;" shape[38] = "func=rect;x=10.28;y=121.7;width=65.26;height=17.48;angle=300;bc=#012063;pw=0;" shape[39] = "func=rect;x=76.14;y=136.95;width=47.77;height=47.77;angle=210;bc=#012063;pw=0;" shape[40] = "func=rect;x=376.07;y=136.95;width=47.77;height=47.77;angle=-30;bc=#012063;pw=0;" shape[41] = "func=rect;x=424.45;y=121.7;width=65.26;height=17.48;angle=60;bc=#012063;pw=0;" shape[42] = "func=rect;x=70.17;y=80.91;width=58.51;height=33.78;angle=315;bc=#012063;pw=0;" shape[43] = "func=rect;x=371.3;y=80.91;width=58.51;height=33.78;angle=45;bc=#012063;pw=0;" shape[44] = "func=rect;x=97.81;y=34.17;width=65.26;height=17.48;angle=150;bc=#012063;pw=0;" shape[45] = "func=rect;x=336.92;y=34.17;width=65.26;height=17.48;angle=210;bc=#012063;pw=0;" shape[46] = "func=text;x=434.45;y=424.45;text=TM;fs=18.48;fn=Calibri;bc=#012063;" shape[47] = "func=text;x=-24.45;y=494.45;text=TOKYO 202①;fs=108.48;fn=Calibri;bc=#012063;" shape[48] = "func=text;x=38.45;y=604.45;text=PARALYMPIC GAMES;fs=50.48;fn=Calibri;bc=#012063;" EndSub End>BNC399.sb< Start>BND561-0.sb< Profiler_sub = "Main" ' for profile Profiler_Init() ' for profile import() Profiler_sub = "Main" ' for profile Go: screen = "false" GraphicsWindow.Clear() mapStack = "empty" jackStack = "empty" gregStack = "empty" GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Height = 400 GraphicsWindow.Width = 600 back1 = ImgPath + "\Assets\"+ "gameOver" + tag back = ImgPath + "\Assets\"+ "loading" + tag GraphicsWindow.DrawImage(back,0,0) currentLevel = -1 Stack.PushValue(jackStack, 20) generateStack() Profiler_sub = "Main" ' for profile Goto Menu Start: GG = 0 KillCount = 0 nextLevel() Profiler_sub = "Main" ' for profile Main: If GG = 2 Then For gL = startActive To stopActive collision() endFor Profiler_sub = "Main" ' for profile gL = 400 collision() Profiler_sub = "Main" ' for profile GG = 0 endif GG = GG + 1 If isDead = 1 Then Profiler_Dump() Goto Go endif MouseMove() pathing() moveSprites() Profiler_sub = "Main" ' for profile Program.Delay(32) Goto Main 'Menu Menu: drawMenu() Profiler_sub = "Main" ' for profile menuDetect: GraphicsWindow.PenColor = "Gray" ' for debug GraphicsWindow.DrawRectangle(70, 60, 200-70, 150-60) ' for debug If(GraphicsWindow.MouseX > 70 And GraphicsWindow.MouseX < 200 And GraphicsWindow.MouseY > 60 And GraphicsWindow.MouseY < 150) Then Shapes.SetOpacity(shape,99) If(Mouse.IsLeftButtonDown) Then isDead = 0 GraphicsWindow.Clear() GraphicsWindow.Height = 600 GraphicsWindow.Width = 600 Goto Start EndIf Else Shapes.SetOpacity(shape,100) EndIf GraphicsWindow.DrawRectangle(70, 260, 200-70, 350-260) ' for debug If(GraphicsWindow.MouseX > 70 And GraphicsWindow.MouseX < 200 And GraphicsWindow.MouseY > 260 And GraphicsWindow.MouseY < 350) Then Shapes.SetOpacity(shape1,99) If(Mouse.IsLeftButtonDown) Then Program.End() EndIf Else Shapes.SetOpacity(shape1,100) EndIf Goto menuDetect 'End Menu Sub death 'exectues death and clean up Profiler_Begin() ' for profile Profiler_sub = "death" ' for profile If( screen = "false") Then unloadMap() Shapes.AddImage(deathScreen) screen = "true" Program.Delay(1500) EndIf Profiler_End() ' for profile EndSub 'end death + clean Sub drawMenu 'DrawMenu Profiler_Begin() ' for profile Profiler_sub = "drawMenu" ' for profile GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = "#060313" GraphicsWindow.DrawImage(menu,200,0) GraphicsWindow.BrushColor = "white" GraphicsWindow.FillRectangle(40,50, 150, 75) GraphicsWindow.FillRectangle(40,200, 150, 75) shape = Shapes.AddImage(menu2) shape1 = Shapes.AddImage(menu3) Shapes.Move(shape, 40,50) Shapes.Move(shape1, 40,200) Profiler_End() ' for profile EndSub 'End Draw Menu Sub nextLevel 'Load and Display Next Level Profiler_Begin() ' for profile Profiler_sub = "nextLevel" ' for profile currentLevel = currentLevel + 1 'printMap() initStage() DisplayMap() xVel[400] = 0 yVel[400] = 0 Profiler_End() ' for profile EndSub' End Load and Display Next Level Sub generateStack 'Generates a series of levels with increasing difficulty Profiler_Begin() ' for profile Profiler_sub = "generateStack" ' for profile numLevels = Stack.PopValue(jackStack) For iJ = 0 To numLevels Stack.PushValue(jackStack, iJ) generateMap() mapArray[iJ] = Stack.PopValue(mapStack) EndFor Profiler_End() ' for profile EndSub 'End Generates a series of levels with increasing difficulty Sub import'Import Assests Profiler_Begin() ' for profile Profiler_sub = "import" ' for profile ImgPath = Program.Directory tag = ".png" image[0] = ImageList.LoadImage( ImgPath + "\Assets\"+ "floortile" + tag) image[1] = ImageList.LoadImage( ImgPath + "\Assets\"+ "wall" + tag ) image[2] = ImageList.LoadImage( ImgPath + "\Assets\"+ "door" + tag) image[3] = ImageList.LoadImage( ImgPath + "\Assets\"+ "crate" + tag ) image[4] = ImageList.LoadImage( ImgPath + "\Assets\"+ "peasantEnemy" + tag ) image[5] = ImageList.LoadImage( ImgPath + "\Assets\"+ "rogueEnemy" + tag ) image[6] = ImageList.LoadImage( ImgPath + "\Assets\"+ "knightEnemy" + tag ) image[7] = ImageList.LoadImage( ImgPath + "\Assets\"+ "wizardEnemy" + tag ) image[8] = ImageList.LoadImage( ImgPath + "\Assets\"+ "bossEnemy" + tag ) image[9] = ImageList.LoadImage( ImgPath + "\Assets\"+ "pit" + tag ) image[10] = ImageList.LoadImage( ImgPath + "\Assets\"+ "floor" + tag ) image[11] = ImageList.LoadImage( ImgPath + "\Assets\"+ "wizard" + tag ) image[12] = ImageList.LoadImage( ImgPath + "\Assets\"+ "0" + tag ) image[13] = ImageList.LoadImage( ImgPath + "\Assets\"+ "S_Fire03" + tag ) image[14] = ImageList.LoadImage( ImgPath + "\Assets\"+ "chicken" + tag ) menu = ImageList.LoadImage(ImgPath + "\Assets\" + "menu" + ".png") menu2 = ImageList.LoadImage(ImgPath + "\Assets\" + "playbutt" + ".png") menu3 = ImageList.LoadImage(ImgPath + "\Assets\" + "quitbutt" + ".png") deathScreen = ImageList.LoadImage(ImgPath + "\Assets\" + "gameOver" + ".png") Profiler_End() ' for profile EndSub'End Import Assets Sub initStage 'Build Level Profiler_Begin() ' for profile Profiler_sub = "initStage" ' for profile moo = mapArray[currentLevel] lastIndex = 0 doorI = 0 For indexM = 0 To 9 'Start Super For For i = 0 To 399 If ( indexM = 1) Then If moo[i] = 1 Then 'Load Wall Data sprites[1 + lastIndex] = image[1] health[1 + lastIndex] = -1 speed[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 1 lastIndex = lastIndex + 1 EndIf 'End Load Wall Data EndIf If ( indexM = 2) Then If moo[i] = 2 Then 'Load Door Data sprites[1 + lastIndex] = image[2] health[1 + lastIndex] = -1 speed[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 2 door[1 + lastIndex] = doorI doorI = doorI + 1 lastIndex = lastIndex + 1 EndIf 'End Load Door Data EndIf If ( indexM = 3) Then If moo[i] = 3 Then 'Load Crate Data sprites[1 + lastIndex] = image[3] health[1 + lastIndex] = 1 speed[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 3 lastIndex = lastIndex + 1 EndIf 'End Load Crate Data EndIf If ( indexM = 4) Then If moo[i] = 4 Then 'Load Peasant Data sprites[1 + lastIndex] = image[4] health[1 + lastIndex] = 1 speed[1 + lastIndex] = 3 stunTimer[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 4 lastIndex = lastIndex + 1 KillCount = KillCount + 1 EndIf 'End Load Load Peasant Data EndIf If ( indexM = 5) Then If moo[i] = 5 Then 'Load Rogue Data sprites[1 + lastIndex] = image[5] health[1 + lastIndex] = 1 speed[1 + lastIndex] = 4 stunTimer[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 5 lastIndex = lastIndex + 1 KillCount = KillCount + 1 EndIf 'End Load Rogue Data EndIf If ( indexM = 6) Then If moo[i] = 6 Then 'Load Knight Data sprites[1 + lastIndex] = image[6] health[1 + lastIndex] = 3 speed[1 + lastIndex] = 2 stunTimer[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 6 lastIndex = lastIndex + 1 KillCount = KillCount + 1 EndIf 'End Load Wizard Data EndIf If ( indexM = 7) Then If moo[i] = 7 Then 'Load Wizard Data sprites[1 + lastIndex] = image[7] health[1 + lastIndex] = 1 speed[1 + lastIndex] = 60 stunTimer[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 7 lastIndex = lastIndex + 1 KillCount = KillCount + 1 EndIf 'End Load Wizard Data EndIf If ( indexM = 8) Then If moo[i] = 8 Then 'Load Uber Data sprites[1 + lastIndex] = image[8] health[1 + lastIndex] = 2 speed[1 + lastIndex] = 5 stunTimer[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 8 lastIndex = lastIndex + 1 KillCount = KillCount + 1 EndIf 'End Load Uber Data EndIf If ( indexM = 4) Then If moo[i] = 9 Then 'Load Uber Data health[1 + lastIndex] = -1 speed[1 + lastIndex] = 0 cordx[1 + lastIndex] = Math.Remainder(i, 20)*30 cordy[1 + lastIndex] = Math.Floor(i/20)*30 ID[1 + lastIndex] = 9 lastIndex = lastIndex + 1 EndIf 'End Load Uber Data EndIf If(lastIndex = 178) Then Goto breakM EndIf EndFor breakM: EndFor ' End Super For For indexX = 0 To 399 If(ID[indexX] = 4 Or ID[indexX] = 5 Or ID[indexX] = 6 Or ID[indexX] = 7 Or ID[indexX] = 8) Then startActive = indexX Goto break1 EndIf EndFor break1: For indexX = 399 To 0 Step -1 If(ID[indexX] = 4 Or ID[indexX] = 5 Or ID[indexX] = 6 Or ID[indexX] = 7 Or ID[indexX] = 8) Then stopActive = indexX Goto break2 EndIf EndFor break2: firestart = stopActive firecycle = 1 fireRate = 0 For i = 1 To 3 sprites[1 + lastIndex] = image[13] health[1 + lastIndex] = 5 speed[1 + lastIndex] = 5 stunTimer[1 + lastIndex] = 0 cordx[1 + lastIndex] = -20 cordy[1 + lastIndex] = -20 ID[1 + lastIndex] = 13 lastIndex = lastIndex + 1 stopActive = stopActive + 1 EndFor health[400] = 1 If(wizDoor = 1) Then cordx[400] = 33 + Math.Remainder(200 , 20)*30 cordy[400] = Math.Floor(200 /20)*30 ElseIf wizDoor = 2 Then cordx[400] = Math.Remainder(219, 20)*30 - 30 cordy[400] = Math.Floor(219 /20)*30 elseIf wizDoor = 3 Then cordx[400] = Math.Remainder(390 , 20)*30 cordy[400] = Math.Floor(390 /20)*30 - 35 Else cordx[400] = Math.Remainder(10, 20)*30 cordy[400] = Math.Floor(25/20)*30 EndIf ID[400] = 11 Profiler_End() ' for profile EndSub 'End Build Level Sub DisplayMap 'Display Map Profiler_Begin() ' for profile Profiler_sub = "DisplayMap" ' for profile displayTiles() displayInactive() displayActive() Profiler_End() ' for profile EndSub 'End Display Map Sub displayTiles 'Display all floor tiles Profiler_Begin() ' for profile Profiler_sub = "displayTiles" ' for profile For i = 0 To 399 GraphicsWindow.DrawImage(image[0], Math.Remainder(i, 20)*30, Math.Floor(i/20)*30) EndFor For i = 0 To 399 If(ID[i] = 3) Then GraphicsWindow.DrawImage(image[12], cordx[i], cordy[i]) EndIf EndFor Profiler_End() ' for profile EndSub 'End Displays all floor tiles Sub displayInactive 'Display all inactive tiles Profiler_Begin() ' for profile Profiler_sub = "displayInactive" ' for profile For i = 0 To 400 If(ID[i] = 3 Or ID[i] = 2 Or ID[i] = 1 Or ID[i] = 9) Then sprites[i] = Shapes.AddImage(image[ID[i]]) Shapes.Move(sprites[i], cordx[i], cordy[i]) EndIf EndFor Profiler_End() ' for profile EndSub 'End Display all inactive tiles Sub displayActive 'Display all active tiles Profiler_Begin() ' for profile Profiler_sub = "displayActive" ' for profile For i = 0 To 400 If(ID[i] = 4 Or ID[i] = 5 Or ID[i] = 6 Or ID[i] = 7 Or ID[i] = 8 Or ID[i] = 11 Or ID[i] = 13) Then sprites[i] = Shapes.AddImage(image[ID[i]]) Shapes.Move(sprites[i], cordx[i], cordy[i]) EndIf EndFor Profiler_End() ' for profile EndSub 'End Display all active tiles Sub unloadMap 'Clear Stage data Profiler_Begin() ' for profile Profiler_sub = "unloadMap" ' for profile GraphicsWindow.Clear() For i = 0 To 400 Shapes.Remove(sprites[i]) EndFor sprites = "blank" health = "blank" speed = "blank" cordx = "blank" cordy = "blank" ID = "blank" Profiler_End() ' for profile EndSub 'End Clear Stage data Sub generateMap 'Generate Map Profiler_Begin() ' for profile Profiler_sub = "generateMap" ' for profile diff = Stack.PopValue(mapStack) i = 0 'Initializes Floor to 0, Walls to 1, Doors to 2 For i = 0 To 399 map[i] = 0 If (i < 20 Or i > 379 Or Math.Remainder(i,20) = 0 Or Math.Remainder(i,20) = 19) Then map[i] = 1 EndIf If( i = 10 Or i = 200 Or i = 219 Or i = 390) Then map[i] = 2 EndIf EndFor blockCount = 15 While( blockCount > 0) 'Places features in room theDice = Math.GetRandomNumber(4)- 1 cord = Math.GetRandomNumber(400) - 1 If( map[cord] <> 1 and map[cord] <> 2 and map[cord] <> 3 and map[cord] <> 9 and map[cord + 20] <> 2 and map[cord - 20] <> 2 and map[cord + 1] <> 2 and map[cord - 1] <> 2) Then 'Master Check If( theDice = 0) Then 'Make walls wallLength = Math.GetRandomNumber(5) theCoin = Math.GetRandomNumber(2) If( theCoin = 1) Then 'Make Horizontal Wall if (cord + wallLength < 400)Then For i1 = 0 To wallLength If( map[cord + i1] <> 1 and map[cord + i1] <> 2 and map[cord + i1] <> 9 and map[cord + i1 + 20] <> 2 and map[cord + i1 - 20] <> 2) Then map[cord + i1] = 3 blockCount = blockCount - 1 EndIf EndFor EndIf Else'Make Vertical Wall if (cord + (20 * wallLength) < 400)THen For i1 = 0 To wallLength If( map[cord + (20 *i1) - 1] <> 2 and map[cord + (20 *i1) + 1] <> 2 and map[cord + (20 *i1)] <> 1 and map[cord + (20 *i1)] <> 2 and map[cord + (20 *i1)] <> 3 and map[cord + (20 *i1)] <> 9) Then map[cord + (20 *i1)] = 3 blockCount = blockCount - 1 EndIf EndFor EndIf EndIf'End Make Vertical Wall && End Horizontal Wall EndIf 'End Wall If(map[cord] <> 1 and map[cord] <> 2 and map[cord + 1] <> 2 and map[cord - 1] <> 2 and map[cord + 20] <> 2 and map[cord - 20] <> 2)Then'Next to door check If(theDice = 1 Or theDice = 2) then 'Make Block map[cord] = 3 blockCount = blockCount - 1 EndIf 'End Make Block if(theDice = 3) then 'Make Pit map[cord] = 9 blockCount = blockCount - 1 EndIf 'End Make Pit EndIf ' End Next to door check EndIf 'End MasterCheck EndWhile'End feature generator seed = diff + Math.GetRandomNumber(5) While(seed > 0)'Mob Generation mob = Math.GetRandomNumber(106 + (5 * diff)) cord = Math.GetRandomNumber(400) - 1 if(map[cord] <> 1 and map[cord] <> 2 and map[cord]<> 3 and map[cord] <> 9 And map[cord + 1] <> 2 and map[cord - 1] <> 2 and map[cord + 20] <> 2 and map[cord - 20] <> 2 And map[cord + 2] <> 2 and map[cord - 2] <> 2 and map[cord + 40] <> 2 and map[cord - 40] <> 2) Then 'Master Check If(cord < 30)Then cord = cord + 80 EndIf If(cord > 370)Then cord = cord - 80 EndIf If(Math.Remainder(cord, 20) < 4)Then cord = cord + 10 EndIf If(Math.Remainder(cord, 20) > 16)Then cord = cord - 10 EndIf ' Spawn Peasant if (mob < 41) Then map[cord] = 4 seed = seed - 1 EndIf 'Spawn Rogue if (40 < mob and mob < 76) Then map[cord] = 5 seed = seed - 2 EndIf ' Spawn Knight if (75 < mob and mob < 91 ) Then map[cord] = 6 seed = seed - 3 EndIf ' Spawn Wizard if (90 < mob and mob <= 100 + (2.5 * diff)) Then map[cord] = 7 seed = seed - 4 EndIf ' Spawn UberBoss if (100 + (2.5 * diff) < mob and mob <= 105 + (2.5 * diff)) Then map[cord] = 8 seed = seed - 9 EndIf endIF 'End Master Check EndWhile 'End Mob Generation Stack.PushValue(mapStack, map) Profiler_End() ' for profile EndSub 'End Generate Map sub MouseMove Profiler_Begin() ' for profile Profiler_sub = "MouseMove" ' for profile GVX = GraphicsWindow.MouseX - cordx[400] GVY = GraphicsWindow.MouseY - cordy[400] Gmag = Math.SquareRoot(GVX * GVX + GVY * GVY) If Mouse.IsLeftButtonDown Then xVel[400] = 1.5 * (GVX / Gmag) yVel[400] = 1.5 * (GVY / Gmag) ElseIf Mouse.IsRightButtonDown Then xVel[400] = -1.5 * (GVX / Gmag) yVel[400] = -1.5 * (GVY / Gmag) Else xVel[400] = 0 yVel[400] = 0 EndIf cordx[400] = cordx[400] + 2 * xVel[400] cordy[400] = cordy[400] + 2 * yVel[400] Shapes.Move(sprites[400], cordx[400], cordy[400]) If(GraphicsWindow.MouseX >= cordx[400]) Then 'start rot Shapes.Rotate(sprites[400], Math.ArcTan(( cordy[400] - GraphicsWindow.MouseY) / (cordx[400] - GraphicsWindow.MouseX + 10)) * (180 / Math.Pi) +180) else Shapes.Rotate(sprites[400], Math.ArcTan(( cordy[400] - GraphicsWindow.MouseY) / (cordx[400] - GraphicsWindow.MouseX + 10)) * (180 / Math.Pi) ) endif fireRate = fireRate + 1 If GraphicsWindow.LastKey = "Space" And fireRate > 30 Then 'Fireball If gi = 0 Then cordx[firestart + firecycle] = cordx[400] cordy[firestart + firecycle] = cordy[400] xVel[firestart + firecycle] = 8 * (GVX / Gmag) yVel[firestart + firecycle] = 8 * (GVY / Gmag) firecycle = firecycle + 1 fireRate = 0 If firecycle = 4 Then firecycle = 1 EndIf gi = 1 EndIf EndIf GraphicsWindow.KeyDown = setiToZero Profiler_End() ' for profile EndSub Sub setiToZero ' needed evil Profiler_Begin() ' for profile Profiler_sub = "setiToZero" ' for profile gi = 0 Profiler_End() ' for profile EndSub ' EndMovement Sub collision Profiler_Begin() ' for profile Profiler_sub = "collision" ' for profile 'Only check each pair once For gj = 1 To startActive - 1 ' start collision For If (cordx[gL] < cordx[gj] + 30 And cordx[gL] + 30 > cordx[gj] And cordy[gL] < cordy[gj] + 30 And cordy[gL] + 30 > cordy[gj]) Then 'start box if If ID[gL] >= 4 and ID[gL] <= 8 Then ' mob collisions If ID[gj] = 1 Then 'Wall collide EndIf If ID[gj] = 2 Then ' Door collide EndIf If ID[gj] = 3 Then 'Create collide cordx[gj] = -90 cordy[gj] = -90 Shapes.Move(sprites[gj], cordx[gj], cordy[gj]) xVel[gL] = 0 yVel[gL] = 0 stunTimer[gL] = 30 EndIf If ID[gj] = 9 Then 'Pit collide stunTimer[gL] = 1 EndIf EndIf if ID[gL] = 11 Then 'Player collisions If ID[gj] = 1 Then 'Wall collide GVX = cordx[gj] - cordx[400] GVY = cordy[gj] - cordy[400] Gmag = Math.SquareRoot(GVX * GVX + GVY * GVY) cordx[400] = cordx[400] - 3 * (GVX/Gmag) cordy[400] = cordy[400] - 3 * (GVY/Gmag) EndIf If ID[gj] = 2 Then ' Door collide If(KillCount <= 0) Then KillCount = 0 wizDoor = door[gj] unloadMap() nextLevel() Else GVX = cordx[gj] - cordx[400] GVY = cordy[gj] - cordy[400] Gmag = Math.SquareRoot(GVX * GVX + GVY * GVY) cordx[400] = cordx[400] - 3 * (GVX/Gmag) cordy[400] = cordy[400] - 3 * (GVY/Gmag) EndIf EndIf If ID[gj] = 3 Then 'Create collide GVX = cordx[gj] - cordx[400] GVY = cordy[gj] - cordy[400] Gmag = Math.SquareRoot(GVX * GVX + GVY * GVY) cordx[400] = cordx[400] - 3 * (GVX/Gmag) cordy[400] = cordy[400] - 3 * (GVY/Gmag) EndIf EndIf 'endplayer collision If ID[gL] = 13 Then 'fireball collision If ID[gj] = 1 Then 'Wall collide cordx[gL] = -31 cordy[gL] = -31 xVel[gL] = 0 yVel[gL] = 0 EndIf If ID[gj] = 2 Then ' Door collide cordx[gL] = -31 cordy[gL] = -31 xVel[gL] = 0 yVel[gL] = 0 EndIf If ID[gj] = 3 Then 'Create collide cordx[gL] = -31 cordy[gL] = -31 xVel[gL] = 0 yVel[gL] = 0 cordx[gj] = -90 cordy[gj] = -90 Shapes.Move(sprites[gj], cordx[gj], cordy[gj]) EndIf EndIf 'end fireball collision EndIf 'end box if EndFor 'end collision For If ID[gL] = 13 Then 'start fire enemy collision for gj = startActive To firestart If (cordx[gL] < cordx[gj] + 30 And cordx[gL] + 30 > cordx[gj] And cordy[gL] < cordy[gj] + 30 And cordy[gL] + 30 > cordy[gj]) Then 'start box if health[gj] = health[gj] - 1 cordx[gL] = -31 cordy[gL] = -31 xVel[gL] = 0 yVel[gL] = 0 If health[gj] < 1 Then KillCount = KillCount - 1 chicken = Shapes.AddImage(image[14]) Shapes.Move(chicken, cordx[gj] + 15, cordy[gj] + 15) cordx[gj] = -350 cordy[gj] = -350 EndIf EndIf EndFor EndIf If gL <> 400 And ID[gL] <> 13 Then 'check if not wizard If (cordx[gL] < cordx[400] + 30 And cordx[gL] + 30 > cordx[400] And cordy[gL] < cordy[400] + 30 And cordy[gL] + 30 > cordy[400]) Then 'std bb collision death() isDead = 1 KillCount = 0 EndIf EndIf Profiler_End() ' for profile EndSub Sub pathing 'Determines Profiler_Begin() ' for profile Profiler_sub = "pathing" ' for profile For i = startActive To firestart If health[i] >= 1 Then GVX = cordx[400] - cordx[i] GVY = cordy[400] - cordy[i] Gmag = Math.SquareRoot(GVX * GVX + GVY * GVY) xVel[i] = speed[i] * (GVX / Gmag) yVel[i] = speed[i] * (GVY / Gmag) If(stunTimer[i] > 0) Then xVel[i] = xVel[i] / 3 yVel[i] = yVel[i] / 3 If ID[i] = 7 Then xVel[i] = xVel[i] / 27 yVel[i] = yVel[i] / 27 Endif EndIf If cordx[400] >= cordx[i] Then 'start rot Shapes.Rotate(sprites[i], Math.ArcTan(( cordy[i] - cordy[400]) / (cordx[i] - cordx[400] + 10)) * (180 / Math.Pi) - 180) else Shapes.Rotate(sprites[i], Math.ArcTan(( cordy[i] - cordy[400]) / (cordx[i] - cordx[400] + 10)) * (180 / Math.Pi) ) endif If ID[i] = 7 And stunTimer[i] = 0 Then stunTimer[i] = 60 EndIf Else xVel[i] = 0 yVel[i] = 0 EndIf EndFor Profiler_End() ' for profile EndSub Sub moveSprites Profiler_Begin() ' for profile Profiler_sub = "moveSprites" ' for profile For i = startActive To stopActive cordx[i] = cordx[i] + xVel[i] cordy[i] = cordy[i] + yVel[i] Shapes.Move(sprites[i], cordx[i], cordy[i]) If(stunTimer[i] > 0)Then stunTimer[i] = stunTimer[i] - 1 EndIf EndFor Profiler_End() ' for profile EndSub Sub Profiler_Init ' for profile Timer.Interval = 50 Timer.Tick = Profiler_OnTick EndSub Sub Profiler_OnTick ' for profile profile[Profiler_sub] = profile[Profiler_sub] + 1 EndSub Sub Profiler_Begin Stack.PushValue("local", Profiler_sub) EndSub Sub Profiler_End Profiler_sub = Stack.PopValue("local") EndSub Sub Profiler_Dump ' for profile nProfile = Array.GetItemCount(profile) index = Array.GetAllIndices(profile) For iProfile = 1 To nProfile TextWindow.WriteLine(index[iProfile] + " : " + profile[index[iProfile]]) EndFor TextWindow.WriteLine("") EndSub End>BND561-0.sb< Start>BNF004.sb< ' Graphical Challenge Janury 2014 - from Microsoft web ' -- Make a simple graphical calculator. Perhaps the user enters 2 numbers in 2 textboxes ' -- and then presses one of 4 buttons to +, -, *, / with the result given in a third textbox. ' by Radomir Folta, 01/20/2014 GraphicsWindow.Width = 600 GraphicsWindow.Height = 400 GraphicsWindow.BackgroundColor = "DarkSlateGray" GraphicsWindow.Title = "Graphical Challenge Janury 2014" ' text fileds GraphicsWindow.BrushColor = "Ivory" GraphicsWindow.DrawText(50, 100, "Your first number:") GraphicsWindow.DrawText(50, 150, "Your second number:") GraphicsWindow.DrawText(50, 250, "Result:") ' input and result fileds + 4 operator buttons GraphicsWindow.BrushColor = "Black" first_number = Controls.AddTextBox(200,100) second_number = Controls.AddTextBox(200,150) plus_button = Controls.AddButton(" + ", 200, 200) minus_button = Controls.AddButton(" - ", 250, 200) multiply_button = Controls.AddButton(" * ", 300, 200) divided_button = Controls.AddButton(" / ", 350, 200) result = Controls.AddTextBox(200, 250) ' event if any button clicked Controls.ButtonClicked = calculate Sub calculate what_clicked = Controls.LastClickedButton nu_1 = Controls.GetTextBoxText(first_number) nu_2 = Controls.GetTextBoxText(second_number) If what_clicked = "Button1" Then Controls.SetTextBoxText(result, nu_1 + nu_2) ElseIf what_clicked = "Button2" Then Controls.SetTextBoxText(result, nu_1 - nu_2) ElseIf what_clicked = "Button3" Then Controls.SetTextBoxText(result, nu_1 * nu_2) ElseIf what_clicked = "Button4" Then Controls.SetTextBoxText(result, nu_1 / nu_2) EndIf EndSub End>BNF004.sb< Start>BNG565.sb< ' Program by Yvan Leduc , FINAL : Jun 4th, 2016 ' Moonlight Sonata de Beethoven for piano on Small Basic ' final program no: image=imagelist.LoadImage( "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Beethoven.jpg/639px-Beethoven.jpg") IH=ImageList.GetHeightOfImage(image) IW=ImageList.GetWidthOfImage(image) GraphicsWindow.Top =0 GraphicsWindow.left =0 GraphicsWindow.Height=IH GraphicsWindow.Width=IW GraphicsWindow.DrawImage(image,0,0) GraphicsWindow.fontname="AR Decode" GraphicsWindow.FontSize=80 GraphicsWindow.BrushColor="#E7D3AD" GraphicsWindow.DrawboundText(20,400,500,"Moonlight Sonata") GraphicsWindow.FontSize=60 GraphicsWindow.BrushColor="#E7B3AB" GraphicsWindow.DrawboundText(100,500,800,"Ludwig V.Beethoven") GraphicsWindow.FontSize=12 GraphicsWindow.DrawText(20,650,"Program and Music Arangement by Yvan Leduc @ 2016") GraphicsWindow.BrushColor="#E7D3AD" GraphicsWindow.FontSize=125 BAR = Shapes.AddText("") Shapes.Move(BAR,50, 50) ' In musical notation, a bar (or measure) ... For M= 1 To 69 Shapes.SetText(BAR,M) Read_Measure() For T=1 TO 12 sound.PlayMusic (a[t]+n[t]) a[t]="" n[t]="" endfor ENDFOR SUB Read_Measure If (M=1) then ' measure 1 a[1]="O2L64 C#" +"O3L64 C#" +"O4L64 G#" n[1]="O4L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O5L4 C#" n[12]="O5L4 E" ElseIf (M=2) then ' measure 2 a[1]="O2L64 B" +"O3L64 B" +"O4L64 B" n[1]="O4L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O5L4 C#" n[12]="O5L4 E" ElseIf (M=3) then ' measure 3 a[1]="O2L64 A" +"O3L64 A" +"O4L64 A" n[1]="O4L4 A" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 A" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O2L64 F#" +"O3L64 F#" +"O4L64 A" n[7]="O4L4 A" n[8]="O5L4 D" n[9]="O5L4 F#" n[10]="O4L4 A" n[11]="O5L4 D" n[12]="O5L4 F#" ElseIf (M=4) then ' measure 4 a[1]="O2L64 G#" +"O3L64 G#" +"O4L64 G#" n[1]="O4L4 G#" n[2]="O5L4 C" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O2L64 G#" +"O3L64 G#" +"O4L64 G#" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O5L4 C" n[12]="O5L4 D#" ElseIf (M=5) then ' measure 5 a[1]="O2L64 C#" +"O3L64 C#" +"O4L64 G#" n[1]="O4L4 E" n[2]="O4L4 G#" n[3]="O4L4 C#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O4L64 G#" +"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 C#" a[12]="O5L64 E" +"O6L64 G#" n[12]="O5L4 E" ElseIf (M=6) then ' measure 6 a[1]="O2L64 F#" +"O3L64 F#" +"O4L64 C" n[1]="O6L4 G#" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O4L64 G#" +"O6L64 G#" n[10]="O6L4 G#" n[11]="O4L4 D#" a[12]="O5L64 F#" +"O6L64 G#" n[12]="O5L4 F#" ElseIf (M=7) then ' measure 7 a[1]="O3L64 C#" +"O4L64 G#" n[1]="O6L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O3L64 F#" +"O4L64 A" n[7]="O6L4 A" n[8]="O4L4 C#" n[9]="O5L4 F#" n[10]="O4L4 A" n[11]="O5L4 C#" n[12]="O5L4 F#" ElseIf (M=8) then ' measure 8 a[1]="O3L64 B" +"O4L64 G#" n[1]="O6L4 G#" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O4L4 B" n[6]="O5L4 E" a[7]="O3L64 B" +"O4L64 G#" n[7]="O6L4 F#" n[8]="O4L4 B" n[9]="O4L4 D#" a[10]="O4L64 A"+"O6L64 B" n[10]="O6L4 B" n[11]="O4L4 B" n[12]="O5L4 D#" ElseIf (M=9) then ' measure 9 a[1]="O3L64 E" +"O4L64 G#" n[1]="O6L4 E" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O4L4 B" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O4L4 B" n[9]="O5L4 E" n[10]="O4L4 G#" n[11]="O4L4 B" n[12]="O5L4 E" ElseIf (M=10) then ' measure 10 a[1]="O3L64 E" +"O4L64 E" n[1]="O4L4 G" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G" n[5]="O4L4 B" n[6]="O5L4 E n[7]="O4L4 G" n[8]="O4L4 B" n[9]="O5L4 E" a[10]="O3L64 G" +"O6L64 G" n[10]="O6L4 G" n[11]="O4L4 B" a[12]="O5L64 E" +"O6L64 G" n[12]="O5L4 E" ElseIf (M=11) then ' measure 11 a[1]="O3L64 D" +"O6L64 G" n[1]="O6L4 G" n[2]="O4L4 B" n[3]="O5L4 F" n[4]="O4L4 G" n[5]="O4L4 B" n[6]="O5L4 F" n[7]="O4L4 G" n[8]="O4L4 B" n[9]="O5L4 F" a[10]="O3L64 G" +"O6L64 G" n[10]="O6L4 G" n[11]="O4L4 F" a[12]="O5L64 E" +"O6L64 G" n[12]="O6L4 G" ElseIf (M=12) then ' measure 12 a[1]="O3L64 G" +"O5L64 G" n[1]="O6L4 G" n[2]="O4L4 C" n[3]="O5L4 E" a[4]="O3L64 B" +"O4L64 B" n[4]="O5L4 G" n[5]="O4L4 C" n[6]="O5L4 E" a[7]="O2L64 A#" +"O3L64 A#" n[7]="O5L4 G" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O4L64 F#"+"O6L64 F#" n[10]="O6L4 F#" n[11]="O4L4 A#" n[12]="O5L4 C#" ElseIf (M=13) then ' measure 13 a[1]="O3L64 B" +"O5L64 F#" n[1]="O6L4 F#" n[2]="O4L4 B" n[3]="O5L4 D" n[4]="O4L4 F#" n[5]="O4L4 B" n[6]="O5L4 D" a[7]="O3L64 E" +"O6L64 G" n[7]="O6L4 G" n[8]="O4L4 B" n[9]="O5L4 C#" a[10]="O3L64 G" +"O6L64 E" n[10]="O6L4 E" n[11]="O4L4 B" n[12]="O5L4 C#" ElseIf (M=14) then ' measure 14 a[1]="O3L64 F#" +"O6L64 F#" n[1]="O6L4 F#" n[2]="O4L4 B" n[3]="O5L4 D" n[4]="O4L4 F#" n[5]="O4L4 B" n[6]="O5L4 D" a[7]="O3L64 F#" +"O4L64 F#" n[7]="O6L4 F#" n[8]="O4L4 A#" n[9]="O5L4 C#" n[10]="O4L4 F#" n[11]="O4L4 A#" n[12]="O5L4 C#" ElseIf (M=15) then ' measure 15 a[1]="O3L64 B" +"O5L64 B" n[1]="O5L4 B" n[2]="O5L4 D" n[3]="O5L4 F#" n[4]="O4L4 B" n[5]="O5L4 D" n[6]="O5L4 F#" n[7]="O4L4 D" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O4L64 B" +"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 D#" n[12]="O5L4 F#" ElseIf (M=16) then ' measure 16 a[1]="O3L64 B" +"O7L64 C" n[1]="O7L4 C" n[2]="O5L4 E" n[3]="O5L4 G" a[4]="O3L64 E" +"O4L64 B" n[4]="O4L4 B" n[5]="O5L4 E" n[6]="O5L4 G" a[7]="O3L64 G" +"O4L64 B" n[7]="O4L4 B" n[8]="O5L4 E" n[9]="O5L4 G" a[10]="O3L64 C" +"O6L64 A#" n[10]="O6L4 A#" n[11]="O5L4 E" n[12]="O5L4 G" ElseIf (M=17) then ' measure 17 a[1]="O3L64 B" +"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 B" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 B" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O3L64 B" +"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 D#" n[12]="O5L4 F#" ElseIf (M=18) then ' measure 18 a[1]="O3L64 B" +"O7L64 C" n[1]="O7L4 C" n[2]="O5L4 E" n[3]="O5L4 G" a[4]="O3L64 E" +"O3L64 B" n[4]="O4L4 B" n[5]="O5L4 E" n[6]="O5L4 G" a[7]="O3L64 G" +"O3L64 B" n[7]="O4L4 B" n[8]="O5L4 E" n[9]="O5L4 G" '♮ a[10]="O3L64 C" +"O6L64 A#" n[10]="O6L4 A#" n[11]="O5L4 E" n[12]="O5L4 G" ElseIf (M=19) then ' measure 19 a[1]="O2L64 B" +"O4L64 B" +"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 B" n[5]="O5L4 D#" n[6]="O5L4 F#" a[7]="O2L64 G#" +"O3L64 G#" +"O6L64 B" n[7]="O6L4 B" n[8]="O5L4 D" n[9]="O5L4 F" n[10]="O4L4 B" n[11]="O5L4 D" n[12]="O5L4 F" ElseIf (M=20) then ' measure 20 a[1]="O2L64 F" +"O3L64 F" +"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 C#" n[3]="O5L4 G#" n[4]="O4L4 B" n[5]="O5L4 C#" n[6]="O5L4 G#" a[7]="O2L64 F#" +"O3L64 F#" +"O6L64 A" n[7]="O6L4 A" n[8]="O5L4 C#" n[9]="O5L4 F#" n[10]="O4L4 G#" n[11]="O5L4 C#" n[12]="O5L4 F#" ElseIf (M=21) then ' measure 21 a[1]="O3L64 B" +"O4L64 B" +"O6L64 G" n[1]="O6L4 G" n[2]="O4L4 B" n[3]="O5L4 D" n[4]="O4L4 G" n[5]="O4L4 B" n[6]="O5L4 D" a[7]="O3L64 C" +"O4L64 C" +"O6L64 F#" n[7]="O6L4 F#" n[8]="O4L4 A" n[9]="O5L4 D#" n[10]="O4L4 F#" n[11]="O4L4 A" n[12]="O5L4 D#" ElseIf (M=22) then ' measure 22 a[1]="O3L64 C#" +"O5L64 C#" n[1]="O5L4 C#" n[2]="O4L4 F#" n[3]="O4L4 A" n[4]="O5L4 C#" n[5]="O4L4 F#" n[6]="O4L4 A" a[7]="O3L64 C#" +"O5L64 C#" n[7]="O5L4 C#" n[8]="O4L4 F#" n[9]="O4L4 G#" a[10]="O3L64 C#" +"O5L64 C#" n[10]="O4L4 C#" n[11]="O4L4 F" n[12]="O4L4 G#" ElseIf (M=23) then ' measure 23 a[1]="O2L64 F#" +"O3L64 C#" +"O4L64 F#" n[1]="O4L4 F#" n[2]="O4L4 A" n[3]="O5L4 C#" n[4]="O4L4 A" n[5]="O5L4 C#" n[6]="O5L4 F#" n[7]="O5L4 C#" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O4L64 E" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O5L4 F#" a[12]="O5L64 A" +"O6L64 C#" n[12]="O6L4 C#" ElseIf (M=24) then ' measure 24 a[1]="O3L64 F" +"O6L64 C#" n[1]="O4L4 C#" n[2]="O4L4 G#" n[3]="O4L4 B" n[4]="O4L4 C#" n[5]="O4L4 G#" n[6]="O4L4 B" n[7]="O4L4 C#" n[8]="O4L4 G#" n[9]="O4L4 B a[10]="O4L64 C#" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 G#" a[12]="O4L64 B" +"O6L64 C#" n[12]="O6L4 C#" ElseIf (M=25) then ' measure 25 a[1]="O3L64 F#" +"O6L64 C#" n[1]="O6L4 C#" n[2]="O4L4 F#" n[3]="O4L4 A" n[4]="O4L4 C#" n[5]="O4L4 F#" n[6]="O4L4 A" a[7]="O4L64 D#" +"O6L64 C" n[7]="O6L4 C" n[8]="O4L4 F#" n[9]="O4L4 A" a[10]="O3L64 C#" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 F#" n[12]="O4L4 A" ElseIf (M=26) then ' measure 26 a[1]="O3L64 C" +"O6L64 D#" n[1]="O6L4 D#" n[2]="O4L4 F#" n[3]="O4L4 G#" n[4]="O4L4 D#" n[5]="O4L4 F#" n[6]="O4L4 G#" n[7]="O4L4 D#" n[8]="O4L4 F#" n[9]="O4L4 G#" a[10]="O3L64 C" +"O6L64 D#" n[10]="O6L4 D#" n[11]="O4L4 F#" n[12]="O4L4 G#" ElseIf (M=27) then ' measure 27 a[1]="O3L64 C#" +"O6L64 E" n[1]="O6L4 E" n[2]="O4L4 G#" n[3]="O4L4 C#" n[4]="O4L4 E" n[5]="O4L4 G#" n[6]="O4L4 C#" a[7]="O3L64 F#" +"O6L64 D#" n[7]="O6L4 D#" n[8]="O4L4 F#" n[9]="O4L4 A" a[10]="O3L64 G" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 E" n[12]="O4L4 A#" ElseIf (M=28) then ' measure 28 a[1]="O3L64 G#" +"O6L64 C" n[1]="O5L4 C" n[2]="O4L4 C" n[3]="O4L4 D#" a[4]="O4L64 G#" +"O6L64 G#" n[4]="O6L4 G#" n[5]="O4L4 C" n[6]="O4L4 D#" a[7]="O4L64 A" +"O6L64 A" n[7]="O6L4 A" n[8]="O4L4 C" n[9]="O4L4 D#" a[10]="O4L64 F#" +"O6L64 F#" n[10]="O6L4 F#" n[11]="O4L4 C" n[12]="O4L4 D#" ElseIf (M=29) then ' measure 29 n[1]="O3L64 G#" n[2]="O4L4 C" n[3]="O4L4 D#" a[4]="O3L64 G#" +"O5L64 G#" n[4]="O5L4 G#" n[5]="O4L4 C" n[6]="O4L4 D#" a[7]="O3L64 G#" +"O5L64 A" n[7]="O5L4 A" n[8]="O4L4 C" n[9]="O4L4 D#" a[10]="O3L64 E" +"O5L64 F#" n[10]="O5L4 F#" n[11]="O4L4 C" n[12]="O4L4 D#" ElseIf (M=30) then ' measure 30 a[1]="O3L64 G#" +"O3L64 E" n[1]="O3L4 E" n[2]="O4L4 E" n[3]="O4L4 G#" a[4]="O5L64 C#" +"O6L64 C#" n[4]="O3L4 E" n[5]="O4L4 E" n[6]="O4L4 G#" a[7]="O5L64 E" +"O6L64 E" n[7]="O6L4 E" n[8]="O4L4 E" n[9]="O4L4 G#" a[10]="O5L64 C#" +"O6L64 C#" n[10]="O6L4 C#" n[11]="O4L4 E" n[12]="O4L4 G#" ElseIf (M=31) then ' measure 31 a[1]="O3L64 G#"+"O3L64 G#" n[1]="O3L4 G#" n[2]="O4L4 E" n[3]="O4L4 G#" a[4]="O5L64 C#" +"O5L64 C#" n[5]="O4L4 E" n[6]="O4L4 G#" a[7]="O4L64 E" +"O6L64 E" n[7]="O6L4 E" n[8]="O4L4 E" n[9]="O4L4 G#" a[10]="O4L64 C#" +"O5L64 C#" n[10]="O5L4 C#" n[11]="O4L4 E" n[12]="O4L4 G#" ElseIf (M=32) then ' measure 32 a[1]="O2L64 G#"+"O3L64 F#" n[1]="O4L4 F#" n[2]="O3L4 A" n[3]="O3L4 F#" n[4]="O5L4 C" n[5]="O4L4 A" n[6]="O5L4 D#" n[7]="O5L4 C" n[8]="O5L4 F#" n[9]="O5L4 D#" n[10]="O5L4 A" n[11]="O5L4 F#" n[12]="O6L4 C" ElseIf (M=33) then ' measure 33 a[1]="O2L64 G#"+"O3L64 E" n[1]="O4L4 E" n[2]="O4L4 C#" n[3]="O3L4 G#" n[4]="O5L4 E" n[5]="O5L4 C#" n[6]="O5L4 G#" n[7]="O5L4 E" n[8]="O6L4 C#" n[9]="O5L4 G#" n[10]="O6L4 E" n[11]="O6L4 C#" n[12]="O5L4 G#" ElseIf (M=34) then ' measure 34 a[1]="O2L64 G#"+"O3L64 G#" n[1]="O4L4 G#" n[2]="O5L4 G" n[3]="O5L4 E" n[4]="O5L4 A#" n[5]="O5L4 G" n[6]="O6L4 C#" n[7]="O5L4 A#" n[8]="O6L4 E" n[9]="O6L4 C#" n[10]="O6L4 G" n[11]="O6L4 E" n[12]="O6L4 A#" ElseIf (M=35) then ' measure 35 a[1]="O2L64 G#"+"O4L64 F#" n[1]="O5L4 F#" n[2]="O6L4 C" n[3]="O5L4 A" n[4]="O6L4 D#" n[5]="O6L4 C" n[6]="O6L4 F#" n[7]="O6L4 D#" n[8]="O6L4 A" n[9]="O6L4 F#" n[10]="O7L4 C" n[11]="O6L4 A" n[12]="O7L4 D#" ElseIf (M=36) then ' measure 36 a[1]="O2L64 G#"+"O3L64 G#"+"O7L64 C" n[1]="O7L4 C" n[2]="O6L4 F#" n[3]="O6L4 A" n[4]="O6L4 D#" n[5]="O6L4 F#" n[6]="O6L4 C" n[7]="O6L4 D#" n[8]="O5L4 A" n[9]="O6L4 C" n[10]="O5L4 F#" n[11]="O5L4 A" n[12]="O5L4 D#" ElseIf (M=37) then ' measure 37 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 F#" n[1]="O5L4 F#" n[2]="O5L4 C" n[3]="O5L4 D#" n[4]="O5L4 A" n[5]="O6L4 C" n[6]="O5L4 F#" a[7]="O5L64 A"+"O6L64 A" n[7]="O5L4 A" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O5L64 C#"+"O6L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=38) then ' measure 38 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 C" n[1]="O5L4 C" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 A" n[5]="O5L4 G#" n[6]="O5L4 F# " a[7]="O5L64 D#"+"O6L64 D#" n[7]="O5L4 D#" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O5L64 C#"+"O6L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=39) then ' measure 39 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 C" n[1]="O5L4 C" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 A" n[5]="O5L4 G#" n[6]="O5L4 F# " a[7]="O5L64 D"+"O6L64 D" n[7]="O5L4 D" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O5L64 C#"+"O6L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=40) then ' measure 40 a[1]="O2L64 G#"+"O3L64 G#"+"O5L64 C" n[1]="O5L4 C" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 A" n[5]="O5L4 G#" n[6]="O5L4 F#" ' a[7]="O2L64 A"+"O3L64 A"+"O5L64 C#" n[7]="O5L4 C#" n[8]="O5L4 E" n[9]="O6L4 C#" n[10]="O5L4 C#" n[11]="O5L4 E" n[12]="O6L4 C#" ElseIf (M=41) then ' measure 41 a[1]="O2L64 F#"+"O3L64 F#"+"O5L64 D#" n[1]="O5L4 D#" n[2]="O5L4 A" n[3]="O6L4 C#" n[4]="O5L4 D#" n[5]="O5L4 A" n[6]="O6L4 C#" a[7]="O2L64 G#"+"O3L64 G#"+"O5L64 D#" n[7]="O5L4 D#" n[8]="O5L4 G#" n[9]="O6L4 C" n[10]="O5L4 D#" n[11]="O5L4 G#" n[12]="O6L4 C" ElseIf (M=42) then ' measure 42 a[1]="O3L64 C#"+"O3L64 G#"+"O5L64 E" n[1]="O5L4 E" n[2]="O5L4 G#" n[3]="O6L4 C#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 C#" a[12]="O5L64 E"+"O6L64 G#" n[12]="O6L4 G#" ElseIf (M=43) then ' measure 43 a[1]="O3L64 C"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 D#" a[12]="O5L64F#"+"O6L64 G#" n[12]="O6L4 G#" ElseIf (M=44) then ' measure 44 a[1]="O3L64 C#"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O3L64 F#"+"O4L64 A"+"O6L64 A" n[7]="O6L4 A" n[8]="O5L4 C#" n[9]="O5L4 F#" n[10]="O4L4 A" n[11]="O5L4 C#" n[12]="O5L4 F#" ElseIf (M=45) then ' measure 45 a[1]="O3L64 B"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 G#" n[5]="O4L4 B" n[6]="O5L4 E" a[7]="O3L64 B"+"O4L64 A"+"O6L64 F#" n[7]="O6L4 F#" n[8]="O4L4 B" n[9]="O5L4 D#" a[10]="O3L64 B"+"O4L64 A"+"O6L64 B" n[10]="O6L4 B" n[11]="O4L4 B" n[12]="O5L4 D# ElseIf (M=46) then ' measure 46 a[1]="O3L64 E"+"O4L64 G#"+"O6L64 E" n[1]="O6L4 E" n[2]="O4L4 B" n[3]="O5L4 E" n[4]="O4L4 B" n[5]="O5L4 E" n[6]="O5L4 G#" n[7]="O4L4 B" n[8]="O5L4 E" n[9]="O5L4 G#" a[10]="O4L64 B"+"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 E" a[12]="O5L64 G#"+"O6L64 B" n[12]="O6L4 B" ElseIf (M=47) then ' measure 47 a[1]="O3L64 D#"+"O4L64 B"+"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O4L4 B" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O4L4 B" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O4L64 B"+"O6L64 B" n[10]="O6L4 B" n[11]="O5L4 F#" a[12]="O5L64 A"+"O6L64 B" n[12]="O6L4 B" ElseIf (M=48) then ' measure 48 a[1]="O3L64 E"+"O4L64 B"+"O6L64 B" n[1]="O4L4 B" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O4L4 B" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 D#"+"O7L64 C" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 G#" a[10]="O3L64 C#"+"O7L64 C#" n[10]="O7L4 C#" n[11]="O5L4 E" n[12]="O5L4 G#" ElseIf (M=49) then ' measure 49 a[1]="O3L64 C"+"O4L64 G#"+"O7L64 D#" n[1]="O7L4 D#" n[2]="O5L4 F#" n[3]="O5L4 G#" n[4]="O5L4 D#" n[5]="O5L4 F#" n[6]="O5L4 G#" a[7]="O3L64 C#"+"O4L64 E"+"O7L64 E" n[7]="O7L4 E" n[8]="O5L4 F#" n[9]="O6L4 C#" n[10]="O5L4 E" n[11]="O5L4 F#" n[12]="O6L4 C#" ElseIf (M=50) then ' measure 50 a[1]="O3L64 C#"+"O4L64 D"+"O7L64 D" n[1]="O7L4 D" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O5L4 D" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 D"+"O7L64 C" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 G#" n[10]="O5L4 C" n[11]="O5L4 F#" n[12]="O5L4 G#" ElseIf (M=51) then ' measure 51 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 C#" n[1]="O7L4 C#" n[2]="O5L4 E" n[3]="O5L4 G#" n[4]="O5L4 C#" n[5]="O5L4 E" n[6]="O5L4 G#" n[7]="O5L4 C#" n[8]="O5L4 F" n[9]="O5L4 G#" a[10]="O5L64 C#" +"O7L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F" n[12]="O5L4 G# ElseIf (M=52) then ' measure 52 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 D" n[1]="O7L4 D" n[2]="O5L4 F#" n[3]="O5L4 A" a[4]="O3L64 F#"+"O4L64 F#" +"O5L64 C#" n[4]="O5L4 C#" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 A"+"O4L64 A"+"O7L64 C" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O3L64 F#"+"O5L64 C#" n[10]="O5L4 C#" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=53) then ' measure 53 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 C#" n[1]="O7L4 C#" n[2]="O5L4 F" n[3]="O5L4 G#" n[4]="O5L4 C#" n[5]="O5L4 F" n[6]="O5L4 G#" n[7]="O5L4 C#" n[8]="O5L4 F" n[9]="O5L4 G#" a[10]="O5L64 C#"+"O7L64 C#" n[10]="O7L4 C#" n[11]="O5L4 F" n[12]="O5L4 G#" ElseIf (M=54) then ' measure 54 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 D" n[1]="O7L4 D" n[2]="O5L4 F#" n[3]="O5L4 A" a[4]="O3L64 F#"+"O4L64 F#" n[4]="O5L4 C#" n[5]="O5L4 F#" n[6]="O5L4 A" a[7]="O3L64 A"+"O4L64 A" n[7]="O7L4 C" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O3L64 F#"+"O5L64 C#" +"O7L64 C" n[10]="O7L4 C" n[11]="O5L4 F#" n[12]="O5L4 A" ElseIf (M=55) then ' measure 55 a[1]="O3L64 C#"+"O4L64 C#"+"O7L64 C#" n[1]="O7L4 C#" n[2]="O5L4 F" n[3]="O5L4 G#" n[4]="O5L4 C#" n[5]="O5L4 F" n[6]="O5L4 G#" a[7]="O3L64 F#"+"O3L64 F#"+"O7L64 C#" n[7]="O5L4 C#" n[8]="O5L4 F" n[9]="O5L4 G#" n[10]="O5L4 C#" n[11]="O5L4 F" n[12]="O5L4 G#" ElseIf (M=56) then ' measure 56 a[1]="O3L64 B"+"O4L64 B"+"O6L64 B" n[1]="O6L4 B" n[2]="O5L4 F#" n[3]="O5L4 A" n[4]="O4L4 B" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O4L4 B" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O3L64 C#"+"O4L64 C#"+"O6L64 B" n[10]="O4L4 B" n[11]="O5L4 E" n[12]="O5L4 G#" ElseIf (M=57) then ' measure 57 a[1]="O3L64 C#"+"O4L64 A"+"O6L64 A" n[1]="O6L4 A" n[2]="O5L4 E" n[3]="O5L4 G#" a[4]="O3L64 D#"+"O4L64 D#"+"O6L64 A" n[4]="O6L4 A" n[5]="O5L4 D#" n[6]="O5L4 F#" a[7]="O3L64 C"+"O4L64 C"+"O6L64 G#" n[7]="O6L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O3L64 C#"+"O4L64 A"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O5L4 C#" n[12]="O5L4 E" ElseIf (M=58) then ' measure 58 a[1]="O3L64 F#"+"O4L64 A"+"O6L64 F#" n[1]="O6L4 F#" n[2]="O5L4 C#" n[3]="O5L4 D#" n[4]="O5L4 F#" n[5]="O5L4 C#" n[6]="O5L4 D#" a[7]="O3L64 E"+"O4L64 G#"+"O6L64 G#" n[7]="O6L4 G#" n[8]="O5L4 C#" n[9]="O5L4 D#" a[10]="O3L64 D#"+"O4L64 D#"+"O6L64 A" n[10]="O6L4 A" n[11]="O5L4 C#" n[12]="O5L4 D#" ElseIf (M=59) then ' measure 59 a[1]="O2L64 E"+"O4L64 G#"+"O6L64 G#" n[1]="O6L4 G#" n[2]="O5L4 C#" n[3]="O5L4 E" n[4]="O5L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" a[7]="O3L64 E"+"O4L64 F#"+"O6L64 G#" n[7]="O5L4 G#" n[8]="O5L4 C" n[9]="O5L4 D# n[10]="O5L4 F#" n[11]="O5L4 C" n[12]="O5L4 D#" ElseIf (M=60) then ' measure 60 a[1]="O3L64 C#"+"O4L64 G#"+"O5L64 C#" n[1]="O5L4 C#" n[2]="O3L4 G#" n[3]="O4L4 C#" n[4]="O4L4 G#" n[5]="O5L4 C#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O5L4 E" a[10]="O3L64 C#"+"O4L64 G#" n[10]="O5L4 G#" n[11]="O5L4 C#" n[12]="O4L64 C#"+"O5L4 E" ElseIf (M=61) then ' measure 61 a[1]="O3L64 C"+"O3L64 G#" n[1]="O4L4 G#" n[2]="O5L4 D#" n[3]="O5L4 F#" n[4]="O4L4 G#" n[5]="O5L4 D#" n[6]="O5L4 F#" n[7]="O4L4 G#" n[8]="O5L4 D#" n[9]="O5L4 F#" a[10]="O3L64 G#"+"O4L64 G#" n[10]="O4L4 G#" n[11]="O5L4 D#" n[12]="O4L64 G#"+"O5L4 F#" ElseIf (M=62) then ' measure 62 a[1]="O3L64 C#"+"O3L64 G#" n[1]="O4L4 G#" n[2]="O5L4 E" n[3]="O5L4 C#" n[4]="O5L4 G#" n[5]="O5L4 E" n[6]="O6L4 C#" n[7]="O5L4 G#" n[8]="O6L4 E" n[9]="O6L4 C#" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O6L4 E" n[12]="O4L64 G#"+"O6L4 C#" ElseIf (M=63) then ' measure 63 a[1]="O2L64 G#"+"O3L64 G#"+"O6L64 C" n[1]="O6L4 C" n[2]="O6L4 D#" n[3]="O5L4 A" n[4]="O6L4 C" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O5L4 D#" n[8]="O5L4 F#" n[9]="O5L4 A" a[10]="O4L64 G#"+"O6L64 C" n[10]="O6L4 C" n[11]="O5L4 G#" n[12]="O4L64 G#"+"O6L4 C#" ElseIf (M=64) then ' measure 64 a[1]="O3L64 C#"+"O3L64 G#"+"O6L64 C#" n[1]="O6L4 C#" n[2]="O5L4 E" n[3]="O5L4 C#" n[4]="O5L4 G#" n[5]="O5L4 E" n[6]="O6L4 C#" n[4]="O5L4 G#" n[5]="O6L4 E" n[6]="O6L4 C#" a[10]="O4L64 G#"+"O6L64 G#" n[10]="O6L4 G#" n[11]="O6L4 E" n[12]="O4L64 G#"+"O6L4 C#" ElseIf (M=65) then ' measure 65 a[1]="O2L64 G#"+"O3L64 G#"+"O6L64 C" n[1]="O6L4 C" n[2]="O6L4 D#" n[3]="O5L4 A" n[4]="O6L4 C" n[5]="O5L4 F#" n[6]="O5L4 A" n[7]="O6L4 D#" n[8]="O6L4 F#" n[9]="O5L4 A" a[10]="O4L64 G#"+"O6L64 C" n[10]="O6L4 C" n[11]="O5L4 G#" n[12]="O4L64 G#"+"O5L4 F#" ElseIf (M=66) then ' measure 66 a[1]="O3L64 C#"+"O3L64 G#"+"O6L64 C#" n[1]="O6L4 C#" n[2]="O5L4 G#" n[3]="O6L4 C#" n[4]="O6L4 E" n[5]="O6L4 C#" n[6]="O5L4 G#" n[7]="O5L4 C#" n[8]="O5L4 E" n[9]="O5L4 G#" n[10]="O6L4 C#" n[11]="O5L4 G#" n[12]="O5L4 E" ElseIf (M=67) then ' measure 67 a[1]="O3L64 C#"+"O4L64 G#" n[1]="O4L4 G#" n[2]="O5L4 E" n[3]="O5L4 G#" n[4]="O6L4 C#" n[5]="O5L4 G#" n[6]="O5L4 E" n[7]="O4L4 G#" n[8]="O5L4 C#" n[9]="O4L4 G#" n[10]="O4L4 E" n[11]="O4L4 G#" n[12]="O4L4 E" ElseIf (M=68) then ' measure 68 a[1]="O2L64 C#"+"O3L64 C#" n[1]="O4L1 C#" a[2]="O3L64 C#"+"O4L64 G#" n[2]="O4L1 G#" ElseIf (M=69) then ' measure 69 a[1]="O2L64 C#"+"O3L64 C#" n[1]="O4L1 C#" EndIf EndSub End>BNG565.sb< Start>BNH331.sb< Init() Sub Init GraphicsWindow.Show() GraphicsWindow.Title = " CD-Player " GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.BackgroundColor = "LightGreen" NameFile = "E:\Smallbasic\CD.png" IM[1] = ImageList.LoadImage(NameFile) IW = ImageList.GetWidthOfImage(IM[1]) + 10 IH = ImageList.GetHeightOfImage(IM[1]) + 10 GraphicsWindow.Width = IW GraphicsWindow.Height = IH LDShapes.BackgroundImage(IM[1]) 'GraphicsWindow.DrawImage(IM[1], 5, 5) SC[1] = "DarkGray" SC[2] = "Silver" SC[3] = LDColours.AntiqueWhite SC[4] = LDColours.AntiqueWhite SC[5] = LDColours.AntiqueWhite SC[6] = "Silver" SC[7] = "LightGray" BrushV = LDShapes.BrushGradient(SC, "V") LDShapes.BrushGradientRoundedRectangle(BrushV, 22, 44, 913,170,20) EndSub End>BNH331.sb< Start>BNJ520.sb< a2r = "1=I;5=V;10=X;50=L;100=C;500=D;1000=M;" While "True" TextWindow.Write("? ") arabic = TextWindow.Read() ToRoman() EndWhile Sub ToRoman If (arabic < 1) Or (3999 < arabic) Or (Math.Floor(arabic) < arabic) Then TextWindow.WriteLine(arabic + " is too small, too large, fraction or not number.") Else roman = "" a = arabic len = Text.GetLength(a) o = 1 While a <> "" d = Text.GetSubTextToEnd(a, len) a = Text.GetSubText(a, 1, len - 1) len = len - 1 ConvertDigit() o = o * 10 EndWhile TextWindow.WriteLine(roman) EndIf EndSub Sub ConvertDigit ' param d - arabic digit to convert ' param o - order ' return roman _d = d If _d = 9 Then roman = a2r[10 * o] + roman _d = 1 ElseIf _d = 4 Then roman = a2r[5 * o] + roman _d = 1 EndIf For i = 1 To Math.Remainder(_d, 5) roman = a2r[o] + roman EndFor If 5 <= _d Then roman = a2r[5 * o] + roman EndIf EndSub End>BNJ520.sb< Start>BNJ883.sb< 'Rotating 3D solid cube 'I owe the maths to this page: http://codentronix.com/2011/05/24/rotating-wireframe-cube-using-vb-net-and-gdi/ 'show window' speed=50 size=0.5 center=250 GraphicsWindow.Show() GraphicsWindow.Height=500 GraphicsWindow.Width=500 GraphicsWindow.PenWidth=0 'define cube corners, based on distance from centre point point3d[1]["x"]=-100 point3d[1]["y"]=-100 point3d[1]["z"]=100 point3d[2]["x"]=100 point3d[2]["y"]=-100 point3d[2]["z"]=100 point3d[3]["x"]=-100 point3d[3]["y"]=100 point3d[3]["z"]=100 point3d[4]["x"]=100 point3d[4]["y"]=100 point3d[4]["z"]=100 point3d[5]["x"]=-100 point3d[5]["y"]=-100 point3d[5]["z"]=-100 point3d[6]["x"]=100 point3d[6]["y"]=-100 point3d[6]["z"]=-100 point3d[7]["x"]=-100 point3d[7]["y"]=100 point3d[7]["z"]=-100 point3d[8]["x"]=100 point3d[8]["y"]=100 point3d[8]["z"]=-100 'define triangles between end points tri[1][1]=1 tri[1][2]=2 tri[1][3]=3 tri[2][1]=2 tri[2][2]=3 tri[2][3]=4 tri[3][1]=1 tri[3][2]=5 tri[3][3]=6 tri[4][1]=1 tri[4][2]=6 tri[4][3]=2 tri[5][1]=1 tri[5][2]=5 tri[5][3]=7 tri[6][1]=1 tri[6][2]=7 tri[6][3]=3 tri[7][1]=2 tri[7][2]=6 tri[7][3]=8 tri[8][1]=2 tri[8][2]=4 tri[8][3]=8 tri[9][1]=3 tri[9][2]=4 tri[9][3]=7 tri[10][1]=7 tri[10][2]=4 tri[10][3]=8 tri[11][1]=5 tri[11][2]=6 tri[11][3]=7 tri[12][1]=6 tri[12][2]=7 tri[12][3]=8 tricolour[1]="blue" tricolour[2]="blue" tricolour[3]="red" tricolour[4]="red" tricolour[5]="green" tricolour[6]="green" tricolour[7]="yellow" tricolour[8]="yellow" tricolour[9]="orange" tricolour[10]="orange" tricolour[11]="pink" tricolour[12]="pink" factor=600 For i = 1 to 1000 Program.Delay(20) For pointno = 1 to 8 rotatez() rotatey() rotatex() endfor convert3dto2d() DetectTriangleDistance() draw2d() EndFor Sub convert3dto2d For points = 1 To 8 point2d[points]["x"] = point3d[points]["x"] + point3d[points]["x"] *(point3d[points]["z"]/factor) point2d[points]["y"] = point3d[points]["y"] + point3d[points]["y"] *(point3d[points]["z"]/factor) EndFor EndSub Sub rotatez rad = 1 * Math.Pi/180 cosa = Math.Cos(rad) sina = Math.Sin(rad) newx= point3d[pointno]["x"] * cosa - point3d[pointno]["y"] * sina newy = point3d[pointno]["x"] * sina + point3d[pointno]["y"] * cosa point3d[pointno]["x"] = (newx) point3d[pointno]["y"] = (newy) EndSub Sub rotatey rad = 1 * Math.Pi/180 cosa = Math.Cos(rad) sina = Math.Sin(rad) newz= point3d[pointno]["z"] * cosa - point3d[pointno]["x"] * sina newx = point3d[pointno]["z"] * sina + point3d[pointno]["x"] * cosa point3d[pointno]["x"] = (newx) point3d[pointno]["z"] = (newz) EndSub Sub rotatex rad = 1 * Math.Pi/180 cosa = Math.Cos(rad) sina = Math.Sin(rad) newy = point3d[pointno]["y"] * cosa - point3d[pointno]["z"] * sina newz = point3d[pointno]["y"] * sina + point3d[pointno]["z"] * cosa point3d[pointno]["y"] = newy point3d[pointno]["z"] = newz EndSub Sub DetectTriangleDistance 'take average of the z values for each of the three points on each triangle For triangles=1 To 12 tridist[triangles] = (point3d[tri[triangles][1]]["z"] + point3d[tri[triangles][2]]["z"] + point3d[tri[triangles][3]]["z"])/3 sorttriangles[triangles] = triangles EndFor 'TextWindow.Write("distances of triangles are: ") 'For i = 1 To 12 'TextWindow.Write(tridist[i] + ", ") 'EndFor 'bubble sort triangles into distance order - furthest first done=0 swapper = 0 While done=0 moves=0 'go through and compare each pair For i = 1 To 11 If tridist[sorttriangles[i]] > tridist[sorttriangles[i+1]] Then swapper = sorttriangles[i] sorttriangles[i] = sorttriangles[i+1] sorttriangles[i+1] = swapper moves=1 EndIf EndFor If moves=0 Then done=1 EndIf EndWhile 'TextWindow.Write("new order is ") 'for i = 1 to 12 'TextWindow.write(sorttriangles[i] + ", ") 'EndFor endsub Sub draw2d GraphicsWindow.Clear() For triangles = 1 To 12 GraphicsWindow.BrushColor = tricolour[sorttriangles[triangles]] GraphicsWindow.filltriangle(center+point2d[tri[sorttriangles[triangles]][1]]["x"]*size,center+point2d[tri[sorttriangles[triangles]][1]]["y"]*size,center+point2d[tri[sorttriangles[triangles]][2]]["x"]*size,center+point2d[tri[sorttriangles[triangles]][2]]["y"]*size,center+point2d[tri[sorttriangles[triangles]][3]]["x"]*size,center+point2d[tri[sorttriangles[triangles]][3]]["y"]*size) 'Program.Delay(speed) endfor 'speedchoice = TextWindow.Read() 'if speedchoice = "" Then ' speed=50 'Else ' speed=200 'EndIf EndSub End>BNJ883.sb< Start>BNM050.sb< 'All the dots are white without dark centres gw = 500 gh = gw GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Gray" GraphicsWindow.BrushColor = "Black" For i = 1 To 8 For j = 1 To 8 GraphicsWindow.FillRectangle((i-1)*gw/8+5,(j-1)*gw/8+5,gw/8-10,gw/8-10) EndFor EndFor GraphicsWindow.BrushColor = "White" For i = 1 To 7 For j = 1 To 7 GraphicsWindow.FillEllipse(i*gw/8-7,j*gw/8-7,14,14) EndFor EndFor End>BNM050.sb< Start>BNR271.sb< Run = Controls.AddButton("Run", 20, 210) 'put in place the Start button Controls.SetSize(Run, 60, 40) Controls.ButtonClicked = ButtonDown Sub ButtonDown for linenumber=1 to 100 ' The following line could be harmful and has been automatically commented. ' myline=file.readline("d:\test-big-File.gpx",linenumber) 'TextWindow.WriteLine(linenumber+ " : "+ text.getlength(myline)+" : "+myline) if Math.Remainder(Linenumber,10)=0 then LineCounter=shapes.addtext(Linenumber) Shapes.ShowShape(LineCounter) Shapes.move(LineCounter,390,142) Program.Delay(200) Shapes.HideShape(LineCounter) endif EndFor EndSub End>BNR271.sb< Start>BNT279-0.sb< init() GraphicsWindow.KeyDown=Move_nyan2 t0= Clock.ElapsedMilliseconds is = 0 While "true" If fire = 1 Then cx = cx + 3*celX cy = cy + 3*celY Shapes.Move(blast, cx, cy) blastcheck() endif Shapes.SetText(mana, power) x = x + delX y = y + delY ax = x + delX ay = y + delY If x <= -10 Then x = 510 elseIf x >= 510 Then x = 0 elseIf y >= 410 Then y = 0 elseIf y <= -10 Then y = 410 endif foodgetcheck() AddBonus() bonusgetcheck() Shapes.Move(Nyan[1], x, y) ' shapes.animate is not suitable 'OK I made a move animation Shapes.Move(Nyan[2], x, y) If bx < x Then belX = 0.4 ElseIf bx > x then belX = -0.4 elseif bx = x then belX = 0 endif If by < y Then belY = 0.55 ElseIf by > y then belY = -0.55 elseif by = y then belY = 0 endif capturedCheck() If is = 1 then bx = bx + belX by = by + belY Shapes.Move(danger, bx, by) endif pasttime=Math.Round((clock.ElapsedMilliseconds-t0)/1000)+"sec" Shapes.SetText(stime,pasttime) Shapes.SetText(enemy, health) If power > 0 then If is = 0 then Danger() endif endif Program.Delay(5) endwhile Sub Danger GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "Black" danger = Shapes.AddEllipse(30, 30) is = 1 If oh = 1 then health = Math.GetRandomNumber(5) oh = 0 endif EndSub Sub foodgetcheck if math.Abs(x-Shapes.GetLeft(food))<=11 and Math.Abs(y- Shapes.Gettop(food))<=11 then score = score + 1 ' If (x_position - food_left)<=±5 '11 and (y_position - food_top)<=±5 '11 then score up Shapes.SetText(points,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) If power < 5 then power = power + 1 'BLAST! endif Shapes.Remove(danger) danger() endif EndSub Sub AddBonus If score>0 and Math.Remainder(score, 5) = 0 then ' bonus appears every 5 counts If flag=0 then ' if bonus does not exist , add bonus at random position GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bonus = Shapes.AddEllipse(20, 20) Shapes.Move(bonus, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) flag=1 ' if bonus appeared 'TY! endif endif EndSub Sub bonusgetcheck if math.Abs(x-Shapes.GetLeft(bonus))<=11 and Math.Abs(Y-Shapes.Gettop(bonus))<=11 then score = score + 3 ' If (x_position - bonus_left)<=±11 and (y_position - bonus_top)<=±11 then score up Shapes.SetText(points,score) Shapes.Remove(bonus) ' if you get bonus , remove bonus flag=0 ' if you get bonus , 'Cool! endif EndSub Sub blastcheck If fire = 1 Then damage = 3 cx = cx + 3*celX cy = cy + 3*celY Shapes.Move(blast, cx, cy) If math.Abs(Shapes.GetLeft(danger)-Shapes.GetLeft(blast))<=15 And math.Abs(Shapes.GetTop(danger)-Shapes.GetTop(blast))<=15 Then health = health - damage Shapes.SetText(enemy,health) Shapes.reMove(danger) endif endif endsub Sub capturedCheck If is=1 And math.Abs(Shapes.GetLeft(danger)-x)<=15 And math.Abs(Shapes.GetTop(danger)-y)<=15 Then X=X+50 ' add this to release is=0 ' add this Shapes.Remove(danger) 'MessageBox.ShowMessage("Game Over!") endif EndSub Sub Move_nyan2 d=GraphicsWindow.LastKey a=text.GetCharacterCode(d) If a=76 or a=82 Then ' Left;76 Right ;82 LeftRight() elseIf a=68 or a=85 Then ' Down: 68 Up: 85 downUp() 'BLASTBLASTBLASTBLASTBLASTBLASTBLAST elseif d = "Space" and power>0 then Shapes.Remove(blast) If power = 1 then GraphicsWindow.PenColor = Colors.DimGray elseif power = 2 then GraphicsWindow.PenColor = Colors.DarkGray elseif power = 3 then GraphicsWindow.PenColor = Colors.LightGray elseif power = 4 then GraphicsWindow.PenColor = Colors.WhiteSmoke elseif power = 5 then GraphicsWindow.PenColor = Colors.LightCyan endif blast = Shapes.AddEllipse(8,8) fire = 1 cx = Shapes.GetLeft(Nyan[1]) cy = Shapes.GetTop(Nyan[1]) Shapes.Move(blast,cx-5,cy) flow = 1 celX = delX celY = delY damage = power ' power = 0 endif EndSub Sub LeftRight b=(a-76)/6+1 ' left (76-76)/6+1=1 (82-76)/6+1=2 Shapes.HideShape(nyan[3-b]) ' left --> 3-1=2:right right--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b], 0) delX = 2*(b-1.5) ' left 20*(1-1.5)=-10 right 20*(2-1.5)=+10 delY = 0 EndSub Sub DownUp b=(a-68)/17+1 ' down (68-68)/17+1=1 Up (85-68)/17+1=2 Shapes.HideShape(nyan[3-b]) ' down--> 3-1=2:Up Up--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b],270) delX = 0 delY = 2*(1.5-b) ' down 20*(1.5-1)=+10 Up 20*(1.5-2)=-10 EndSub Sub init GraphicsWindow.Height = 390 GraphicsWindow.Width = 490 gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.CanResize = 0 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Cyan" Shapes.AddRectangle(500, 400) GraphicsWindow.PenColor = "Green" Nyan[1] = Shapes.AddImage("http://ximages.net/images/28930020147868715423.png") ' left Nyan[2] = Shapes.AddImage("http://ximages.net/images/74412177564379571315.png") ' right GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize=15 mana= Shapes.AddText("0") Shapes.Move(mana,200, 20) points= Shapes.AddText("0") Shapes.Move(points,300, 20) enemy= Shapes.AddText("0") Shapes.Move(enemy,350, 20) food = Shapes.AddImage("http://ximages.net/images/03515726579119112960.png") Shapes.Move(food, Math.GetRandomNumber(30) * 10, Math.GetRandomNumber(40) * 10) Flag=0 ' for start bonus=0 rot = 0 score = 0 x = 300 ' start X y = 200 ' start Y Shapes.Move(Nyan[1], x, y) Shapes.Rotate(Nyan[1], rot) delX = 0 ' initial moving X delY = 10 ' initial moving Y bx = 300 by = 200 belX = 0 belY = 0 GraphicsWindow.BrushColor="red" stime=Shapes.AddText(" ") Shapes.Move(stime,15,5) ' past time health = 0 endsub End>BNT279-0.sb< Start>BNT279-1.sb< init() GraphicsWindow.KeyDown=Move_nyan2 t0= Clock.ElapsedMilliseconds is = 0 While "true" If fire = 1 Then cx = cx + 3*celX cy = cy + 3*celY Shapes.Move(blast, cx, cy) blastcheck() endif Shapes.SetText(mana, power) x = x + delX y = y + delY ax = x + delX ay = y + delY If x <= -10 Then x = 510 elseIf x >= 510 Then x = 0 elseIf y >= 410 Then y = 0 elseIf y <= -10 Then y = 410 endif foodgetcheck() AddBonus() bonusgetcheck() Shapes.Move(Nyan[1], x, y) ' shapes.animate is not suitable 'OK I made a move animation Shapes.Move(Nyan[2], x, y) If bx < x Then belX = 0.4 ElseIf bx > x then belX = -0.4 elseif bx = x then belX = 0 endif If by < y Then belY = 0.55 ElseIf by > y then belY = -0.55 elseif by = y then belY = 0 endif capturedCheck() If is = 1 then bx = bx + belX by = by + belY Shapes.Move(danger, bx, by) endif pasttime=Math.Round((clock.ElapsedMilliseconds-t0)/1000)+"sec" Shapes.SetText(stime,pasttime) Shapes.SetText(enemy, health) If power > 0 then If is = 0 then Danger() endif endif Program.Delay(5) endwhile Sub Danger GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "Black" danger = Shapes.AddEllipse(30, 30) is = 1 If oh = 1 then health =health + Math.GetRandomNumber(5) oh = 0 endif EndSub Sub foodgetcheck if math.Abs(x-Shapes.GetLeft(food))<=11 and Math.Abs(y- Shapes.Gettop(food))<=11 then score = score + 1 ' If (x_position - food_left)<=±5 '11 and (y_position - food_top)<=±5 '11 then score up Shapes.SetText(points,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) If power < 5 then power = power + 1 'BLAST! endif oh=1 Shapes.Remove(danger) danger() endif EndSub Sub AddBonus If score>0 and Math.Remainder(score, 5) = 0 then ' bonus appears every 5 counts If flag=0 then ' if bonus does not exist , add bonus at random position GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bonus = Shapes.AddEllipse(20, 20) Shapes.Move(bonus, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) flag=1 ' if bonus appeared 'TY! endif endif EndSub Sub bonusgetcheck if math.Abs(x-Shapes.GetLeft(bonus))<=11 and Math.Abs(Y-Shapes.Gettop(bonus))<=11 then score = score + 3 ' If (x_position - bonus_left)<=±11 and (y_position - bonus_top)<=±11 then score up Shapes.SetText(points,score) Shapes.Remove(bonus) ' if you get bonus , remove bonus flag=0 ' if you get bonus , 'Cool! endif EndSub Sub blastcheck If fire = 1 Then damage = 3 cx = cx + 3*celX cy = cy + 3*celY Shapes.Move(blast, cx, cy) If math.Abs(Shapes.GetLeft(danger)-Shapes.GetLeft(blast))<=15 And math.Abs(Shapes.GetTop(danger)-Shapes.GetTop(blast))<=15 Then health = health - damage Shapes.SetText(enemy,health) Shapes.reMove(danger) endif endif endsub Sub capturedCheck If is=1 And math.Abs(Shapes.GetLeft(danger)-x)<=15 And math.Abs(Shapes.GetTop(danger)-y)<=15 Then X=X+50 ' add this to release is=0 ' add this Shapes.Remove(danger) 'MessageBox.ShowMessage("Game Over!") endif EndSub Sub Move_nyan2 d=GraphicsWindow.LastKey a=text.GetCharacterCode(d) If a=76 or a=82 Then ' Left;76 Right ;82 LeftRight() elseIf a=68 or a=85 Then ' Down: 68 Up: 85 downUp() 'BLASTBLASTBLASTBLASTBLASTBLASTBLAST elseif d = "Space" and power>0 then Shapes.Remove(blast) If power = 1 then GraphicsWindow.PenColor = Colors.DimGray elseif power = 2 then GraphicsWindow.PenColor = Colors.DarkGray elseif power = 3 then GraphicsWindow.PenColor = Colors.LightGray elseif power = 4 then GraphicsWindow.PenColor = Colors.WhiteSmoke elseif power = 5 then GraphicsWindow.PenColor = Colors.LightCyan endif blast = Shapes.AddEllipse(8,8) fire = 1 cx = Shapes.GetLeft(Nyan[1]) cy = Shapes.GetTop(Nyan[1]) Shapes.Move(blast,cx-5,cy) flow = 1 celX = delX celY = delY damage = power ' power = 0 endif EndSub Sub LeftRight b=(a-76)/6+1 ' left (76-76)/6+1=1 (82-76)/6+1=2 Shapes.HideShape(nyan[3-b]) ' left --> 3-1=2:right right--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b], 0) delX = 2*(b-1.5) ' left 20*(1-1.5)=-10 right 20*(2-1.5)=+10 delY = 0 EndSub Sub DownUp b=(a-68)/17+1 ' down (68-68)/17+1=1 Up (85-68)/17+1=2 Shapes.HideShape(nyan[3-b]) ' down--> 3-1=2:Up Up--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b],270) delX = 0 delY = 2*(1.5-b) ' down 20*(1.5-1)=+10 Up 20*(1.5-2)=-10 EndSub Sub init GraphicsWindow.Height = 390 GraphicsWindow.Width = 490 gw = GraphicsWindow.Width gh = GraphicsWindow.Height ' GraphicsWindow.CanResize = 0 GraphicsWindow.BackgroundColor = "black" GraphicsWindow.PenColor = "Cyan" 'Shapes.AddRectangle(500, 400) GraphicsWindow.PenColor = "Green" Nyan[1] = Shapes.AddImage("http://ximages.net/images/28930020147868715423.png") ' left Nyan[2] = Shapes.AddImage("http://ximages.net/images/74412177564379571315.png") ' right GraphicsWindow.BrushColor = "Green" GraphicsWindow.DrawText(200,5,"mana") GraphicsWindow.DrawText(300,5,"points") GraphicsWindow.DrawText(350,5,"enemy") GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize=15 mana= Shapes.AddText("0") Shapes.Move(mana,200, 20) points= Shapes.AddText("0") Shapes.Move(points,300, 20) enemy= Shapes.AddText("0") Shapes.Move(enemy,350, 20) food = Shapes.AddImage("http://ximages.net/images/03515726579119112960.png") Shapes.Move(food, Math.GetRandomNumber(30) * 10, Math.GetRandomNumber(40) * 10) Flag=0 ' for start bonus=0 rot = 0 score = 0 x = 300 ' start X y = 200 ' start Y Shapes.Move(Nyan[1], x, y) Shapes.Rotate(Nyan[1], rot) delX = 0 ' initial moving X delY = 10 ' initial moving Y bx = 300 by = 200 belX = 0 belY = 0 GraphicsWindow.BrushColor="red" stime=Shapes.AddText(" ") Shapes.Move(stime,15,5) ' past time health = 0 endsub End>BNT279-1.sb< Start>BNT279.sb< init() GraphicsWindow.KeyDown=Move_nyan2 t0= Clock.ElapsedMilliseconds is = 0 While "true" If fire = 1 Then cx = cx + 3*celX cy = cy + 3*celY Shapes.Move(blast, cx, cy) endif Shapes.SetText(mana, power) x = x + delX y = y + delY ax = x + delX ay = y + delY If x <= -10 Then x = 510 elseIf x >= 510 Then x = 0 elseIf y >= 410 Then y = 0 elseIf y <= -10 Then y = 410 endif if math.Abs(x-Shapes.GetLeft(food))<=11 and Math.Abs(y- Shapes.Gettop(food))<=11 then score = score + 1 ' If (x_position - food_left)<=±5 '11 and (y_position - food_top)<=±5 '11 then score up Shapes.SetText(points,score) Shapes.Move(food, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) If power < 5 then power = power + 1 'BLAST! endif endif If score>0 and Math.Remainder(score, 5) = 0 then ' bonus appears every 5 counts If flag=0 then ' if bonus does not exist , add bonus at random position GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() bonus = Shapes.AddEllipse(20, 20) Shapes.Move(bonus, Math.GetRandomNumber(25) * 10, Math.GetRandomNumber(35) * 10) flag=1 ' if bonus appeared 'TY! endif endif if math.Abs(x-Shapes.GetLeft(bonus))<=11 and Math.Abs(Y-Shapes.Gettop(bonus))<=11 then score = score + 3 ' If (x_position - bonus_left)<=±11 and (y_position - bonus_top)<=±11 then score up Shapes.SetText(points,score) Shapes.Remove(bonus) ' if you get bonus , remove bonus flag=0 ' if you get bonus , 'Cool! endif Shapes.Move(Nyan[1], x, y) ' shapes.animate is not suitable 'OK I made a move animation Shapes.Move(Nyan[2], x, y) Program.Delay(0) If bx < x Then belX = 0.5 ElseIf bx > x then belX = -0.5 elseif bx = x then belX = 0 endif If by < y Then belY = 0.75 ElseIf by > y then belY = -0.75 elseif by = y then belY = 0 endif If fire = 1 Then damage = 3 cx = cx + 3*celX cy = cy + 3*celY Shapes.Move(blast, cx, cy) If Shapes.GetLeft(danger)-1 0 then If is = 0 then Danger() endif endif Program.Delay(5) If is = 1 then If Shapes.GetLeft(danger)-1 0 then If power = 1 then GraphicsWindow.PenColor = Colors.DimGray elseif power = 2 then GraphicsWindow.PenColor = Colors.DarkGray elseif power = 3 then GraphicsWindow.PenColor = Colors.LightGray elseif power = 4 then GraphicsWindow.PenColor = Colors.WhiteSmoke elseif power = 5 then GraphicsWindow.PenColor = Colors.LightCyan endif blast = Shapes.AddLine(x+20, y+10, x+delX*20+20, y+delY*20+10) fire = 1 cx = Shapes.GetLeft(Nyan) cy = Shapes.GetTop(Nyan) flow = 1 If flow = 1 then celX = delX celY = delY endif damage = power power = 0 endif endif EndSub Sub LeftRight b=(a-76)/6+1 ' left (76-76)/6+1=1 (82-76)/6+1=2 Shapes.HideShape(nyan[3-b]) ' left --> 3-1=2:right right--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b], 0) delX = 2*(b-1.5) ' left 20*(1-1.5)=-10 right 20*(2-1.5)=+10 delY = 0 EndSub Sub Danger GraphicsWindow.PenColor = "White" GraphicsWindow.BrushColor = "Black" danger = Shapes.AddEllipse(30, 30) is = 1 If oh = 1 then health = Math.GetRandomNumber(5) oh = 0 endif EndSub Sub DownUp b=(a-68)/17+1 ' down (68-68)/17+1=1 Up (85-68)/17+1=2 Shapes.HideShape(nyan[3-b]) ' down--> 3-1=2:Up Up--> 3-2=1:left Shapes.ShowShape(nyan[b]) Shapes.Rotate(Nyan[b],270) delX = 0 delY = 2*(1.5-b) ' down 20*(1.5-1)=+10 Up 20*(1.5-2)=-10 EndSub Sub init GraphicsWindow.Height = 390 GraphicsWindow.Width = 490 gw = GraphicsWindow.Width gh = GraphicsWindow.Height GraphicsWindow.CanResize = 0 GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Cyan" Shapes.AddRectangle(500, 400) GraphicsWindow.PenColor = "Green" Nyan[1] = Shapes.AddImage("http://ximages.net/images/28930020147868715423.png") ' left Nyan[2] = Shapes.AddImage("http://ximages.net/images/74412177564379571315.png") ' right GraphicsWindow.BrushColor = "Green" GraphicsWindow.PenColor = "White" GraphicsWindow.FontSize=15 enemy= Shapes.AddText("0") Shapes.Move(enemy,350, 20) GraphicsWindow.FontSize=15 mana= Shapes.AddText("0") Shapes.Move(mana,200, 20) GraphicsWindow.FontSize=15 points= Shapes.AddText("0") Shapes.Move(points,300, 20) food = Shapes.AddImage("http://ximages.net/images/03515726579119112960.png") Shapes.Move(food, Math.GetRandomNumber(30) * 10, Math.GetRandomNumber(40) * 10) GraphicsWindow.DrawBoundText(0, 0, 80, "0000000") ' what is this ????? Food counter?? 'maybe Flag=0 ' for start bonus=0 rot = 0 score = 0 x = 300 ' start X y = 200 ' start Y Shapes.Move(Nyan[1], x, y) Shapes.Rotate(Nyan[1], rot) delX = 0 ' initial moving X delY = 10 ' initial moving Y bx = 300 by = 200 belX = 0 belY = 0 GraphicsWindow.BrushColor="red" stime=Shapes.AddText(" ") Shapes.Move(stime,15,5) ' past time health = 0 endsub End>BNT279.sb< Start>BNW650-0.sb< '**************************************************************************** 'Main Code '**************************************************************************** 'Info Screen Info() 'Initialise Init() 'Play loop While ("True") 'Set components Select() 'Return any processed event flags ResetEvents() 'Attach components Attach() 'Move components Move() 'Update screen Update() 'Run Run() 'Load or Save LoadSave() Program.Delay(10) EndWhile '**************************************************************************** 'Info Screen '**************************************************************************** Sub Info 'Initialise Window InitWindow() 'Set description GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(100,100,gw-200,"Use the LEFT MOUSE button to grab components from the KEY PANE on the right and position in the main part of the screen.") GraphicsWindow.DrawBoundText(100,140,gw-200,"DELETE a component by dragging it back the the KEY PANE.") GraphicsWindow.DrawBoundText(100,180,gw-200,"CONNECT using the CONTROL key and mouse (click DOWN on the OUTPUT of one component and click UP on the INPUT to another component).") GraphicsWindow.DrawBoundText(100,220,gw-200,"To test a circuit use the RETURN key and MOUSE CLICK on an INPUT component to toggle its status and run the circuit, or just press the SPACE BAR to run the current circuit.") GraphicsWindow.DrawBoundText(100,260,gw-200,"ALL of the inputs to an AND component must be ON for it to activate.") GraphicsWindow.DrawBoundText(100,300,gw-200,"ANY of the inputs to an OR component must be ON for it to activate.") GraphicsWindow.DrawBoundText(100,340,gw-200,"The XOR component requires some inputs to be ON and some to be OFF to activate.") GraphicsWindow.DrawBoundText(100,380,gw-200,"The NOT component will reverse the signal of the last input (should only have one input).") GraphicsWindow.DrawBoundText(100,420,gw-200,"We can handle loops and any number of input/ouput connections. Save with 'S', Load with 'L' and Clear with 'C'.") GraphicsWindow.DrawBoundText(100,460,gw-200,"TO DO : Images, Gameplay(some objective), More component devices.") GraphicsWindow.DrawBoundText(100,500,gw-200,"Hit a key to continue.") GraphicsWindow.TextInput = OnTextInput key = 0 While (key = 0) EndWhile GraphicsWindow.Clear() EndSub Sub InitWindow 'Window gw = 800 gh = 600 gk = 200 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.Title = "Small Boots" GraphicsWindow.BackgroundColor = "LightBlue" EndSub Sub OnTextInput key = 1 EndSub '**************************************************************************** 'Initialisation '**************************************************************************** Sub Init 'Variables InitVariables() 'Key in Window InitKey() 'Events InitEvents() EndSub Sub InitVariables 'Global variables diameter = 30 radius = diameter/2 nComp = 0 Components = "" activeComponent = 0 connectComponent = 0 nConnect = 0 Connections = "" runComponent = 0 pi = Math.Pi 'Component types nType = 6 color[1] = "Red" color[2] = "Blue" color[3] = "Green" color[4] = "Orange" color[5] = "Purple" color[6] = "Gray" EndSub Sub InitKey 'Key GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(gw-gk,0,gw-gk,gh) For i = 1 To gh/nType-1 GraphicsWindow.DrawLine(gw-gk,i*gh/nType,gw,i*gh/nType) EndFor For i = 1 To nType GraphicsWindow.BrushColor = color[i] GraphicsWindow.FillEllipse(gw-gk*3/4-radius,(i-0.5)*gh/nType-radius,diameter,diameter) GraphicsWindow.DrawEllipse(gw-gk*3/4-radius,(i-0.5)*gh/nType-radius,diameter,diameter) EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(gw-gk/2,(1-0.5)*gh/nType-10,"INPUT") GraphicsWindow.DrawText(gw-gk/2,(2-0.5)*gh/nType-10,"AND") GraphicsWindow.DrawText(gw-gk/2,(3-0.5)*gh/nType-10,"OR") GraphicsWindow.DrawText(gw-gk/2,(4-0.5)*gh/nType-10,"XOR") GraphicsWindow.DrawText(gw-gk/2,(5-0.5)*gh/nType-10,"NOT") GraphicsWindow.DrawText(gw-gk/2,(6-0.5)*gh/nType-10,"OUTPUT") EndSub '**************************************************************************** 'Event subroutines '**************************************************************************** Sub InitEvents 'Event variables MouseDown = 0 MouseClickDown = 0 MouseClickUp = 0 MouseMove = 0 KeyDown = 0 SpaceDown = 0 ReturnDown = 0 ControlDown = 0 SDown = 0 LDown = 0 CDown = 0 Moving = 0 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp EndSub Sub OnMouseDown MouseDown = 1 MouseClickDown = 1 EndSub Sub OnMouseUp MouseDown = 0 MouseClickUp = 1 EndSub Sub OnMouseMove MouseMove = 1 xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY EndSub Sub OnKeyDown key = GraphicsWindow.LastKey KeyDown = 1 If (key = "Space") Then SpaceDown = 1 ElseIf (key = "Return") Then ReturnDown = 1 ElseIf (key = "LeftCtrl" Or key = "RightCtrl") Then ControlDown = 1 ElseIf (key = "S") Then SDown = 1 ElseIf (key = "L") Then LDown = 1 ElseIf (key = "C") Then CDown = 1 EndIf EndSub Sub OnKeyUp key = GraphicsWindow.LastKey KeyDown = 0 If (key = "Space") Then SpaceDown = 0 ElseIf (key = "Return") Then ReturnDown = 0 ElseIf (key = "LeftCtrl" Or key = "RightCtrl") Then ControlDown = 0 ElseIf (key = "S") Then SDown = 0 ElseIf (key = "L") Then LDown = 0 ElseIf (key = "C") Then CDown = 0 EndIf EndSub Sub ResetEvents MouseClickDown = 0 MouseClickUp = 0 MouseMove = 0 EndSub '**************************************************************************** 'Game Subroutines '**************************************************************************** Sub Select 'Mouse Clicked If (MouseClickDown = 1) Then 'Is Mouse in game or key area If (xM < gw-gk) Then 'Game area 'Select a componet to move or connect OverComponent() activeComponent = selected ElseIf (KeyDown = 0) Then 'Key area 'Add Something nComp = nComp+1 activeComponent = nComp Components[activeComponent]["Type"] = Math.Ceiling(yM/100) Components[activeComponent]["X"] = xM Components[activeComponent]["Y"] = yM Components[activeComponent]["W"] = diameter Components[activeComponent]["H"] = diameter Components[activeComponent]["Status"] = 0 GraphicsWindow.BrushColor = color[Components[activeComponent]["Type"]] Components[activeComponent]["S"] = Shapes.AddEllipse(diameter,diameter) EndIf ElseIf (MouseClickUp = 1) Then If (ControlDown = 1 And activeComponent > 0) Then 'Select component to connect OverComponent() connectComponent = selected ElseIf (ReturnDown = 1 And activeComponent > 0) Then 'Select component to run runComponent = activeComponent Else 'Delete selected component released in Key area - also delete any connections If (activeComponent > 0 And xM > gw-gk) Then Connect = Array.GetAllIndices(Connections) For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp1 = activeComponent Or comp2 = activeComponent) Then Connections[Connect[i]] = "" Moving = 1 'To ensure a clear before redraw EndIf EndFor Shapes.Remove(Components[activeComponent]["S"]) Components[activeComponent] = "" EndIf 'Release selected components activeComponent = 0 connectComponent = 0 runComponent = 0 EndIf ElseIf (MouseDown = 0) Then 'Release selected components - sometimes MouseClickUp isn't registered activeComponent = 0 connectComponent = 0 runComponent = 0 EndIf EndSub Sub OverComponent 'Is mouse over a component selected = 0 Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) iComp = Comp[i] x = Components[iComp]["X"] y = Components[iComp]["Y"] w = Components[iComp]["W"] h = Components[iComp]["H"] If (xM > x-w/2 And xM < x+w/2 And yM > y-h/2 And yM < y+h/2) Then selected = iComp EndIf EndFor EndSub Sub Move If (activeComponent > 0 And KeyDown = 0) Then Components[activeComponent]["X"] = xM Components[activeComponent]["Y"] = yM Moving = 1 EndIf EndSub Sub Update 'Draw components Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) x = Components[Comp[i]]["X"] y = Components[Comp[i]]["Y"] w = Components[Comp[i]]["W"] h = Components[Comp[i]]["H"] s = Components[Comp[i]]["S"] status = Components[Comp[i]]["Status"] Shapes.Move(s,x-w/2,y-h/2) If (activeComponent = Comp[i]) Then Shapes.SetOpacity(s,30) Else If (status = 0) Then Shapes.SetOpacity(s,50) Else Shapes.SetOpacity(s,100) EndIf EndIf EndFor 'Clear screen if needed (component moved) If (Moving = 1) Then GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(0,0,gw-gk,gh) Moving = 0 EndIf 'Draw connections Connect = Array.GetAllIndices(Connections) For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] x1 = Math.Min(Components[comp1]["X"],gw-gk) 'Don't draw into Key area y1 = Components[comp1]["Y"] x2 = Math.Min(Components[comp2]["X"],gw-gk) y2 = Components[comp2]["Y"] If (Connections[Connect[i]]["Status"] = 0) Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" Else GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" EndIf GraphicsWindow.DrawLine(x1,y1,x2,y2) 'Add direction indicator If (x1 = x2) Then theta = pi/2 Else theta = Math.ArcTan((y2-y1)/(x2-x1)) EndIf If (x2 < x1) Then theta = theta+pi EndIf x3 = (x1+x2)/2 y3 = (y1+y2)/2 x3 = x3+15*Math.Cos(theta) y3 = y3+15*Math.Sin(theta) x4 = x3-30*Math.Cos(theta)+8*Math.Sin(theta) y4 = y3-30*Math.Sin(theta)-8*Math.Cos(theta) x5 = x3-30*Math.Cos(theta)-8*Math.Sin(theta) y5 = y3-30*Math.Sin(theta)+8*Math.Cos(theta) GraphicsWindow.FillTriangle(x3,y3,x4,y4,x5,y5) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" EndFor EndSub Sub Attach If (activeComponent > 0 And connectComponent > 0 And activeComponent <> connectComponent) Then 'Check for connection existing to delete connected = 0 Connect = Array.GetAllIndices(Connections) For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If ((comp1 = activeComponent And comp2 = connectComponent) Or (comp2 = activeComponent And comp1 = connectComponent)) Then connected = 1 Connections[Connect[i]] = "" Moving = 1 'To ensure a clear before redraw EndIf EndFor 'Connect if we didn't delete the connection If (connected = 0) Then nConnect = nConnect+1 Connections[nConnect][1] = activeComponent Connections[nConnect][2] = connectComponent Connections[nConnect]["Status"] = 0 Moving = 1 'To ensure a clear before redraw EndIf activeComponent = 0 connectComponent = 0 EndIf EndSub Sub Run If (runComponent > 0 And Components[runComponent]["Type"] = 1) Then Components[runComponent]["Status"] = 1-Components[runComponent]["Status"] ' Switch status RunUpdate() ElseIf (SpaceDown = 1) Then RunUpdate() EndIf runComponent = 0 EndSub Sub RunUpdate Connect = Array.GetAllIndices(Connections) CompList = Array.GetAllIndices(Components) 'First update all components For i = 1 To Array.GetItemCount(CompList) type = Components[i]["Type"] 'Set status by checking inputs and component type If (type = 1) Then 'Input status = Components[i]["Status"] ElseIf (type = 2) Then 'And status = 1 For j = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[j]][1] comp2 = Connections[Connect[j]][2] If (comp2 = i And Connections[Connect[j]]["Status"] = 0) Then status = 0 EndIf EndFor ElseIf (type = 3 Or type = 6) Then 'Or Output status = 0 For j = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[j]][1] comp2 = Connections[Connect[j]][2] If (comp2 = i And Connections[Connect[j]]["Status"] = 1) Then status = 1 EndIf EndFor ElseIf (type = 4) Then 'XOR on = 0 off = 0 For j = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[j]][1] comp2 = Connections[Connect[j]][2] If (comp2 = i) Then If (Connections[Connect[j]]["Status"] = 1) Then on = 1 EndIf If (Connections[Connect[j]]["Status"] = 0) Then off = 1 EndIf EndIf EndFor If (on + off = 2) Then status = 1 Else status = 0 EndIf ElseIf (type = 5) Then 'Not For j = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[j]][1] comp2 = Connections[Connect[j]][2] If (comp2 = i) Then status = 1-Connections[Connect[j]]["Status"] EndIf EndFor EndIf Components[i]["Status"] = status EndFor 'Then update all connectors For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] Connections[Connect[i]]["Status"] = Components[comp1]["Status"] EndFor EndSub '**************************************************************************** 'Load and Save '**************************************************************************** Sub LoadSave If (LDown = 1) Then Load() EndIf If (SDown = 1) Then Save() EndIf If (CDown = 1) Then Clear() EndIf EndSub Sub Save ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(Program.Directory+"\boots.txt",1,Components) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(Program.Directory+"\boots.txt",2,Connections) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(Program.Directory+"\boots.txt",3,nComp) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' File.WriteLine(Program.Directory+"\boots.txt",4,nConnect) EndSub Sub Load CompList = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(CompList) Shapes.Remove(Components[CompList[i]]["S"]) EndFor ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' Components = File.ReadLine(Program.Directory+"\boots.txt",1) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' Connections = File.ReadLine(Program.Directory+"\boots.txt",2) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' nComp = File.ReadLine(Program.Directory+"\boots.txt",3) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' nConnect = File.ReadLine(Program.Directory+"\boots.txt",4) For i = 1 To Array.GetItemCount(Components) GraphicsWindow.BrushColor = color[Components[i]["Type"]] Components[i]["S"] = Shapes.AddEllipse(diameter,diameter) EndFor Moving = 1 EndSub Sub Clear CompList = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(CompList) Shapes.Remove(Components[CompList[i]]["S"]) EndFor Components = "" Connections = "" nComp = 0 nConnect = 0 Moving = 1 EndSub End>BNW650-0.sb< Start>BNW650-1.sb< '**************************************************************************** 'Main Code '**************************************************************************** 'Info Screen Info() 'Initialise Init() 'Play loop While ("True") 'Set components Select() 'Return any processed event flags ResetEvents() 'Attach components Attach() 'Move components Move() 'Update screen Update() 'Run Run() 'Load or Save LoadSave() Program.Delay(10) EndWhile '**************************************************************************** 'Info Screen '**************************************************************************** Sub Info 'Initialise Window InitWindow() 'Set description GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(100,100,gw-200,"Use the LEFT MOUSE button to grab components from the KEY PANE on the right and position in the main part of the screen.") GraphicsWindow.DrawBoundText(100,140,gw-200,"DELETE a component by dragging it back the the KEY PANE.") GraphicsWindow.DrawBoundText(100,180,gw-200,"CONNECT using the CONTROL key and mouse (click DOWN on the OUTPUT of one component and click UP on the INPUT to another component).") GraphicsWindow.DrawBoundText(100,220,gw-200,"To test a circuit use the RETURN key and MOUSE CLICK on an INPUT component to toggle its status and run the circuit, or just press the SPACE BAR to run the current circuit.") GraphicsWindow.DrawBoundText(100,260,gw-200,"ALL of the inputs to an AND component must be ON for it to activate.") GraphicsWindow.DrawBoundText(100,300,gw-200,"ANY of the inputs to an OR component must be ON for it to activate.") GraphicsWindow.DrawBoundText(100,340,gw-200,"The XOR component requires some inputs to be ON and some to be OFF to activate.") GraphicsWindow.DrawBoundText(100,380,gw-200,"The NOT component will reverse the signal of the last input (should only have one input).") GraphicsWindow.DrawBoundText(100,420,gw-200,"We can handle loops and any number of input/ouput connections. Save with 'S', Load with 'L' and Clear with 'C'.") GraphicsWindow.DrawBoundText(100,460,gw-200,"TO DO : Images, Gameplay(some objective), More component devices.") GraphicsWindow.DrawBoundText(100,500,gw-200,"Hit a key to continue.") GraphicsWindow.TextInput = OnTextInput key = 0 While (key = 0) EndWhile GraphicsWindow.Clear() EndSub Sub InitWindow 'Window gw = 800 gh = 600 gk = 200 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.Title = "Small Boots" GraphicsWindow.BackgroundColor = "LightBlue" EndSub Sub OnTextInput key = 1 EndSub '**************************************************************************** 'Initialisation '**************************************************************************** Sub Init 'Variables InitVariables() 'Key in Window InitKey() 'Events InitEvents() EndSub Sub InitVariables 'Global variables diameter = 30 radius = diameter/2 nComp = 0 Components = "" Nodes = "" activeComponent = 0 connectComponent = 0 activePort = 0 connectPort = 0 nConnect = 0 Connections = "" runComponent = 0 pi = Math.Pi 'Component types nType = 6 color[1] = "Red" color[2] = "Blue" color[3] = "Green" color[4] = "Orange" color[5] = "Purple" color[6] = "Gray" EndSub Sub InitKey 'Key GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(gw-gk,0,gw-gk,gh) For i = 1 To gh/nType-1 GraphicsWindow.DrawLine(gw-gk,i*gh/nType,gw,i*gh/nType) EndFor 'Draw Input GraphicsWindow.BrushColor = color[1] DrawComponent_X = gw-gk*3/4-radius DrawComponent_Y = (1-0.5)*gh/nType-radius 'Draw basic shape GraphicsWindow.FillEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) GraphicsWindow.DrawEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) 'Draw output port GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(DrawComponent_X+diameter*7/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X+diameter*7/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) 'Draw OR, AND, XOR For i = 2 To (nType-2) GraphicsWindow.BrushColor = color[i] DrawComponent_X = gw-gk*3/4-radius DrawComponent_Y = (i-0.5)*gh/nType-radius 'Draw basic shape GraphicsWindow.FillEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) GraphicsWindow.DrawEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) 'Draw input ports GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(DrawComponent_X,DrawComponent_Y,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X,DrawComponent_Y,diameter/4,diameter/4) GraphicsWindow.FillEllipse(DrawComponent_X,DrawComponent_Y+diameter*3/4,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X,DrawComponent_Y+diameter*3/4,diameter/4,diameter/4) 'Draw output port GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(DrawComponent_X+diameter*7/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X+diameter*7/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) EndFor GraphicsWindow.BrushColor = color[nType-1] DrawComponent_X = gw-gk*3/4-radius DrawComponent_Y = (nType-1-0.5)*gh/nType-radius 'Draw basic shape GraphicsWindow.FillEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) GraphicsWindow.DrawEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) 'Draw input port GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(DrawComponent_X-diameter/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X-diameter/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) 'Draw output port GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(DrawComponent_X+diameter*7/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X+diameter*7/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) 'Draw Output GraphicsWindow.BrushColor = color[nType] DrawComponent_X = gw-gk*3/4-radius DrawComponent_Y = (nType-0.5)*gh/nType-radius 'Draw basic shape GraphicsWindow.FillEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) GraphicsWindow.DrawEllipse(DrawComponent_X,DrawComponent_Y,diameter,diameter) 'Draw input port GraphicsWindow.BrushColor = "White" GraphicsWindow.FillEllipse(DrawComponent_X-diameter/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) GraphicsWindow.DrawEllipse(DrawComponent_X-diameter/8,DrawComponent_Y+diameter*3/8,diameter/4,diameter/4) GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(gw-gk/2,(1-0.5)*gh/nType-10,"INPUT") GraphicsWindow.DrawText(gw-gk/2,(2-0.5)*gh/nType-10,"AND") GraphicsWindow.DrawText(gw-gk/2,(3-0.5)*gh/nType-10,"OR") GraphicsWindow.DrawText(gw-gk/2,(4-0.5)*gh/nType-10,"XOR") GraphicsWindow.DrawText(gw-gk/2,(5-0.5)*gh/nType-10,"NOT") GraphicsWindow.DrawText(gw-gk/2,(6-0.5)*gh/nType-10,"OUTPUT") EndSub '**************************************************************************** 'Event subroutines '**************************************************************************** Sub InitEvents 'Event variables MouseDown = 0 MouseClickDown = 0 MouseClickUp = 0 MouseMove = 0 KeyDown = 0 SpaceDown = 0 ReturnDown = 0 ControlDown = 0 SDown = 0 LDown = 0 CDown = 0 Moving = 0 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp EndSub Sub OnMouseDown MouseDown = 1 MouseClickDown = 1 EndSub Sub OnMouseUp MouseDown = 0 MouseClickUp = 1 EndSub Sub OnMouseMove MouseMove = 1 xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY EndSub Sub OnKeyDown key = GraphicsWindow.LastKey KeyDown = 1 If (key = "Space") Then SpaceDown = 1 ElseIf (key = "Return") Then ReturnDown = 1 ElseIf (key = "LeftCtrl" Or key = "RightCtrl") Then ControlDown = 1 ElseIf (key = "S") Then SDown = 1 ElseIf (key = "L") Then LDown = 1 ElseIf (key = "C") Then CDown = 1 EndIf EndSub Sub OnKeyUp key = GraphicsWindow.LastKey KeyDown = 0 If (key = "Space") Then SpaceDown = 0 ElseIf (key = "Return") Then ReturnDown = 0 ElseIf (key = "LeftCtrl" Or key = "RightCtrl") Then ControlDown = 0 ElseIf (key = "S") Then SDown = 0 ElseIf (key = "L") Then LDown = 0 ElseIf (key = "C") Then CDown = 0 EndIf EndSub Sub ResetEvents MouseClickDown = 0 MouseClickUp = 0 MouseMove = 0 EndSub '**************************************************************************** 'Game Subroutines '**************************************************************************** Sub Select 'Mouse Clicked If (MouseClickDown = 1) Then 'Is Mouse in game or key area If (xM < gw-gk) Then 'Game area 'Select a componet to move or connect OverComponent() activeComponent = selected activePort = selectedPort ElseIf (KeyDown = 0) Then 'Key area 'Add Something nComp = nComp+1 activeComponent = nComp Components[activeComponent]["Type"] = Math.Ceiling(yM/100) Components[activeComponent]["X"] = xM Components[activeComponent]["Y"] = yM Components[activeComponent]["W"] = diameter Components[activeComponent]["H"] = diameter Components[activeComponent]["in1"] = 0 Components[activeComponent]["in2"] = 0 Components[activeComponent]["out"] = activeComponent Components[activeComponent]["Status"] = 0 GraphicsWindow.BrushColor = color[Components[activeComponent]["Type"]] Components[activeComponent]["S"] = Shapes.AddEllipse(diameter,diameter) GraphicsWindow.BrushColor = "White" If (Components[activeComponent]["Type"] > 1) Then Components[activeComponent]["Sin1"] = Shapes.AddEllipse(diameter/4,diameter/4) If (Components[activeComponent]["Type"] <= 4) Then Components[activeComponent]["Sin2"] = Shapes.AddEllipse(diameter/4,diameter/4) Endif EndIf GraphicsWindow.BrushColor = "Black" If (Components[activeComponent]["Type"] < 6) Then Components[activeComponent]["Sout"] = Shapes.AddEllipse(diameter/4,diameter/4) EndIf Nodes[activeComponent]["Status"] = 0 EndIf ElseIf (MouseClickUp = 1) Then If (ControlDown = 1 And activeComponent > 0) Then 'Select component to connect OverComponent() connectComponent = selected connectPort = selectedPort ElseIf (ReturnDown = 1 And activeComponent > 0) Then 'Select component to run runComponent = activeComponent Else 'Delete selected component released in Key area - also delete any connections If (activeComponent > 0 And xM > gw-gk) Then node = Components[activeComponent]["out"] Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Components) If (Components[Comp[i]]["in1"] = node) Then Components[Comp[i]]["in1"] = 0 Moving = 1 'To ensure a clear before redraw EndIf If (Components[Comp[i]]["in2"] = node) Then Components[Comp[i]]["in2"] = 0 Moving = 1 'To ensure a clear before redraw EndIf EndFor Shapes.Remove(Components[activeComponent]["S"]) Shapes.Remove(Components[activeComponent]["Sin1"]) Shapes.Remove(Components[activeComponent]["Sin2"]) Shapes.Remove(Components[activeComponent]["Sout"]) Components[activeComponent] = "" Nodes[activeComponent] = "" EndIf 'Release selected components activeComponent = 0 activePort = 0 connectComponent = 0 connectPort = 0 runComponent = 0 EndIf ElseIf (MouseDown = 0) Then 'Release selected components - sometimes MouseClickUp isn't registered activeComponent = 0 activePort = 0 connectComponent = 0 connectPort = 0 runComponent = 0 EndIf EndSub Sub OverComponent 'Is mouse over a component selected = 0 selectedPort = "" Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) iComp = Comp[i] type = Components[iComp]["Type"] x = Components[iComp]["X"] y = Components[iComp]["Y"] w = Components[iComp]["W"] h = Components[iComp]["H"] If (xM > x-w/2 And xM < x+w/2 And yM > y-h/2 And yM < y+h/2) Then selected = iComp If (type > 1 And xM < x) Then If (type <= 4 And yM > y) Then selectedPort = "in2" Else selectedPort = "in1" EndIf ElseIf (type < 6) Then selectedPort = "out" EndIf EndIf EndFor EndSub Sub Move If (activeComponent > 0 And KeyDown = 0) Then Components[activeComponent]["X"] = xM Components[activeComponent]["Y"] = yM Moving = 1 EndIf EndSub Sub Update 'Draw components Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) type = Components[Comp[i]]["Type"] x = Components[Comp[i]]["X"] y = Components[Comp[i]]["Y"] w = Components[Comp[i]]["W"] h = Components[Comp[i]]["H"] s = Components[Comp[i]]["S"] status = Components[Comp[i]]["Status"] Shapes.Move(s,x-w/2,y-h/2) If (type > 1) Then sin1 = Components[Comp[i]]["Sin1"] If (type >= 5) Then Shapes.Move(sin1,x-w*5/8,y-h/8) Else Shapes.Move(sin1,x-w/2,y-h/2) sin2 = Components[Comp[i]]["Sin2"] Shapes.Move(sin2,x-w/2,y+h/4) EndIf EndIf If (type < 6) Then sout = Components[Comp[i]]["Sout"] Shapes.Move(sout,x+w*3/8,y-h/8) EndIf If (activeComponent = Comp[i]) Then Shapes.SetOpacity(s,30) Else If (status = 0) Then Shapes.SetOpacity(s,50) Else Shapes.SetOpacity(s,100) EndIf EndIf EndFor 'Clear screen if needed (component moved) If (Moving = 1) Then GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(0,0,gw-gk,gh) Moving = 0 EndIf 'Draw connections Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) comp1 = Components[Comp[i]]["in1"] If(comp1 > 0) Then x1 = Math.Min(Components[comp1]["X"]+Components[comp1]["W"]/2,gw-gk) 'Don't draw into Key area y1 = Components[comp1]["Y"] x2 = Math.Min(Components[Comp[i]]["X"]-Components[Comp[i]]["W"]/2,gw-gk) If (Components[Comp[i]]["Type"] <= 4) Then y2 = Components[Comp[i]]["Y"]-Components[comp1]["H"]/2 Else y2 = Components[Comp[i]]["Y"] EndIf If (Nodes[comp1]["Status"] = 0) Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" Else GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" EndIf GraphicsWindow.DrawLine(x1,y1,x2,y2) EndIf comp1 = Components[Comp[i]]["in2"] If(comp1 > 0) Then x1 = Math.Min(Components[comp1]["X"]+Components[comp1]["W"]/2,gw-gk) 'Don't draw into Key area y1 = Components[comp1]["Y"] x2 = Math.Min(Components[Comp[i]]["X"]-Components[Comp[i]]["W"]/2,gw-gk) y2 = Components[Comp[i]]["Y"]+Components[comp1]["H"]/2 If (Nodes[comp1]["Status"] = 0) Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" Else GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" EndIf GraphicsWindow.DrawLine(x1,y1,x2,y2) EndIf EndFor EndSub Sub Attach If (activeComponent > 0 And connectComponent > 0 And activeComponent <> connectComponent) Then If(activePort = "out" And (connectPort = "in1" Or connectPort = "in2")) Then Components[connectComponent][connectPort] = Components[activeComponent]["out"] ElseIf(connectPort = "out" And (activePort = "in1" Or activePort = "in2")) Then Components[activeComponent][activePort] = Components[connectComponent]["out"] EndIf Moving = 1 'To ensure a clear before redraw activeComponent = 0 connectComponent = 0 EndIf EndSub Sub Run If (runComponent > 0 And Components[runComponent]["Type"] = 1) Then Components[runComponent]["Status"] = 1-Components[runComponent]["Status"] ' Switch status EndIf If (SpaceDown = 1) Then RunUpdate() EndIf runComponent = 0 EndSub Sub RunUpdate CompList = Array.GetAllIndices(Components) 'First update all components For i = 1 To Array.GetItemCount(CompList) type = Components[i]["Type"] 'Set status by checking inputs and component type If (type = 1) Then 'Input status = Components[i]["Status"] ElseIf (type = 2) Then 'And If(Nodes[Components[i]["in1"]]["Status"] = 1 And Nodes[Components[i]["in2"]]["Status"] = 1) Then status = 1 Else status = 0 EndIf ElseIf (type = 3 Or type = 6) Then 'Or Output If(Nodes[Components[i]["in1"]]["Status"] = 1 Or Nodes[Components[i]["in2"]]["Status"] = 1) Then status = 1 Else status = 0 EndIf ElseIf (type = 4) Then 'XOR If(Nodes[Components[i]["in1"]]["Status"] + Nodes[Components[i]["in2"]]["Status"] = 1) Then status = 1 Else status = 0 EndIf ElseIf (type = 5) Then 'Not status = 1 - Nodes[Components[i]["in1"]]["Status"] EndIf Components[i]["Status"] = status EndFor 'Then update all nodes For i = 1 To Array.GetItemCount(CompList) Nodes[Components[i]["out"]]["Status"] = Components[i]["Status"] EndFor EndSub '**************************************************************************** 'Load and Save '**************************************************************************** Sub LoadSave If (LDown = 1) Then Load() EndIf If (SDown = 1) Then Save() EndIf If (CDown = 1) Then Clear() EndIf EndSub Sub Save ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' File.WriteLine(Program.Directory+"\boots.txt",1,Components) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' File.WriteLine(Program.Directory+"\boots.txt",2,Connections) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' File.WriteLine(Program.Directory+"\boots.txt",3,nComp) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' File.WriteLine(Program.Directory+"\boots.txt",4,nConnect) EndSub Sub Load CompList = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(CompList) Shapes.Remove(Components[CompList[i]]["S"]) EndFor ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' Components = File.ReadLine(Program.Directory+"\boots.txt",1) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' Connections = File.ReadLine(Program.Directory+"\boots.txt",2) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' nComp = File.ReadLine(Program.Directory+"\boots.txt",3) ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' The following line could be harmful and has been automatically commented. ' ' ' nConnect = File.ReadLine(Program.Directory+"\boots.txt",4) For i = 1 To Array.GetItemCount(Components) GraphicsWindow.BrushColor = color[Components[i]["Type"]] Components[i]["S"] = Shapes.AddEllipse(diameter,diameter) EndFor Moving = 1 EndSub Sub Clear CompList = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(CompList) Shapes.Remove(Components[CompList[i]]["S"]) EndFor Components = "" Connections = "" nComp = 0 nConnect = 0 Moving = 1 EndSub End>BNW650-1.sb< Start>BNW650.sb< '**************************************************************************** 'Main Code '**************************************************************************** 'Info Screen Info() 'Initialise Init() 'Play loop While ("True") 'Set components Select() 'Return any processed event flags ResetEvents() 'Attach components Attach() 'Move components Move() 'Update screen Update() 'Run Run() 'Load or Save LoadSave() Program.Delay(10) EndWhile '**************************************************************************** 'Info Screen '**************************************************************************** Sub Info 'Initialise Window InitWindow() 'Set description GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawBoundText(100,100,gw-200,"Use the LEFT MOUSE button to grab components from the KEY PANE on the right and position in the main part of the screen.") GraphicsWindow.DrawBoundText(100,140,gw-200,"DELETE a component by dragging it back the the KEY PANE.") GraphicsWindow.DrawBoundText(100,180,gw-200,"CONNECT using the CONTROL key and mouse (click DOWN on the OUTPUT of one component and click UP on the INPUT to another component).") GraphicsWindow.DrawBoundText(100,220,gw-200,"To test a circuit use the RETURN key and MOUSE CLICK on an INPUT component to toggle its status and run the circuit, or just press the SPACE BAR to run the current circuit.") GraphicsWindow.DrawBoundText(100,260,gw-200,"ALL of the inputs to an AND component must be ON for it to activate.") GraphicsWindow.DrawBoundText(100,300,gw-200,"ANY of the inputs to an OR component must be ON for it to activate.") GraphicsWindow.DrawBoundText(100,340,gw-200,"The XOR component requires some inputs to be ON and some to be OFF to activate.") GraphicsWindow.DrawBoundText(100,380,gw-200,"The NOT component will reverse the signal of the last input (should only have one input).") GraphicsWindow.DrawBoundText(100,420,gw-200,"We can handle loops and any number of input/ouput connections. Save with 'S', Load with 'L' and Clear with 'C'.") GraphicsWindow.DrawBoundText(100,460,gw-200,"TO DO : Images, Gameplay(some objective), More component devices.") GraphicsWindow.DrawBoundText(100,500,gw-200,"Hit a key to continue.") GraphicsWindow.TextInput = OnTextInput key = 0 While (key = 0) EndWhile GraphicsWindow.Clear() EndSub Sub InitWindow 'Window gw = 800 gh = 600 gk = 200 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Top = (Desktop.Height-gh)/2 GraphicsWindow.Title = "Small Boots" GraphicsWindow.BackgroundColor = "LightBlue" EndSub Sub OnTextInput key = 1 EndSub '**************************************************************************** 'Initialisation '**************************************************************************** Sub Init 'Variables InitVariables() 'Key in Window InitKey() 'Events InitEvents() EndSub Sub InitVariables 'Global variables diameter = 30 radius = diameter/2 nComp = 0 Components = "" activeComponent = 0 connectComponent = 0 nConnect = 0 Connections = "" runComponent = 0 pi = Math.Pi 'Component types nType = 6 color[1] = "Red" color[2] = "Blue" color[3] = "Green" color[4] = "Orange" color[5] = "Purple" color[6] = "Gray" EndSub Sub InitKey 'Key GraphicsWindow.PenColor = "Black" GraphicsWindow.DrawLine(gw-gk,0,gw-gk,gh) For i = 1 To gh/nType-1 GraphicsWindow.DrawLine(gw-gk,i*gh/nType,gw,i*gh/nType) EndFor For i = 1 To nType GraphicsWindow.BrushColor = color[i] GraphicsWindow.FillEllipse(gw-gk*3/4-radius,(i-0.5)*gh/nType-radius,diameter,diameter) GraphicsWindow.DrawEllipse(gw-gk*3/4-radius,(i-0.5)*gh/nType-radius,diameter,diameter) EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(gw-gk/2,(1-0.5)*gh/nType-10,"INPUT") GraphicsWindow.DrawText(gw-gk/2,(2-0.5)*gh/nType-10,"AND") GraphicsWindow.DrawText(gw-gk/2,(3-0.5)*gh/nType-10,"OR") GraphicsWindow.DrawText(gw-gk/2,(4-0.5)*gh/nType-10,"XOR") GraphicsWindow.DrawText(gw-gk/2,(5-0.5)*gh/nType-10,"NOT") GraphicsWindow.DrawText(gw-gk/2,(6-0.5)*gh/nType-10,"OUTPUT") EndSub '**************************************************************************** 'Event subroutines '**************************************************************************** Sub InitEvents 'Event variables MouseDown = 0 MouseClickDown = 0 MouseClickUp = 0 MouseMove = 0 KeyDown = 0 SpaceDown = 0 ReturnDown = 0 ControlDown = 0 SDown = 0 LDown = 0 CDown = 0 Moving = 0 GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp EndSub Sub OnMouseDown MouseDown = 1 MouseClickDown = 1 EndSub Sub OnMouseUp MouseDown = 0 MouseClickUp = 1 EndSub Sub OnMouseMove MouseMove = 1 xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY EndSub Sub OnKeyDown key = GraphicsWindow.LastKey KeyDown = 1 If (key = "Space") Then SpaceDown = 1 ElseIf (key = "Return") Then ReturnDown = 1 ElseIf (key = "LeftCtrl" Or key = "RightCtrl") Then ControlDown = 1 ElseIf (key = "S") Then SDown = 1 ElseIf (key = "L") Then LDown = 1 ElseIf (key = "C") Then CDown = 1 EndIf EndSub Sub OnKeyUp key = GraphicsWindow.LastKey KeyDown = 0 If (key = "Space") Then SpaceDown = 0 ElseIf (key = "Return") Then ReturnDown = 0 ElseIf (key = "LeftCtrl" Or key = "RightCtrl") Then ControlDown = 0 ElseIf (key = "S") Then SDown = 0 ElseIf (key = "L") Then LDown = 0 ElseIf (key = "C") Then CDown = 0 EndIf EndSub Sub ResetEvents MouseClickDown = 0 MouseClickUp = 0 MouseMove = 0 EndSub '**************************************************************************** 'Game Subroutines '**************************************************************************** Sub Select 'Mouse Clicked If (MouseClickDown = 1) Then 'Is Mouse in game or key area If (xM < gw-gk) Then 'Game area 'Select a componet to move or connect OverComponent() activeComponent = selected ElseIf (KeyDown = 0) Then 'Key area 'Add Something nComp = nComp+1 activeComponent = nComp Components[activeComponent]["Type"] = Math.Ceiling(yM/100) Components[activeComponent]["X"] = xM Components[activeComponent]["Y"] = yM Components[activeComponent]["W"] = diameter Components[activeComponent]["H"] = diameter Components[activeComponent]["Status"] = 0 GraphicsWindow.BrushColor = color[Components[activeComponent]["Type"]] Components[activeComponent]["S"] = Shapes.AddEllipse(diameter,diameter) EndIf ElseIf (MouseClickUp = 1) Then If (ControlDown = 1 And activeComponent > 0) Then 'Select component to connect OverComponent() connectComponent = selected ElseIf (ReturnDown = 1 And activeComponent > 0) Then 'Select component to run runComponent = activeComponent Else 'Delete selected component released in Key area - also delete any connections If (activeComponent > 0 And xM > gw-gk) Then Connect = Array.GetAllIndices(Connections) For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp1 = activeComponent Or comp2 = activeComponent) Then Connections[Connect[i]] = "" Moving = 1 'To ensure a clear before redraw EndIf EndFor Shapes.Remove(Components[activeComponent]["S"]) Components[activeComponent] = "" EndIf 'Release selected components activeComponent = 0 connectComponent = 0 runComponent = 0 EndIf ElseIf (MouseDown = 0) Then 'Release selected components - sometimes MouseClickUp isn't registered activeComponent = 0 connectComponent = 0 runComponent = 0 EndIf EndSub Sub OverComponent 'Is mouse over a component selected = 0 Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) iComp = Comp[i] x = Components[iComp]["X"] y = Components[iComp]["Y"] w = Components[iComp]["W"] h = Components[iComp]["H"] If (xM > x-w/2 And xM < x+w/2 And yM > y-h/2 And yM < y+h/2) Then selected = iComp EndIf EndFor EndSub Sub Move If (activeComponent > 0 And KeyDown = 0) Then Components[activeComponent]["X"] = xM Components[activeComponent]["Y"] = yM Moving = 1 EndIf EndSub Sub Update 'Draw components Comp = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(Comp) x = Components[Comp[i]]["X"] y = Components[Comp[i]]["Y"] w = Components[Comp[i]]["W"] h = Components[Comp[i]]["H"] s = Components[Comp[i]]["S"] status = Components[Comp[i]]["Status"] Shapes.Move(s,x-w/2,y-h/2) If (activeComponent = Comp[i]) Then Shapes.SetOpacity(s,30) Else If (status = 0) Then Shapes.SetOpacity(s,50) Else Shapes.SetOpacity(s,100) EndIf EndIf EndFor 'Clear screen if needed (component moved) If (Moving = 1) Then GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle(0,0,gw-gk,gh) Moving = 0 EndIf 'Draw connections Connect = Array.GetAllIndices(Connections) For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] x1 = Math.Min(Components[comp1]["X"],gw-gk) 'Don't draw into Key area y1 = Components[comp1]["Y"] x2 = Math.Min(Components[comp2]["X"],gw-gk) y2 = Components[comp2]["Y"] If (Connections[Connect[i]]["Status"] = 0) Then GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" Else GraphicsWindow.PenColor = "Red" GraphicsWindow.BrushColor = "Red" EndIf GraphicsWindow.DrawLine(x1,y1,x2,y2) 'Add direction indicator If (x1 = x2) Then theta = pi/2 Else theta = Math.ArcTan((y2-y1)/(x2-x1)) EndIf If (x2 < x1) Then theta = theta+pi EndIf x3 = (x1+x2)/2 y3 = (y1+y2)/2 x3 = x3+15*Math.Cos(theta) y3 = y3+15*Math.Sin(theta) x4 = x3-30*Math.Cos(theta)+8*Math.Sin(theta) y4 = y3-30*Math.Sin(theta)-8*Math.Cos(theta) x5 = x3-30*Math.Cos(theta)-8*Math.Sin(theta) y5 = y3-30*Math.Sin(theta)+8*Math.Cos(theta) GraphicsWindow.FillTriangle(x3,y3,x4,y4,x5,y5) GraphicsWindow.PenColor = "Black" GraphicsWindow.BrushColor = "Black" EndFor EndSub Sub Attach If (activeComponent > 0 And connectComponent > 0 And activeComponent <> connectComponent) Then 'Check for connection existing to delete connected = 0 Connect = Array.GetAllIndices(Connections) For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If ((comp1 = activeComponent And comp2 = connectComponent) Or (comp2 = activeComponent And comp1 = connectComponent)) Then connected = 1 Connections[Connect[i]] = "" Moving = 1 'To ensure a clear before redraw EndIf EndFor 'Connect if we didn't delete the connection If (connected = 0) Then nConnect = nConnect+1 Connections[nConnect][1] = activeComponent Connections[nConnect][2] = connectComponent Connections[nConnect]["Status"] = 0 Moving = 1 'To ensure a clear before redraw EndIf activeComponent = 0 connectComponent = 0 EndIf EndSub Sub Run If (runComponent > 0 And Components[runComponent]["Type"] = 1) Then Components[runComponent]["Status"] = 1-Components[runComponent]["Status"] ' Switch status RunUpdate() ElseIf (SpaceDown = 1) Then RunUpdate() EndIf runComponent = 0 EndSub Sub RunUpdate Connect = Array.GetAllIndices(Connections) 'Recursively feed the signal down components from all inputs CompList = Array.GetAllIndices(Components) nCompleted = 0 For i = 1 To Array.GetItemCount(CompList) Completed[CompList[i]] = 0 EndFor While (nCompleted < Array.GetItemCount(Completed)) 'Only consider a component when all input components have been completed For i = 1 To Array.GetItemCount(CompList) If (Completed[CompList[i]] = 0) Then 'Check uncompleted components 'Check if ALL inputs are completed (i.e check if any are not) comp = CompList[i] For j = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[j]][1] comp2 = Connections[Connect[j]][2] If (comp2 = comp And Completed[comp1] = 0) Then comp = 0 EndIf EndFor If (comp > 0) Then Goto ComponentFound EndIf EndIf EndFor ' We must have a loop if we haven't found a component with all upstream components already set For i = 1 To Array.GetItemCount(CompList) If (Completed[CompList[i]] = 0) Then 'Check uncompleted components 'Check if ANY inputs are completed comp = CompList[i] For j = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[j]][1] comp2 = Connections[Connect[j]][2] If (comp2 = comp And Completed[comp1] = 1) Then Goto ComponentFound EndIf EndFor EndIf EndFor ComponentFound: 'We have found a component that hasn't been set, but all upstream components have type = Components[comp]["Type"] 'Set status by checking inputs and component type If (type = 1) Then 'Input status = Components[comp]["Status"] ElseIf (type = 2) Then 'And status = 1 For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp2 = comp And Components[comp1]["Status"] = 0) Then status = 0 EndIf EndFor ElseIf (type = 3 Or type = 6) Then 'Or Output status = 0 For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp2 = comp And Components[comp1]["Status"] = 1) Then status = 1 EndIf EndFor ElseIf (type = 4) Then 'XOR on = 0 off = 0 For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp2 = comp) Then If (Components[comp1]["Status"] = 1) Then on = 1 EndIf If (Components[comp1]["Status"] = 0) Then off = 1 EndIf EndIf EndFor If (on + off = 2) Then status = 1 Else status = 0 EndIf ElseIf (type = 5) Then 'Not For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp2 = comp) Then status = 1-Components[comp1]["Status"] EndIf EndFor EndIf Components[comp]["Status"] = status Completed[comp] = 1 nCompleted = nCompleted+1 'Downstream connectors status For i = 1 To Array.GetItemCount(Connect) comp1 = Connections[Connect[i]][1] comp2 = Connections[Connect[i]][2] If (comp1 = comp) Then Connections[Connect[i]]["Status"] = status EndIf EndFor EndWhile EndSub '**************************************************************************** 'Load and Save '**************************************************************************** Sub LoadSave If (LDown = 1) Then Load() EndIf If (SDown = 1) Then Save() EndIf If (CDown = 1) Then Clear() EndIf EndSub Sub Save ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\boots.txt",1,Components) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\boots.txt",2,Connections) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\boots.txt",3,nComp) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\boots.txt",4,nConnect) EndSub Sub Load CompList = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(CompList) Shapes.Remove(Components[CompList[i]]["S"]) EndFor ' The following line could be harmful and has been automatically commented. ' Components = File.ReadLine(Program.Directory+"\boots.txt",1) ' The following line could be harmful and has been automatically commented. ' Connections = File.ReadLine(Program.Directory+"\boots.txt",2) ' The following line could be harmful and has been automatically commented. ' nComp = File.ReadLine(Program.Directory+"\boots.txt",3) ' The following line could be harmful and has been automatically commented. ' nConnect = File.ReadLine(Program.Directory+"\boots.txt",4) For i = 1 To Array.GetItemCount(Components) GraphicsWindow.BrushColor = color[Components[i]["Type"]] Components[i]["S"] = Shapes.AddEllipse(diameter,diameter) EndFor Moving = 1 EndSub Sub Clear CompList = Array.GetAllIndices(Components) For i = 1 To Array.GetItemCount(CompList) Shapes.Remove(Components[CompList[i]]["S"]) EndFor Components = "" Connections = "" nComp = 0 nConnect = 0 Moving = 1 EndSub End>BNW650.sb< Start>BNZ691.sb< GraphicsWindow.Width = 700 GraphicsWindow.Height = 280 GraphicsWindow.Title = "Motion Detection" movement = Controls.AddTextBox(360,260) sensitivity = 10 img1 = "" img2 = "" webcam = LDWebCam.Start(320,240) Shapes.Move(webcam,20,20) Timer.Interval = 1000 Timer.Tick = OnTick Sub OnTick img1 = LDWebCam.SnapshotToImageList() If (img1 <> "" And img2 <> "") Then img = LDImage.DifferenceImages(img1,img2) GraphicsWindow.DrawResizedImage(img,360,20,320,240) mean = LDImage.Mean(img) total = Math.Floor(mean["Red"]+mean["Green"]+mean["Blue"]) Controls.SetTextBoxText(movement,total) If (total > sensitivity) Then LDImage.Save(img1,Program.Directory+"\movement.jpg") Sound.PlayClickAndWait() EndIf EndIf LDImage.Remove(img2) img2 = img1 LDImage.Remove(img) EndSub End>BNZ691.sb< Start>BPB749.sb< 'Implementing the recursive method for Factorial and Fibonacci ' 'Iterate is Human, Recursion is Divine ' 'This example helps to understand recursion and management 'of parameters and return a result in the calling of functions 'and in general the working mechanism of the memory heap ' 'In General 'Every time we have to call a function which can overwrite our 'local variable, we have to push them into a stack. If the function 'needs parameters, after the local variable, we push into the stack 'the parameters. After a function call, we have to remove all the 'element from the Stack. If the function return a value we need a 'pop to get that value, and then a pop for each local variable we saved. 'In the called function we have to pop the parameters and finally 'push the resulting value. ' 'In this example n is a local variabile into Main(), Fact() and Fib() 'subroutines but I never lost the local value. In addition the subroutine 'Fact() and Fib() accept a parameter and it returns a value ' 'One final note ... I hate "Goto"... I love the structured programming... Small Basic is very cute 'Main - User Interface Sub Main 'Main Program n = 1 'An initial value for n sel = 1 'An initial value for sel While(sel<>0) TextWindow.WriteLine("0) Exit") 'A menu TextWindow.WriteLine("1) Factorial") TextWindow.WriteLine("2) Fobonacci") TextWindow.Write("Make your choice: ") sel=TextWindow.ReadNumber() 'What would you like to do? If(sel>0 And sel<3)Then 'When I have a good choice TextWindow.Write("Insert a number: ") n=TextWindow.ReadNumber() 'Which number? EndIf Stack.PushValue("Heap",n) 'Save local variable n Stack.PushValue("Heap",n) 'Set the paramenter for the Fact() or Fib() function If(sel=1)Then 'Calculating factorial Fact() ElseIf(sel=2)Then 'Calculating Fibonacci Fib() 'Even if no function will be executed, push e pop are right EndIf 'and the Stack will be cleared! ret = Stack.PopValue("Heap")'Get the returned value n = Stack.PopValue("Heap")'Restore local variable TextWindow.WriteLine("") If(sel=0)Then TextWindow.WriteLine("Exiting...") ElseIf(sel=1)Then 'Factorial result TextWindow.WriteLine(n + "! = " + ret) ElseIf(sel=2)Then 'Fibonacci result TextWindow.WriteLine("Fib(" + n + ")=" + ret) Else 'Wrong Choice TextWindow.WriteLine("Wrong choice!") EndIf TextWindow.WriteLine("") TextWindow.WriteLine("") EndWhile EndSub 'Fact - Factorial calculating Sub Fact n=Stack.PopValue("Heap") 'Get Parameter If(n<0)Then 'The Parameter must be positive TextWindow.WriteLine("There is an error, the number is negative!") Stack.PushValue("Heap",0) ElseIf(n=0)Then 'n! where n=0 is 1 Stack.PushValue("Heap",1) 'Set the return value to 1 Else Stack.PushValue("Heap",n) 'Save Local Variable Stack.PushValue("Heap",n-1) 'Set Parameter for new Fact() call Fact() 'Recursion for (n-1)! 'Set return value with n * (n-1)! Stack.PushValue("Heap",Stack.PopValue("Heap")*Stack.PopValue("Heap")) EndIf EndSub 'Fib - Fibonacci calculating Sub Fib n = Stack.PopValue("Heap") 'Get parameter If(n=0)Then Stack.PushValue("Heap",0) 'Return value for n=0 ElseIf(n=1)Then Stack.PushValue("Heap",1) 'Return value for n=1 Else Stack.PushValue("Heap",n) 'Save local variable n Stack.PushValue("Heap",n-1)'Set Parameter for Fib() Fib() 'Recursion... WOW! Get Fib(n-1) ret=Stack.PopValue("Heap") 'Get Result n=Stack.PopValue("Heap") 'Restore local variable n Stack.PushValue("Heap",ret)'Save local Variable Ret, n is no more necessary Stack.PushValue("Heap",n-2)'Set Parameter for Fib() Fib() 'Recursion...I'm so glad. Get Fib(n-2) 'Return value Fib(n-1)+Fib(n-2) Stack.PushValue("Heap",Stack.PopValue("Heap")+Stack.PopValue("Heap")) EndIf EndSub Main() 'Call to Main, the entry point program End>BPB749.sb< Start>BPC513.sb< ScreenInit() ColourInit() ca = 3 cp = 0 tp = 600 A[an] = "Start" While A[an] <> B[101] Init() NewColour() ShowColour() Wait4Answer() ShowResult() EndWhile Program.End() Sub ScreenInit Controls.ButtonClicked = OnButtonClicked GraphicsWindow.Top = 0 GraphicsWindow.Left = 0 GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 GraphicsWindow.Title = "Please click the colour in the the correct order!" GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.PenColor = "Black" GraphicsWindow.BackgroundColor = "Moccasin" GraphicsWindow.FontBold = "True" GraphicsWindow.FontName = "Arial" GraphicsWindow.FontSize = 12 EndSub 'ScreenInit Sub ColourInit C[1] = "Red" C[2] = "Orange" C[3] = "Yellow" C[4] = "Green" C[5] = "Violet" C[6] = "Blue" C[7] = "White" C[8] = "Gray" C[9] = "Black" EndSub 'ColourInit Sub Init cp = cp + 1 If Math.Remainder(cp, 3) = 0 Then tp = tp - 10 If tp < 300 then tp = 300 EndIf ca = ca + 1 EndIf For i = 1 to 9 p = (i * 60) - 60 B[i] = Controls.AddButton(C[i], p,500) Controls.HideControl(B[i]) EndFor B[100] = Controls.AddButton(" CONTINUE ", 200,500) Controls.HideControl(B[100]) B[101] = Controls.AddButton(" E N D ", 300,500) Controls.HideControl(B[101]) EndSub 'Init Sub NewColour For i = 1 to ca RC[i] = Math.GetRandomNumber(9) Controls.ShowControl(B[RC[i]]) EndFor EndSub 'NewColour Sub ShowColour For i = 1 to ca GraphicsWindow.BrushColor = C[RC[i]] ShowIt() Program.Delay(tp) GraphicsWindow.BrushColor = "Moccasin" GraphicsWindow.FillRectangle(0,0,600,500) Program.Delay(tp) EndFor GraphicsWindow.BrushColor = "SteelBlue" EndSub 'ShowColour Sub ShowIt g = Math.GetRandomNumber(5) If g = 1 Then x1 = Math.GetRandomNumber(100) y1 = Math.GetRandomNumber(100) x2 = Math.GetRandomNumber(100) + 100 y2 = X2 GraphicsWindow.FillRectangle(x1,y1,x2,y2) ElseIf g = 2 Then x1 = Math.GetRandomNumber(100) y1 = Math.GetRandomNumber(100) x2 = Math.GetRandomNumber(100) + 100 y2 = Math.GetRandomNumber(100) + 100 GraphicsWindow.FillRectangle(x1,y1,x2,y2) ElseIf g = 3 Then x1 = Math.GetRandomNumber(100) y1 = Math.GetRandomNumber(100) x2 = Math.GetRandomNumber(100) + 100 y2 = x2 GraphicsWindow.FillEllipse(x1,y1,x2,y2) ElseIf g = 4 Then x1 = Math.GetRandomNumber(100) y1 = Math.GetRandomNumber(100) x2 = Math.GetRandomNumber(100) + 100 y2 = Math.GetRandomNumber(100) + 100 GraphicsWindow.FillEllipse(x1,y1,x2,y2) Else x1 = Math.GetRandomNumber(100) y1 = Math.GetRandomNumber(100) x2 = Math.GetRandomNumber(100) + 100 y2 = Math.GetRandomNumber(100) + 100 x3 = Math.GetRandomNumber(100) + 200 y3 = Math.GetRandomNumber(100) + 200 GraphicsWindow.FillTriangle(x1,y1,x2,y2,x3,y3) EndIf EndSub 'ShowIt Sub Wait4Answer an = 0 While an < ca EndWhile EndSub 'Wait4Answer Sub ShowResult For i = 1 to ca Zeig = i Zeig = Text.Append(Zeig, ". ") Zeig = Text.Append(Zeig, C[RC[i]]) Controls.HideControl(B[RC[i]]) If B[RC[i]] = A[i] Then Zeig = Text.Append(Zeig, " correct ") Else Zeig = Text.Append(Zeig, " incorrect ") EndIf p = i * 24 GraphicsWindow.DrawText(1, p, Zeig) EndFor Controls.ShowControl(B[100]) Controls.ShowControl(B[101]) an = 0 While an = 0 EndWhile If A[an] = B[101] Then Program.End() EndIf Controls.HideControl (B[100]) Controls.HideControl (B[101]) GraphicsWindow.BrushColor = "Moccasin" GraphicsWindow.FillRectangle(0,0,600,500) GraphicsWindow.BrushColor = "SteelBlue" EndSub 'ShowResult Sub OnButtonClicked an = an + 1 A[an] = Controls.LastClickedButton EndSub 'OnButtonClicked End>BPC513.sb< Start>BPF583.sb< GraphicsWindow.BrushColor="teal GraphicsWindow.Title="Trainspotting2... GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Width=1200 GraphicsWindow.Height =700 GraphicsWindow.MouseMove=mww For x=0 To 7 w[x]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[x] x) t=x+34 w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[t] 350+x*45 420) t=24-x w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[x] 350+x*45 400) Shapes.Move (w[t] 350+x*45 35) EndFor For x=0 to 40 nx[x]=x+1 endfor nx[41]=8 'nx[33]=0 pl=Shapes.AddRectangle (45 10) Shapes.Move (pl 350 320) LDShapes.SetShapeEvent (pl) LDDialogs.ToolTip (pl "Closed") LDShapes.RotateAbout (pl 350 320, 45) p350=650 pl1=Shapes.AddRectangle (45 10) Shapes.Move (pl1 p350 320) LDShapes.SetShapeEvent (pl1) LDDialogs.ToolTip (pl1 "Closed") LDShapes.BrushColour (pl1 "Red") 'LDShapes.RotateAbout (pl1 350 320, 45) cl=1 LDShapes.ShapeEvent=see f10=15 f90=90 For x=2 To 10 t=18-x w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[18-x] 620+LDMath.Cos(x*f10-f90)*195 LDMath.sin(x*f10-f90)*195+220 ) Shapes .Rotate (w[18-x] x*f10) EndFor For x=2 To 10 t=35-x w[t]=Shapes.AddRectangle (35 15) LDDialogs.ToolTip (w[t] t) Shapes.Move (w[t] 400+LDMath.Cos(x*f10+f90)*195 LDMath.sin(x*f10+f90)*195+220 ) Shapes .Rotate (w[t] x*f10) EndFor x=0 For y=1 to 3 cp[y]= y-1 cp1[y]= y+35 endfor ac="true ac1="true While "true"' ========================loop---------------------- If ac then For y=1 to 3 cp[y]= nx[cp[y]] t= cp[y] LDShapes.BrushColour (w[t] "red") EndFor If cp[3]=41 and cl=1 then ac="false endif endif If ac1 then For y=1 to 3 cp1[y]= nx[cp1[y]] t= cp1[y] LDShapes.BrushColour (w[t] "cyan") EndFor If cp1[3]=41 and cl=1 then ac1="false endif endif If ac or ac1 Then Program.Delay (250) if ac then tdel() EndIf if ac1 then tdel1() EndIf endif endwhile'================================================**** Sub tdel For y=1 to 3 t=cp[y] LDShapes.BrushColour (w[t] "teal") EndFor EndSub Sub tdel1 For y=1 to 3 t=cp1[y] LDShapes.BrushColour (w[t] "teal") EndFor EndSub Sub see If LDShapes.LastEventType="MouseDown" then If LDShapes.LastEventShape=pl then sw=1-sw If sw=1 then LDDialogs.ToolTip (pl "Open") LDShapes.RotateAbout (pl 350 320, 45) nx[33]=34 Else LDDialogs.ToolTip (pl "Closed") LDShapes.RotateAbout (pl 350 320, 0) nx[33]=0 EndIf ElseIf LDShapes.LastEventShape=pl1 then cl=1-cl If cl=0 then LDDialogs.ToolTip (pl1 "Open") LDShapes.RotateAbout (pl1 p350 320, -45) LDShapes.BrushColour (pl1 "Lime") ac="true tdel() ac1="true tdel1() Else LDDialogs.ToolTip (pl1 "Closed") LDShapes.RotateAbout (pl1 p350 320, 0) LDShapes.BrushColour (pl1 "Red") EndIf endif endif EndSub Sub mww ' GraphicsWindow.Title=GraphicsWindow.MouseX +" : "+GraphicsWindow.MouseY EndSub End>BPF583.sb< Start>BPG098.sb< 'Traffic light T = "True" F = "False" Init() Timer.Interval = 100 Timer.Tick = OnTimer Controls.ButtonClicked = OnButtonClicked Main() Program.End() Sub Main While EndOfProgram = F If BC = T Then BC = F EndOfProgram = T EndIf EndWhile EndSub Sub Init EndOfProgram = F Flag = 0 GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "Darkgray" EWH = 100 x1 = 50 x2 = GraphicsWindow.Width - (EWH + 50) y1 = 50 y2 = 160 y3 = 270 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(x1-10, y1-10, EWH + 20, y3 + 70) GraphicsWindow.BrushColor = "Red" SRed1 = Shapes.AddEllipse(EWH,EWH) Shapes.Move(SRed1, x1, y1) GraphicsWindow.BrushColor = "Yellow" SYel1 = Shapes.AddEllipse(EWH,EWH) Shapes.Move(SYel1, x1, y2) GraphicsWindow.BrushColor = "Green" SGre1 = Shapes.AddEllipse(EWH,EWH) Shapes.Move(SGre1, x1, y3) GraphicsWindow.BrushColor = "LigtGray" SGraRed1 = Shapes.AddEllipse(EWH,EWH) Shapes.SetOpacity(SGraRed1,70) SGraYel1 = Shapes.AddEllipse(EWH,EWH) Shapes.SetOpacity(SGraYel1,80) SGraGre1 = Shapes.AddEllipse(EWH,EWH) Shapes.SetOpacity(SGraGre1,70) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "Red" SRed2 = Shapes.AddRectangle(10,EWH) Shapes.Move(SRed2, x2+EWH-11, y1) GraphicsWindow.BrushColor = "Yellow" SYel2 = Shapes.AddRectangle(10,EWH) Shapes.Move(SYel2, x2+EWH-11, y2) GraphicsWindow.BrushColor = "Green" SGre2 = Shapes.AddRectangle(10,EWH) Shapes.Move(SGre2, x2+EWH-11, y3) GraphicsWindow.BrushColor = "Black" SGraRed2 = Shapes.AddRectangle(10,EWH) Shapes.SetOpacity(SGraRed2,70) SGraYel2 = Shapes.AddRectangle(10,EWH) Shapes.SetOpacity(SGraYel2,70) SGraGre2 = Shapes.AddRectangle(10,EWH) Shapes.SetOpacity(SGraGre2,60) Shapes.Move(SGraRed1, x1, y1) Shapes.Move(SGraYel1, x1, y2) Shapes.Move(SGraGre1, x1, y3) Shapes.Move(SGraRed2, x2+EWH-11, y1) Shapes.Move(SGraYel2, x2+EWH-11, y2) Shapes.Move(SGraGre2, x2+EWH-11, y3) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(x2-10, y1-10, EWH, y3 + 70) GraphicsWindow.FontSize = 24 Controls.AddButton(" E N D ", GraphicsWindow.Width / 2 - 50, GraphicsWindow.Height - 60) EndSub Sub OnTimer If Flag = 0 Then Timer.Interval = 5000 Shapes.HideShape(SGraRed1) Shapes.ShowShape(SGraYel1) Shapes.HideShape(SGraGre2) Shapes.ShowShape(SGraYel2) Shapes.ShowShape(SGraRed2) Flag = 1 ElseIf Flag = 1 Then Timer.Interval = 2000 Shapes.HideShape(SGraYel1) Shapes.ShowShape(SGraGre2) Shapes.HideShape(SGraYel2) Flag = 2 ElseIf Flag = 2 Then Timer.Interval = 10000 Shapes.ShowShape(SGraRed1) Shapes.ShowShape(SGraYel1) Shapes.HideShape(SGraGre1) Shapes.HideShape(SGraRed2) Shapes.ShowShape(SGraYel2) Flag = 3 ElseIf Flag = 3 Then Timer.Interval = 2000 Shapes.ShowShape(SGraGre1) Shapes.HideShape(SGraYel1) Shapes.HideShape(SGraYel2) Flag = 0 EndIf EndSub Sub OnButtonClicked BC = T EndSub End>BPG098.sb< Start>BPJ264.sb< GraphicsWindow.Top = 1 GraphicsWindow.Title = "Drawing GraphicsWindow.Width = 600 GraphicsWindow.Height = 650 GraphicsWindow.BackgroundColor = "midnightblue Turtle.Speed = 10 Turtle.Show() Turtle.X = 350 Turtle.Y = 300 GraphicsWindow.BrushColor = "white" study = "Study Room" GraphicsWindow.FontSize = 50 studyshape = Shapes.AddText(study) Shapes.Move(studyshape,50,30) 'light GraphicsWindow.PenColor = "yellow" Turtle.Move(20) Turtle.TurnRight() Turtle.Move(20) Turtle.TurnRight() Turtle.Move(20) Turtle.TurnRight() Turtle.Move(60) Turtle.Angle = 200 Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(114) Turtle.Angle = 340 Turtle.Move(20) Turtle.Angle = 270 Turtle.Move(40) Turtle.PenUp() Turtle.Angle = 45 Turtle.PenDown() Turtle.Move(60) Turtle.Angle = 140 Turtle.Move(100) Turtle.Angle = 200 Turtle.Move(100) Turtle.Angle = 270 Turtle.Move(20) Turtle.Angle = 20 Turtle.Move(100) Turtle.Angle = 320 Turtle.Move(75) Turtle.Angle = 225 Turtle.Move(34) Turtle.PenUp() Turtle.Angle = 180 Turtle.Move(127) Turtle.Angle = 90 Turtle.Move(59) Turtle.PenDown() Turtle.Move(30) Turtle.Angle = 160 Turtle.Move(20) Turtle.Angle = 270 Turtle.Move(90) Turtle.Angle =20 Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(30) 'start of the desk GraphicsWindow.PenColor = "brown" Turtle.PenUp() Turtle.Angle = 0 Turtle.Move(10) Turtle.Angle = 90 Turtle.Move(20) Turtle.PenDown() Turtle.Move(50) Turtle.Angle = 130 Turtle.Move(120) Turtle.Angle = 270 Turtle.Move(300) Turtle.Angle = 50 Turtle.Move(120) Turtle.Angle = 90 Turtle.Move(45) Turtle.PenUp() Turtle.Angle = 180 Turtle.Move(78) Turtle.Angle = 270 Turtle.Move(136) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(10) Turtle.Angle = 90 Turtle.Move(300) Turtle.Angle = 0 Turtle.Move(10) Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(300) Turtle.Angle = 180 Turtle.Move(10) Turtle.PenDown() Turtle.Move(100) 'leg of desk(Left) Turtle.Angle = 90 Turtle.Move(10) Turtle.Angle = 0 Turtle.Move(100) Turtle.PenUp() Turtle.Angle = 90 Turtle.Move(5) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(90) Turtle.Angle = 200 Turtle.Move(12) Turtle.PenUp() Turtle.Angle = 0 Turtle.Move(102) Turtle.Angle = 90 Turtle.Move(289) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(100) 'lef of the desk(right) Turtle.Angle = 270 Turtle.Move(10) Turtle.Angle = 0 Turtle.Move(100) Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(5) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(90) Turtle.Angle = 160 Turtle.Move(10) Turtle.Angle = 0 GraphicsWindow.PenColor = "purple" Turtle.X = 450 'starting clock Turtle.Y = 150 GraphicsWindow.DrawEllipse(400,100,100,100) GraphicsWindow.PenColor = "white" Turtle.Move(40) Turtle.Angle = 180 Turtle.Move(40) Turtle.Angle = 270 Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(20) 'end clock GraphicsWindow.PenColor = "aqua" Turtle.X = 260 'location of window Turtle.Y = 150 Turtle.Angle = 270 Turtle.PenDown() Turtle.Move(150) Turtle.Angle = 180 Turtle.Move(300) Turtle.Angle = 90 Turtle.Move(150) Turtle.Angle = 0 Turtle.Move(300) Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(150) Turtle.PenDown() GraphicsWindow.PenColor = "blue" Turtle.Angle = 340 'left hinge Turtle.Move(50) Turtle.Angle = 180 Turtle.Move(396) Turtle.Angle = 20 Turtle.Move(54) 'end left hindge Turtle.Angle = 90 Turtle.PenUp() Turtle.Move(149) Turtle.Angle = 160 Turtle.PenDown() Turtle.Move(50) 'right hindge Turtle.Angle = 0 Turtle.Move(396) Turtle.Angle = 200 Turtle.Move(54) 'end right hindge GraphicsWindow.PenColor = "black" Turtle.PenUp() 'edge of wimdow Turtle.Angle = 180 Turtle.Move(300) Turtle.Angle = 270 Turtle.Move(90) Turtle.PenDown() GraphicsWindow.PenColor = "brown" Turtle.Angle = 350 'pot start Turtle.Move(50) Turtle.Angle = 90 Turtle.Move(60) Turtle.Angle = 190 Turtle.Move(50) 'pot end Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(22) Turtle.Angle = 0 Turtle.Move(49) Turtle.PenDown() GraphicsWindow.PenColor = "green" Turtle.Move(50) 'start flower Turtle.Angle = 270 GraphicsWindow.PenColor = "red" Turtle.Move(15) Turtle.Angle = 0 Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(30) Turtle.Angle = 180 Turtle.Move(20) Turtle.Angle = 270 Turtle.Move(15) 'end flower and start going to base board Turtle.X = 0 Turtle.Y = 505 Turtle.Angle = 90 Turtle.Move(288) Turtle.PenUp() Turtle.Move(304) Turtle.PenDown() Turtle.Move(10) 'finished base board 'streaks of light Turtle.X = 140 Turtle.Y = 180 Turtle.Angle = 125 GraphicsWindow.PenColor = "orange" Turtle.Move(120) Turtle.X = 180 Turtle.Y = 180 Turtle.Move(70) Turtle.X = 220 Turtle.Y = 180 Turtle.Move(20) Turtle.X = 140 Turtle.Y = 210 Turtle.Move(120) Turtle.X = 140 Turtle.Y = 240 Turtle.Move(120) Turtle.X = 140 Turtle.Y = 270 Turtle.Move(120) Turtle.X = 140 Turtle.Y = 270 Turtle.Move(120) Turtle.X = 140 'intersect the peddles Turtle.Y = 300 Turtle.Move(45) Turtle.PenUp() Turtle.Move(45) Turtle.PenDown() Turtle.Move(30) 'end intersect peddle Turtle.X = 140 'intersect the stem Turtle.Y = 335 Turtle.Move(50) Turtle.PenUp() Turtle.Move(25) Turtle.PenDown() Turtle.Move(45) 'end intersect stem Turtle.X = 140 'intersect the stem Turtle.Y = 370 Turtle.Move(45) Turtle.PenUp() Turtle.Move(55) Turtle.PenDown() Turtle.Move(20) 'second stem end Turtle.X = 140 'intersect the stem Turtle.Y = 400 Turtle.Move(10) 'end third Turtle.X = 140 'intersect the stem Turtle.Y = 430 Turtle.Move(10) 'end fourth Turtle.X = 305 'start lamp glare Turtle.Y = 320 Turtle.Angle = 200 Turtle.Move(60) Turtle.X = 415 'start lamp glare Turtle.Y = 320 Turtle.Angle = 160 Turtle.Move(60) Turtle.Hide() '------===========Making the girl==================== Program.Delay(2000) GraphicsWindow.Clear() Turtle.Speed = 10 GraphicsWindow.BackgroundColor = "lightblue" GraphicsWindow.BrushColor = "black" test = "I took the test..." GraphicsWindow.FontSize = 20 testshape = Shapes.AddText(test) Shapes.Move(testshape,240,400) LDShapes.ResetTurtle () Turtle.Speed = 10 Turtle.X = 300 Turtle.Y = 200 Turtle.Angle = 270 Turtle.Move(10) Turtle.Angle = 180 Turtle.Move(10) Turtle.Angle = 90 Turtle.Move(10) Turtle.Angle = 120 Turtle.Move(25) Turtle.Angle = 60 Turtle.Move(25) Turtle.Angle = 90 Turtle.Move(10) Turtle.Angle = 0 Turtle.Move(10) Turtle.Angle = 270 Turtle.Move (10) GraphicsWindow.PenColor = "brown" Turtle.Angle = 270 Turtle.Move(44) Turtle.PenUp() Turtle.Angle = 180 Turtle.Move(10) Turtle.PenDown() Turtle.Move(20) Turtle.Angle = 280 Turtle.Move(20) Turtle.Angle = 0 Turtle.Move(40) Turtle.Angle = 70 Turtle.Move(45) Turtle.Angle = 110 Turtle.Move(45) Turtle.Angle = 180 Turtle.Move(40) Turtle.Angle = 260 Turtle.Move(20) Turtle.Angle = 0 Turtle.Move(20) Turtle.PenUp() Turtle.Angle = 0 Turtle.Move(2) Turtle.Angle = 270 Turtle.Move(10) Turtle.PenDown() GraphicsWindow.PenColor = "black" Turtle.Move(7) Turtle.PenUp() Turtle.Move(10) Turtle.PenDown() Turtle.Move(7) Turtle.PenUp() Turtle.Angle = 180 Turtle.Move(10) Turtle.PenDown() GraphicsWindow.PenColor = "aqua" Turtle.Angle = 190 Turtle.Move(100) Turtle.Angle = 90 Turtle.Move(57) Turtle.Angle = 350 Turtle.Move(100) Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(20) Turtle.Angle = 180 Turtle.Move(100) Turtle.PenDown() GraphicsWindow.PenColor = "black" Turtle.Move(20) Turtle.Angle = 270 Turtle.Move(10) Turtle.PenUp() Turtle.Angle = 90 Turtle.Move(10) Turtle.Angle = 0 turtle.move(20) Turtle.Angle = 90 Turtle.Move(20) Turtle.Angle = 180 Turtle.PenDown() Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(10) Turtle.PenUp() Turtle.Angle = 0 Turtle.Move(78) Turtle.Angle = 30 Turtle.PenDown() Turtle.Move(20) 'hand right Turtle.Angle = 210 Turtle.Move(20) Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(40) Turtle.PenDown() Turtle.Move(20) 'hand left Turtle.Angle = 180 'paper square Turtle.Move(40) Turtle.Angle = 270 Turtle.Move(30) 'a Turtle.Angle = 0 Turtle.Move(60) Turtle.Angle = 90 Turtle.Move(30) 'a Turtle.Angle = 180 Turtle.Move(40) 'paper square finished solve = "Write a short essay on how the president took over the white house." GraphicsWindow.FontSize = 15 solveshape = Shapes.AddText(solve) Shapes.Move(solveshape,50,90) '======================== Program.Delay(2000) GraphicsWindow.Clear() LDShapes.ResetTurtle () Turtle.Speed = 10 GraphicsWindow.BackgroundColor = "white" GraphicsWindow.PenColor = "blue" Turtle.X = 0 '2nd line Turtle.Y = 80 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '3rd line Turtle.Y = 120 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '4th line Turtle.Y = 160 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '5th line Turtle.Y = 200 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '6th line Turtle.Y = 240 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '7th line Turtle.Y = 280 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '8th line Turtle.Y = 320 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '9th line Turtle.Y = 360 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '10th line Turtle.Y = 400 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '11th line Turtle.Y = 440 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '12th line Turtle.Y = 480 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '13th line Turtle.Y = 520 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '14th line Turtle.Y = 560 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '15th line Turtle.Y = 600 Turtle.Angle = 90 Turtle.Move(600) Turtle.X = 0 '16th line Turtle.Y = 640 Turtle.Angle = 90 Turtle.Move(600) '------------------fnished the line blue paper Turtle.X = 100 Turtle.Y = 0 GraphicsWindow.PenColor = "red" Turtle.Angle = 180 Turtle.Move(650) GraphicsWindow.PenColor = "gray" GraphicsWindow.BrushColor = "black" GraphicsWindow.FillEllipse(25,122,35,35) GraphicsWindow.PenColor = "gray" 'second circle GraphicsWindow.BrushColor = "black" GraphicsWindow.FillEllipse(25,522,35,35) '----------------------------------------------------finished circles start comments name = "Anonymous" GraphicsWindow.FontSize = 20 nameshape = Shapes.AddText(name) Shapes.Move(nameshape,470,10) date = "Da/te/2013" GraphicsWindow.FontSize = 20 dateshape = Shapes.AddText(date) Shapes.Move(dateshape,470,30) period = "Subject Name" GraphicsWindow.FontSize = 20 periodshape = Shapes.AddText(period) Shapes.Move(periodshape,450,50) GraphicsWindow.BrushColor = "red" Score = "A+" GraphicsWindow.FontSize = 100 scoreshape = Shapes.AddText(Score) Shapes.Move(Scoreshape,400,100) Turtle.Y = 110 Turtle.X = 110 Turtle.Angle = 45 For x=1 To 10 Turtle.Move(20) Turtle.TurnRight() Turtle.Move(20) Turtle.TurnLeft() EndFor '--------------finished turtle writing GraphicsWindow.BrushColor = "black" pledge = "I pledge the honor code. -Signature" GraphicsWindow.FontSize = 20 pledgeshape = Shapes.AddText(pledge) Shapes.Move(pledgeshape,110,620) '============================================== Program.Delay(2000) GraphicsWindow.Clear() LDShapes.ResetTurtle () computer = "Check NetClassRoom..." GraphicsWindow.FontSize = 20 computershape = Shapes.AddText(computer) Shapes.Move(computershape,220,450) GraphicsWindow.PenColor = "black Turtle.X = 230 Turtle.Y = 150 Turtle.Angle = 90 'screen Turtle.Move(200) Turtle.Angle = 180 Turtle.Move(200) Turtle.Angle = 270 Turtle.Move(200) Turtle.Angle = 0 Turtle.Move(200) Turtle.X = 220 'screen frame Turtle.Y = 140 Turtle.Angle = 90 Turtle.Move(220) Turtle.Angle = 180 Turtle.Move(220) Turtle.Angle = 270 Turtle.Move(220) Turtle.Angle = 0 Turtle.Move(220) Turtle.X = 280 'leg base Turtle.Y = 360 Turtle.Angle = 180 Turtle.Move(30) 'same (A) Turtle.Angle = 90 Turtle.Move(100) 'change according to screen and stand (B) Turtle.Angle = 0 Turtle.Move(30) 'same (A) Turtle.PenUp() Turtle.Angle = 270 Turtle.Move(100) 'change according to screen (B) Turtle.Angle = 180 Turtle.Move(15) Turtle.PenDown() Turtle.Angle = 270 Turtle.Move(30) 'starting base Turtle.Angle = 220 Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(187) Turtle.Angle = 320 Turtle.Move(20) Turtle.Angle = 270 Turtle.Move(30) Turtle.X = 238 'cube Turtle.Y = 390 Turtle.Angle = 180 Turtle.Move(20) Turtle.Angle = 90 Turtle.Move(187) Turtle.Angle = 0 Turtle.Move(20) Turtle.X = 230 Turtle.Y = 250 GraphicsWindow.PenColor = "green" GraphicsWindow.PenWidth = 198 Turtle.Angle = 90 Turtle.Move(200) Turtle.X = 230 Turtle.Y = 250 GraphicsWindow.PenColor = "green" 'screen GraphicsWindow.PenWidth = 198 Turtle.Angle = 90 Turtle.Move(200) End>BPJ264.sb< Start>BPN353.sb< initialise() k=Math.GetRandomNumber(600) f=Math.GetRandomNumber(600) start: game() meteor() wrongway() die() Goto start Sub initialise back=ImageList.LoadImage("http://lparchive.org/Gazillionaire-Deluxe/Update%2048/26-SPACE.png") GraphicsWindow.DrawImage(back,0,0) rocket=ImageList.LoadImage("http://icons.iconarchive.com/icons/iconfactory/space/32/Rocket-ship-icon.png") mete=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_32x32_006.png") mete1=ImageList.LoadImage("http://media.indiedb.com/cache/images/games/1/26/25272/thumb_300x150/Asteroids_64x64_006.png") rock=Shapes.AddImage(rocket) x=295 y=375 g=-75 l=-75 met1=Shapes.AddImage(mete1) met=Shapes.AddImage(mete) GraphicsWindow.KeyDown=keydown EndSub Sub game Shapes.Move(rock,x,y) EndSub Sub keydown last=GraphicsWindow.LastKey If last="Left" Then x=x-5 EndIf If last="Right" Then x=x+5 EndIf EndSub Sub wrongway If x=-10 Then x=x+5 EndIf If x=605 Then x=x-5 EndIf EndSub Sub meteor Shapes.Move(met1,k,l) Shapes.Animate(met1,k,l,10) l=l+2 Shapes.Move(met,f,g) Shapes.Animate(met,f,g,10) g=g+2 Program.Delay(10) EndSub Sub die rktop=Shapes.GetTop(rock) mettop=Shapes.GetTop(met) met1top=Shapes.GetTop(met1) rkleft=Shapes.GetLeft(rock) metleft=Shapes.GetLeft(met) met1left=Shapes.GetLeft(met1) If rktop=mettop+32 And rkleft>=metleft And rkleft<=metleft+32 Then Shapes.Remove(rock) EndIf If rktop=met1top+64 And rkleft>=met1left And rkleft<=met1left+64 Then Shapes.Remove(rock) EndIf EndSub End>BPN353.sb< Start>BPN924.sb< _nln=Text.GetCharacter(13)+Text.GetCharacter(10) dbg="False" _hexx="123456789ABCDEF LDDialogs.Wait("Turtle commander V1.1"+_nln +"(p)2015 by SB community","Green") Program.Delay(1500) LDDialogs.EndWait () dmt="0=Add/Chng...;1=Diamond;2=MultiDiamnds;3=Lace;4=Spyrall;5=Star5;6=HyperLoop;7=HypFlwrGrid;8=Flwr5;9=Flwr4;10=Clock dmm=11 vcnt=0 scnt=0 smd=0 rec=0 deff[1]="{10!S 0!R 108!{5 !R 72!F 80!}!## deff[2]="{5!S 0!{10!R 108!{5 !R 72!F 80!}!}!//!R 144!U!F 210!D!## deff[3]="{25!S 0!F 30!{3 !R 95!F 140!}!## deff[4]="{95!S 1.025!R 91.5!F 40!## deff[5]="{5!R 144!F 140!## deff[6]="{1!L 40!{55 !S 1.025!R 91.5!F 40!}!//!$!R 90!{55 !R 91.5!F 40!S/1.025!}!//!&!L 90!{55 !R 91.5!F 40!S/1.025!}!//!&!R 90!{55 !L 91.5!F 40!S/1.025!}!## deff[7]="{1!L 40!{55 !S 1.025!R 91.5!F 40!}!//!$!R 90!{55 !R 91.5!F 40!S/1.025!}!//!&!L 90!{55 !R 91.5!F 40!S/1.025!}!//!&!R 90!{55 !L 91.5!F 40!S/1.025!}!//!&!{55 !L 91.5!F 40!S/1.025!}!//!&!{55 !R 91.5!F 40!S/1.025!}!//!&!R 180!{55 !R 91.5!F 40!S/1.025!}!//!&!R 180!{55 !L 91.5!F 40!S/1.025!}!## deff[8]="{5!|X1=5!|C2=15!{15 !F %2!R |X1!|X1+1.93!}!## deff[9]="{4!|X1=5!|C2=15!{15 !F %2!R |X1!|X1+1.76!}!## deff[10]="{1!D!R 130!{72 !F 11!R 5!}!|V2=1!U!R 140!F 33!L 136!{12 !WRT %1!F 55!R 30!|V2+1!}!R 72!F 20!D!F 100!R 45!F 60!## _TFL="0=False;1=True;2=True" stpp=0 Init() LDDialogs.AddRightClickMenu(dmt,"") LDDialogs.RightClickMenu=rmm return=0 args=0 GraphicsWindow.MouseDown=mdd 'GraphicsWindow.MouseMove=mww GraphicsWindow.MouseUp=muu Main() Sub domsg mtxx="Turtle commander V1.1"+_nln +"(p)2015 by SB community" If Text.StartsWith(args[1],"$") Then mtxx=text.GetSubTextToEnd(args[1],2) Endif LDDialogs.Wait(mtxx,"Green") Program.Delay(1500) LDDialogs.EndWait () EndSub Sub muu nxt=1 endsub Sub cang ox= Turtle.X oy= Turtle.Y nx= GraphicsWindow. Mousex ny= GraphicsWindow. Mousey ta= Turtle.Angle aag= 0'mathplus.GetDegrees ( MathPlus.ATan2(nx-ox,ny-oy)+Math.Pi/2) -ta If aag>180 Then aag=aag-360 elseIf aag<-180 Then aag=aag+360 endif aag=math.Round(aag) endsub Sub mww If rec=1 Then cang() GraphicsWindow.Title = aag+" | old:"+Turtle.angle endif EndSub Sub mdd If mov=1 Then Turtle.x= GraphicsWindow.MouseX Turtle.y=GraphicsWindow.MouseY mov=0 elseif rec=1 and nxt=1 Then nxt=0 'cang() ota=turtle.angle Turtle.Angle=Turtle.Angle+aag If Turtle.Angle>180 then Turtle.Angle=Turtle.Angle-360 elseif Turtle.Angle<-180 then Turtle.Angle=Turtle.Angle+360 endif nta=turtle.angle dta=nta-ota dst=0' Math.SquareRoot ( ESLMaths.Square (GraphicsWindow.MouseX - Turtle.x)+ESLMaths.Square (GraphicsWindow.Mousey - Turtle.y)) dst=math.Round (dst) Turtle.Move (dst) dd="R " If dta<0 then dd="L " endif 'TextWindow.WriteLine (aag) 'Clipboard.SetText(cr+dd+Math.Abs(dta)+cr+"F "+dst) LDFocus.SetFocus(pgm) ' aw = SPExtra.SendKeys("+{INS}") EndIf EndSub Sub findvar ar=Text.ConvertToUpperCase(args[1]) For ax=1 To vcnt If Text.ConvertToUpperCase(mem[ax][0])=ar Then return=ax Goto xxx endif EndFor TextWindow.WriteLine (ar+" VAR-notfnd!") return="!VARnotfnd!" xxx: endsub Sub rmm dd= LDDialogs.LastRightClickMenuItem if dd>0 Then LDControls .RichTextBoxSetText(pgm, LDText.Replace ( deff[dd],"!",_nln ),"False") Else rr=LDDialogs.Confirm("YES-save NO-load CANC=add","Menu Action:" ) If rr="Yes" Then ' The following line could be harmful and has been automatically commented. ' File.WriteContents ("d:\defs.txt",deff) ' The following line could be harmful and has been automatically commented. ' File.WriteContents ("d:\defm.txt",dmt) LDCall.Function ("DoMsg","$Saved ok.") elseIf rr="No" Then ' The following line could be harmful and has been automatically commented. ' deff=File.ReadContents ("d:\defs.txt") ' The following line could be harmful and has been automatically commented. ' dmt=File.ReadContents ("d:\defm.txt") LDCall.Function ("DoMsg","$Load ok.") LDDialogs.AddRightClickMenu(dmt,"") else li= LDText.Split (src,CR) att="" For t=1 To Array.GetItemCount (li) att=att+li[t]+"!" endfor tree=LDControls.TreeViewGetData(trr) deff[dmm]= att dmt[dmm]=tree[12][11] dmm=dmm+1 LDDialogs.AddRightClickMenu(dmt,"") endif EndIf EndSub Sub hshow txx= LDText.Split("FWD!BCK!<<>>!LOOP!VAR!CNST!SUB!FOR!GRID!Rec!MvTo!IF!EDIT!OPEN!NEW","!") For x=1 To 16 bb[x]= Controls.AddButton(txx[x], 2, 5+(x-1)*40) EndFor EndSub Sub Main nwwp: nww=0 tree="" tree[1][0]="Main" tree[2][1]="Defs tree[3][2]="Heading tree[4][3]="0 tree[5][2]="Bgrnd tree[6][5]="#bbccdd tree[7][2]="ForeClr tree[8][7]="AUTO tree[9][2]="Width tree[10][9]="4 tree[11][1]="Con/Vars tree[12][11]="0 tree[13][1]="Subs/Lps mem=0 sbb=0 Goto rr2 rrr: GraphicsWindow.BackgroundColor =bcll rr2: nxt=1 _inn=0 GraphicsWindow.Clear() Turtle.Show() GraphicsWindow.PenWidth=4 Turtle.PenUp () Turtle.MoveTo (600,400) Turtle.PenDown () GraphicsWindow.FontName="Calibri" GraphicsWindow.FontSize=14 hshow() ch=0 _l=1 sc=1 _sbc=0 GraphicsWindow.BrushColor = "DimGray" LDControls.RichTextBoxFontFamily="Lucida Console" LDControls .RichTextBoxFontSize = 18 trr=LDControls.AddTreeView(tree,180,350) nset() Controls.Move (trr,50,gh-355) pgm = ldControls.AddRichTextBox (10, 10) Controls.SetSize(pgm, 180, gh - 360) Controls.Move (pgm,50,1) ldControls.RichTextBoxSetText (pgm, src,"False") LDControls.RichTextBoxDefault(pgm) GraphicsWindow.BrushColor = "Black" g=gh-36 c1= Controls.AddButton("RUN", 2, g) g=g-35 c2=Controls.AddButton("CLR", 2, g) g=g-35 c3=Controls.AddButton("XPlain", 2, g) g=g-35 c4=Controls.AddButton("Paste", 2, g) g=g-35 c5=Controls.AddButton("? hlp", 2, g) g=g-35 c6=Controls.AddButton("DrwCh", 2, g) clicked = "False" Controls.ButtonClicked = OnButtonClicked GraphicsWindow.PenColor = "DimGray" Turtle.Show() Turtle.PenUp() Turtle.MoveTo (700,400) Turtle.PenDown() Turtle.Angle=0 GraphicsWindow.FontName = "Lucida Console" GraphicsWindow.FontSize =12 While "True" If rst=1 Then src = LDControls .RichTextBoxGetText (pgm) tree=LDControls.TreeViewGetData(trr) bcll =tree[6][5] rst=0 If nww=1 then Goto nwwp else Goto rrr endif elseIf clicked Then Controls.SetButtonCaption(c1,"STOP") clicked = "False" src = LDControls .RichTextBoxGetText(pgm) If Text.GetSubText(src,1,1)="{" or Text.GetSubText(src,1,1)="#" then If Text.GetSubText(src,1,1)="#" then dbg="True" Else dbg="False" endif line= LDText.Split (src,_nln ) rrw= ( text.GetSubTextToEnd(line[1],2))'tonum! nLines =Array.GetItemCount (line) If dbg then TextWindow.WriteLine (">>>>>>>>>>>>>>>>>>>>>runn>>>>>>>>>>>>>>>>>>") endif GraphicsWindow.Title="Run mode..." tree=LDControls.TreeViewGetData(trr) 'TextWindow.WriteLine(tree) GraphicsWindow.PenWidth=tree[10][9] 'GraphicsWindow.Title=rrw tree=LDControls.TreeViewGetData(trr) Turtle.Angle =tree[4][3] sbscan() For tt=1 To rrw vcnt=0 scnt=0 'TextWindow.WriteLine (line) For i = 2 To rwx linee=line[i] If Text.StartsWith(linee,"##") then Goto finn elseif Text.StartsWith(linee,"<") then smd=1 elseif Text.StartsWith(linee,">") then smd=0 ElseIf smd=0 and stpp=0 then DoLine() endif If stpp=1 then Controls.SetButtonCaption(c1,"RUN") stpp=0 GraphicsWindow.Title="Stopped." clicked="False Goto wwh endif EndFor finn: EndFor tree[4][3]=math.Round (math.Remainder (Turtle.Angle,360)) LDControls.TreeViewContent(trr,tree) nset() Controls.SetButtonCaption(c1,"RUN") GraphicsWindow.Title="Done." EndIf Else EndIf wwh: EndWhile EndSub Sub sbscan c=1 rwx=nLines While Text.StartsWith (line[c],"##")<>"True c=c+1 If c>nLines then TextWindow.WriteLine("No ##") goto tt endif EndWhile rwx=c-1 For i=c To nLines If Text.StartsWith(line[i], "<") Then _sbc=_sbc+1 smd=1 sbb[_sbc]["Stt"] = i + 1 For k = i+1 To nLines If Text.StartsWith(line[k], ">") Then sbb[_sbc]["End"] = k-1 smd=0 endif endfor tree=LDControls.TreeViewGetData(trr) tnd=Array.GetAllIndices(tree) nc=array.GetItemCount (tnd)+1 If dbg then typ="Sb" sbb[_sbc][0]=Text.GetSubTextToEnd (linee, 2) tree[nc][13]=typ+":"+_sbc+">"+sbb[_sbc]["Stt"]+" to "+sbb[_sbc]["End"] LDControls.TreeViewContent(trr,tree) nset() endif endif endfor tt: Endsub Sub nset LDControls.TreeViewExpand(trr,0,"True","True") nn= LDText.Split("4,6,8,10,12",",") For x=1 To Array.GetItemCount(nn) LDControls.TreeViewEdit(trr,nn[x],"True") endfor EndSub Sub drwgrd GraphicsWindow.PenWidth=1 GraphicsWindow.PenColor="#aaaaaa For x=1 To 70 GraphicsWindow.DrawLine(220+x*20,0,220+x*20,800) EndFor For x=1 To 40 GraphicsWindow.DrawLine(220,x*20,1400,x*20) EndFor EndSub Sub xplain TextWindow.Show () TextWindow.Clear() idd=" " src = LDControls .RichTextBoxGetText (pgm) TextWindow.WriteLine("Explain program dump list"+_nln ) line= LDText.Split (Text.ConvertToUpperCase(src),_nln ) rrw= ( text.GetSubTextToEnd(line[1],2))'ToNumber nLines =Array.GetItemCount (line) TextWindow.WriteLine ("{Main loop, repeating times:"+rrw) For i=2 To nLines linee=line[i] If Text.StartsWith(linee,"##") then TextWindow.WriteLine ("} Main loop end.*******************") else xpline() endif EndFor endsub Sub OnButtonClicked '"FWD!BCK!<<>>!LOOP!VAR!CNST!sub!FOR!SUB!SAVE!LOAD!IF!HLP!NEW" clb=Controls.LastClickedButton If clb=c2 then rst=1 elseIf clb=c3 then xplain () elseIf clb=c4 then LDControls.RichTextBoxSetText(pgm,Src,"False") rst=1 elseif clb=bb[1] then LDControls.RichTextBoxSetText(pgm,"F ","True") elseif clb=bb[2] then LDControls.RichTextBoxSetText(pgm,"R 180"+cr+"F "+cr+"R 180","True") elseif clb=bb[3] then LDControls.RichTextBoxSetText(pgm,"L ","True") elseif clb=bb[4] then LDControls.RichTextBoxSetText(pgm,"R ","True") elseif clb=bb[5] then LDControls.RichTextBoxSetText(pgm,"{1 "+cr+"}","True") elseif clb=bb[6] then LDControls.RichTextBoxSetText(pgm,"|v1=1","True") elseif clb=bb[7] then LDControls.RichTextBoxSetText(pgm,"%1","True") elseif clb=bb[8] then ctx=(cr+""+cr) LDControls.RichTextBoxSetText(pgm,ctx,"True") elseif clb=bb[9] then ctx=(cr+"|f1~1"+cr+"FOR %1;10;+1 ["+cr+"]"+cr) LDControls.RichTextBoxSetText(pgm,ctx,"True") elseif clb=bb[10] then DrwGrd() elseif clb=bb[11] then elseif clb=bb[12] then mov=1 elseif clb=bb[13] then ctx=(cr+"{IF =%1;n;2 "+cr+"//True"+cr+":$2 "+cr+"//False"+cr) LDControls.RichTextBoxSetText(pgm,ctx,"True") elseif clb=bb[14] then Controls.SetSize(pgm,800, gh - 360) elseif clb=bb[15] then fnm=LDDialogs.OpenFile("txt","i:\txt") ' The following line could be harmful and has been automatically commented. ' If ldFile.Exists(fnm) then ' The following line could be harmful and has been automatically commented. ' fcc=File.ReadContents(fnm) LDControls.RichTextBoxSetText(pgm,fcc,"False") endif elseif clb=c5 then Helpp() elseif clb=c6 then tree=LDControls.TreeViewGetData(trr) cch=tree[12][11] If text.GetCharacterCode (cch)>32 then GraphicsWindow.FontName="Times New Roman" GraphicsWindow.FontSize=540 GraphicsWindow.FontBold="True GraphicsWindow.FontItalic="True GraphicsWindow.BrushColor="#bbbbbb GraphicsWindow.DrawText(300,150,cch) endif elseif clb=bb[16] then rst=1 nww=1 src="{1"+cr LDControls .RichTextBoxSetText (pgm, src,"False") else clicked = "True" endif EndSub Sub DoLine '----------------------------------------------LINEPROC----------------------------- linee= LDText.Trim (linee) If linee="" Or Text.StartsWith(linee,"//") Then Goto exx endif If tree[8][7]="AUTO" Then GraphicsWindow.PenColor=LDColours.HSLtoRGB(math.Remainder (ch,360) ,0.9,0.4) Else GraphicsWindow.PenColor=tree[8][7] endif ch=ch+1 While Text.IsSubText(linee,"%") dorepl() endwhile ree: If Text.StartsWith(linee, Text.GetCharacter (34)) Then 'virtual mode If _inn>0 Then linee=text.GetSubTextToEnd (linee,2) Goto ree Endif elseIf Text.StartsWith(linee, "|") Then vn=text.GetSubText(linee,2,2) vv=text.GetSubTextToEnd (linee,5) dfc=text.GetSubText(linee,4,1) If dfc="=" then vcnt=vcnt+1 mem[vcnt][1]=vv mem[vcnt][0]=vn elseif dfc="'" then rr=ldcall.Function("findvar",vn) mem[rr][1]=text.GetCharacter (vv) elseif dfc="." then pp= (text.GetSubText(linee,5,2))'mathplus.ToNumber scnt=scnt+1 Matr[scnt]=Text.GetSubTextToEnd ( vv,4) elseif dfc=";" then For scnt=1 to Text.GetLength (vv) Matr[scnt]=Text.GetSubText(vv,scnt,1) endfor elseif dfc="+" then rr=ldcall.Function("findvar",vn) mem[rr][1]=mem[rr][1]+vv elseif dfc="~" then rr=ldcall.Function("findvar",vn) mem[rr][1]=vv elseif dfc="*" then rr=ldcall.Function("findvar",vn) mem[rr][1]=mem[rr][1]*vv elseif dfc="/" then rr=ldcall.Function("findvar",vn) mem[rr][1]=mem[rr][1]/vv endif ElseIf Text.StartsWith(linee, "~B#") Then 'block wdth tww= Text.GetSubTextToEnd (linee,4) ElseIf Text.StartsWith(linee, "WB#") Then 'block txt ttx= Text.GetSubTextToEnd (linee,4) GraphicsWindow.DrawBoundText(Turtle.x, Turtle.y,tww,ttx) ElseIf Text.StartsWith(linee, "#I:") Then 'flickr image get n draw ttx= Text.GetSubTextToEnd (linee,4) ppt= LDText.Split(ttx,";") pim= (Flickr.GetRandomPicture(ppt[1])) GraphicsWindow.DrawResizedImage(pim,ppt[2],ppt[3],ppt[4],ppt[5]) ElseIf Text.StartsWith(linee, "#O>") Then 'obj mode objm=1 oo=1 Program.Delay(5) obj[oo][1]=Turtle.X obj[oo][2]=Turtle.Y oo=oo+1 ElseIf Text.StartsWith(linee, "#O#") Then 'obj mode ttx= Text.GetSubTextToEnd (linee,4) objm=0 opp[ttx]=LDShapes.AddPolygon (obj) LDShapes.BrushColour(opp[ttx],GraphicsWindow.PenColor) ElseIf Text.StartsWith(linee, "#OM") Then 'obj mode ttx= Text.GetSubTextToEnd (linee,5) ttt= LDText.Split (ttx,";") Shapes.Move (opp[ttt[3]],ttt[1]-obj[1][1],ttt[2]-obj[1][2]) ElseIf Text.StartsWith(linee, "#OA") Then 'obj mode ttx= Text.GetSubTextToEnd (linee,5) ttt= LDText.Split (ttx,";") Shapes.Animate (opp[ttt[3]],ttt[1]-obj[1][1],ttt[2]-obj[1][2],ttt[4]) ElseIf Text.StartsWith(linee, "W#") Then 'console debug writting ttx= Text.GetSubTextToEnd (linee,3) If Text.StartsWith (ttx,"|") then vn=text.GetSubText(ttx,2,2) ttx=ldcall.Function("findvar",vn) Endif TextWindow.WriteLine(">:"+ttx) ElseIf Text.StartsWith(linee, "WRT") Then ttx= Text.GetSubTextToEnd (linee,5) If Text.StartsWith (ttx,"|") then vn=text.GetSubText(ttx,2,2) ttx=ldcall.Function("findvar",vn) Endif GraphicsWindow.DrawText(Turtle.x, Turtle.y, ttx) elseif Text.StartsWith(linee, "F") Then distance = Text.GetSubTextToEnd(linee, 3) If Text.StartsWith(distance,"|") Then rr=ldcall.Function("findvar",vn) dist=mem[rr][1] Else dist=distance endif Turtle.Move(math.Floor (dist*sc)) if objm=1 then obj[oo][1]=Turtle.X obj[oo][2]=Turtle.Y oo=oo+1 endif 'GraphicsWindow.Title="Dst:"+math.Round ( dist*sc) if dbg then TextWindow.WriteLine(math.Floor (dist*sc)) endif Elseif Text.StartsWith(linee, "S") Then If Text.GetSubText(linee,2,1)="/" then sc=sc/ Text.GetSubTextToEnd(linee, 3) else sc=sc* Text.GetSubTextToEnd(linee, 3) endif If sc=0 then sc=1 EndIf ElseIf Text.StartsWith(linee, "$") Then tx=Turtle.x ty=Turtle.Y ta= Turtle.Angle ts=sc ElseIf Text.StartsWith(linee, "@") Then ' subbs scc=Text.GetSubTextToEnd (linee,2) Sst= sbb[scc]["Stt"] sen=sbb[scc]["End"] Stack.PushValue("locali", i) Stack.PushValue("localj", j) For i = sSt To sEn linee=line[i] _inn=_inn+1 DoLine() _inn=_inn-1 Endfor i = Stack.PopValue("locali")+1 j=Stack.PopValue("localj") ElseIf Text.StartsWith(linee, "&") Then Turtle.x=tx Turtle.Y=ty Turtle.Angle=ta sc=ts ElseIf Text.StartsWith(linee, "#X") Then 'FCExtensions.Eval(Text.GetSubTextToEnd(linee, 4)) ElseIf Text.StartsWith(linee, "#E") Then ' mem[1][1]=FCExtensions.MathEval(Text.GetSubTextToEnd(linee, 4)) ElseIf Text.StartsWith(linee, "#F") Then ff=Text.GetSubTextToEnd(linee, 4) fn=LDText.Split(ff,";") GraphicsWindow.FontName=fn[1] GraphicsWindow.FontBold=_tfl[fn[2]] GraphicsWindow.FontItalic=_tfl[fn[3]] GraphicsWindow.FontSize=fn[4] ElseIf Text.StartsWith(linee, "#P") Then GraphicsWindow.BrushColor=GraphicsWindow.PenColor ElseIf Text.StartsWith(linee, "~S") Then LDQueue.Enqueue("q1",Turtle.x+":"+Turtle.y) ElseIf Text.StartsWith(linee, "~G") Then tp=LDQueue.Dequeue ("q1") tt=LDText.Split(tp,":") Turtle.x=tt[1] Turtle.y=tt[2] ElseIf Text.StartsWith(linee, "#C") Then ww = ( Text.GetSubTextToEnd(linee, 4))'tonum GraphicsWindow.BrushColor=GraphicsWindow.PenColor If ww=0 then ww=5 endif GraphicsWindow.FillEllipse(Turtle.x-ww, Turtle.y-ww,ww*2,ww*2) ElseIf Text.StartsWith(linee, "XC") Then ww = ( Text.GetSubTextToEnd(linee, 4))'tonum GraphicsWindow.BrushColor=GraphicsWindow.BackgroundColor If ww=0 then ww=5 endif GraphicsWindow.FillEllipse(Turtle.x-ww, Turtle.y-ww,ww*2,ww*2) ElseIf Text.StartsWith(linee, "`C") Then ww = Text.GetSubTextToEnd(linee, 3) GraphicsWindow.BrushColor=ww ElseIf Text.StartsWith(linee, "~H") Then Turtle.x=600 Turtle.Y=400 Turtle.Angle=0 ElseIf Text.StartsWith(linee, "P") Then GraphicsWindow.PenColor=GraphicsWindow.BackgroundColor GraphicsWindow.PenWidth=GraphicsWindow.PenWidth+2 distance = Text.GetSubTextToEnd(linee, 3) If Text.StartsWith(distance,"|") Then rr=ldcall.Function("findvar",vn) dist=mem[rr][1] Else dist=distance endif Turtle.Move(math.Floor (dist*sc)) GraphicsWindow.PenWidth=GraphicsWindow.PenWidth-2 ElseIf Text.StartsWith(linee, "~FN") Then GraphicsWindow.FontName=Text.GetSubTextToEnd(Linee,5) ElseIf Text.StartsWith(linee, "~FS") Then GraphicsWindow.FontSize=Text.GetSubTextToEnd(Linee,5) ElseIf Text.StartsWith(linee, "~C") Then ccl=GraphicsWindow.BrushColor GraphicsWindow.BrushColor =GraphicsWindow.BackgroundColor GraphicsWindow.FillRectangle (220,200,800,400) GraphicsWindow.BrushColor=ccl ElseIf Text.StartsWith(linee, "~T") Then mem[1][1]=Clock.Hour mem[1][0]="_H" mem[2][1]=Clock.Minute mem[2][0]="_M mem[3][1]=Clock.Second mem[3][0]="_S mem[4][1]=Clock.Date mem[4][0]="_D" ElseIf Text.StartsWith(linee, "~") Then Program.Delay (Text.GetSubTextToEnd(linee, 2)) ElseIf Text.StartsWith(linee, "U") Then Turtle.PenUp() ElseIf Text.StartsWith(linee, "D") Then Turtle.PenDown() ElseIf Text.StartsWith(linee, "R") Then distance = Text.GetSubTextToEnd(linee, 3) If Text.StartsWith(distance,"|") Then rr=ldcall.Function("findvar",vn) dist=mem[rr][1] Else dist=distance endif Turtle.Turn(dist) ElseIf Text.StartsWith(linee, "L") Then distance = Text.GetSubTextToEnd(linee, 3) If Text.StartsWith(distance,"|") Then rr=ldcall.Function("findvar",vn) dist=mem[rr][1] Else dist=distance endif Turtle.Turn(-dist) ElseIf Text.StartsWith(linee, "A") Then distance = -Text.GetSubTextToEnd(linee, 3) If Text.StartsWith(distance,"|") Then rr=ldcall.Function("findvar",vn) dist=mem[rr][1] Else dist=distance endif Turtle.Angle=dist ElseIf Text.StartsWith(linee, ":$") Then icc=Text.GetSubTextToEnd (linee, 3) i=i+icc ElseIf Text.StartsWith(linee, "IF") Then icc=Text.GetSubTextToEnd (linee, 4) iif= LDText.Split(icc,";") v1=iif[1] v2=iif[2] If iif[3]=0 then skp=2 Else skp=iif[3] endif cond=0 TextWindow.WriteLine ("Sk:"+Skp) If Text.StartsWith(icc,"=") then If v1=v2 then cond=1 Else cond=2 endif elseIf Text.StartsWith(icc,">") then If v1v2 then cond=1 Else cond=2 endif elseIf Text.StartsWith(icc,"!") then If v1<>v2 then cond=1 Else cond=2 endif endif If cond=0 then TextWindow.WriteLine ("IF invalid cond error!") else if cond=1 then 'true part TextWindow.WriteLine ("TRue") Else 'false part TextWindow.WriteLine ("Flss") i=i+skp endif endif ElseIf Text.StartsWith(linee, "{") Then count[_l] = ( Text.GetSubTextToEnd (linee, 2))'tonum iStart[_l] = i + 1 iEnd[_l] = nLines nest = 0 tree=LDControls.TreeViewGetData(trr) tnd=Array.GetAllIndices(tree) nc=array.GetItemCount (tnd)+1 For k = iStart[_l] To nLines 'TextWindow.WriteLine(">>"+k) If Text.StartsWith(line[k], "{") Then nest = nest + 1 ElseIf Text.StartsWith(line[k], "]") or Text.StartsWith(line[k], "}") Then If nest = 0 Then iEnd[_l] = k - 1 k= nLines Else nest = nest - 1 EndIf EndIf EndFor If dbg then typ="Lp" tree[nc][13]=typ+":"+nest+">"+iStart[_l]+" to "+iEnd[_l] LDControls.TreeViewContent(trr,tree) nset() endif j = count[_l] _l = _l + 1 While j>0 Stack.PushValue("local", j) _inn=_inn+1 For i = iStart[_l - 1] To iEnd[_l - 1] linee=line[i] If Text.IsSubText (linee,"%$$") Then linee=LDText.Replace (linee,"%$$",j) elseIf Text.IsSubText (linee,"%$A") Then linee=LDText.Replace (linee,"%$A",Turtle.Angle ) elseIf Text.IsSubText (linee,"%$C") Then linee=LDText.Replace (linee,"%$C",GraphicsWindow.PenColor ) elseIf Text.IsSubText (linee,"%$") Then linee=LDText.Replace (linee,"%$","%"+ text.GetSubText (_hexx,j,1) ) endif If dbg then TextWindow.WriteLine (i+">>"+linee) endif DoLine() EndFor _inn=_inn-1 j = Stack.PopValue("local")-1 Endwhile _l = _l - 1 i = iEnd[_l] + 2 EndIf exx: EndSub Sub dorepl If Text.IsSubText (linee,"%") Then aq="!! If Text.IsSubText(linee,aq) Then m2=Text.Append("0", mem[2][1]) m2=Text.GetSubTextToEnd (m2,text.GetLength( mem[2][1])) m3=Text.Append("0", mem[3][1]) m3=Text.GetSubTextToEnd (m3,text.GetLength( mem[3][1])) endif If Text.IsSubText (linee,"%1") Then linee=LDText.Replace (linee,"%1",mem[1][1]) elseIf Text.IsSubText (linee,"%2"+aq) Then linee=LDText.Replace (linee,"%2"+aq,m2) elseIf Text.IsSubText (linee,"%3"+aq) Then linee=LDText.Replace (linee,"%3"+aq,m3) elseIf Text.IsSubText (linee,"%2") Then linee=LDText.Replace (linee,"%2",mem[2][1]) elseIf Text.IsSubText (linee,"%3") Then linee=LDText.Replace (linee,"%3",mem[3][1]) elseIf Text.IsSubText (linee,"%4") Then linee=LDText.Replace (linee,"%4",mem[4][1]) elseIf Text.IsSubText (linee,"%5") Then linee=LDText.Replace (linee,"%5",mem[5][1]) elseIf Text.IsSubText (linee,"%6") Then linee=LDText.Replace (linee,"%6",mem[6][1]) elseIf Text.IsSubText (linee,"%7") Then linee=LDText.Replace (linee,"%7",mem[7][1]) elseIf Text.IsSubText (linee,"%8") Then linee=LDText.Replace (linee,"%8",mem[8][1]) elseIf Text.IsSubText (linee,"%9") Then linee=LDText.Replace (linee,"%9",mem[9][1]) elseIf Text.IsSubText (linee,"%A") Then linee=LDText.Replace (linee,"%A",mem[10][1]) elseIf Text.IsSubText (linee,"%B") Then linee=LDText.Replace (linee,"%B",mem[11][1]) elseIf Text.IsSubText (linee,"%C") Then linee=LDText.Replace (linee,"%C",mem[12][1]) elseIf Text.IsSubText (linee,"%D") Then linee=LDText.Replace (linee,"%D",mem[13][1]) elseIf Text.IsSubText (linee,"%E") Then linee=LDText.Replace (linee,"%E",mem[14][1]) elseIf Text.IsSubText (linee,"%F") Then linee=LDText.Replace (linee,"%F",mem[15][1]) elseIf Text.IsSubText (linee,"%M") Then mm=text.GetSubTextToEnd(linee,text.GetIndexOf(linee,".")+1) linee=LDText.Replace (linee,"%M."+mm,matr[(mm)]) elseIf Text.IsSubText (linee,"%X") Then linee=LDText.Replace (linee,"%X",math.Round (Turtle.x)) elseIf Text.IsSubText (linee,"%Y") Then linee=LDText.Replace (linee,"%Y",math.Round (Turtle.y)) elseIf Text.IsSubText (linee,"%W") Then linee=LDText.Replace (linee,"%W",math.Remainder (Turtle.Angle,360) ) endif endif endsub Sub fWriteLn TextWindow.WriteLine(idd+args[1]) EndSub Sub xpline '**************************************xplains prg....********************* If Text.StartsWith(linee, "|") Then vn=text.GetSubText(linee,2,2) vv=text.GetSubTextToEnd (linee,5) dfc=text.GetSubText(linee,4,1) If dfc="=" then LDCall.Function("fWriteLn","Define New VAR "+vn+" and assign value:"+vv) vcnt=vcnt+1 mem[vcnt][0]=vn elseif dfc="+" then LDCall.Function("fWriteLn","Increase VAR "+vn+" by:"+vv) elseif dfc="~" then LDCall.Function("fWriteLn","Find VAR "+vn+" and assign value:"+vv) elseif dfc="*" then LDCall.Function("fWriteLn","Multiply VAR "+vn+" by:"+vv) elseif dfc="/" then LDCall.Function("fWriteLn","Divide VAR "+vn+" by:"+vv) endif endif If Text.StartsWith(linee, "W#") Then 'console debug writting ttx= Text.GetSubTextToEnd (linee,3) LDCall.Function("fWriteLn","Write to console:"+ttx) ElseIf Text.StartsWith(linee, "%") then LDCall.Function("fWriteLn","Perform "+Text.GetSubTextToEnd (linee,4)) ElseIf Text.StartsWith(linee, "WRT") Then 'turtle writting ttx= Text.GetSubTextToEnd (linee,5) LDCall.Function("fWriteLn","Write to screen:"+ttx) ElseIf Text.StartsWith(linee, "Ht") Then LDCall.Function("fWriteLn","Reset to Home pos.") elseif Text.StartsWith(linee, "F") Then dist = Text.GetSubTextToEnd(linee, 3) If Text.StartsWith(dist,"%") then dist = "var value:"+mem[Text.GetIndexOf (_hexx, Text.GetSubTextToEnd(dist, 2))][0] endif LDCall.Function("fWriteLn","Forward by:"+ dist) Elseif Text.StartsWith(linee, "<") Then ttx= Text.GetSubTextToEnd (linee,2) LDCall.Function("fWriteLn","") Then idd=text.GetSubTextToEnd(idd,3) LDCall.Function("fWriteLn",">END SUB.") Elseif Text.StartsWith(linee, "]") Then idd=text.GetSubTextToEnd(idd,4) LDCall.Function("fWriteLn","] END Repeat block") Elseif Text.StartsWith(linee, "}") Then idd=text.GetSubTextToEnd(idd,4) LDCall.Function("fWriteLn","} END block") Elseif Text.StartsWith(linee, "S") Then If sc=0 then sc=1 LDCall.Function("fWriteLn","Set scale to 1") else If Text.GetSubText(linee,2,1)="%" then LDCall.Function("fWriteLn","Alter scale <(kind +/*) selected by VAR:"+mem[Text.GetIndexOf (_hexx, Text.GetSubText(linee, 3,1))][0]+"> by factor:"+Text.GetSubTextToEnd(linee, 5)) elseIf Text.GetSubText(linee,2,1)="/" then LDCall.Function("fWriteLn","Divide scale by:"+Text.GetSubTextToEnd(linee, 3)) else LDCall.Function("fWriteLn","Multiply scale by:"+Text.GetSubTextToEnd(linee, 3)) endif EndIf ElseIf Text.StartsWith(linee, "$") Then LDCall.Function("fWriteLn","Save turtle pos.") ElseIf Text.StartsWith(linee, "@") Then ' subbs scc=Text.GetSubTextToEnd (linee,2) LDCall.Function("fWriteLn","Call sub:"+sbb[scc][0]) ElseIf Text.StartsWith(linee, "&") Then LDCall.Function("fWriteLn","Restore turtle pos.") ElseIf Text.StartsWith(linee, "U") Then LDCall.Function("fWriteLn","Pen UP - moving") ElseIf Text.StartsWith(linee, "D") Then LDCall.Function("fWriteLn","Pen DN - drawing") ElseIf Text.StartsWith(linee, "R") Then dist = Text.GetSubTextToEnd(linee, 3) LDCall.Function("fWriteLn","Turn RIGHT by:"+dist) ElseIf Text.StartsWith(linee, "L") Then dist = Text.GetSubTextToEnd(linee, 3) LDCall.Function("fWriteLn","Turn LEFT by:"+dist) ElseIf Text.StartsWith(linee, "{") Then LDCall.Function("fWriteLn","{Repeat block times:"+Text.GetSubTextToEnd(linee,2)) idd=idd+" " EndIf EndSub'---------------------------------xplain********************** Sub Init gw = 1000 gh = 900 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Turtle Graphics GraphicsWindow.BackgroundColor="#bbccdd GraphicsWindow.Top=0 GraphicsWindow.Left=0 Turtle.Speed=10 CR = _nln src=LDText.Replace ( deff[8],"!",_nln ) EndSub Sub Helpp txx="Spec.vars :"+_nln txx=txx+">only shows :"+_nln txx=txx+"%$$ = loop counter backward"+_nln txx=txx+"%$A = Turtle.Angle"+_nln txx=txx+"%$C = Pen color"+_nln txx=txx+"%$n = n=[ 1..F(hex)] ref. in loop to vars 1..15"+_nln txx=txx+_nln+"Spec.cmds:"+_nln txx=txx+"%M.nn= matrix row nn _1..99"+_nln txx=txx+"|vv;txt <= stores txt as chars in matrix %M"+_nln txx=txx+"|vv~nnn <= stores data in existing var vv"+_nln txx=txx+"|vv=nnn <= stores data in new var vv"+_nln txx=txx+"|vv+nnn <= adds value to var vv"+_nln txx=txx+"|vv*nnn <= multipl. value to var vv"+_nln txx=txx+"|vv/nnn <= divides var vv by val."+_nln txx=txx+"|vv'cccc <= stores chr unicode cccc to var vv"+_nln txx=txx+"~n = delay n msecs"+_nln txx=txx+"#C ww = fill circle rad.ww px"+_nln txx=txx+"XC ww = del. circle rad.ww px"+_nln txx=txx+"~C = del. watch zone"+_nln txx=txx+"$ = save turtle loc."+_nln txx=txx+"& = restore turtle loc."+_nln txx=txx+"#F fnam;bld;itl;siz = set font name, bold 0 or 1, italic 0/1, size"+_nln txx=txx+"#P = set pen clr from treedef."+_nln txx=txx+"~H = Home turtle"+_nln txx=txx+"#E xpr = matheval xpr expression"+_nln txx=txx+"#X cmd = exec. sb cmd"+_nln GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Tahoma" GraphicsWindow.FontSize = 15 GraphicsWindow.PenColor="Black GraphicsWindow.DrawText(310, 20, "S ff | S/ff = scale") GraphicsWindow.DrawText(310, 40, "F dist=move forward") GraphicsWindow.DrawText(310, 60, "L|R angle = turn angle") GraphicsWindow.DrawText(310, 80, "D)wn | U)p = pen mode") GraphicsWindow.DrawText(310, 105, " sub end") GraphicsWindow.DrawText(310, 165, "@n = sub call n=1..maxnsub by def. order ") GraphicsWindow.DrawText(310, 190, "{count ") GraphicsWindow.DrawText(310, 210, "loop cmds ") GraphicsWindow.DrawText(310, 230, "] or } loop end") GraphicsWindow.DrawBoundText(310,250,350,txx) EndSub End>BPN924.sb< Start>BPQ575.sb< GW=600 GraphicsWindow.Width=GW GraphicsWindow.Height=GW Textwindow.left=800 GraphicsWindow.BackgroundColor="Gray" GraphicsWindow.PenColor="Green" GraphicsWindow.BrushColor="Gray" GraphicsWindow.FillRectangle(0,350,700,1) Box=Shapes.AddRectangle(50,50) GraphicsWindow.BrushColor="Orange" GraphicsWindow.PenColor="Orange" LightSource=Shapes.AddEllipse(30,30) ImageList.LoadImage(Program.Directory+"/formula2.jpg") 'Move the objects: Shapes.Move(Box,300,300) Shapes.Move(LightSource,300,200) 'Prepare the Pen for the shadow: GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="Black" GraphicsWindow.PenColor="Black" While "True" Textwindow() BoxX=Shapes.GetLeft(Box) BoxY=Shapes.GetTop(Box) LightSourceX=Shapes.GetLeft(LightSource)+15 LightSourceY=Shapes.GetTop(LightSource)+15 Shapes.Move(LightSource,GraphicsWindow.MouseX-15,GraphicsWindow.MouseY-15) BigHHoriz=BoxX+50-LightSourceX SmallhHoriz=(BoxX+50-LightSourceX)-50 If LightSourceY<=BoxY then BigH=BoXY+50-LightSourceY Smallh=(BoXY+50-LightSourceY)-50 a=LightSourceX-BoxX b=((BoxX+50)-LightSourceX) Else BigH=BoXY+50-LightSourceY Smallh=(BoXY+50-LightSourceY)-50 a=LightSourceX-BoxX b=((BoxX+50)-LightSourceX) endif If Smallh <> 0 Then If LightSourceY<=BoxY then ' bbbbbbbbbbbbbbbbb****(HHHHHHHHHHHHHHHHH/hhhhhhhhhhhhhhhhhhh ShadowRight=b*BigH/(((BoXY+50)-LightSourceY)-50)+LightSourceX ' aaaaaaaaaaaaaaaa****(HHHHHHHHHHHHHHHHH/hhhhhhhhhhhhhhhhhhh ShadowLeft=LightSourceX-a*BigH/Smallh Else ' bbbbbbbbbbbbbbbbb****(HHHHHHHHHHHHHHHHH/hhhhhhhhhhhhhhhhhhh ShadowRight=b*BigH/(((BoXY+50)-LightSourceY)-50)+LightSourceX ' aaaaaaaaaaaaaaaa****(HHHHHHHHHHHHHHHHH/hhhhhhhhhhhhhhhhhhh ShadowLeft=LightSourceX-a*BigH/Smallh endif Else ShadowLeft=-3000 ShadowRight=3000 EndIf CreateShadow() LightSourceOldX=LightSourceX LightSourceOldY=LightSourceY BoxOldX=BoxX BoxOldY=BoxY GraphicsWindow.BrushColor="gray" Shapes.Move(Box,275+u,275) u=u'+0.1 If u>250 Then u=-350 endif endwhile 'B = b * (H/h) 'C = a * (H/h) Sub CreateShadow If LightSourceOldX<>LightSourceX or LightSourceOldY<>LightSourceY or BoxOldX<>BoxX or BoxOldY<>BoxY then Clear() GraphicsWindow.DrawImage(ImageList.LoadImage(Program.Directory+"/kreis2.png"),GraphicsWindow.mouseX-150,GraphicsWindow.mouseY-150) If LightSourceY<=BoxY then if LightSourceX<=BoxX then GraphicsWindow.FillTriangle(BoxX,BoxY+50,BoxX+50,BoxY,ShadowLeft,GW) GraphicsWindow.FillTriangle(BoxX+50,BoxY,ShadowLeft,GW,ShadowRight,GW) else GraphicsWindow.FillTriangle(BoxX,BoxY,BoxX+50,BoxY+50,ShadowLeft,GW) endif if LightSourceX>=BoxX And LightSourceX=BoxX+50 then GraphicsWindow.FillTriangle(BoxX+50,BoxY+50,ShadowLeft,GW,ShadowRight,GW) endif endif If LightSourceY>BoxY then if LightSourceX<=BoxX then GraphicsWindow.FillTriangle(BoxX,BoxY+50,BoxX+50,BoxY,ShadowLeft,0) GraphicsWindow.FillTriangle(BoxX+50,BoxY,ShadowLeft,0,ShadowRight,0) else GraphicsWindow.FillTriangle(BoxX,BoxY,BoxX+50,BoxY+50,ShadowLeft,0) endif if LightSourceX>=BoxX And LightSourceX=BoxX+50 then GraphicsWindow.FillTriangle(BoxX+50,BoxY+50,ShadowLeft,0,ShadowRight,0) endif endif endif endsub Sub Clear GraphicsWindow.BrushColor="Gray" GraphicsWindow.FillRectangle(0,0,GW,GW) GraphicsWindow.BrushColor="Black" endsub Sub Textwindow TextWindow.WriteLine("h: "+smallh) TextWindow.WriteLine("H: "+Bigh) TextWindow.WriteLine("HHoriz: "+BighHoriz) TextWindow.WriteLine("hHoriz: "+smallhHoriz) TextWindow.WriteLine("ShadowRight: "+ShadowRight) TextWindow.WriteLine("ShadowLeft: "+ShadowLeft) TextWindow.WriteLine("a: "+a) TextWindow.WriteLine("b: "+b) Program.Delay(5) TextWindow.Clear() endsub For i=1 To 10 Step 3 GraphicsWindow.BrushColor="#44000000" if LightSourceX<=BoxX then GraphicsWindow.FillTriangle(BoxX,BoxY+50,BoxX+50,BoxY,ShadowLeft-i,GW) else GraphicsWindow.FillTriangle(BoxX,BoxY,BoxX+50,BoxY+50,ShadowLeft-i,GW) endif if LightSourceX>=BoxX And LightSourceX=BoxX+50 then GraphicsWindow.FillTriangle(BoxX+50,BoxY+50,ShadowLeft-i,GW,ShadowRight+i,GW) ElseIf LightSourceX<=BoxX then GraphicsWindow.FillTriangle(BoxX+50,BoxY,ShadowLeft-i,GW,ShadowRight+i,GW) endif endfor End>BPQ575.sb< Start>BPR047.sb< 'Database 101 'By Robert W Jones ' 'Setup FileName = "c:\My data files\Database101\Datafile01.dat" TempFileName = "c:\My data files\Database101\Datafile01.tmp" DataRecordNumber = 1 'Data record structure DataRecord["Deleted"] = "N" DataRecord["Name"] = "Bob" DataRecord["Address"] = "1234 Main St" DataRecord["City"] = "Vancouver" DataRecord["Prov"] = "BC" DataRecord["Country"] = "Canada" TextWindow.WriteLine("Write = " + DataRecord) 'To save this record WriteDataRecord() 'To read this record DataRecord = "" ReadDataRecord() TextWindow.WriteLine("Read as " + DataRecord ) Sub WriteDataRecord ' The following line could be harmful and has been automatically commented. ' File.WriteLine(FileName, RecordNumber, DataRecord) EndSub Sub ReadDataRecord ' The following line could be harmful and has been automatically commented. ' DataRecord = File.ReadLine(FileName, RecordNumber) EndSub Sub WriteTempDataRecord ' The following line could be harmful and has been automatically commented. ' File.WriteLine(TempFileName , TempRecordNumber , DataRecord) EndSub Sub ReadTempDataRecord ' The following line could be harmful and has been automatically commented. ' DataRecord = File.ReadLine(TempFileName, RecordNumber) EndSub Sub DeleteDataRecord ReadDataRecord() DataRecord["Deleted"] = "Y" WriteDataRecord() EndSub Sub PurgeDataFile 'Set Inital Values TempRecordNumber = 1 RecordNumber = 1 PurgeDataFileLoop: ReadDataRecord() 'Check to see if you are at the end of the file If DataRecord["Deleted"] = "" Then Goto PurgeDataFileEnd EndIf 'Check to see if you have deleted the record, if so skip to the next record If DataRecord["Deleted"]= "Y" Then DataRecordNumber = DataRecordNumber + 1 Goto PurgeDataFileLoop EndIf 'Write the record to the temporary file WriteTempDataRecord() 'Increment the record number and goto the begining of the loop TempRecordNumber = TempRecordNumber + 1 Goto PurgeDataFileLoop 'To finish the purge, you delete the original file PurgeDataFileEnd: ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(FileName) 'You then rename the temporary by coping the temporary file to the data file ' The following line could be harmful and has been automatically commented. ' File.CopyFile(TempFileName, FileName) 'You then delete the temporary file ' The following line could be harmful and has been automatically commented. ' File.DeleteFile (TempFileName ) EndSub End>BPR047.sb< Start>BPV315-0.sb< GraphicsWindow.Height = 600 GraphicsWindow.Width = 600 TextWindow.Left = GraphicsWindow.Left + 615 TextWindow.Top = GraphicsWindow.Top Mouse.HideCursor() Steam_Skin=ImageList.LoadImage("http://public.bay.livefilestore.com/y1pSDvsXajbdg0-y3xRxTA_W7gio52NarIE4aiSvo3pk3QhqsV72UwBk7HWeBd5i6PlZ2W5CtYZzegxsrkfsbLAxA/smoke1.png") 'Steam_Skin = ImageList.LoadImage(Program.Directory + "\smoke1.png") Steam_Air_Resistance = -8 GraphicsWindow.BrushColor = "Black" Emitter = Shapes.AddTriangle(0,0,70,0,35,70) While "True" TimeStart = Clock.ElapsedMilliseconds Mouse_X=GraphicsWindow.mouseX Mouse_Y=GraphicsWindow.mouseY Shapes.Move(Emitter,Mouse_X-35,Mouse_Y-35) If Mouse.IsRightButtonDown Then ang = ang+1 Shapes.Rotate(Emitter,ang) EndIF If Mouse.IsLeftButtonDown Then Steam_EmitDelay = Steam_EmitDelay + 1 If Steam_EmitDelay = 2 Then SteamEmitter() Steam_EmitDelay = 0 endif endif SteamCode() TextWindow.Clear() TextWindow.WriteLine("Steam Sprites: " + (Steam_New-Steam_Old)) TextWindow.WriteLine("Steam_New: " + Steam_New) TextWindow.WriteLine("Steam_Old: " + Steam_Old) TimeEnd = Clock.ElapsedMilliseconds PassedTime=TimeEnd-TimeStart PerfectDelay = 30-PassedTime If PerfectDelay > 0 Then Program.Delay(PerfectDelay) endif endwhile Sub SteamEmitter Steam_New = Steam_New + 1 Steam[Steam_New] = Shapes.AddImage(Steam_Skin) Shapes.Move(Steam[Steam_New],-1000,-1000) vel = 10+Math.GetRandomNumber(20) angle = Math.Pi*(ang/180-0.5) Steam_X[Steam_New] = Mouse_X+35*Math.Cos(angle) Steam_Y[Steam_New] = Mouse_Y+35*Math.Sin(angle) Steam_WX[Steam_New] = Math.Cos(angle) * vel Steam_WY[Steam_New] = Math.Sin(angle) * vel Steam_Opacity[Steam_New] = 100 Steam_Angle[Steam_New] = Math.GetRandomNumber(359) Steam_Zoom[Steam_New] = Math.GetRandomNumber(5) * 0.1 + 0.8 endsub Sub SteamCode For s = Steam_Old+1 To Steam_New 'if Steam_WY[s] < Steam_Air_Resistance Then Steam_WX[s] = Steam_WX[s] * 0.95 Steam_WY[s] = Steam_WY[s] * 0.95 'endIf Steam_X[s] = Steam_X[s] + Steam_WX[s] Steam_Y[s] = Steam_Y[s] + Steam_WY[s] 'Steam_Angle[s] = Steam_Angle[s] + Steam_WX[s] * 1 Steam_Zoom[s] = Steam_Zoom[s] + Math.GetRandomNumber(10)*0.02 Steam_Opacity[s] = Steam_Opacity[s] - 2 Shapes.SetOpacity(Steam[s],Steam_Opacity[s]) If Steam_Opacity[s] <= 0 Then Shapes.Remove(Steam[s]) Steam[s] = "" Steam_X[s] = "" Steam_Y[s] = "" Steam_WX[s] = "" Steam_WY[s] = "" Steam_Opacity[s] = "" Steam_Angle[s] = "" Steam_Zoom[s] = "" Steam_Old = Steam_Old + 1 endif Shapes.Zoom(Steam[s],Steam_Zoom[s],Steam_Zoom[s]) Shapes.Rotate(Steam[s],Steam_Angle[s]) Shapes.Move(Steam[s],Steam_X[s]-35,Steam_Y[s]-35) endfor endsub End>BPV315-0.sb< Start>BPV315.sb< GraphicsWindow.Height = 600 GraphicsWindow.Width = 600 TextWindow.Left = GraphicsWindow.Left + 615 TextWindow.Top = GraphicsWindow.Top Mouse.HideCursor() Steam_Skin=ImageList.LoadImage("http://public.bay.livefilestore.com/y1pSDvsXajbdg0-y3xRxTA_W7gio52NarIE4aiSvo3pk3QhqsV72UwBk7HWeBd5i6PlZ2W5CtYZzegxsrkfsbLAxA/smoke1.png") 'Steam_Skin = ImageList.LoadImage(Program.Directory + "\smoke1.png") Steam_Air_Resistance = -8 GraphicsWindow.BrushColor = "Black" Emitter = Shapes.AddTriangle(0,0,70,0,35,70) While "True" TimeStart = Clock.ElapsedMilliseconds Mouse_X=GraphicsWindow.mouseX Mouse_Y=GraphicsWindow.mouseY Shapes.Move(Emitter,Mouse_X-25,Mouse_Y) If Mouse.IsLeftButtonDown Then Steam_EmitDelay = Steam_EmitDelay + 1 If Steam_EmitDelay = 2 Then SteamEmitter() Steam_EmitDelay = 0 endif endif SteamCode() TextWindow.Clear() TextWindow.WriteLine("Steam Sprites: " + (Steam_New-Steam_Old)) TextWindow.WriteLine("Steam_New: " + Steam_New) TextWindow.WriteLine("Steam_Old: " + Steam_Old) TimeEnd = Clock.ElapsedMilliseconds PassedTime=TimeEnd-TimeStart PerfectDelay = 30-PassedTime If PerfectDelay > 0 Then Program.Delay(PerfectDelay) endif endwhile Sub SteamEmitter Steam_New = Steam_New + 1 Steam[Steam_New] = Shapes.AddImage(Steam_Skin) Shapes.Move(Steam[Steam_New],-1000,-1000) Steam_X[Steam_New] = Mouse_X Steam_Y[Steam_New] = Mouse_Y Steam_WX[Steam_New] = 0.15*(Math.GetRandomNumber(60)-31) Steam_WY[Steam_New] = 0.25*(Math.GetRandomNumber(20)-150) Steam_Opacity[Steam_New] = 100 Steam_Angle[Steam_New] = Math.GetRandomNumber(359) Steam_Zoom[Steam_New] = Math.GetRandomNumber(5) * 0.1 + 0.8 endsub Sub SteamCode For s = Steam_Old+1 To Steam_New if Steam_WY[s] < Steam_Air_Resistance Then Steam_WY[s] = Steam_WY[s] + 1.8 endIf Steam_X[s] = Steam_X[s] + Steam_WX[s] Steam_Y[s] = Steam_Y[s] + Steam_WY[s] Steam_Angle[s] = Steam_Angle[s] + Steam_WX[s] * 1 Steam_Zoom[s] = Steam_Zoom[s] + Math.GetRandomNumber(10)*0.02 Steam_Opacity[s] = Steam_Opacity[s] - 2 Shapes.SetOpacity(Steam[s],Steam_Opacity[s]) If Steam_Opacity[s] <= 0 Then Shapes.Remove(Steam[s]) Steam[s] = "" Steam_X[s] = "" Steam_Y[s] = "" Steam_WX[s] = "" Steam_WY[s] = "" Steam_Opacity[s] = "" Steam_Angle[s] = "" Steam_Zoom[s] = "" Steam_Old = Steam_Old + 1 endif Shapes.Zoom(Steam[s],Steam_Zoom[s],Steam_Zoom[s]) Shapes.Rotate(Steam[s],Steam_Angle[s]) Shapes.Move(Steam[s],Steam_X[s]-35,Steam_Y[s]-35) endfor endsub End>BPV315.sb< Start>BQB498.sb< ' Methane Rotation Anime ' Copyright © 2020 Nonki Takahashi. The MIT License. ' Last update 2020-03-11 GraphicsWindow.Title = "Methane Rotation Anime" Init() atom["H"] = "color=White;size=55;1=32;" atom["C"] = "color=Black;size=85;1=75;2=67;3=60;" atom["O"] = "color=#EE0000;size=76;1=63;2=57;3=53;" sH = atom["H"]["size"] dH = atom["H"][1] sC = atom["C"]["size"] dC = atom["C"][1] root2 = Math.SquareRoot(2) root3 = Math.SquareRoot(3) mol = "CH_4" DrawMolecularName() gw = GraphicsWindow.Width gh = GraphicsWindow.Height v[1][1] = 0 v[2][1] = 0 v[3][1] = 0 param = "name=v0;rows=3;cols=1;" param["init"] = v Matrix_Init() Matrix_Dump() v[1][1] = 1 v[2][1] = -1 v[3][1] = -1 param = "name=v1;rows=3;cols=1;" param["init"] = v Matrix_Init() Vector_Abs() abs_v1 = return arm = 1 CalcArm() k[1][1] = (dC + dH) / return param = "name=k;rows=1;cols=1;" param["init"] = k ' = (dC + dH) / |v1| Matrix_Init() Matrix_Dump() param = "name1=v1;name2=k;name=v1;" Matrix_Mul() Matrix_Dump() Vector_Abs() buf = buf + "|v1| = " + (Math.Round(return * 100) / 100) + LF DumpBuf() v[1][1] = -1 v[2][1] = 1 v[3][1] = -1 param = "name=v2;rows=3;cols=1;" param["init"] = v Matrix_Init() arm = 2 CalcArm() param = "name1=v2;name2=k;name=v2;" Matrix_Mul() Matrix_Dump() v[1][1] = -1 v[2][1] = -1 v[3][1] = 1 param = "name=v3;rows=3;cols=1;" param["init"] = v Matrix_Init() arm = 3 CalcArm() param = "name1=v3;name2=k;name=v3;" Matrix_Mul() Matrix_Dump() v[1][1] = 1 v[2][1] = 1 v[3][1] = 1 param = "name=v4;rows=3;cols=1;" param["init"] = v Matrix_Init() arm = 4 CalcArm() param = "name1=v4;name2=k;name=v4;" Matrix_Mul() Matrix_Dump() DrawMolecule() α = 0 β = Math.GetRadians(10) γ = 0 m[1][1] = Math.Cos(β) * Math.Cos(γ) m[1][2] = Math.Sin(α) * Math.Sin(β) * Math.Cos(γ) - Math.Cos(α) * Math.Sin(γ) m[1][3] = Math.Sin(α) * Math.Sin(γ) + Math.Cos(α) * Math.Sin(β) * Math.Cos(γ) m[2][1] = Math.Cos(β) * Math.Sin(γ) m[2][2] = Math.Sin(α) * Math.Sin(β) * Math.Sin(γ) + Math.Cos(α) * Math.Cos(γ) m[2][3] = -Math.Sin(α) * Math.Cos(γ) + Math.Cos(α) * Math.Sin(β) * Math.Sin(γ) m[3][1] = -Math.Sin(β) m[3][2] = Math.Sin(α) * Math.Cos(β) m[3][3] = Math.Cos(α) * Math.Cos(β) param = "name=R;rows=3;cols=3;" param["init"] = m Matrix_Init() Matrix_Dump() While "True" Program.Delay(200) Rotate() ClearMolecule() DrawMolecule() EndWhile Sub CalcArm ' param abs_v1 - |v1| vs = arm * 2 + 3 ve = arm * 2 + 4 f[1][1] = (sC / 2) / abs_v1 param = "name=f;rows=1;cols=1;" param["init"] = f Matrix_Init() param = "name1=v" + arm + ";name2=f;name=v" + vs + ";" Matrix_Mul() xa = matrix["v" + arm]["values"][1][1] ya = matrix["v" + arm]["values"][2][1] xs = matrix["v" + vs]["values"][1][1] ys = matrix["v" + vs]["values"][2][1] f[1][1] = (dC + dH - sH / 2) / abs_v1 param = "name=f;rows=1;cols=1;" param["init"] = f Matrix_Init() param = "name1=v" + arm + ";name2=f;name=v" + ve + ";" Matrix_Mul() xe = matrix["v" + ve]["values"][1][1] ye = matrix["v" + ve]["values"][2][1] EndSub Sub ClearMolecule GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FillRectangle(0, 0, gw, gh) DrawMolecularName() EndSub Sub DrawArm ' draw arm name1 = "v" + (i * 2 + 3) entry1 = matrix[name1] values1 = entry1["values"] x1 = values1[1][1] y1 = values1[2][1] name2 = "v" + (i * 2 + 4) entry2 = matrix[name2] values2 = entry2["values"] x2 = values2[1][1] y2 = values2[2][1] GraphicsWindow.PenColor = "Gray" GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawLine(gw / 2 + x1, gh / 2 + y1, gw / 2 + x2, gh / 2 + y2) EndSub Sub DrawMolecule ' insert sort for drawing order order = "" order[-1] = 0 ' start order[0] = -1 ' end For j = 1 To 4 param = "" _i = -1 i = order[-1] gt = "True" While gt And (-1 < i) param["name1"] = "v" + i param["name2"] = "v" + j Vector_Comp() If gt Then _i = i ' last i i = order[i] EndIf EndWhile ' insert vj before vi (or end) order[_i] = j order[j] = i EndFor ' draw atoms i = -1 i = order[i] n = 0 buf = buf + "drawing order" + LF v0done = "False" While -1 < i vertex = "v" + i If vertex = "v0" Then ' draw C a = "C" v0done = "True" Else ' draw H a = "H" EndIf size = atom[a]["size"] entry = matrix[vertex] values = entry["values"] x = values[1][1] y = values[2][1] If a = "C" Then ' draw shadow GraphicsWindow.BrushColor = "#11000000" GraphicsWindow.FillRectangle(0, 0, gw, gh) EndIf If v0done And (a = "H") Then DrawArm() EndIf GraphicsWindow.BrushColor = atom[a]["color"] n = n + 1 GraphicsWindow.FillEllipse(gw / 2 + x - size / 2, gh / 2 + y - size / 2, size, size) buf = buf + n + " : " + vertex + LF If Not[v0done] And (a = "H") Then DrawArm() EndIf i = order[i] EndWhile DumpBuf() EndSub Sub DrawMolecularName GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" x = 30 For p = 1 To Text.GetLength(mol) c = Text.GetSubText(mol, p, 1) If c = "_" Then y = 35 p = p + 1 fs = 20 c = Text.GetSubText(mol, p, 1) Else y = 20 fs = 30 EndIf GraphicsWindow.FontSize = fs GraphicsWindow.DrawText(x, y, c) x = x + fs * 0.7 EndFor EndSub Sub DumpBuf Shapes.SetText(console, buf) EndSub Sub Format ' format value as ###0.00 value = value * 1 dot = Text.GetIndexOf(value, DECIMAL) If 0 < dot Then value = Math.Round(value * 100) / 100 Else value = Text.Append(value, ".") EndIf dot = Text.GetIndexOf(value, DECIMAL) len = Text.GetLength(value) If len < dot + 2 Then value = Text.Append(value, Text.GetSubText("00", 1, dot + 2 - len)) EndIf len = Text.GetLength(value) If len < 7 Then value = Text.Append(Text.GetSubText(" ", 1, 7 - len), value) EndIf EndSub Sub Init Not = "False=True;True=False;" DECIMAL = "." LF = Text.GetCharacter(10) space = " " For l = 3 To 10 space = space + " " sp[l] = space EndFor GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontName = "Consolas" GraphicsWindow.FontSize = 12 console = Shapes.AddText("") gw = GraphicsWindow.Width gh = GraphicsWindow.Height Shapes.Move(console, gw - 150, 10) buf = "" EndSub Sub Rotate buf = "" param = "name1=R;" For vi = 1 To 12 param["name2"] = "v" + vi param["name"] = "v" + vi Matrix_Mul() If vi <= 4 Then Matrix_Dump() EndIf EndFor EndSub Sub Matrix_Add ' add two matrices ' param["name1"] - left matrix name ' param["name2"] - right matrix name ' param["name"] - matrix name to return name1 = param["name1"] entry1 = matrix[name1] cols1 = entry1["cols"] rows1 = entry1["rows"] name2 = param["name2"] entry2 = matrix[name2] cols2 = entry2["cols"] rows2 = entry2["rows"] If (cols1 = rows1) And (cols2 = rows2) Then values1 = entry1["values"] values2 = entry2["values"] values = "" For col = 1 To cols1 For row = 1 To rows1 values[row][col] = values1[row][col] + values2[row][col] EndFor EndFor name = param["name"] Stack.PushValue("local", param) param = "" param["name"] = name param["cols"] = cols1 param["rows"] = rows1 param["init"] = values Matrix_Init() param = Stack.PopValue("local") Else If rows1 <> rows2 Then msg = "Matrix " + name1 + " has " + rows1 + "row[s]," msg = LF + "but matrix " + name2 + " has " + rows2 + "row[s]" EndIf If cols1 <> cols2 Then msg = "Matrix " + name1 + " has " + cols1 + "column[s]," msg = LF + "but matrix " + name2 + " has " + cols2 + "column[s]" EndIf GraphicsWindow.ShowMessage(msg, "Matrix_Add Error") EndIf EndSub Sub Matrix_Dump ' param["name"] - matrix name to set name = param["name"] entry = matrix[name] rows = entry["rows"] cols = entry["cols"] values = entry["values"] left = name + " = " For row = 1 To rows buf = buf + left If row = 1 Then left = sp[Text.GetLength(left)] EndIf For col = 1 To cols value = values[row][col] Format() buf = buf + value If col < cols Then buf = buf + " " EndIf EndFor buf = buf + LF DumpBuf() EndFor EndSub Sub Matrix_Init ' param["name"] - matrix name to initialize ' param["rows"] - number of rows ' param["cols"] - number of columns ' param["init"] - initial data array name = param["name"] rows = param["rows"] cols = param["cols"] init = param["init"] _init = "" _rows = Array.GetItemCount(init) _row = Array.GetAllIndices(init) For j = 1 To _rows row = _row[j] _cols = Array.GetItemCount(init[row]) _col = Array.GetAllIndices(init[row]) For i = 1 To _cols col = _col[i] _init[row][col] = init[row][col] EndFor EndFor entry["rows"] = rows entry["cols"] = cols entry["values"] = _init matrix[name] = entry EndSub Sub Matrix_Mul ' multiply two matrices ' param["name1"] - left matrix name ' param["name2"] - right matrix name ' param["name"] - matrix name to return name1 = param["name1"] entry1 = matrix[name1] cols1 = entry1["cols"] rows1 = entry1["rows"] name2 = param["name2"] entry2 = matrix[name2] cols2 = entry2["cols"] rows2 = entry2["rows"] If cols1 = rows2 Then values1 = entry1["values"] values2 = entry2["values"] values = "" For col = 1 To cols2 For row = 1 To rows1 For i = 1 To cols1 values[row][col] = values[row][col] + values1[row][i] * values2[i][col] EndFor EndFor EndFor name = param["name"] Stack.PushValue("local", param) param = "" param["name"] = name param["cols"] = cols2 param["rows"] = rows1 param["init"] = values Matrix_Init() param = Stack.PopValue("local") Else msg = "Matrix " + name1 + " has " + cols1 + "column[s]," msg = msg + LF + "but matrix " + name2 + " has " + rows2 + "row[s]" GraphicsWindow.ShowMessage(msg, "Matrix_Mul Error") EndIf EndSub Sub Vector_Abs ' calculate vector length ' param["name"] - 1×n matrix for vector ' return - vector length name = param["name"] entry = matrix[name] cols = entry["cols"] If cols = 1 Then values = entry["values"] return = 0 For row = 1 To entry["rows"] return = return + Math.Power(values[row][1], 2) EndFor return = Math.SquareRoot(return) Else msg = "Vector " + name + " has " + cols + "columns" GraphicsWindow.ShowMessage(msg, "Vector_Abs Error") EndIf EndSub Sub Vector_Comp ' param["name1"] - v1 name to compare ' param["name2"] - v2 name to compare ' return le - "True" if v1 <= v2 ' return lt - "True" if v1 < v2 ' return eq - "True" if v1 = v2 ' return ge - "True" if v1 >= v2 ' return gt - "True" if v1 > v2 name1 = param["name1"] name2 = param["name2"] entry1 = matrix[name1] entry2 = matrix[name2] cols1 = entry1["cols"] cols2 = entry2["cols"] rows1 = entry1["rows"] rows2 = entry2["rows"] If cols1 <> 1 Then msg = "Vector " + name1 + " has " + cols1 + "columns" GraphicsWindow.ShowMessage(msg, "Vector_Comp Error") ElseIf rows1 <> 3 Then msg = "Vector " + name1 + " has " + rows1 + "row[s]" GraphicsWindow.ShowMessage(msg, "Vector_Comp Error") ElseIf cols2 <> 1 Then msg = "Vector " + name2 + " has " + cols2 + "columns" GraphicsWindow.ShowMessage(msg, "Vector_Comp Error") ElseIf rows2 <> 3 Then msg = "Vector " + name1 + " has " + rows2 + "row[s]" GraphicsWindow.ShowMessage(msg, "Vector_Comp Error") Else values1 = entry1["values"] values2 = entry2["values"] z1 = values1[3][1] z2 = values2[3][1] lt = "False" le = "False" eq = "False" gt = "False" ge = "False" If z1 < z2 Then lt = "True" le = "True" ElseIf z1 = z2 Then y1 = values1[2][1] y2 = values2[2][1] If y1 < y2 Then gt = "True" ge = "True" ElseIf y1 = y2 Then x1 = values1[1][1] x2 = values2[1][1] If x1 < x2 Then gt = "True" ge = "True" ElseIf x1 = x2 Then le = "True" eq = "True" ge = "True" Else ' x1 > x2 le = "True" lt = "True" EndIf Else ' y1 > y2 le = "True" lt = "True" EndIf Else ' z1 > z2 gt = "True" ge = "True" EndIf EndIf EndSub End>BQB498.sb< Start>BQD248.sb< '-------------------------------------------step 1----------------------------------------------------------------------- gw = 900 gh = 600 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Top = 10 GraphicsWindow.Left = (Desktop.Width - gw) / 2 'centres window in the middle of the screen GraphicsWindow.Title = "Show What You Know - Curriculum 3.4: Events & Interactivity" GraphicsWindow.CanResize = "false" GraphicsWindow.PenWidth = 3 GraphicsWindow.DrawRectangle(5, 5, gw, gh - 150) GraphicsWindow.DrawRectangle(5, gh-137, 225, 140) GraphicsWindow.DrawRectangle(5+8+225, gh-137, 225, 140) GraphicsWindow.DrawRectangle(5+(8*2)+(225*2), gh-137, 225, 140) GraphicsWindow.DrawRectangle(5+(8*3)+(225*3), gh-137, 200, 140) '-------------------------------------------step 2------------------------------------------------------------------------ 'caption is an Array caption = "1=Triangle;2=Rectangle;3=Circle;4=Rotate;5=Zoom;6=Draw;7=Clear;8=Exit" For i = 1 To 3 button[i] = Controls.AddButton(caption[i], (225-180)/2, (gh-130)+((i-1)*43)) Controls.SetSize(button[i], 180, 38) EndFor posX = "1=253;2=363;3=488;4=598;5=763" 'I just set these using trial & error For i = 4 To 8 button[i] = Controls.AddButton(caption[i], posX[i-3], gh-105) Controls.SetSize(button[i], 80, 80) EndFor End>BQD248.sb< Start>BQJ639.sb< GraphicsWindow.Width=800 GraphicsWindow.Height=900 GraphicsWindow.Left=5 GraphicsWindow.Top=5 GraphicsWindow.Title="Text Sensing tt="T.h.e. .a.u.t.u.m.n. .l.e.a.v.e.s. .a.r.e. .f.a.l.l.i.n.g. .d.o.w.n. .t.o. .s.t.r.e.e.t.:. .L.o.r.e.m. .i.p.s.u.m. .d.o.l.o.r. .s.i.t. .a.m.e.n.t. .n.o.n.n.u.m. .u.n.a.m. .e.i.u.n.m.o.d.:. " GraphicsWindow.PenWidth=0 cc[1]=LDText.Split (tt ".") ww= Array.GetItemCount (cc[1]) cc[1]=ldtext.Replace (cc[1] ":" ".") GraphicsWindow.FontName="Calibri GraphicsWindow.FontSize=22 GraphicsWindow.BrushColor=LDColours.HSLtoRGB (30 .8 .2) GraphicsWindow.FillRectangle (0 0 1200 1000) GraphicsWindow.BrushColor="black ee=Shapes.AddEllipse (300 300) Shapes.Move (ee 300 70) ee1=LDShapes .AddStar (15 160 200) Shapes.Move (ee1 250 500) ii=LDGraphicsWindow.Capture ("" "false") Shapes.zoom (ee .8 .8) Shapes.Move (ee 306 78) LDEffect.DropShaddow (ee "") Shapes.zoom (ee1 .8 .8) Shapes.Move (ee1 260 508) ff=.9 px=30 For r=1 To ww c[1][r]=ldtext.GetWidth(cc[1][r]) Program.Delay (5) EndFor gw= 1000 GraphicsWindow.BrushColor="white py=40 px=170 For y=1 To 5 ci=1 r=1 while r<= ww ll=LDImage.GetPixel (ii px py) if ll="#FF000000" or px>400 then If cc[1][r]=" " or cc[1][r+1]=" " then r=r+1 Goto xxx elseIf cc[1][r+1]="." or cc[1][r]="." then GraphicsWindow.DrawText (px py ".") r=r+1 Goto xxx else If cc[1][r]=" " then else GraphicsWindow.DrawText (px py "-") endif px=170 py=py+40 Goto xxx endif px=170 py=py+40 endif If cc[1][r]=" " and px=170 Then 'skip space at begin of row else GraphicsWindow.DrawText (px py cc[1][r]) px=px+c[1][r] r=r+1 endif xxx: EndWhile EndFor px=460 py=40 For y=1 To 5 ci=1 r=1 while r<= ww ll=LDImage.GetPixel (ii px py) while ll="#FF000000" px=px+5 ll=LDImage.GetPixel (ii px py) EndWhile If px>750 then If cc[1][r]=" " or cc[1][r+1]=" " then r=r+1 Goto xxx1 elseIf cc[1][r+1]="." or cc[1][r]="." then GraphicsWindow.DrawText (px py ".") r=r+1 Goto xxx1 else If cc[1][r]=" " then else GraphicsWindow.DrawText (px py "-") endif px=460 py=py+40 Goto xxx1 endif px=460 py=py+40 endif If cc[1][r]=" " and px=460 Then 'skip space at begin of row else GraphicsWindow.DrawText (px py cc[1][r]) px=px+c[1][r] r=r+1 endif xxx1: EndWhile EndFor ii=ImageList.LoadImage (Flickr.GetRandomPicture ("leaf")) bi= LDShapes.BrushImage (ii) LDShapes.BrushShape (ee bi) ldshapes.BrushShape (ee1 LDShapes.BrushGradient ("1=red;2=gold" "R")) End>BQJ639.sb< Start>BQJ710-0.sb< ' Calc v0.2 - (C) 2011 Nonki Takahashi ' ' History ' 2010/03/06 v0.1 Graphic design completed (191 lines BQJ710) ' 2010/03/09 v0.2 Created syntax analysis (519 lines BQJ710-0) ' ' Naming convention ' class Xxx_ ' label lXxx ' constant XXX ' variable type integer iXxx ' variable type real rXxx ' variable type string sXxx ' variable type url uXxx ' variable type char cXxx ' variable type boolean bXxx ' variable type object oXxx ' ' Main Body_Init() Lex_Init() Body_Draw() While "True" Button_InputKey() Calc_EvalExp() EndWhile ' ' Body | Initialization Sub Body_Init VERSION = "02" ' v0.2 TYPE = "B" ' beta version Calc_sExp = "" Calc_iAns = 0 Body_iWidth = 300 Body_iHeight = 400 Body_sFontName = "Arial" Body_iFontSize = 14 LCD_iWX0 = 35 ' LCD window size LCD_iWX1 = 265 LCD_iWY0 = 80 LCD_iWY1 = 130 LCD_sFontName = "Consolas" LCD_iFontSize = 30 LCD_iEX0 = LCD_iWX0 + 15 LCD_iEY0 = LCD_iWY0 + 15 Button_iX0 = LCD_iWX0 - 20 Button_iY0 = LCD_iWY1 + 50 Button_iX1 = LCD_iWX1 + 20 Button_iY1 = LCD_iWY1 + 400 Button_iWidth = 60 Button_iHeight = 30 Button_iGX = Math.Floor(((Button_iX1 - Button_iX0) - Button_iWidth * 4) / 3) Button_iGY = Math.Floor(((Button_iY1 - Button_iY0) - Button_iWidth * 5) / 4) Button_idX = Button_iWidth + Button_iGX Button_idY = Button_iHeight + Button_iGY Button_sKey[1][1] = "AC" Button_sKey[2][1] = "BS" Button_sKey[3][1] = "ANS" Button_sKey[4][1] = "/" Button_sKey[1][2] = "7" Button_sKey[2][2] = "8" Button_sKey[3][2] = "9" Button_sKey[4][2] = "*" Button_sKey[1][3] = "4" Button_sKey[2][3] = "5" Button_sKey[3][3] = "6" Button_sKey[4][3] = "-" Button_sKey[1][4] = "1" Button_sKey[2][4] = "2" Button_sKey[3][4] = "3" Button_sKey[4][4] = "+" Button_sKey[1][5] = "0" Button_sKey[2][5] = "." Button_sKey[3][5] = "EXE" Button_iX[1][1] = 14 ' "AC" Button_iX[2][1] = 14 ' "BS" Button_iX[3][1] = 8 ' "ANS" Button_iX[4][1] = 22 ' "/" Button_iX[1][2] = 18 ' "7" Button_iX[2][2] = 18 ' "8" Button_iX[3][2] = 18 ' "9" Button_iX[4][2] = 20 ' "*" Button_iX[1][3] = 18 ' "4" Button_iX[2][3] = 18 ' "5" Button_iX[3][3] = 18 ' "6" Button_iX[4][3] = 21 ' "-" Button_iX[1][4] = 18 ' "1" Button_iX[2][4] = 18 ' "2" Button_iX[3][4] = 18 ' "3" Button_iX[4][4] = 18 ' "+" Button_iX[1][5] = 18 ' "0" Button_iX[2][5] = 20 ' "." Button_iX[3][5] = 40 ' "EXE" EndSub ' ' Body | Draw Sub Body_Draw GraphicsWindow.Width = Body_iWidth GraphicsWindow.Height = Body_iHeight GraphicsWindow.BrushColor = "Gainsboro" ' body color GraphicsWindow.FillRectangle(0, 0, Body_iWidth, Body_iHeight) GraphicsWindow.FontName = "Arial Black" GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.DrawText(15, 10, "NONKI") GraphicsWindow.FontName = Body_sFontName GraphicsWindow.FontSize = Body_iFontSize GraphicsWindow.DrawText(15, 34, "CA-" + VERSION + TYPE) GraphicsWindow.DrawText(220, 10, "12 DIGITS") LCD_Draw() Button_DrawNumKeys() EndSub ' ' Button | Draw num keys Sub Button_DrawNumKeys GraphicsWindow.FontName = Body_sFontName GraphicsWindow.FontSize = Body_iFontSize For iRow = 1 To 5 iY = Button_iY0 + (iRow - 1) * Button_idY For iCol = 1 To 4 iX = Button_iX0 + (iCol - 1) * Button_idX bPushed = "False" If iCol = 4 And iRow = 5 Then ElseIf iCol = 3 And iRow = 5 Then bLong = "True" Button_DrawNumKey() Else bLong = "False" Button_DrawNumKey() EndIf EndFor EndFor EndSub ' ' Button | Draw num key ' in: iX, iY - key possition ' in: iCol, iRow - key index ' in: bPushed - flag key pushed ' in: bLong - flag key size is long Sub Button_DrawNumKey If bLong Then iWidth = Button_iWidth * 2 + Button_iGX Else iWidth = Button_iWidth EndIf GraphicsWindow.BrushColor = "DimGray" ' button frame color GraphicsWindow.FillRectangle(iX, iY, iWidth, Button_iHeight) If iCol = 1 And iRow = 1 Then GraphicsWindow.BrushColor = "Chocolate" ' button shadow color 2 Else GraphicsWindow.BrushColor = "Black" ' button shadow color 1 EndIf iDX0 = iX + 6 iDY0 = iY + 6 iDX1 = iDX0 + iWidth - 10 iDY1 = iDY0 + Button_iHeight - 10 GraphicsWindow.FillRectangle(iDX0, iDY0, iDX1 - iDX0, iDY1 - iDY0) If bPushed Then iPX = 8 iPY = 8 Else iPX = 4 iPY = 4 EndIf iUX0 = iX + iPX - 4 iUX1 = iUX0 + iWidth - 10 iUY0 = iY + iPY - 4 iUY1 = iUY0 + Button_iHeight - 10 GraphicsWindow.FillTriangle(iUX1, iUY0, iUX1, iDY0, iDX1, iDY0) GraphicsWindow.FillTriangle(iUX0, iUY1, iDX0, iUY1, iDX0, iDY1) If iCol = 1 And iRow = 1 Then GraphicsWindow.BrushColor = "DarkOrange" ' button surface color 2 Else GraphicsWindow.BrushColor = "DimGray" ' button surface color 1 EndIf GraphicsWindow.FillRectangle(iUX0, iUY0, iUX1 - iUX0, iUY1 - iUY0) GraphicsWindow.BrushColor = "White" ' button digit color GraphicsWindow.DrawText(iX + iPX + Button_iX[iCol][iRow], iY + iPY, Button_sKey[iCol][iRow]) EndSub ' ' Button | Input key ' out: Calc_sExp - expression input Sub Button_InputKey bExe = "False" bFirst = "True" While bExe = "False" Button_bOutOfBoard = "True" While Button_bOutOfBoard GraphicsWindow.MouseDown = Button_OnMouseDown Button_bNotClicked = "True" While Button_bNotClicked Program.Delay(200) EndWhile GraphicsWindow.MouseDown = Button_DoNothing Button_GetPosition() EndWhile sKey = Button_sKey[iCol][iRow] GraphicsWindow.FontName = Body_sFontName GraphicsWindow.FontSize = Body_iFontSize iX = Button_iX0 + (iCol - 1) * Button_idX iY = Button_iY0 + (iRow - 1) * Button_idY bPushed = "True" If iCol = 4 And iRow = 5 Then ElseIf iCol = 3 And iRow = 5 Then bLong = "True" Button_DrawNumKey() Else bLong = "False" Button_DrawNumKey() EndIf If sKey = "AC" Then Calc_sExp = "" ElseIf sKey = "ANS" Then Calc_sExp = Text.Append(Calc_sExp, Calc_iAns) ElseIf sKey = "EXE" Then bExe = "True" ElseIf sKey = "BS" Then iLen = Text.GetLength(Calc_sExp) If iLen > 0 Then Calc_sExp = Text.GetSubText(Calc_sExp, 1, iLen - 1) EndIf Else If bFirst Then bFirst = "False" iCode = Text.GetCharacterCode(sKey) If iCode >= DIGIT0 And iCode <= DIGIT9 Or sKey = "." Then Calc_sExp = "" EndIf EndIf Calc_sExp = Text.Append(Calc_sExp, sKey) EndIf Program.Delay(100) bPushed = "False" Button_DrawNumKey() LCD_Draw() EndWhile EndSub ' ' Button | Get board position from mouse position ' out: iCol, iRow - next move position ' out: Button_bOutOfBoard - mouse clicked out of board / captured slot Sub Button_GetPosition iCol = Math.Floor((Button_iMX - Button_iX0) / Button_idX) + 1 iRow = Math.Floor((Button_iMY - Button_iY0) / Button_idY) + 1 iColOffset = Math.Remainder((Button_iMX - Button_iX0), Button_idX) iRowOffset = Math.Remainder((Button_iMY - Button_iY0), Button_idY) Button_bOutOfBoard = "False" If iCol = 3 And iRow = 5 Then iColOffset = 0 ElseIf iCol = 4 And iRow = 5 Then iCol = 3 EndIf If iCol < 1 Or iCol > 4 Or iRow < 1 Or iRow > 5 Or iColOffset > Button_iWidth Or iRowOffset > Button_iHeight Then Button_bOutOfBoard = "True" EndIf EndSub ' ' Button | Get mouse position ' out: Button_iMX, Button_iMY - clicked mouse position ' out: Button_bNotClicked - flag Sub Button_OnMouseDown Button_iMX = GraphicsWindow.MouseX Button_iMY = GraphicsWindow.MouseY Button_bNotClicked = "False" EndSub ' ' Button | Do nothing Sub Button_DoNothing EndSub ' ' Calc | Evaluate expression Sub Calc_EvalExp TextWindow.WriteLine(Calc_sExp) sBuf = Calc_sExp iBufPtr = 1 Parse_GetExpression() Calc_sExp = rNum Calc_iAns = Calc_sExp LCD_Draw() TextWindow.WriteLine(Calc_sExp) EndSub ' ' LCD | Draw Sub LCD_Draw iWidth = LCD_iWX1 - LCD_iWX0 iHeight = LCD_iWY1 - LCD_iWY0 GraphicsWindow.BrushColor = "DimGray" ' LCD frame color GraphicsWindow.FillRectangle(LCD_iWX0 - 20, LCD_iWY0 - 15, iWidth + 40, iHeight + 30) GraphicsWindow.FontName = LCD_sFontName GraphicsWindow.FontSize = LCD_iFontSize iEnd = Text.GetLength(Calc_sExp) - 11 If iEnd < 1 Then iEnd = 1 EndIf For i = 1 To iEnd GraphicsWindow.BrushColor = "DarkKhaki" ' LCD color GraphicsWindow.FillRectangle(LCD_iWX0, LCD_iWY0, iWidth, iHeight) GraphicsWindow.BrushColor = "Black" ' LCD digits color GraphicsWindow.DrawText(LCD_iEX0, LCD_iEY0, Text.GetSubText(Calc_sExp, i, 12)) Program.Delay(100) EndFor EndSub ' ' Lex | Initialization ' out: DIGIT0, DIGIT9 - char code for "0", "9" Sub Lex_Init DIGIT0 = Text.GetCharacterCode("0") DIGIT9 = Text.GetCharacterCode("9") EndSub ' ' Lex | Get digit ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: cDigit - digit ' out: bMatched - is digit Sub Lex_GetDigit cDigit = Text.GetSubText(sBuf, iBufPtr, 1) iCode = Text.GetCharacterCode(cDigit) If iCode >= DIGIT0 And iCode <= DIGIT9 Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub ' ' Lex | Get decimal point ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' work: c - decimal point ' out: bMatched - is add operator Sub Lex_GetDecimalPoint c = Text.GetSubText(sBuf, iBufPtr, 1) If c = "." Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub ' ' Lex | Get add operator ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: cOp - operator "+" of "-" ' out: bMatched - is add operator Sub Lex_GetAddOperator cOp = Text.GetSubText(sBuf, iBufPtr, 1) If cOp = "+" Or cOp = "-" Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub ' ' Lex | Get multiply operator ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: cOp - operator "*" of "/" ' out: bMatched - is multiply operator Sub Lex_GetMultiplyOperator cOp = Text.GetSubText(sBuf, iBufPtr, 1) If cOp = "*" Or cOp = "/" Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub ' ' Parse | Get number ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: cOp - operator "*" of "/" ' out: bMatched - is number Sub Parse_GetNumber Parse_GetReal() If bMatched = "False" Then Parse_GetInteger() EndIf EndSub ' ' Parse | Get integer ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: rNum - operator "*" of "/" ' out: bMatched - is number Sub Parse_GetInteger iSign = 1 bReturn = "False" Lex_GetAddOperator() While bMatched If cOp = "-" Then iSign = iSign * -1 EndIf Lex_GetAddOperator() EndWhile rNum = 0 Lex_GetDigit() If bMatched Then bReturn = "True" EndIf While bMatched rNum = rNum * 10 + cDigit Lex_GetDigit() EndWhile rNum = iSign * rNum bMatched = bReturn EndSub ' ' Parse | Get real ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: rNum - operator "*" of "/" ' out: bMatched - is number Sub Parse_GetReal iSavedPtr = iBufPtr bDig1 = "False" bDP = "False" bDig2 = "False" iSign = 1 Lex_GetAddOperator() While bMatched If cOp = "-" Then iSign = iSign * -1 EndIf Lex_GetAddOperator() EndWhile rNum = 0 Lex_GetDigit() If bMatched Then bDig1 = "True" EndIf While bMatched rNum = rNum * 10 + cDigit Lex_GetDigit() EndWhile Lex_GetDecimalPoint() If bMatched Then bDP = "True" EndIf If bMatched Then rFrac = 0.1 Lex_GetDigit() If bMatched Then bDig2 = "True" EndIf While bMatched rNum = rNum + rFrac * cDigit rFrac = rFrac * 0.1 Lex_GetDigit() EndWhile Else ' decimal point not found iBufPtr = iSavedPtr EndIf rNum = iSign * rNum If (bDig1 And bDP) Or (bDP And bDig2) Then bMatched = "True" EndIf EndSub ' ' Parse | Get term ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: rNum - value of term ' out: bMatched - is term Sub Parse_GetTerm bReturn = "False" Parse_GetNumber() If bMatched Then bReturn = "True" EndIf rNum1 = rNum While bMatched Lex_GetMultiplyOperator() cOp1 = cOp If bMatched Then Parse_GetNumber() If bMatched And (cOp1 = "*") Then rNum = rNum1 * rNum rNum1 = rNum ElseIf bMatched And (cOp1 = "/") Then rNum = rNum1 / rNum rNum1 = rNum EndIf EndIf EndWhile bMatched = bReturn EndSub ' ' Parse | Get expression ' in: sBuf - buffer ' in/out: iBufPtr - buffer pointer ' out: rNum - value of expression ' out: bMatched - is term Sub Parse_GetExpression bReturn = "False" Parse_GetTerm() If bMatched Then bReturn = "True" EndIf rNum2 = rNum While bMatched Lex_GetAddOperator() cOp2 = cOp If bMatched Then Parse_GetTerm() If bMatched And (cOp2 = "+") Then rNum = rNum2 + rNum rNum2 = rNum ElseIf bMatched And (cOp2 = "-") Then rNum = rNum2 - rNum rNum2 = rNum EndIf EndIf EndWhile bMatched = bReturn EndSub End>BQJ710-0.sb< Start>BQJ710-3.sb< ' Calc 04B ' Copyright (c) 2011-2014 Nonki Takahashi. ' ' Lisence: ' The MIT Lisence (MIT) ' http://en.wikipedia.org/wiki/MIT_License ' ' History: ' 04B 2014-05-15 Added workaround for the known issue 21694 (512 lines BQJ710-3) ' 0.3b 2010-10-12 Twice scale version (521 lines BQJ710-2) ' 0.2b 2010-03-09 Created syntax analysis (519 lines BQJ710-0) ' 0.1 2010-03-06 Graphic design completed (191 lines BQJ710) ' ' Naming convention: ' class Xxx_ ' label lXxx ' constant XXX ' variable type integer iXxx ' variable type real rXxx ' variable type string sXxx ' variable type url uXxx ' variable type char cXxx ' variable type boolean bXxx ' variable type object oXxx ' ' Main SB_Workaround() Body_Init() Lex_Init() Body_Draw() While "True" Button_InputKey() Calc_EvalExp() EndWhile Sub Body_Init ' Body | Initialization VERSION = "04" TYPE = "B" ' beta version Calc_sExp = "" Calc_iAns = 0 Body_iWidth = 300 Body_iHeight = 400 Body_sFontName = "Arial" Body_iFontSize = 14 LCD_iWX0 = 35 ' LCD window size LCD_iWX1 = 265 LCD_iWY0 = 80 LCD_iWY1 = 130 LCD_sFontName = "Consolas" LCD_iFontSize = 30 LCD_iEX0 = LCD_iWX0 + 15 LCD_iEY0 = LCD_iWY0 + 15 Button_iX0 = LCD_iWX0 - 20 Button_iY0 = LCD_iWY1 + 50 Button_iX1 = LCD_iWX1 + 20 Button_iY1 = LCD_iWY1 + 400 Button_iWidth = 60 Button_iHeight = 30 Button_iGX = Math.Floor(((Button_iX1 - Button_iX0) - Button_iWidth * 4) / 3) Button_iGY = Math.Floor(((Button_iY1 - Button_iY0) - Button_iWidth * 5) / 4) Button_idX = Button_iWidth + Button_iGX Button_idY = Button_iHeight + Button_iGY Button_sKey[1] = "1=AC;2=7;3=4;4=1;5=0;" Button_sKey[2] = "1=BS;2=8;3=5;4=2;5=.;" Button_sKey[3] = "1=ANS;2=9;3=6;4=3;5=EXE;" Button_sKey[4] = "1=/;2=*;3=-;4=+;" Button_iX[1] = "1=14;2=18;3=18;4=18;5=18;" Button_iX[2] = "1=14;2=18;3=18;4=18;5=20;" Button_iX[3] = "1=8;2=18;3=18;4=18;5=40;" Button_iX[4] = "1=22;2=20;3=21;4=18;" EndSub Sub Body_Draw ' Body | Draw GraphicsWindow.Width = Body_iWidth GraphicsWindow.Height = Body_iHeight GraphicsWindow.BrushColor = "Gainsboro" ' body color GraphicsWindow.FillRectangle(0, 0, Body_iWidth, Body_iHeight) GraphicsWindow.FontName = "Arial Black" If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.DrawText(15, 10, "NONKI") GraphicsWindow.FontName = Body_sFontName If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = Body_iFontSize GraphicsWindow.DrawText(15, 34, "CA-" + VERSION + TYPE) GraphicsWindow.DrawText(220, 10, "12 DIGITS") LCD_Draw() Button_DrawNumKeys() EndSub Sub Button_DrawNumKeys ' Button | Draw num keys GraphicsWindow.FontName = Body_sFontName If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = Body_iFontSize For iRow = 1 To 5 iY = Button_iY0 + (iRow - 1) * Button_idY For iCol = 1 To 4 iX = Button_iX0 + (iCol - 1) * Button_idX bPushed = "False" If iCol = 4 And iRow = 5 Then ElseIf iCol = 3 And iRow = 5 Then bLong = "True" Button_DrawNumKey() Else bLong = "False" Button_DrawNumKey() EndIf EndFor EndFor EndSub Sub Button_DrawNumKey ' Button | Draw num key ' param iX, iY - key possition ' param iCol, iRow - key index ' param bPushed - flag key pushed ' param bLong - flag key size is long If bLong Then iWidth = Button_iWidth * 2 + Button_iGX Else iWidth = Button_iWidth EndIf GraphicsWindow.BrushColor = "DimGray" ' button frame color GraphicsWindow.FillRectangle(iX, iY, iWidth, Button_iHeight) If iCol = 1 And iRow = 1 Then GraphicsWindow.BrushColor = "Chocolate" ' button shadow color 2 Else GraphicsWindow.BrushColor = "Black" ' button shadow color 1 EndIf iDX0 = iX + 6 iDY0 = iY + 6 iDX1 = iDX0 + iWidth - 10 iDY1 = iDY0 + Button_iHeight - 10 GraphicsWindow.FillRectangle(iDX0, iDY0, iDX1 - iDX0, iDY1 - iDY0) If bPushed Then iPX = 8 iPY = 8 Else iPX = 4 iPY = 4 EndIf iUX0 = iX + iPX - 4 iUX1 = iUX0 + iWidth - 10 iUY0 = iY + iPY - 4 iUY1 = iUY0 + Button_iHeight - 10 GraphicsWindow.FillTriangle(iUX1, iUY0, iUX1, iDY0, iDX1, iDY0) GraphicsWindow.FillTriangle(iUX0, iUY1, iDX0, iUY1, iDX0, iDY1) If iCol = 1 And iRow = 1 Then GraphicsWindow.BrushColor = "DarkOrange" ' button surface color 2 Else GraphicsWindow.BrushColor = "DimGray" ' button surface color 1 EndIf GraphicsWindow.FillRectangle(iUX0, iUY0, iUX1 - iUX0, iUY1 - iUY0) GraphicsWindow.BrushColor = "White" ' button digit color GraphicsWindow.DrawText(iX + iPX + Button_iX[iCol][iRow], iY + iPY, Button_sKey[iCol][iRow]) EndSub Sub Button_InputKey ' Button | Input key ' return Calc_sExp - expression input bExe = "False" bFirst = "True" While bExe = "False" Button_bOutOfBoard = "True" While Button_bOutOfBoard GraphicsWindow.MouseDown = Button_OnMouseDown Button_bNotClicked = "True" While Button_bNotClicked Program.Delay(200) EndWhile GraphicsWindow.MouseDown = Button_DoNothing Button_GetPosition() EndWhile sKey = Button_sKey[iCol][iRow] GraphicsWindow.FontName = Body_sFontName If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = Body_iFontSize iX = Button_iX0 + (iCol - 1) * Button_idX iY = Button_iY0 + (iRow - 1) * Button_idY bPushed = "True" If iCol = 4 And iRow = 5 Then ElseIf iCol = 3 And iRow = 5 Then bLong = "True" Button_DrawNumKey() Else bLong = "False" Button_DrawNumKey() EndIf If sKey = "AC" Then Calc_sExp = "" ElseIf sKey = "ANS" Then Calc_sExp = Text.Append(Calc_sExp, Calc_iAns) ElseIf sKey = "EXE" Then bExe = "True" ElseIf sKey = "BS" Then iLen = Text.GetLength(Calc_sExp) If iLen > 0 Then Calc_sExp = Text.GetSubText(Calc_sExp, 1, iLen - 1) EndIf Else If bFirst Then bFirst = "False" iCode = Text.GetCharacterCode(sKey) If iCode >= DIGIT0 And iCode <= DIGIT9 Or sKey = "." Then Calc_sExp = "" EndIf EndIf Calc_sExp = Text.Append(Calc_sExp, sKey) EndIf Program.Delay(100) bPushed = "False" Button_DrawNumKey() LCD_Draw() EndWhile EndSub Sub Button_GetPosition ' Button | Get board position from mouse position ' return iCol, iRow - next move position ' return Button_bOutOfBoard - mouse clicked out of board / captured slot iCol = Math.Floor((Button_iMX - Button_iX0) / Button_idX) + 1 iRow = Math.Floor((Button_iMY - Button_iY0) / Button_idY) + 1 iColOffset = Math.Remainder((Button_iMX - Button_iX0), Button_idX) iRowOffset = Math.Remainder((Button_iMY - Button_iY0), Button_idY) Button_bOutOfBoard = "False" If iCol = 3 And iRow = 5 Then iColOffset = 0 ElseIf iCol = 4 And iRow = 5 Then iCol = 3 EndIf If iCol < 1 Or iCol > 4 Or iRow < 1 Or iRow > 5 Or iColOffset > Button_iWidth Or iRowOffset > Button_iHeight Then Button_bOutOfBoard = "True" EndIf EndSub Sub Button_OnMouseDown ' Button | Get mouse position ' return Button_iMX, Button_iMY - clicked mouse position ' return Button_bNotClicked - flag Button_iMX = GraphicsWindow.MouseX Button_iMY = GraphicsWindow.MouseY Button_bNotClicked = "False" EndSub Sub Button_DoNothing ' Button | Do nothing EndSub Sub Calc_EvalExp ' Calc | Evaluate expression TextWindow.WriteLine(Calc_sExp) sBuf = Calc_sExp iBufPtr = 1 Parse_GetExpression() Calc_sExp = rNum Calc_iAns = Calc_sExp LCD_Draw() TextWindow.WriteLine(Calc_sExp) EndSub Sub LCD_Draw ' LCD | Draw iWidth = LCD_iWX1 - LCD_iWX0 iHeight = LCD_iWY1 - LCD_iWY0 GraphicsWindow.BrushColor = "DimGray" ' LCD frame color GraphicsWindow.FillRectangle(LCD_iWX0 - 20, LCD_iWY0 - 15, iWidth + 40, iHeight + 30) GraphicsWindow.FontName = LCD_sFontName If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = LCD_iFontSize iEnd = Text.GetLength(Calc_sExp) - 11 If iEnd < 1 Then iEnd = 1 EndIf For i = 1 To iEnd GraphicsWindow.BrushColor = "DarkKhaki" ' LCD color GraphicsWindow.FillRectangle(LCD_iWX0, LCD_iWY0, iWidth, iHeight) GraphicsWindow.BrushColor = "Black" ' LCD digits color GraphicsWindow.DrawText(LCD_iEX0, LCD_iEY0, Text.GetSubText(Calc_sExp, i, 12)) Program.Delay(100) EndFor EndSub Sub Lex_Init ' Lex | Initialization ' return DIGIT0, DIGIT9 - char code for "0", "9" DIGIT0 = Text.GetCharacterCode("0") DIGIT9 = Text.GetCharacterCode("9") EndSub Sub Lex_GetDigit ' Lex | Get digit ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return cDigit - digit ' return bMatched - is digit cDigit = Text.GetSubText(sBuf, iBufPtr, 1) iCode = Text.GetCharacterCode(cDigit) If iCode >= DIGIT0 And iCode <= DIGIT9 Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub Sub Lex_GetDecimalPoint ' Lex | Get decimal point ' param sBuf - buffer ' param iBufPtr - buffer pointer ' work c - decimal point ' return iBufPtr - updated buffer pointer ' return bMatched - is add operator c = Text.GetSubText(sBuf, iBufPtr, 1) If c = "." Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub Sub Lex_GetAddOperator ' Lex | Get add operator ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return cOp - operator "+" or "-" ' return bMatched - is add operator cOp = Text.GetSubText(sBuf, iBufPtr, 1) If cOp = "+" Or cOp = "-" Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub Sub Lex_GetMultiplyOperator ' Lex | Get multiply operator ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return cOp - operator "*" or "/" ' return bMatched - is multiply operator cOp = Text.GetSubText(sBuf, iBufPtr, 1) If cOp = "*" Or cOp = "/" Then bMatched = "True" iBufPtr = iBufPtr + 1 Else bMatched = "False" EndIf EndSub Sub Parse_GetNumber ' Parse | Get number ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return rNum - value of real or integer ' return bMatched - is number Parse_GetReal() If bMatched = "False" Then Parse_GetInteger() EndIf EndSub Sub Parse_GetInteger ' Parse | Get integer ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return rNum - value of integer ' return bMatched - is integer iSign = 1 bReturn = "False" Lex_GetAddOperator() While bMatched If cOp = "-" Then iSign = iSign * -1 EndIf Lex_GetAddOperator() EndWhile rNum = 0 Lex_GetDigit() If bMatched Then bReturn = "True" EndIf While bMatched rNum = rNum * 10 + cDigit Lex_GetDigit() EndWhile rNum = iSign * rNum bMatched = bReturn EndSub Sub Parse_GetReal ' Parse | Get real ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return rNum - value of real ' return bMatched - is real iSavedPtr = iBufPtr bDig1 = "False" bDP = "False" bDig2 = "False" iSign = 1 Lex_GetAddOperator() While bMatched If cOp = "-" Then iSign = iSign * -1 EndIf Lex_GetAddOperator() EndWhile rNum = 0 Lex_GetDigit() If bMatched Then bDig1 = "True" EndIf While bMatched rNum = rNum * 10 + cDigit Lex_GetDigit() EndWhile Lex_GetDecimalPoint() If bMatched Then bDP = "True" EndIf If bMatched Then rFrac = 0.1 Lex_GetDigit() If bMatched Then bDig2 = "True" EndIf While bMatched rNum = rNum + rFrac * cDigit rFrac = rFrac * 0.1 Lex_GetDigit() EndWhile Else ' decimal point not found iBufPtr = iSavedPtr EndIf rNum = iSign * rNum If (bDig1 And bDP) Or (bDP And bDig2) Then bMatched = "True" EndIf EndSub Sub Parse_GetTerm ' Parse | Get term ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return rNum - value of term ' return bMatched - is term bReturn = "False" Parse_GetNumber() If bMatched Then bReturn = "True" EndIf rNum1 = rNum While bMatched Lex_GetMultiplyOperator() cOp1 = cOp If bMatched Then Parse_GetNumber() If bMatched And (cOp1 = "*") Then rNum = rNum1 * rNum rNum1 = rNum ElseIf bMatched And (cOp1 = "/") Then rNum = rNum1 / rNum rNum1 = rNum EndIf EndIf EndWhile bMatched = bReturn EndSub Sub Parse_GetExpression ' Parse | Get expression ' param sBuf - buffer ' param iBufPtr - buffer pointer ' return iBufPtr - updated buffer pointer ' return rNum - value of expression ' return bMatched - is expression bReturn = "False" Parse_GetTerm() If bMatched Then bReturn = "True" EndIf rNum2 = rNum While bMatched Lex_GetAddOperator() cOp2 = cOp If bMatched Then Parse_GetTerm() If bMatched And (cOp2 = "+") Then rNum = rNum2 + rNum rNum2 = rNum ElseIf bMatched And (cOp2 = "-") Then rNum = rNum2 - rNum rNum2 = rNum EndIf EndIf EndWhile bMatched = bReturn EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub End>BQJ710-3.sb< Start>BQJ912.sb< version = "1.0 Jul 9, 2009 - for SmallBasic 0.5, Daddyo" ' Shows astronomy pictures of the day from http://antwrp.gsfc.nasa.gov/apod/ ' Check out the site yourself to see full information on each image. ' Size of display window width = 1000 height = 700 GraphicsWindow.Hide() GraphicsWindow.BackgroundColor = 0 GraphicsWindow.CanResize = "False" GraphicsWindow.Width = width GraphicsWindow.Height = height GraphicsWindow.Title = "AstroPic" ' Center GraphicsWindow on the desktop GraphicsWindow.Left = Desktop.Width / 2 - width / 2 GraphicsWindow.Top = Desktop.Height / 2 - height / 2 GraphicsWindow.Show() ' Show 1st image manually OnTick() ' Set up periodic timer to show images Timer.Interval = 10000 Timer.Tick = OnTick ' Where the daily web pages are located apodPath = "http://antwrp.gsfc.nasa.gov/apod/" ' Loop forever until user presses escape While GraphicsWindow.LastKey <> "Escape" ' Spend most of our time doing nothing, use delay so ' that PC isn't too busy sitting in While loop Program.Delay(400) EndWhile ' End the program now that we left the While loop Program.End() ' Periodic timer event used to get & display photos Sub OnTick ' Get a random date, returned in randomDate variable CreateRandomDate() 'textwindow.WriteLine(apodPath + "ap" + randomDate + ".html") ' Load the HTML page that contains only text of web page page = Network.GetWebPageContents(apodPath + "ap" + randomDate + ".html") ' Get title of page, example: ' APOD: 2009 July 8 - The Dark River to Antares ' titlePos = Text.GetIndexOf(page, "") + 7 If titlePos > 7 Then title = Text.GetSubTextToEnd(page, titlePos) titlePos = Text.GetIndexOf(title, "") - 2 If titlePos > -1 Then title = Text.GetSubText(title, 1, titlePos) ' Only display if reasonable length, ' otherwise might have an error finding title If Text.GetLength(title) < 100 Then GraphicsWindow.Title = title EndIf EndIf EndIf ' Find picture file path, for example: ' monthToday Then dateFound = "False" ElseIf year = yearToday And month = monthToday And day > dayToday Then dateFound = "False" ' Make sure it's not before the 1st picture available ElseIf year = yearFirst And month < monthFirst Then dateFound = "False" ElseIf year = yearFirst And month = monthFirst And day < dayFirst Then dateFound = "False" Else ' Found a good date! dateFound = "True" EndIf EndWhile ' Convert month & day to 2 digits If Text.GetLength(month) < 2 Then month = Text.Append("0", month) EndIf If Text.GetLength(day) < 2 Then day = Text.Append("0", day) EndIf ' Put together year-month-day string randomDate = Text.Append(Text.GetSubTextToEnd(year, 3), month) randomDate = Text.Append(randomDate, day) EndSub End>BQJ912.sb< Start>BQT156.sb< Init() While Y1 < gh X1 = X1 + deltaX Y1 = Y1 + deltaY If (X1 >= gw - 16 or X1 <= 0) Then deltaX = -deltaX EndIf If (Y1 <= 0) Then deltaY = -deltaY EndIf padX = Shapes.GetLeft(paddle) If (Y1 = gh - 28 and X1 >= padX and X1 <= padX + pw) Then deltaY = -deltaY EndIf If KeyDownEvent = 1 Then KeyDownPress() KeyDownEvent = 0 EndIf Shapes.Move(paddle, ppw, pph) Shapes.Move(ball, X1, Y1) checkBrickCollision() Program.Delay(7) If points >= gw/bw*3 Then GetBricks() sumpoints = sumpoints + points points = 0 Program.Delay(200) X1 = ppw + 20 Y1 = pph - 20 Shapes.Move(ball, X1, Y1) Program.Delay(200) EndIf EndWhile sumpoints = sumpoints + points notice = "Your points = " notice = Text.Append(notice, sumpoints) GraphicsWindow.ShowMessage(notice, "End") Program.End() '**************************************************************************** Sub Init GraphicsWindow.KeyDown = OnKeyDownEvent gw = 660 GraphicsWindow.Width = gw + 300 gh = GraphicsWindow.Height GraphicsWindow.BackgroundColor = "DarkBlue" pw = 120 ph = 12 phh = ph ppw = gw/2 - pw/2 pph = gh - phh W1 = 16 H1 = W1 paddle = Shapes.AddRectangle(pw, ph) Shapes.Move(paddle, ppw, pph) ball = Shapes.AddEllipse(W1, H1) X1 = ppw + 20 Y1 = pph - 20 Shapes.Move(ball, X1, Y1) deltaX = 1 deltaY = 1 rowLength = Math.Floor(gw/50) GetBricks() points = 0 panz = sumpoints + points GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(gw+1, 0, 300,660) GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(gw+10,0,"Points: "+panz) EndSub 'Init Sub OnKeyDownEvent KeyDownEvent = 1 EndSub Sub KeyDownPress LK = GraphicsWindow.LastKey 'TextWindow.WriteLine(LK) If LK = "Up" Then phh = phh + 5 If phh > 200 Then phh = 195 EndIf pph = gh - phh ElseIf LK = "Down" Then phh = phh - 5 If phh > 0 then phh = 5 EndIf pph = gh - phh ElseIf LK = "Right" Then ppw = ppw + 10 If ppw > gw - pw then ppw = gw - pw - 10 EndIf ElseIf LK = "Left" Then ppw = ppw - 10 If ppw < 0 Then ppw = 10 EndIf EndIf EndSub Sub GetBricks bw = 60 bh = bw / 1.6 sx = bw * -1 sy = 30 For i = 1 To gw/bw*3 b[i]["C"] = GraphicsWindow.GetRandomColor() b[i]["W"] = bw b[i]["H"] = bh sx = sx + b[i]["W"] If sx = bw * 11 Then sx = 0 sy = sy + b[i]["H"] EndIf b[i]["X"] = sx b[i]["Y"] = sy GraphicsWindow.BrushColor = b[i]["C"] b[i]["S"] = Shapes.AddRectangle(b[i]["W"],b[i]["H"]) Shapes.SetOpacity(b[i]["S"],80) Shapes.Move(b[i]["S"],b[i]["X"],b[i]["Y"]) EndFor EndSub Sub checkBrickCollision For i = 1 To gw/bw*3 If X1+W1 >= b[i]["X"] And X1 <= b[i]["X"]+b[i]["W"] And Y1+H1 >= b[i]["Y"] And Y1 <= b[i]["Y"]+b[i]["H"] Then ' Bei Kollision mache folgendes Shapes.Remove(b[i]["S"]) b[i]["X"] = -1 b[i]["Y"] = -1 deltaY = -deltaY points = points + 1 panz = sumpoints + points GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(gw+1, 0, 300,20) GraphicsWindow.BrushColor = "White" GraphicsWindow.DrawText(gw+10,0,"Points: "+panz) EndIf EndFor EndSub 'checkBrickCollision End>BQT156.sb< Start>BQT169.sb< ' Write a program to calculate display numbers with either a fixed number of significant figures or fixed number of decimal places. ' august challenge proposed by litdev ' program by yvan leduc, August 3rd 2016 ' program no: GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height = 400 GraphicsWindow.Width = 800 GraphicsWindow.BackgroundColor="blue" GraphicsWindow.brushcolor="black" GraphicsWindow.FONTSIZE=14 GraphicsWindow.DrawBoundText ( 50,50,750,"This program calculate the force gravity of the Earth on the Moon, displays the gross result in conditions that Small Basic allows, then with this program, he converted this huge number in scientific notation in power of 10 with 3 decimal places like precision") GraphicsWindow.FONTSIZE=20 k=(math.Power(10,-11))*6.67384 masse1=(math.Power(10,22))*7.3477 ' moon mass masse2=(math.Power(10,24))*5.9736 ' Earth mass distance=384999 ' mean distance Earh-moon in km ( moy. du Périgée et de l'Apogée de Terre-Lune DONNÉES DE WIKIPÉDIA) Rayon=distance*1000 ' to put KM in meters G1=k*((Masse1)/math.Power(Rayon,2)) ' Newton's gravitational universal formula ( in 2 lines, to avoid overflow error ) G=G1*Masse2 ' Newton's gravitational universal formula notation() FG_rounded=(math.Round(number*1000))/1000 FG_final=(math.Round(FG_rounded*1000))/1000 GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(150, 150, G +" Newtons") GraphicsWindow.DrawText(200, 200, " give this: ") GraphicsWindow.DrawText(250, 250, FG_final + " x 10^"+ x +" Newtons") Sub notation 'la réponse vérifié dans excel est de 198,341,656,327,164,230,000 Newton 'ou 1,98 x 10²⁰ N ( N pour Newton , newton ce sont des kg * mètres * sec ) ' ma methode pour afficher clairment en notation scientifique en base de 10 le résultat x=0 number = math.Round(G) While (number > 10) ' 10 pour avoir par exemple 3,57 et non 0,357 'TextWindow.WriteLine(number + " 10 exposant "+ x ) ( faire afficher cette ligne pour vérifier mon progrmme) number = number / 10 x=x+1 ' x est pour déterminer la valeur de l'exposant en base de 10 du résultat EndWhile endsub End>BQT169.sb< Start>BQV567.sb< 'Graphics Challenge GraphicsWindow.BackgroundColor="Black" GraphicsWindow.Width=640 GraphicsWindow.Height=480 GraphicsWindow.BrushColor="red" For i=0 To 63 For k=0 To 47 GraphicsWindow.FillEllipse(i*10,k*10,10,10) EndFor EndFor End>BQV567.sb< Start>BQX229.sb< GraphicsWindow.Title = "WhereIsThat? v0.1 by Kroltan" GraphicsWindow.CanResize = "false" mapImgFile = Program.Directory+"\map.jpg" mapImgRaw = ImageList.LoadImage(mapImgFile) mapImg = PictureTools.GrayScale(mapImgRaw) GraphicsWindow.Width = ImageList.GetWidthOfImage(mapImg) GraphicsWindow.Height = ImageList.GetHeightOfImage(mapImg)+53 Controls.ButtonClicked = Click Clear() While 1=1 newThingName = Controls.GetTextBoxText(newBox) itemToSearch = Controls.GetTextBoxText(inputBox) EndWhile '//////////////////////////////////////////////////// '// SUBROUTINES // '//////////////////////////////////////////////////// Sub Clear GraphicsWindow.Clear() GraphicsWindow.BrushColor = "black" GraphicsWindow.FontBold = "false" inputBox = Controls.AddTextBox(3,3) Controls.SetSize(inputBox,GraphicsWindow.Width-66,25) GraphicsWindow.FontBold = "true" searchBtn = Controls.AddButton("Search",GraphicsWindow.Width-60,3) Controls.SetSize(searchBtn,57,25) GraphicsWindow.FontBold = "false" newBox = Controls.AddTextBox(GraphicsWindow.Width-200,31) GraphicsWindow.FontBold = "true" newBtn = Controls.AddButton("Add",GraphicsWindow.Width-38,31) GraphicsWindow.DrawImage(mapImg,0,53) EndSub Sub Click If Controls.LastClickedButton = newBtn Then GraphicsWindow.MouseDown = AddThing EndIf If Controls.LastClickedButton = searchBtn Then Search() EndIf EndSub Sub AddThing ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\points\"+newThingName+".kpt",1,Mouse.MouseX) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\points\"+newThingName+".kpt",2,Mouse.MouseY) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Program.Directory+"\points\"+newThingName+".kpt",3,newThingName) GraphicsWindow.MouseDown = Null EndSub Sub Search ' The following line could be harmful and has been automatically commented. ' pointsPaths = File.GetFiles(Program.Directory+"\points\") For loopSearch = 1 To Array.GetItemCount(pointsPaths) If Text.IsSubText(pointsPaths[loopSearch],itemToSearch)= "true" Then ' The following line could be harmful and has been automatically commented. ' itemName = File.ReadLine(pointsPaths[loopSearch],3) Clear() GraphicsWindow.DrawText(3,30,itemName) ' The following line could be harmful and has been automatically commented. ' itemX = File.ReadLine(pointsPaths[loopSearch],1) ' The following line could be harmful and has been automatically commented. ' itemY = File.ReadLine(pointsPaths[loopSearch],2) GraphicsWindow.DrawEllipse(itemX-2,itemY-2,4,4) EndIf EndFor EndSub Sub Null GraphicsWindow.DrawEllipse(0,0,0,0) EndSub End>BQX229.sb< Start>BQX534.sb< ' Hydrangea ' Copyright (c) 2014 Nonki Takahashi. The MIT License. ' GraphicsWindow.Title = "Hydrangea" GraphicsWindow.BackgroundColor = "SeaGreen" param = "size=40;color=DarkSeaGreen;x=75;y=60;" AddInflorescence() param = "size=40;color=Pink;x=100;y=200;" AddInflorescence() param = "size=40;color=PaleTurquoise;x=300;y=40;" AddInflorescence() param = "size=40;color=White;x=425;y=160;" AddInflorescence() param = "size=40;color=Lavender;x=275;y=260;" AddInflorescence() Sub AddInflorescence size = param["size"] color = param["color"] cy = param["y"] Stack.PushValue("local", size) size = size * 0.8 stp = size * 1.25 For cx = param["x"] + stp + 20 To param["x"] + stp * 2 + 20 Step stp angle = Math.GetRandomNumber(360) AddHydrangea() EndFor cy = cy + size size = Stack.PopValue("local") stp = size * 1.25 For cx = param["x"] + stp - 25 To param["x"] + stp * 3 - 25 Step stp angle = Math.GetRandomNumber(360) AddHydrangea() EndFor cy = cy + size For cx = param["x"] To param["x"] + stp * 3 Step stp angle = Math.GetRandomNumber(360) AddHydrangea() EndFor cy = cy + size For cx = param["x"] + stp - 25 To param["x"] + stp * 3 - 25 Step stp angle = Math.GetRandomNumber(360) AddHydrangea() EndFor EndSub Sub AddHydrangea ' param color - color of hydrangea ' param angle - angle of hydrangea ' param size - size of hydrangea ' param cx, cy - center co-ordinate GraphicsWindow.BrushColor = color Stack.PushValue("local", angle) For i = 1 To 4 GraphicsWindow.PenWidth = 0 calyx = Shapes.AddRectangle(size * 0.44, size * 0.44) Shapes.Rotate(calyx, angle) angle = angle + 45 If 360 <= angle Then angle = angle - 360 EndIf _angle = Math.GetRadians(angle) root2 = Math.SquareRoot(2) x = cx + (size * 0.30 * root2) * Math.Cos(_angle) y = cy + (size * 0.30 * root2) * Math.Sin(_angle) Shapes.Move(calyx, x - size * 0.22, y - size * 0.22) 'GraphicsWindow.PenWidth = 1 flower = Shapes.AddEllipse(size * 0.12, size * 0.12) angle = angle + 45 If 360 <= angle Then angle = angle - 360 EndIf _angle = Math.GetRadians(angle) x = cx + (size * 0.08 * root2) * Math.Cos(_angle) y = cy + (size * 0.08 * root2) * Math.Sin(_angle) Shapes.Move(flower, x - size * 0.06, y - size * 0.06) EndFor angle = Stack.PopValue("local") EndSub End>BQX534.sb< Start>BQZ829.sb< Init() LoadScene() previewscene: Preview() GraphicsWindow.BrushColor = "Black" GraphicsWindow.DrawText(10,450,"Press Enter to render image, or press Space for different scene.") While(Space = "False" And Enter = "False") Program.Delay(10) EndWhile If(Space = "True") Then Space = "False" Enter = "False" RandomScene() Goto previewscene EndIf Preview() For y=0 To 479 step 2 For x=0 To 639 step 3 Level = 0 Coefficient = 1 Red = 0 Green = 0 Blue = 0 Ray["Coord"]["x"] = x Ray["Coord"]["y"] = y Ray["Coord"]["z"] = -1000 Ray["Dir"]["x"] = 0 Ray["Dir"]["y"] = 0 Ray["Dir"]["z"] = 1 While (Coefficient > 0) And (Level < 10) t = 2000 FoundIndex = 0 ObjectIndices = Array.GetAllIndices(Objects) IntersectRay = Ray For i = 1 To Array.GetItemCount(ObjectIndices) Object = Objects[ObjectIndices[i]] DetermineIntersection() EndFor If(FoundIndex > 0) Then Ray["Coord"]["x"] = Ray["Coord"]["x"] + Ray["Dir"]["x"] * t Ray["Coord"]["y"] = Ray["Coord"]["y"] + Ray["Dir"]["y"] * t Ray["Coord"]["z"] = Ray["Coord"]["z"] + Ray["Dir"]["z"] * t FoundObject = Objects[FoundIndex] Normalise_Vector["x"] = Ray["Coord"]["x"] - FoundObject["Coord"]["x"] Normalise_Vector["y"] = Ray["Coord"]["y"] - FoundObject["Coord"]["y"] Normalise_Vector["z"] = Ray["Coord"]["z"] - FoundObject["Coord"]["z"] Normalise() SphereNormal = Normalise_Vector LightIndices = Array.GetAllIndices(Lights) For j = 1 To Array.GetItemCount(LightIndices) Light = Lights[LightIndices[j]] LightRay["Coord"] = Ray["Coord"] Normalise_Vector["x"] = Light["Coord"]["x"] - Ray["Coord"]["x"] Normalise_Vector["y"] = Light["Coord"]["y"] - Ray["Coord"]["y"] Normalise_Vector["z"] = Light["Coord"]["z"] - Ray["Coord"]["z"] Normalise() LightRay["Dir"] = Normalise_Vector DotProduct_Vector1 = SphereNormal DotProduct_Vector2 = LightRay["Dir"] DotProduct_Product = DotProduct_Vector1["x"] * DotProduct_Vector2["x"]+ DotProduct_Vector1["y"] * DotProduct_Vector2["y"] + DotProduct_Vector1["z"] * DotProduct_Vector2["z"] If(DotProduct_Product <= 0) Then Goto skiplight EndIf InShadow = "False" IntersectRay = LightRay FoundIndex = 0 For i = 1 To Array.GetItemCount(ObjectIndices) Object = Objects[ObjectIndices[i]] DetermineIntersection() If(FoundIndex > 0) Then InShadow = "True" EndIf EndFor If(InShadow = "False") Then DotProduct_Vector1 = SphereNormal DotProduct_Vector2 = LightRay["Dir"] DotProduct_Product = DotProduct_Vector1["x"] * DotProduct_Vector2["x"]+ DotProduct_Vector1["y"] * DotProduct_Vector2["y"] + DotProduct_Vector1["z"] * DotProduct_Vector2["z"] Lambert = DotProduct_Product * Coefficient Red = Red + Lambert * Light["Color"]["r"] * FoundObject["Color"]["r"] Green = Green + Lambert * Light["Color"]["g"] * FoundObject["Color"]["g"] Blue = Blue + Lambert * Light["Color"]["b"] * FoundObject["Color"]["b"] EndIf skiplight: EndFor Coefficient = Coefficient * FoundObject["Reflect"] DotProduct_Vector1 = Ray["Dir"] DotProduct_Vector2 = SphereNormal DotProduct_Product = DotProduct_Vector1["x"] * DotProduct_Vector2["x"]+ DotProduct_Vector1["y"] * DotProduct_Vector2["y"] + DotProduct_Vector1["z"] * DotProduct_Vector2["z"] Reflet = 2 * DotProduct_Product Normalise_Vector["x"] = Ray["Dir"]["x"] - (Reflet * SphereNormal["x"]) Normalise_Vector["y"] = Ray["Dir"]["y"] - (Reflet * SphereNormal["y"]) Normalise_Vector["z"] = Ray["Dir"]["z"] - (Reflet * SphereNormal["z"]) Normalise() Ray["Dir"] = Normalise_Vector Level = Level + 1 Else Level = 10 EndIf EndWhile If(Red > 1) Then Red = 1 EndIf If(Green > 1) Then Green = 1 EndIf If(Blue > 1) Then Blue = 1 EndIf GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(Red*255, Green*255, Blue*255) GraphicsWindow.FillEllipse(x,y,4 4) EndFor EndFor 'Inititalises screen 'Input: 'Output: Sub Init GraphicsWindow.Title = "CH4 by Raytracer" GraphicsWindow.BackgroundColor = "Gray" GraphicsWindow.Height = 480 GraphicsWindow.Width = 640 GraphicsWindow.KeyUp = OnKeyUp Space = "False" Enter = "False" EndSub Sub OnKeyUp key = GraphicsWindow.LastKey If (key = "Space") Then Space = "True" ElseIf (key = "Return") Then Enter = "True" EndIf EndSub 'Inititalises scene 'Input: 'Output: Objects, Lights Sub LoadScene Objects[1]["Coord"]["x"] = 320 Objects[1]["Coord"]["y"] = 240 Objects[1]["Coord"]["z"] = 0 Objects[1]["Size"] = 85 Objects[1]["Color"]["r"] = 0.1 Objects[1]["Color"]["g"] = 0.1 Objects[1]["Color"]["b"] = 0.1 Objects[1]["Reflect"] = 0.2 Objects[2]["Coord"]["x"] = 320 Objects[2]["Coord"]["y"] = 240 - 87.5 * 2 Objects[2]["Coord"]["z"] = 62 Objects[2]["Size"] = 55 Objects[2]["Color"]["r"] = 1 Objects[2]["Color"]["g"] = 1 Objects[2]["Color"]["b"] = 1 Objects[2]["Reflect"] = 0.2 Objects[3]["Coord"]["x"] = 320 - 87.5 * 2 Objects[3]["Coord"]["y"] = 240 Objects[3]["Coord"]["z"] = -62 Objects[3]["Size"] = 55 Objects[3]["Color"]["r"] = 1 Objects[3]["Color"]["g"] = 1 Objects[3]["Color"]["b"] = 1 Objects[3]["Reflect"] = 0.2 Objects[4]["Coord"]["x"] = 320 + 87.5 * 2 Objects[4]["Coord"]["y"] = 240 Objects[4]["Coord"]["z"] = -62 Objects[4]["Size"] = 55 Objects[4]["Color"]["r"] = 1 Objects[4]["Color"]["g"] = 1 Objects[4]["Color"]["b"] = 1 Objects[4]["Reflect"] = 0.2 Objects[5]["Coord"]["x"] = 320 Objects[5]["Coord"]["y"] = 240 + 87.5 * 2 Objects[5]["Coord"]["z"] = 62 Objects[5]["Size"] = 55 Objects[5]["Color"]["r"] = 1 Objects[5]["Color"]["g"] = 1 Objects[5]["Color"]["b"] = 1 Objects[5]["Reflect"] = 0.2 Lights[1]["Coord"]["x"] = 0 Lights[1]["Coord"]["y"] = 240 Lights[1]["Coord"]["z"] = -100 Lights[1]["Color"]["r"] = 1 Lights[1]["Color"]["g"] = 1 Lights[1]["Color"]["b"] = 1 Lights[2]["Coord"]["x"] = 640 Lights[2]["Coord"]["y"] = 240 Lights[2]["Coord"]["z"] = -10000 Lights[2]["Color"]["r"] = 0.5 Lights[2]["Color"]["g"] = 0.5 Lights[2]["Color"]["b"] = 0.5 EndSub 'Generates a new random scene Sub RandomScene Objects = "" ObjectCount = Math.GetRandomNumber(4) + 1 For i=1 To ObjectCount Objects[i]["Coord"]["x"] = Math.GetRandomNumber(640)-1 Objects[i]["Coord"]["y"] = Math.GetRandomNumber(480)-1 Objects[i]["Coord"]["z"] = Math.GetRandomNumber(400)-200 Objects[i]["Size"] = Math.GetRandomNumber(80) + 60 Normalise_Vector["x"] = Math.GetRandomNumber(256) - 1 Normalise_Vector["y"] = Math.GetRandomNumber(256) - 1 Normalise_Vector["z"] = Math.GetRandomNumber(256) - 1 Normalise() Objects[i]["Color"]["r"] = Normalise_Vector["x"] Objects[i]["Color"]["g"] = Normalise_Vector["y"] Objects[i]["Color"]["b"] = Normalise_Vector["z"] Objects[i]["Reflect"] = (Math.GetRandomNumber(10))/10 EndFor EndSub 'Shows a preview of what will be rendered Sub Preview ObjectIndices = Array.GetAllIndices(Objects) 'First bubblesort to object list so the objects furthest away are drawn first bubblesort: swapped = "False" For i = 1 To Array.GetItemCount(ObjectIndices)-1 Object = Objects[ObjectIndices[i]] If(Objects[ObjectIndices[i+1]]["Coord"]["z"] > Object["Coord"]["z"]) Then swapped = "True" Objects[ObjectIndices[i]] = Objects[ObjectIndices[i+1]] Objects[ObjectIndices[i+1]] = Object EndIf EndFor If(swapped = "True") Then Goto bubblesort EndIf GraphicsWindow.Clear() For i = 1 To Array.GetItemCount(ObjectIndices) Object = Objects[ObjectIndices[i]] r = Object["Color"]["r"]*255 g = Object["Color"]["g"]*255 b = Object["Color"]["b"]*255 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(r,g,b) x = Object["Coord"]["x"] - Object["Size"] y = Object["Coord"]["y"] - Object["Size"] GraphicsWindow.FillEllipse(x, y, Object["Size"]*2, Object["Size"]*2) EndFor EndSub 'Determines if and where the ray and object intersect 'Input: IntersectRay["Coord"["x", "y", "z"], "Dir"["x", "y", "z"]], Object["Coord"["x", "y", "z"], "Size"], ObjectIndices[i] 'Output: t, FoundIndex Sub DetermineIntersection Distance["x"] = Object["Coord"]["x"] - IntersectRay["Coord"]["x"] Distance["y"] = Object["Coord"]["y"] - IntersectRay["Coord"]["y"] Distance["z"] = Object["Coord"]["z"] - IntersectRay["Coord"]["z"] DotProduct_Vector1 = IntersectRay["Dir"] DotProduct_Vector2 = Distance DotProduct_Product = DotProduct_Vector1["x"] * DotProduct_Vector2["x"]+ DotProduct_Vector1["y"] * DotProduct_Vector2["y"] + DotProduct_Vector1["z"] * DotProduct_Vector2["z"] B = DotProduct_Product DotProduct_Vector1 = Distance DotProduct_Vector2 = Distance DotProduct_Product = DotProduct_Vector1["x"] * DotProduct_Vector2["x"]+ DotProduct_Vector1["y"] * DotProduct_Vector2["y"] + DotProduct_Vector1["z"] * DotProduct_Vector2["z"] D = B*B - DotProduct_Product + Object["Size"]*Object["Size"] If(D >= 0) Then t0 = B - Math.SquareRoot(D) t1 = B + Math.SquareRoot(D) If((t0 > 0.1) And (t0 < t)) Then t = t0 FoundIndex = ObjectIndices[i] EndIf If((t1 > 0.1) And (t1 < t)) Then t = t1 FoundIndex = ObjectIndices[i] EndIf EndIf EndSub 'Normalises vector 'Input: Normalise_Vector["x", "y", "z"] 'Output: Normalise_Vector["x", "y", "z"] Sub Normalise DotProduct_Vector1 = Normalise_Vector DotProduct_Vector2 = Normalise_Vector DotProduct_Product = DotProduct_Vector1["x"] * DotProduct_Vector2["x"]+ DotProduct_Vector1["y"] * DotProduct_Vector2["y"] + DotProduct_Vector1["z"] * DotProduct_Vector2["z"] dpp=Math.SquareRoot(DotProduct_Product) If(dpp > 0) Then Normalise_Vector["x"] = Normalise_Vector["x"] / dpp Normalise_Vector["y"] = Normalise_Vector["y"] / dpp Normalise_Vector["z"] = Normalise_Vector["z"] / dpp EndIf EndSub End>BQZ829.sb< Start>BRD921.sb< 'Challenge of the Month - January 2012 'Easy Challenge 1 'Write a program to write out the current date and time in this format: '20:06:34 Saturday 31/12/2011 gw = 400 gh = 100 GraphicsWindow.Hide() GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) /2 GraphicsWindow.Top = (Desktop.Height - gh) /2 GraphicsWindow.Title = "Date & Time" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.Show() GraphicsWindow.KeyUp = ExitProgram Sub ExitProgram If GraphicsWindow.LastKey = "Escape" Then Program.End() EndIf EndSub up: If Clock.Hour >= 12 Then status = "PM" Else status = "AM" EndIf currentTime = Clock.Hour + ":" + Clock.Minute + ":" + Clock.Second + " " + status + " : " + Clock.WeekDay + " : " + Clock.Date GraphicsWindow.BrushColor = "Red" GraphicsWindow.FontSize = 20 GraphicsWindow.DrawText(15, 35, currentTime) Program.Delay(1000) GraphicsWindow.Clear() Goto up End>BRD921.sb< Start>BRK772.sb< ' Pictionary - English ' Version 0.9 ' Copyright © 2017-2019 Nonki Takahashi. The MIT License. ' Last update 2019-04-17 GraphicsWindow.Title = "Pictionary" SB_Workaround() gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" ' initialize shapes for english Shapes_Init_English() angle = 0 ' dummy ' add shapes scale = 1 iMin = 1 iMax = Array.GetItemCount(shape) Shapes_Add() ' initialize shapes for caption Shapes_Init_Caption() ' add shapes iMax = Array.GetItemCount(shape) Shapes_Add() Sub Shapes_Init_Caption ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 414 ' x offset shY = 358 ' y offset shape = "" shape[1] = "func=text;x=0;y=0;text=English;fn=Trebuchet MS;fs=50;fb=True;pw=0;bc=Black;" EndSub Sub Shapes_Init_English ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 99 ' x offset shY = 94 ' y offset shape = "" shape[1] = "pw=0;bc=#FFF;func=rect;width=400;height=240;x=0;y=0;" shape[2] = "pw=0;bc=#CD202C;func=rect;width=48;height=240;x=176;y=0;" shape[3] = "pw=0;bc=#CD202C;func=rect;width=400;height=48;x=0;y=96;" EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_Add ' Shapes | add shapes as shapes data ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - 1 if same scale ' return shWidth, shHeight - total size of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param iMin, iMax - shape indices to add ' return shWidth, shHeight - total size of shapes For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub End>BRK772.sb< Start>BRL438.sb< setup() GraphicsWindow.Title = "Slider Demo GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp While 1=1'-----------------------mainloop------------------- DoKey() Move() Program.Delay(1) EndWhile'--------------------------------------------------- Sub CreateGround ' Create ground lines, all set in upper left corner so that their top/left properties match their visible top/left GraphicsWindow.PenColor = "yellow" GraphicsWindow.PenWidth = 2.5 currY = windowHeight * 0.8 currX = 0 For i = 1 To groundPieces - 1 deltaX = Math.GetRandomNumber(130) + 30 If Math.GetRandomNumber(2) > 1.5 Then deltaY = deltaX * groundSlope If currY+deltaY > windowHeight - 40 Then deltaY = - deltaX * groundSlope EndIf Else deltaY = -deltaX * groundSlope If currY+deltaY < windowHeight / 2 Then deltaY = deltaX * groundSlope EndIf EndIf temp = Shapes.AddLine(0, 0, deltaX, deltaY) Shapes.Move(temp, 0, -500) ground[i] = temp groundLeft[i] = currX groundWidth[i] = deltaX groundTop[i] = currY currX = currX + deltaX currY = currY + deltaY EndFor deltaY = windowHeight * 0.8 - currY deltaX = Math.Abs(deltaY) temp = Shapes.AddLine(0, 0, deltaX, deltaY) Shapes.Move(temp, 0, -500) ' Move it immediately off screen so it isn't ever seen groundLeft[groundPieces] = currX groundWidth[groundPieces] = deltaX groundTop[groundPieces] = currY ground[groundPieces] = temp groundWidthTotal = currX EndSub Sub Move'--------------------------------------------------- playerVx = playerVx * 0.97 + playerAx If playerVx > playerSpeed Then playerVx = playerSpeed ElseIf playerVx < -playerSpeed Then playerVx = -playerSpeed EndIf ' Show player facing pA = playerAx ' Capture playerAx since can change with keyboard input If pA < 0 Then playerDirection = 1 ElseIf pA > 0 Then playerDirection = 0 EndIf If playerDirection = 0 Then ' If going left slideX = (windowWidth * 0.85 - pX) * .04 ' Slide player to right side with limited velocity If slideX > 5 Then slideX = 5 ElseIf slideX < -5 Then slideX = -5 EndIf pX = pX + slideX Else ' Slide player to left side with limited velocity slideX = (windowWidth * 0.1 - pX) * .04 If slideX > 5 Then slideX = 5 ElseIf slideX < -5 Then slideX = -5 EndIf pX = pX + slideX EndIf leftMost = 5000 rightMost = -5000 For i = 1 To groundPieces left = groundLeft[i] If left > rightMost Then ' Keep track of the left and right most ground pieces, used later rightMost = left rightMostIndex = i EndIf If left < leftMost Then leftMost = left leftMostIndex = i EndIf If destruct > 0 Then ' Blow up till ground pieces are off screen If destruct < windowHeight + 100 Then destruct = destruct + 0.12 EndIf If Math.Remainder(i, 2) = 0 Then destructX = 5 Else destructX = -5 EndIf Else destructX = 0 EndIf groundLeft[i] = left + playerVx + destructX Shapes.Move(ground[i], left + playerVx + destructX, groundTop[i]) EndFor If rightMost < windowWidth * 1.2 Then ' Check if about to travel off left/right of ground j = leftMostIndex For i = 1 To groundPieces If groundLeft[j] < -windowWidth * 0.2 Then ' Get position and width of right most piece temp = groundWidth[rightMostIndex] temp2 = groundLeft[rightMostIndex] groundLeft[j] = temp + temp2 - 1 ' Move left most piece to right side of ground rightMostIndex = j ' And now this moved piece is the rightmost piece rightMost = temp + temp2 - 1 EndIf j = j + 1 ' Continue on ground pieces from left to right If j > groundPieces Then j = 1 EndIf EndFor ElseIf leftMost > -windowWidth * 1 Then j = rightMostIndex For i = 1 To groundPieces If groundLeft[j] > windowWidth * 2 Then temp = groundWidth[j] temp2 = groundLeft[leftMostIndex] groundLeft[j] = temp2 - temp - 1 ' Move right most piece to left side of ground leftMostIndex = j ' And now this moved piece is the leftmost piece leftMost = temp2 - temp - 1 EndIf j = j - 1 ' Continue on ground pieces from right to left If j < 1 Then j = groundPieces EndIf EndFor EndIf If left > groundWidthTotal * 0.7 Then ' Wrap it around the world left = left - groundWidthTotal ElseIf left < -groundWidthTotal * 0.7 Then left = left + groundWidthTotal EndIf EndSub Sub OnKeyDown'============================================== If(GraphicsWindow.LastKey = "Right") Then rightKeyPressed = true ' If both left & right pressed, this has higher priority since pressed last leftRightPriority = "Right ElseIf(GraphicsWindow.LastKey = "Left") Then leftKeyPressed = true leftRightPriority = "Left EndIf EndSub Sub OnKeyUp'================================================ If GraphicsWindow.LastKey = "Right" Then rightKeyPressed = false ElseIf GraphicsWindow.LastKey = "Left" Then leftKeyPressed = false EndIf EndSub Sub DoKey'================================================== If rightKeyPressed And leftKeyPressed Then' Figure out which direction based on last pressed or released If leftRightPriority = "Right" Then playerAx = -3 Else playerAx = 3 EndIf Else If rightKeyPressed Then playerAx = -3 ElseIf leftKeyPressed Then playerAx = 3 Else playerAx = 0 EndIf EndIf EndSub Sub setup false = "false true = "true scoreBoardTop=0 windowWidth = 940 windowHeight = 480 groundPieces = 30 groundSlope = 0.6 leftKeyPressed = false rightKeyPressed = false upKeyPressed = false downKeyPressed = false leftRightPriority = "Right upDownPriority = "Up destruct = 0 playerVx = 0 playerSpeed = 10 GraphicsWindow.BackgroundColor = "darkgreen GraphicsWindow.Width = windowWidth GraphicsWindow.Height = windowHeight GraphicsWindow.Left = 5 GraphicsWindow.Top = 5 CreateGround() EndSub End>BRL438.sb< Start>BRP768.sb< '----------------------------------------------------------------------------- ' Small Basic: Read and Write CSV Files ' http://social.technet.microsoft.com/wiki/contents/articles/20626.small-basic-read-and-write-csv-files.aspx '----------------------------------------------------------------------------- ' see http://social.technet.microsoft.com/wiki/contents/articles/15062.small-basic-array-basics.aspx csv = "1=1\=1\;2\=2\;3\=3\;;2=1\=4\;2\=5\;3\=6\;;3=1\=7\;2\=8\;3\=9\;;" csv_filename = "data.csv" For line_number = 1 to Array.GetItemCount(csv) line = csv[line_number][1] For field_nr = 2 to Array.GetItemCount(csv[line_number]) line = line + "," + csv[line_number][field_nr] EndFor ' write line to file ' The following line could be harmful and has been automatically commented. ' File.AppendContents(csv_filename, line) EndFor End>BRP768.sb< Start>BRQ689.sb< ' Pictionary - Italian ' Version 0.92 ' Copyright © 2017-2019 Nonki Takahashi. The MIT License. ' Last update 2019-04-19 GraphicsWindow.Title = "Pictionary" SB_Workaround() Init() ' initialize flag shapes Shapes_Init_Flag() name = "Flag" Group_Add() ' initialize caption shapes Shapes_Init_Caption() name = "Caption" Group_Add() Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "LightGray" EndSub Sub Group_Add ' Group | add shapes to a group ' param name - group name ' param shX, shY, origin of shape array ' param shape[] - shape array ' param nGroup - number of group ' return nGroup - updated number of group ' return group - group array Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nGroup = nGroup + 1 grp = "" grp["name"] = name grp["x"] = shX grp["y"] = shY grp["angle"] = 0 grp["dir"] = 1 Shapes_CalcWidthAndHeight() grp["width"] = shWidth grp["cx"] = shWidth / 2 grp["height"] = shHeight s = 1 grp["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If Text.IsSubText("text|btn", shp["func"]) Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] If shp["fb"] = "False" Then GraphicsWindow.FontBold = "False" Else GraphicsWindow.FontBold = "True" EndIf EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor grp["shape"] = shape group[nGroup] = grp y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_Init_Caption ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 432 ' x offset shY = 358 ' y offset shape = "" shape[1] = "func=text;x=0;y=0;text=Italian;fn=Trebuchet MS;fs=50;fb=True;pw=0;bc=Black;" EndSub Sub Shapes_Init_Flag ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 0 ' x offset shY = 0 ' y offset shape = "" shape[1] = "pw=0;bc=#009246;func=rect;width=120;height=240;x=119;y=94;" shape[2] = "pw=0;bc=#FFF;func=rect;width=120;height=240;x=239;y=94;" shape[3] = "pw=0;bc=#CD2B37;func=rect;width=120;height=240;x=359;y=94;" EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param shape[] - shape array ' return shWidth, shHeight - total size of shapes For i = 1 To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub End>BRQ689.sb< Start>BRQ733.sb< ' Fifty - finds programs that have less equal 50 lines ' Copyright (c) 2012 Nonki Takahashi. All rights reserved. ' CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) While "True" TextWindow.Write("Path? ") path = TextWindow.Read() ' The following line could be harmful and has been automatically commented. ' files = File.GetFiles(path) num = Array.GetItemCount(files) For i = 1 To num If Text.EndsWith(files[i], ".smallbasic") Or Text.EndsWith(files[i], ".sb") Then filename = files[i] File_CountLines() If lines <= 50 Then TextWindow.WriteLine(lines + " " + filename) EndIf EndIf EndFor TextWindow.WriteLine("") EndWhile Sub File_CountLines ' param filename - file name ' return lines - lines of file ' The following line could be harmful and has been automatically commented. ' buf = File.ReadContents(filename) len = Text.GetLength(buf) ptr = 1 lines = 0 While ptr <= len _ptr = Text.GetIndexOf(Text.GetSubTextToEnd(buf, ptr), CRLF) If _ptr = 0 Then _ptr = len + 1 EndIf ptr = ptr + _ptr + 1 lines = lines + 1 EndWhile EndSub End>BRQ733.sb< Start>BRR321.sb< GraphicsWindow.Title="Tutrle drive" GraphicsWindow.BackgroundColor="white" turnleft = Controls.AddButton("Turn left" , 0 ,0) turnright = Controls.AddButton("Turn right" , 100 , 0) Controls.ButtonClicked = buttonclick Turtle.Show() i = Math.GetRandomNumber(100) Turtle.Move(i) While "True" 'never ending loop While g = 1 i = Math.GetRandomNumber(100) Program.Delay(600) Turtle.Move(i) g = 0 EndWhile EndWhile '******************************************************************* Sub buttonclick g = 1 If Controls.LastClickedButton = turnright Then Turtle.TurnRight() Else Turtle.TurnLeft() EndIf EndSub End>BRR321.sb< Start>BRR848.sb< 'WCD663 GraphicsWindow.Width = 501 GraphicsWindow.Height = 261 GraphicsWindow.Show() FillArray() ShowMatrix() ShowFirstLine() 'Show Array by index TC = Text.GetCharacter(255) LI = Array.GetItemCount(A) p = 15 For i = 1 To LI TextWindow.WriteLine(i) OutputLine() EndFor TextWindow.WriteLine(" ") 'Show Arry Sort by Name p = 15 * 5 SortByName() SortOutput() TextWindow.WriteLine(" ") 'Show Arry Sort by Straße p = 15 * 9 SortByStraße() SortOutput() TextWindow.WriteLine(" ") 'Show Arry Sort by Ort p = 15 * 13 SortByOrt() SortOutput() TextWindow.WriteLine(" ") '*************************************************************************************** '* SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB SUB * '*************************************************************************************** Sub SortByName B = "" For i = 1 To LI B[i] = A[i]["Name"] + TC + i EndFor C = LDSort.ByValue(B) EndSub Sub SortByStraße B = "" For i = 1 To LI B[i] = A[i]["Straße"] + TC + i EndFor C = LDSort.ByValue(B) EndSub Sub SortByOrt B = "" For i = 1 To LI B[i] = A[i]["Ort"] + TC + i EndFor C = LDSort.ByValue(B) EndSub Sub SortOutput For j = 1 To LI S = Text.GetIndexOf(C[j],TC) + 1 i = Text.GetSubTextToEnd(C[j], s) TextWindow.WriteLine(i) OutputLine() EndFor EndSub Sub OutputLine GraphicsWindow.DrawText(10, i * 15 + p, A[i]["Name"]) GraphicsWindow.DrawText(150, i * 15 + p, A[i]["Straße"]) GraphicsWindow.DrawText(300, i * 15 + p, A[i]["Ort"]) EndSub Sub ShowFirstLine GraphicsWindow.DrawText(10, 10, "Name") GraphicsWindow.DrawText(150, 10, "Straße") GraphicsWindow.DrawText(300, 10, "Ort") EndSub Sub ShowMatrix 'horizontly GraphicsWindow.DrawLine(1,27,500,27) GraphicsWindow.DrawLine(1,80,500,80) GraphicsWindow.DrawLine(1,140,500,140) GraphicsWindow.DrawLine(1,200,500,200) GraphicsWindow.DrawLine(1,260,500,260) 'verticaly GraphicsWindow.DrawLine(1,1,500,1) GraphicsWindow.DrawLine(1,1,1,260) GraphicsWindow.DrawLine(145,1,145,260) GraphicsWindow.DrawLine(295,1,295,260) GraphicsWindow.DrawLine(500,1,500,260) EndSub Sub FillArray A[1]["Name"] = "Meyer, Anne" A[1]["Ort"] = "London" A[1]["Straße"] = "Northstreet" A[2]["Name"] = "Android, Jan" A[2]["Ort"] = "Belfast" A[2]["Straße"] = "Weststreet" A[3]["Name"] = "Nobian, Marcus" A[3]["Ort"] = "New York" A[3]["Straße"] = "Brigdestreet" EndSub End>BRR848.sb< Start>BRS931-2.sb< Main: w = 1023 ' screen width h = 768 'screen height size = 10 'w = 512 ' screen width 'h = 384 'screen height GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.CanResize = 1 GraphicsWindow.BackgroundColor = "black" posX = 5.5 posY = 10.5 ' x and y start positions dirX = 1 dirY = 0 ' initial direction vector planeX = 0 ' planeY = 0.66 ' the 2d raycaster version of camera plane planeY = 0.66 ' the 2d raycaster version of camera plane time = 0 ' time of current frame oldTime = 0 ' time of previous frame completed = 1 moveSpeed = 0.4 rotSpeed = 0.1 'moveSpeed = 0.2 'rotSpeed = 0.07 'GraphicsWindow.Keydown = OnKeydown2 GraphicsWindow.Keyup = OnKeyup setupmap() main() '======================================================================== 'Added This '======================================================================== 'Loop: 'Goto loop GraphicsWindow.Keydown = OnKeydown2 While "True" 'GAME LOOP in the UI Thread. Do all the calcs and redraws in this thread. If keyDown Then onkeydown() EndIf keyDown = "" Program.Delay(Math.Max(0, 20 - (Clock.ElapsedMilliseconds - start))) '50 fps Else Delay(0) & any lag start = Clock.ElapsedMilliseconds EndWhile Sub OnKeydown2 keyDown = "True" 'Only do Callback in the Async Thread. Build up happens here if lots of calcs are done EndSub '===================================================================================== Sub onkeydown If completed = 1 Then keypress = GraphicsWindow.LastKey 'move forward if nothing is in front If keypress = "Up" Then If worldMap[Math.Floor(posX + dirX * moveSpeed)][Math.Floor(posy)] = 0 Then posX = posX + dirX * moveSpeed Endif If worldMap[Math.Floor(posx)][math.Floor(posY + dirY * movespeed)] = 0 Then posY = posY + dirY * movespeed Endif Endif ' move backwards if nothing is behind If keypress = "Down" Then If worldMap[Math.Floor(posX - dirX * moveSpeed)][Math.Floor(posy)] = 0 Then posX = posX - dirX * moveSpeed Endif If worldMap[Math.Floor(posx)][math.Floor(posY - dirY * movespeed)] = 0 Then posY = posY - dirY * movespeed Endif Endif If keypress = "Left" Then oldDirx = dirX dirX = dirX * Math.cos(-1 * rotSpeed) - dirY * Math.sin(-1 * rotSpeed) dirY = oldDirX * Math.sin(-1 * rotSpeed) + dirY * Math.cos(-1 * rotSpeed) oldPlanex = planeX planeX = planeX * Math.cos(-1 * rotSpeed) - planeY * Math.sin(-1 * rotSpeed) planeY = oldPlaneX * Math.sin(-1 * rotSpeed) + planeY * Math.cos(-1 * rotSpeed) ' ' EndIf If keypress = "Right" Then oldDirx = dirX dirX = dirX * Math.cos(rotSpeed) - dirY * Math.sin(rotSpeed) dirY = oldDirX * Math.sin(rotSpeed) + dirY * Math.cos(rotSpeed) oldPlaneX = planeX planeX = planeX * Math.cos(rotSpeed) - planeY * Math.sin(rotSpeed) planeY = oldPlaneX * Math.sin(rotSpeed) + planeY * Math.cos(rotSpeed) ' ' EndIf main() EndIf EndSub Sub OnKeyUp keypress = "" EndSub sub main completed = 0 'For x = 0 To w / 2 ' calculate ray position and direction ' cameraX = 2 * x / w - 1 ' x-coordinate in camera space For x = 0 To w / size ' calculate ray position and direction cameraX = 2 * x / (w / size) - 1 ' x-coordinate in camera space rayPosX = posX rayPosY = posY rayDirX = dirX + planeX * cameraX rayDirY = dirY + planeY * cameraX ' 'which box of the map we're in mapX = Math.Floor(rayPosX) mapY = Math.Floor(rayPosY) 'length of ray from current position to next x or y-side sideDistX = 0 sideDistY = 0 'length of ray from one x or y-side to next x or y-side deltaDistX = Math.SquareRoot(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX)) deltaDistY = Math.SquareRoot(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY)) perpWallDist = 0 'what direction to step in x or y-direction (either +1 or -1) stepX = 0 stepY = 0 hit = 0 ' was there a wall hit? side = 0 ' was a NS or a EW wall hit? ' calculate step and initial sideDist If rayDirX < 0 Then stepX = -1 sideDistX = (rayPosX - mapX) * deltaDistX Else stepX = 1 sideDistX = (mapX + 1.0 - rayPosX) * deltaDistX EndIf If rayDirY < 0 then stepY = -1 sideDistY = (rayPosY - mapY) * deltaDistY Else stepY = 1 sideDistY = (mapY + 1.0 - rayPosY) * deltaDistY EndIf ' perform DDA While hit = 0 ' jump to next map square, OR in x-direction, OR in y-direction If sideDistX < sideDistY Then sideDistX = sideDistX + deltaDistX mapX = mapx + stepX side = 0 Else sideDistY = sideDistY + deltaDistY mapY = mapy + stepY side = 1 EndIf ' Check if ray has hit a wall If worldMap[mapX][mapY] > 0 Then hit = 1 EndIf EndWhile ' Calculate distance projected on camera direction (oblique distance will give fisheye effect!) If side = 0 Then perpWallDist = Math.Abs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX) Else perpWallDist = Math.Abs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY) EndIf ' Calculate height of line to draw on screen lineHeight = Math.Abs(h / perpWallDist) lineHeight = Math.Round (lineheight) If lineHeight > h Then lineHeight = h EndIf ' ' calculate lowest and highest pixel to fill in current stripe drawStart = (lineHeight * -1) / 2 + h / 2 If drawStart < 0 Then drawStart = 0 EndIf drawEnd = lineHeight / 2 + h / 2 If drawEnd >= h Then drawEnd = h - 1 EndIf ' set up the colours depending on the block numbers coldistr = math.SquareRoot(lineHeight*50) coldistg = math.SquareRoot(lineHeight*50) coldistb = math.SquareRoot(lineHeight*50) ' red If worldMap[mapx][mapy] = 2 Then coldistr = math.SquareRoot(lineHeight*50) coldistg = 2 coldistb = 2 EndIf 'green If worldMap[mapx][mapy] = 3 Then coldistr = 2 coldistg = math.SquareRoot(lineHeight*50) coldistb = 2 EndIf 'blue If worldMap[mapx][mapy] = 4 Then coldistr = 2 coldistg = 2 coldistb = math.SquareRoot(lineHeight*50) EndIf 'magenta If worldMap[mapx][mapy] = 5 Then coldistr = math.SquareRoot(lineHeight*50) coldistg = 2 coldistb = math.SquareRoot(lineHeight*50) EndIf 'yellow If worldMap[mapx][mapy] = 6 Then coldistr = math.SquareRoot(lineHeight*50) coldistg = math.SquareRoot(lineHeight*50) coldistb = 2 EndIf If coldistr > 200 Then coldistr = 200 EndIf If coldistg > 200 Then coldistg = 200 EndIf If coldistb > 200 Then coldistb = 200 EndIf colour = GraphicsWindow.GetColorFromRGB(coldistr, coldistg, coldistb) 'colour = "#202020" If side = 1 Then colour = GraphicsWindow.GetColorFromRGB(coldistr / 2, coldistg / 2, coldistb / 2) 'colour = "#505050" EndIf '//draw the pixels of the stripe as a vertical line GraphicsWindow.PenWidth = size GraphicsWindow.PenColor = colour 'GraphicsWindow.DrawLine (x,drawStart,x,drawEnd) GraphicsWindow.DrawLine (x * size,drawStart,x * size,drawEnd) GraphicsWindow.PenColor = "blue" GraphicsWindow.DrawLine (x * size,0,x*size,drawstart-1) GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,drawend+1,x*size,h) EndFor completed = 1 Endsub Sub setupmap mapwidth = 21 mapheight = 21 'define the map in the mapline array as strings mapline[1] = "155555511111111555555" mapline[2] = "600000000000000000005" mapline[3] = "600000002000005000051" mapline[4] = "600000000000305000051" mapline[5] = "600000002600305022201" mapline[6] = "604020006000005000001" mapline[7] = "604031006016604444441" mapline[8] = "600000000010004000001" mapline[9] = "600230000010004000001" mapline[10] = "100000000000004000003" mapline[11] = "100002200022000000003" mapline[12] = "100000000000000000033" mapline[13] = "100002200022000333033" mapline[14] = "100000000000000033031" mapline[15] = "103333311111111011011" mapline[16] = "100000011110000000002" mapline[17] = "100000001110000000002" mapline[18] = "100200000110000000002" mapline[19] = "100000000116543211302" mapline[20] = "100000000000000000003" mapline[21] = "111111111116543211222" ' ' define some parameters that state how big the map is mapsizex = Text.GetLength (mapline[1]) mapsizey = array.GetItemCount (mapline) ' 'try to read this in and convert it into a two dimensional array For yloop = 1 To mapsizey For xloop = 1 To mapsizex worldmap[xloop][yloop] = Text.GetSubText(mapline[yloop],xloop,1) EndFor EndFor EndSub End>BRS931-2.sb< Start>BRS931.sb< Main: w = 1023 ' screen width h = 768 'screen height size = 10 'w = 512 ' screen width 'h = 384 'screen height GraphicsWindow.Width = w GraphicsWindow.Height = h GraphicsWindow.CanResize = 1 GraphicsWindow.BackgroundColor = "black" posX = 5.5 posY = 10.5 ' x and y start positions dirX = 1 dirY = 0 ' initial direction vector planeX = 0 ' planeY = 0.66 ' the 2d raycaster version of camera plane planeY = 0.66 ' the 2d raycaster version of camera plane time = 0 ' time of current frame oldTime = 0 ' time of previous frame completed = 1 moveSpeed = 0.4 rotSpeed = 0.1 'moveSpeed = 0.2 'rotSpeed = 0.07 GraphicsWindow.Keydown = OnKeydown GraphicsWindow.Keyup = OnKeyup setupmap() main() Loop: Goto loop Sub onkeydown If completed = 1 Then keypress = GraphicsWindow.LastKey 'move forward if nothing is in front If keypress = "Up" Then If worldMap[Math.Floor(posX + dirX * moveSpeed)][Math.Floor(posy)] = 0 Then posX = posX + dirX * moveSpeed Endif If worldMap[Math.Floor(posx)][math.Floor(posY + dirY * movespeed)] = 0 Then posY = posY + dirY * movespeed Endif Endif ' move backwards if nothing is behind If keypress = "Down" Then If worldMap[Math.Floor(posX - dirX * moveSpeed)][Math.Floor(posy)] = 0 Then posX = posX - dirX * moveSpeed Endif If worldMap[Math.Floor(posx)][math.Floor(posY - dirY * movespeed)] = 0 Then posY = posY - dirY * movespeed Endif Endif If keypress = "Left" Then oldDirx = dirX dirX = dirX * Math.cos(-1 * rotSpeed) - dirY * Math.sin(-1 * rotSpeed) dirY = oldDirX * Math.sin(-1 * rotSpeed) + dirY * Math.cos(-1 * rotSpeed) oldPlanex = planeX planeX = planeX * Math.cos(-1 * rotSpeed) - planeY * Math.sin(-1 * rotSpeed) planeY = oldPlaneX * Math.sin(-1 * rotSpeed) + planeY * Math.cos(-1 * rotSpeed) ' ' EndIf If keypress = "Right" Then oldDirx = dirX dirX = dirX * Math.cos(rotSpeed) - dirY * Math.sin(rotSpeed) dirY = oldDirX * Math.sin(rotSpeed) + dirY * Math.cos(rotSpeed) oldPlaneX = planeX planeX = planeX * Math.cos(rotSpeed) - planeY * Math.sin(rotSpeed) planeY = oldPlaneX * Math.sin(rotSpeed) + planeY * Math.cos(rotSpeed) ' ' EndIf main() EndIf EndSub Sub OnKeyUp keypress = "" EndSub sub main completed = 0 'For x = 0 To w / 2 ' calculate ray position and direction ' cameraX = 2 * x / w - 1 ' x-coordinate in camera space For x = 0 To w / size ' calculate ray position and direction cameraX = 2 * x / (w / size) - 1 ' x-coordinate in camera space rayPosX = posX rayPosY = posY rayDirX = dirX + planeX * cameraX rayDirY = dirY + planeY * cameraX ' 'which box of the map we're in mapX = Math.Floor(rayPosX) mapY = Math.Floor(rayPosY) 'length of ray from current position to next x or y-side sideDistX = 0 sideDistY = 0 'length of ray from one x or y-side to next x or y-side deltaDistX = Math.SquareRoot(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX)) deltaDistY = Math.SquareRoot(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY)) perpWallDist = 0 'what direction to step in x or y-direction (either +1 or -1) stepX = 0 stepY = 0 hit = 0 ' was there a wall hit? side = 0 ' was a NS or a EW wall hit? ' calculate step and initial sideDist If rayDirX < 0 Then stepX = -1 sideDistX = (rayPosX - mapX) * deltaDistX Else stepX = 1 sideDistX = (mapX + 1.0 - rayPosX) * deltaDistX EndIf If rayDirY < 0 then stepY = -1 sideDistY = (rayPosY - mapY) * deltaDistY Else stepY = 1 sideDistY = (mapY + 1.0 - rayPosY) * deltaDistY EndIf ' perform DDA While hit = 0 ' jump to next map square, OR in x-direction, OR in y-direction If sideDistX < sideDistY Then sideDistX = sideDistX + deltaDistX mapX = mapx + stepX side = 0 Else sideDistY = sideDistY + deltaDistY mapY = mapy + stepY side = 1 EndIf ' Check if ray has hit a wall If worldMap[mapX][mapY] > 0 Then hit = 1 EndIf EndWhile ' Calculate distance projected on camera direction (oblique distance will give fisheye effect!) If side = 0 Then perpWallDist = Math.Abs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX) Else perpWallDist = Math.Abs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY) EndIf ' Calculate height of line to draw on screen lineHeight = Math.Abs(h / perpWallDist) lineHeight = Math.Round (lineheight) If lineHeight > h Then lineHeight = h EndIf ' ' calculate lowest and highest pixel to fill in current stripe drawStart = (lineHeight * -1) / 2 + h / 2 If drawStart < 0 Then drawStart = 0 EndIf drawEnd = lineHeight / 2 + h / 2 If drawEnd >= h Then drawEnd = h - 1 EndIf ' set up the colours depending on the block numbers coldistr = math.SquareRoot(lineHeight*50) coldistg = math.SquareRoot(lineHeight*50) coldistb = math.SquareRoot(lineHeight*50) ' red If worldMap[mapx][mapy] = 2 Then coldistr = math.SquareRoot(lineHeight*50) coldistg = 2 coldistb = 2 EndIf 'green If worldMap[mapx][mapy] = 3 Then coldistr = 2 coldistg = math.SquareRoot(lineHeight*50) coldistb = 2 EndIf 'blue If worldMap[mapx][mapy] = 4 Then coldistr = 2 coldistg = 2 coldistb = math.SquareRoot(lineHeight*50) EndIf 'magenta If worldMap[mapx][mapy] = 5 Then coldistr = math.SquareRoot(lineHeight*50) coldistg = 2 coldistb = math.SquareRoot(lineHeight*50) EndIf 'yellow If worldMap[mapx][mapy] = 6 Then coldistr = math.SquareRoot(lineHeight*50) coldistg = math.SquareRoot(lineHeight*50) coldistb = 2 EndIf If coldistr > 200 Then coldistr = 200 EndIf If coldistg > 200 Then coldistg = 200 EndIf If coldistb > 200 Then coldistb = 200 EndIf colour = GraphicsWindow.GetColorFromRGB(coldistr, coldistg, coldistb) 'colour = "#202020" If side = 1 Then colour = GraphicsWindow.GetColorFromRGB(coldistr / 2, coldistg / 2, coldistb / 2) 'colour = "#505050" EndIf '//draw the pixels of the stripe as a vertical line GraphicsWindow.PenWidth = size GraphicsWindow.PenColor = colour 'GraphicsWindow.DrawLine (x,drawStart,x,drawEnd) GraphicsWindow.DrawLine (x * size,drawStart,x * size,drawEnd) GraphicsWindow.PenColor = "blue" GraphicsWindow.DrawLine (x * size,0,x*size,drawstart-1) GraphicsWindow.PenColor = "black" GraphicsWindow.DrawLine (x * size,drawend+1,x*size,h) EndFor completed = 1 Endsub Sub setupmap mapwidth = 21 mapheight = 21 'define the map in the mapline array as strings mapline[1] = "155555511111111555555" mapline[2] = "600000000000000000005" mapline[3] = "600000002000005000051" mapline[4] = "600000000000305000051" mapline[5] = "600000002600305022201" mapline[6] = "604020006000005000001" mapline[7] = "604031006016604444441" mapline[8] = "600000000010004000001" mapline[9] = "600230000010004000001" mapline[10] = "100000000000004000003" mapline[11] = "100002200022000000003" mapline[12] = "100000000000000000033" mapline[13] = "100002200022000333033" mapline[14] = "100000000000000033031" mapline[15] = "103333311111111011011" mapline[16] = "100000011110000000002" mapline[17] = "100000001110000000002" mapline[18] = "100200000110000000002" mapline[19] = "100000000116543211302" mapline[20] = "100000000000000000003" mapline[21] = "111111111116543211222" ' ' define some parameters that state how big the map is mapsizex = Text.GetLength (mapline[1]) mapsizey = array.GetItemCount (mapline) ' 'try to read this in and convert it into a two dimensional array For yloop = 1 To mapsizey For xloop = 1 To mapsizex worldmap[xloop][yloop] = Text.GetSubText(mapline[yloop],xloop,1) EndFor EndFor EndSub End>BRS931.sb< Start>BRZ332.sb< ' SmallBasic Version 1.2 ' Program: SBFocusDemo ' Changelog: ' Author: Pappa Lapub ' Website: https://social.msdn.microsoft.com/Forums/en-US/1c64e71e-ea0c-41da-8bed-3f2714cc0137/delete-cursor-from-textbox ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev, SBFocus ' Comment: ' Keys: 1, 2 ... focus button1/2 (LDFocus); 3, 4 ... focus button 1/2 (SBFocus) ' T ... focus Textbox; ESC ... focus background; G ... Get focus ' Bugs: After removing Focus with SBFocus.SetFocus(""), then ... ' 1. ... the focus can't be set again programmatically by SB/LDFocus.SetFocus(shapeName) -> Focus has to be set manually by MouseClick again ' 2. ... LDFocus.GetFocus() shows the Control, that last had focus before ' Variables: ' ToDo: ' ================================================================================ btn1 = Controls.AddButton(" 1 ", 10,10) btn2 = Controls.AddButton(" 2 ", 10,50) tb = Controls.AddTextBox(100,10) GraphicsWindow.Title = "Curr: "+ LDFocus.GetFocus() GraphicsWindow.KeyDown = OnKeyDown Controls.ButtonClicked = OnButtonClick Sub OnKeyDown lastKey = GraphicsWindow.LastKey If lastKey = "G" Then GraphicsWindow.Title = "Curr: "+ LDFocus.GetFocus() ElseIf lastKey = "D1" Then GraphicsWindow.Title = "Set 1: "+ LDFocus.SetFocus(btn1) +" | Curr: "+ LDFocus.GetFocus() ElseIf lastKey = "D2" Then GraphicsWindow.Title = "Set 2: "+ LDFocus.SetFocus(btn2) +" | Curr: "+ LDFocus.GetFocus() ElseIf lastKey = "D3" Then GraphicsWindow.Title = "Set 1: "+ SBFocus.SetFocus(btn1) +" | Curr: "+ LDFocus.GetFocus() ElseIf lastKey = "D4" Then GraphicsWindow.Title = "Set 2: "+ SBFocus.SetFocus(btn2) +" | Curr: "+ LDFocus.GetFocus() ElseIf lastKey = "T" Then GraphicsWindow.Title = "Set tb: "+ LDFocus.SetFocus(tb) +" | Curr: "+ LDFocus.GetFocus() ElseIf lastKey = "Escape" Then GraphicsWindow.Title = "Set BG: "+ SBFocus.SetFocus("") +" | Curr: "+ LDFocus.GetFocus() ' SBFocus.SetFocus("background") EndIf EndSub Sub OnButtonClick GraphicsWindow.ShowMessage(Controls.LastClickedButton, "Curr:") EndSub End>BRZ332.sb< Start>BRZ449.sb< GraphicsWindow.Title="SB GraphEdit v0.1 LDGraphicsWindow.BackgroundImage(ImageList.LoadImage ("e:\sbb.png")) GraphicsWindow.BrushColor="Lime ss=Shapes.AddText("GraphWind") Shapes.Move (ss 0 60) LDShapes.Font (ss "calibri" 20 "true" "false") LDShapes.SetShapeEvent (ss) LDEffect.DropShadow (ss "") LDShapes.ShapeEvent =see GraphicsWindow.MouseMove =mmm ii=LDText.Split ("GW|Backgroundcolor GW|Brushcolor GW|DrawRect GW|DrawEllipse GW|DrawTriang GW|DrawLine TW|Read TW|Write TW|WriteLn" " ") LDDialogs.RightClickMenu=rmm LDDialogs.AddRightClickMenu (ii "") LDEvents.MouseWheel =mww args=0 ct[1]=Controls.AddButton("GraphWind" 0 0) ct[2]=Controls.AddButton ("Shapes" 90 0) ct[3]=Controls.AddButton ("TxtWind" 160 0) Controls.ButtonClicked=bcc lar[1]=ss lar[2]="GraphWind lar[3]=1 li=1 lar[4]=0 lst=LDList.CreateFromValues (lar) For x=1 to 3 LDShapes.ZIndex (ct[x] 5000) LDShapes.BrushColour(ct[x] "teal") endfor Sub mww dd= LDEvents.LastMouseWheelDelta *30 ccc= LDShapes.GetAllShapes () For x=1 To Array.GetItemCount (ccc) ssh=ccc[x] If Text.StartsWith (ssh "But") Then else Shapes.Move (ssh ldShapes.GetLeft(ssh) ldShapes.GetTop (ssh)+dd) EndIf EndFor EndSub Sub pget aa=args[1] TextWindow.WriteLine (aa+": "+args[2]) pp=ldtext.Split (args[2] " ") For x=1 to Array.GetItemCount(pp) TextWindow.Write (pp[x]+": ") qq[pp[x]]= TextWindow.Read () endfor If aa="Ellip" Then ee=Shapes.AddEllipse (qq["wd"] qq["ht"]) ElseIf aa="Rect" then ee=Shapes.AddRectangle (qq["wd"] qq["ht"]) ElseIf aa="Triang" then ee=Shapes.AddTriangle (qq["x1"] qq["y1"] qq["x2"] qq["y2"] qq["x3"] qq["y3"]) endif Shapes.SetText (ls aa+":"+qq) Shapes.Move (ee ldShapes.GetLeft(ls)+160 ldShapes.GetTop (ls)-50) LDShapes.ZIndex (ee, -1) If pp[4]>50 then sc=50/pp[4] Shapes.Zoom (ee sc sc) endif Shapes.Remove (lsm[ls]) lsm[ls]=ee EndSub Sub rmm ll= LDDialogs.LastRightClickMenuItem If ll=1 Then cc= LDDialogs.Colour() If cc="" then else LDShapes.BrushColour (ls cc) Shapes.SetText (ls "GW|BgrndClr="+cc) endif elseIf ll=2 Then cc= LDDialogs.Colour() If cc="" then else LDShapes.PenColour (ls cc) Shapes.SetText (ls "GW|BrushClr="+cc) endif elseIf ll=3 Then ldcall.Function2("pget" "Rect" "xp yp wd ht") elseIf ll=4 Then ldcall.Function2("pget" "Ellip" "xp yp wd ht") elseIf ll=5 Then ldcall.Function2("pget" "Triang" "x1 y1 x2 y2 x3 y3") elseIf ll=8 Then TextWindow.Write ("Text:") tx=TextWindow.Read () Shapes.SetText (ls "TW|Wrt:"+tx) elseIf ll=9 Then TextWindow.Write ("LinTxt:") tx=TextWindow.Read () Shapes.SetText (ls "TW|WrtLn:"+tx) Else Shapes.SetText (ls ii[LDDialogs.LastRightClickMenuItem ]) endif EndSub Sub bcc lb= Controls.LastClickedButton ss=Shapes.AddText(Controls.GetButtonCaption (lb)) LDShapes.ZIndex (ss 1) Shapes.Move (ss 0 30+Shapes.GetTop (ls)) LDShapes.Font (ss "calibri" 20 "true" "false") LDShapes.SetShapeEvent (ss) LDEffect.DropShadow (ss "") lar[1]=ss lar[2]= Controls.GetButtonCaption (lb) li=li+1 lar[3]=li lar[4]=0 LDList.Add (lst lar) 'TextWindow.WriteLine (lar) EndSub Sub mmm If Mouse.IsLeftButtonDown Then If ls="" Then else Shapes.move (Ls GraphicsWindow.MouseX-20 GraphicsWindow.MouseY ) sd=lsm[ ls] If sd="" Then Else Shapes.move (sd GraphicsWindow.MouseX-20 GraphicsWindow.MouseY ) endif EndIf endif EndSub Sub see le= LDShapes.LastEventType If le="MouseDown" Then ls= LDShapes.LastEventShape 'GraphicsWindow.Title =ls ElseIf le="MouseUp" then ' ls="" EndIf EndSub End>BRZ449.sb< Start>BSB984.sb< 'Sudden Death - Stop the timer before it runs out; Written by by Matthew L. Parets (codingCat) 'This game will display a timer, the goal is to hit the Return (enter) key before the time 'reaches zero. The closer to zero you get, the higher your score. Press space to start the 'next round. You have 30 seconds to get as high a score as possible. GraphicsWindow.Show() top: GraphicsWindow.Clear() GraphicsWindow.Title = "Sudden Death" GraphicsWindow.BackgroundColor = "blue" score = 0 countdown = 5000 timedown = 30 starttime = Clock.ElapsedMilliseconds While timedown > 0 While countdown > 0 And timedown > 0 GraphicsWindow.FontItalic = "true" GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillRectangle(0,0,640,50) GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(61,16,"") GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(60,16,"") GraphicsWindow.FontItalic = "false" GraphicsWindow.FontSize = 50 GraphicsWindow.FontItalic = "false" 'GraphicsWindow.DrawRectangle(320,0,1,480) ' Centerline While key <> "Return" And countdown > 0 And timedown > 0 timedown = (30000 - (Clock.ElapsedMilliseconds - starttime)) / 1000 GraphicsWindow.Title = "Sudden Death in " + (math.Round(timedown * 100)/100) countdown = countdown - 1 GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillRectangle(250,50,150,65) GraphicsWindow.BrushColor = "black" nudge = 4 - Text.GetLength(countdown) GraphicsWindow.DrawText(257 + (nudge * 16),50,countdown) key = GraphicsWindow.LastKey EndWhile GraphicsWindow.FontItalic = "true" GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillRectangle(0,0,640,50) If countdown <= 0 Then timedown = 0 Else nudge = Text.GetLength(countdown) GraphicsWindow.DrawText(563 - ((nudge-1) * 45),353, score) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(13,203,"Missed it by") GraphicsWindow.DrawText(53,278,"that much: ") GraphicsWindow.DrawText(563 - ((nudge-1) * 32),278,countdown) GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(10,200,"Missed it by") GraphicsWindow.DrawText(50,275,"that much: ") GraphicsWindow.DrawText(560 - ((nudge-1) * 32),275,countdown) GraphicsWindow.FontSize = 90 GraphicsWindow.BrushColor = "black" If countdown <= 1000 And countdown > 500 Then multiplier = 1 GraphicsWindow.DrawText(125,105,"Progress") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(120,100,"Progress") ElseIf countdown <= 500 and countdown > 100 then multiplier = 2 GraphicsWindow.DrawText(005,105,"Double Down") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(000,100,"Double Down") Elseif countdown <= 100 and countdown > 10 then multiplier = 10 GraphicsWindow.DrawText(155,105,"Decade") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(150,100,"Decade") Elseif countdown <= 10 and countdown > 1 then multiplier = 100 GraphicsWindow.DrawText(185,105,"WOW") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(180,100,"WOW") Elseif countdown = 1 then multiplier = 1000 GraphicsWindow.DrawText(-5,105,"Unbelievable!") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(-10,100,"Unbelievable!") Else multiplier = 0 GraphicsWindow.DrawText(115,95,"Stopped") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(110,90,"Stopped") endif GraphicsWindow.FontSize = 60 If countdown < 1000 then result = "Points Earned = " + countdown result = result + " -- Multiplier = " + multiplier score = score + countdown score = score * multiplier GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(176, 351, result) GraphicsWindow.BrushColor = "green" GraphicsWindow.DrawText(175, 350, result) EndIf GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(211,16,"") GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(210,15,"") GraphicsWindow.FontSize = 40 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(178,378,score) GraphicsWindow.DrawText(12,377,"Score = ") GraphicsWindow.BrushColor = "orange" GraphicsWindow.DrawText(10,375,"Score = ") key = GraphicsWindow.LastKey While key <> "Space" And timedown > 0 Program.Delay(100) timedown = (30000 - (Clock.ElapsedMilliseconds - starttime)) / 1000 GraphicsWindow.Title = "Sudden Death in " + (math.Round(timedown * 100)/100) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(175,375,score) key = GraphicsWindow.LastKey EndWhile GraphicsWindow.Clear() countdown = 5000 key = "" EndIf EndWhile EndWhile GraphicsWindow.Title = "Sudden Deathed" GraphicsWindow.Clear() GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(211,16,"") GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(210,15,"") If countdown <= 0 Then GraphicsWindow.FontSize = 90 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(185,105,"Loser") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(180,100,"Loser") score = 0 Else GraphicsWindow.FontSize = 90 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(30,105,"You Made It") GraphicsWindow.BrushColor = "limegreen" GraphicsWindow.DrawText(25,100,"You Made It") EndIf GraphicsWindow.FontSize = 40 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(12,307, "Final Score = ") GraphicsWindow.BrushColor = "white" GraphicsWindow.DrawText(10,305, "Final Score = ") GraphicsWindow.FontSize = 70 nudge = Text.GetLength(score) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(563 - ((nudge-1) * 45),353, score) key = GraphicsWindow.LastKey While key <> "Escape" Program.Delay(100) GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() GraphicsWindow.DrawText(560 - ((nudge-1) * 45),350, score) key = GraphicsWindow.LastKey EndWhile Goto top End>BSB984.sb< Start>BSC206.sb< '' stopwatch 2013-08-26 WhTurner '' '' Challege of the Month - August 2013 '' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' KNOWN BUG : the first lap calculation after Stop and then Continue is wrong FO=Program.Directory+"\StopwLog.txt" ''name of logfile FileUse=1 ' 0=no file write 1=clear file and use 2=append to existing file If FileUse=1 then ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(FO) endif graphinit() Controls.ButtonClicked=Click GraphicsWindow.KeyDown=KeyD '================================================== ' SUBROUTINES KeyD ; Click; Shand ; graphinit ; DoLap '================================================== Sub KeyD Key=GraphicsWindow.LastKey If Key="Space" Then DoLap() endif EndSub Sub Click If Controls.LastClickedButton=b1 then 'start running=1 Controls.HideControl(b1) Controls.ShowControl(b2) GraphicsWindow.FontSize=20 Timer.Tick=Shand Timer.Interval=500 date=Clock.Date If FileUse>0 Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,"Started on "+date) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO," at "+Clock.Time) EndIf t0=Clock.ElapsedMilliseconds-t000 endif If Controls.LastClickedButton=b2 then 'stop running=0 Timer.Pause() Controls.HideControl(b2) Controls.ShowControl(b5) t1=Clock.ElapsedMilliseconds t000=t1-t0 sc=(t1-t0)/10000000 sc=(0+text.GetSubText(sc,3,6))/100 min=Math.Floor(sc/60) sc=Math.Remainder(sc,60) secf=text.GetSubText("100"+sc+"00000",2,5) minf=Text.GetSubTextToEnd(100+min,2) GraphicsWindow.BrushColor="#E0E0E0" ''lightgray GraphicsWindow.fillRectangle(200,550,180,50) GraphicsWindow.BrushColor="black" GraphicsWindow.DrawText(230,560,minf+":"+secf) If FileUse>0 Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,"stop" +minf+":"+secf) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,"Stopped at "+Clock.Time) EndIf EndIf If Controls.LastClickedButton=b3 Then 'reset running=0 hsec=-1 min=0 minh=0 min2=0 t000=0 Shand() Controls.HideControl(b2) Controls.HideControl(b5) Controls.ShowControl(b1) Timer.Tick=Shand Timer.Interval=500 Timer.Pause() GraphicsWindow.BrushColor="white" ''erase lap-table GraphicsWindow.FillRectangle(549,20,220,650) GraphicsWindow.BrushColor="black" ll=0 lapoffset=0 If FileUse>0 Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,"Reset at "+Clock.Time) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,"") EndIf endif If Controls.LastClickedButton=b4 then 'lap DoLap() endif If Controls.LastClickedButton=b5 then 'continue running=1 Controls.HideControl(b5) Controls.ShowControl(b2) If FileUse>0 Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,"Continued at "+Clock.Time) EndIf Timer.Resume() t0=Clock.ElapsedMilliseconds-t000 t01=t0 EndIf EndSub Sub Shand hsec=hsec+1 If hsec>119 Then hsec=hsec-120 minh=minh+1 EndIf secf=text.GetSubTextToEnd("100"+hsec/2,2) minf=Text.GetSubTextToEnd(100+minh,2) hr=Math.GetRadians(hsec*3) sinhr=Math.Sin(hr) coshr=Math.Cos(hr) Shapes.Rotate(ptr,hsec*3) Shapes.Move(ptr,xmp-2.5+90*sinhr,ymp-100-90*coshr) GraphicsWindow.BrushColor="#E0E0E0" ''lightgray GraphicsWindow.fillRectangle(200,550,180,50) GraphicsWindow.BrushColor="#A0A0A0" ''mediumgray GraphicsWindow.FontSize=30 GraphicsWindow.DrawText(220,560,minf+":"+secf) GraphicsWindow.BrushColor="Black" endsub Sub graphinit GraphicsWindow.Height=650 GraphicsWindow.top=50 GraphicsWindow.Width=800 GraphicsWindow.Left=50 GraphicsWindow.FontSize=20 r0=200 r1=190 r2=170 xmp=300 ymp=300 GraphicsWindow.BrushColor="#E0E0E0" GraphicsWindow.FillEllipse(xmp-210,ymp-210,420,420) GraphicsWindow.fillRectangle(200,550,180,50) GraphicsWindow.drawRectangle(200,550,180,50) GraphicsWindow.BrushColor="#A0A0A0" GraphicsWindow.FontSize=30 GraphicsWindow.DrawText(230,560,"00:00.") GraphicsWindow.BrushColor="Black" GraphicsWindow.FontSize=20 GraphicsWindow.DrawEllipse(xmp-210,ymp-210,420,420) GraphicsWindow.fillEllipse(xmp-20,ymp-20,40,40) For h=0 To 60 'sec.marks hr= Math.GetRadians(6*h) sinhr=Math.Sin(hr) coshr=Math.Cos(hr) GraphicsWindow.DrawLine(xmp+r0*Sinhr,ymp+r0*Coshr,xmp+r1*sinhr,ymp+r1*coshr) EndFor For h=0 To 60 Step 6 '10 sec marks hr= Math.GetRadians(10*h) sinhr=Math.Sin(hr) coshr=Math.Cos(hr) GraphicsWindow.DrawLine(xmp+r0*Sinhr,ymp+r0*Coshr,xmp+r2*sinhr,ymp+r2*coshr) EndFor For h=0 To 50 Step 10 'numbers hr=Math.GetRadians(h*6) sinhr=Math.Sin(hr) coshr=Math.Cos(hr) GraphicsWindow.DrawText(xmp-10+150*sinhr,ymp-10-150*coshr,h) EndFor b1=Controls.AddButton("start",100,100) b2=controls.addButton("stop/pause",50,100) b5=controls.addButton("continue.",60,100) Controls.HideControl(b2) Controls.HideControl(b5) b3=Controls.AddButton("reset",450,100) b4=Controls.AddButton(" lap (or use spacebar)",180,50) ptr=Shapes.AddRectangle(5,200) ''secondshand Shapes.Move(ptr,xmp-2.5,ymp-190) t000=0 EndSub sub DoLap If running=1 Then running=2 GraphicsWindow.FontSize=15 GraphicsWindow.DrawText(570,20,"Lap history") GraphicsWindow.DrawText(550,40,"# from start from last lap") EndIf If running>0 then t01=t1 t1=Clock.ElapsedMilliseconds t00=t1-t0 'from start sc=Text.Append((t00)/10000000,"000000") sc=(0+text.GetSubText(sc,3,6))/100 min=Math.Floor(sc/60) sc=Math.Remainder(sc,60) secf=text.GetSubText(Text.append(100+sc,"0000000"),2,5) minf=Text.GetSubTextToEnd(100+min,2) sc2=(t1-t01)/10000000 sc2=(0+text.GetSubText(sc2,3,6))/100 min2=Math.Floor(sc2/60) sc2=Math.Remainder(sc2,60) sec2f=text.GetSubText(Text.Append(100+sc2,"00"),2,5) min2f=Text.GetSubTextToEnd(100+min2,2) ll=ll+1 llf= Text.GetSubText(100+ll,2,2) lap[ll]=llf+" - "+minf+":"+secf+" "+min2f+":"+sec2f GraphicsWindow.FontSize=15 If ll-lapoffset>20 Then lapoffset=lapoffset+10 GraphicsWindow.BrushColor="white" ''erase lap-table GraphicsWindow.FillRectangle(549,70,200,600) GraphicsWindow.BrushColor="black" For ilap=1 To 10 GraphicsWindow.DrawText(550,50+25*ilap,lap[ilap+lapoffset]) Endfor endif GraphicsWindow.DrawText(550,50+25*(ll-lapoffset),lap[ll]) If FileUse>0 Then ' The following line could be harmful and has been automatically commented. ' File.AppendContents(FO,lap[ll]) EndIf endif EndSub End>BSC206.sb< Start>BSC699.sb< level=1 lat=0 lon=0 GraphicsWindow.width=512 GraphicsWindow.Height=512 GraphicsWindow.KeyDown=OnKeyDown GraphicsWindow.Title="Openstreetmap viewer" drawMap() 'While "true" 'endwhile Sub OnKeyDown key=graphicsWindow.LastKey 'GraphicsWindow.Clear() 'GraphicsWindow.DrawBoundText(250,5,300,key) If key="Left" Then If lon>0 Then lon=lon-1 EndIf ElseIf key="Right" then If lon0 Then lat=lat-1 EndIf ElseIf key="Down" then If lat1 then level=level-1 lon=math.Floor(lon/2) lat=math.Floor(lat/2) EndIf endif 'nl: img=ImageList.LoadImage("http://tile.openstreetmap.org/tiles/"+level+"/"+lon+"/"+lat+".png") drawMap() EndSub Sub drawMap lon1=lon+1 lat1=lat+1 img1=ImageList.LoadImage("http://a.tile.openstreetmap.org/"+level+"/"+lon+"/"+lat+".png") imageShape = Shapes.AddImage(img1) img1=ImageList.LoadImage("http://a.tile.openstreetmap.org/"+level+"/"+lon1+"/"+lat+".png") imageShape2 = Shapes.AddImage(img1) Shapes.Move(imageShape2,256,0) img1=ImageList.LoadImage("http://a.tile.openstreetmap.org/"+level+"/"+lon+"/"+lat1+".png") imageShape3 = Shapes.AddImage(img1) Shapes.Move(imageShape3,0,256) img1=ImageList.LoadImage("http://a.tile.openstreetmap.org/"+level+"/"+lon1+"/"+lat1+".png") imageShape4 = Shapes.AddImage(img1) Shapes.Move(imageShape4,256,256) EndSub End>BSC699.sb< Start>BSH241.sb< GraphicsWindow.BackgroundColor="darkblue" cx=624/2 cy=442/2 GraphicsWindow.Title ="Blackhole in action GraphicsWindow.PenWidth = 0 LDPhysics.SetGravity(0,0) While "true a=0 For n=1 To 1600 r15=math.SquareRoot(n)/2+4 x=cx+ldmath.Sin(a)*(cy-10) y=cy+ldmath.Cos(a)*(cy-10) dx=ldmath.Sin(a) dy=ldmath.Cos(a) GraphicsWindow.BrushColor=LDColours.HSLtoRGB (n/2 1 .6) t[n] = Shapes.AddEllipse(r15,r15) LDPhysics.AddMovingShape(t[n],1,0,0) LDPhysics.SetPosition(t[n],x,y,0) LDPhysics.SetVelocity(t[n],-dx*50,-dy*50) a=a+137.5 If n>160 Then LDPhysics.RemoveShape (t[n-160]) endif LDPhysics.DoTimestep() EndFor a=0 For r=n-160 To 1600 LDPhysics.RemoveShape (t[r]) endfor endwhile End>BSH241.sb< Start>BSK130.sb< GraphicsWindow.Show() 'While old bug GraphicsWindow.FontName = "Consolas" 'set a font with equal length of all sign d = -2 'Different time for hours sct = Shapes.AddText("Current time: ") 'build a shape for current time Shapes.Move(sct, 10, 10) 'move shape for current time on position 10, 10 sdct = Shapes.AddText("Different to current time: ") 'build a shape for different current time Shapes.Move(sdct, 10, 40) 'move shape for different current time to position 10, 40 While d <> 25 'no ending loop for main program h = clock.Hour 'put the actual hour to h If h < 10 Then h = Text.Append("0", h) 'put zero at first position of h EndIf m = Clock.Minute 'put the actual minute to m If m < 10 Then m = Text.Append("0", m) 'put zero at first position of m EndIf s = Clock.Second 'put the actual secont to s If s < 10 Then s = Text.Append("0", s) 'put zero at first position of s EndIf ct = Text.Append(h, ":") 'build the current tim in format hh:mm:ss ct = Text.Append(ct, m) ct = Text.Append(ct, ":") ct = Text.Append(ct, s) dh = h + d 'put the different of actual hour and the different hour to dh 'Corection the differnt by greater 24 or lower zero If d < 0 Then If dh < 0 Then dh = dh + 24 EndIf ElseIf d > 0 Then If dh > 24 Then dh = dh - 24 EndIf EndIf If dh < 10 Then dh = Text.Append("0", dh) 'put zero at first position of diffent hour EndIf dct = Text.Append(dh, ":") 'build the different current tim in format hh:mm:ss dct = Text.Append(dct, m) dct = Text.Append(dct, ":") dct = Text.Append(dct, s) Shapes.SetText(sct, "Current time : " + ct) 'set the text for output in the shape sct Shapes.SetText(sdct,"Different to current time: " + dct) 'set the text for output in the shape sdct EndWhile 'go back to the begin of the loop End>BSK130.sb< Start>BSK175-0.sb< ' Challenge of the month July 2013 Search Keyword by NaochanON BSK175 ' This program includes contents of SB Forum July's thread . Sfile= Program.Directory+"\source.txt" ' Source file name source() ' <---- make a source file// if exist , unnecessary Kfile= Program.Directory+"\Keyword.txt" ' Keyword file name keywords() ' <---- make a keyword file// if exist , unnecessary GUI() Controls.ButtonClicked=onclicked Sub onclicked target= text.ConvertToLowerCase(Controls.GetTextBoxText(Tbox)) ' The following line could be harmful and has been automatically commented. ' stext= File.ReadContents(Sfile)+CRLF SLen= Text.GetLength(stext) search_the_keyword() show_result() EndSub Sub search_the_keyword LL=0 MM=0 IsLine="" While SLen>0 MM=MM+1 midP= Text.GetIndexOf(stext,CRLF) pre[MM]= text.ConvertToLowerCase(Text.GetSubText(stext,1,midP+1)) ' pre include CRLF If Text.IsSubText(pre[MM],target) Then LL=LL+1 IsLine[LL]="LineNo: "+MM+" "+pre[MM] EndIf stext= Text.GetSubTextToEnd(stext,midp+2) SLen= Text.GetLength(stext) endwhile EndSub Sub show_result result="" For i=1 To Array.GetItemCount(IsLine) result=result+IsLine[i]+CRLF EndFor Shapes.SetText(msg,result) EndSub Sub GUI CRLF= Text.GetCharacter(13)+Text.GetCharacter(10) GraphicsWindow.Width=1200 GraphicsWindow.Height=700 GraphicsWindow.BackgroundColor="Darkgreen" GraphicsWindow.BrushColor="Yellow" GraphicsWindow.FontSize=20 ' The following line could be harmful and has been automatically commented. ' KWD=Shapes.AddText("Keywords are..."+CRLF+CRLF+File.ReadContents(Kfile)) Shapes.Move(KWD,1000,20) GraphicsWindow.BrushColor="Navy" TBox=Controls.AddTextBox(20,70) Controls.SetSize(TBox,500,40) Controls.AddButton("Search",540,70) GraphicsWindow.BrushColor="White" GraphicsWindow.FontSize=14 GraphicsWindow.DrawText(20,20,"Enter keyword here and click the button") MSG=Shapes.AddText(" Results are shown here......") Shapes.Move(msg,20,120) EndSub Sub source D[1]=" Challenge 2.1" D[2]="" D[3]="(1) Write a program that draws 5 randomly positioned and sized red rectangles on a blue background." D[4]="" D[5]="(2) Draw a picture of a car using rectangles, ellipses and lines." D[6]="" D[7]="(3) Draw a map of your local area." D[8]="" D[9]="Basic Challenge 1" D[10]="" D[11]="Write a program where the user enters 5 numbers and you calculate the sum (all added), product (all multiplied) and average." D[12]="" D[13]="Basic Challenge 2" D[14]="" D[15]="Write a program with 4 buttons, one in each corner or the GraphicsWindow. They will:" D[16]=":Change the background colour" D[17]=":Make a sound" D[18]=":Show an image in the middle of the GraphicsWindow" D[19]=":Clear the GraphicsWindow, but not the buttons!" D[20]="" D[21]="Intermediate Challenge 1" D[22]="" D[23]="Write a program using the Controls methods to create a booking form for a hotel and store the results to a file to be printed." D[24]="" D[25]="Data fields include:" D[26]=":Name" D[27]=":Arrival date" D[28]=":Departure date" D[29]=":Number of adults and children" D[30]=":Breakfast included or not" D[31]=":Special requests" D[32]="Intermediate Challenge 2" D[33]="" D[34]="Open a text file, search it for some keywords and output any sentence containing the keywords." D[35]=" D[36]="The keywords should be set in another file, read by the program." D[37]="" D[38]="Physics Game Challenge" D[39]="" D[40]="Make a simple table air hockey game for 2 players." D[41]="" D[42]="Maths Challenge" D[43]="" D[44]="Write a program to calculate the sum of the first 100 prime numbers." D[45]="" D[46]="Graphics Challenge D[47]=" D[48]="Draw an animation of a walking man." D[49]="" D[50]="" D[51]="Community Suggestion 1 (By Timo So)" D[52]="" D[53]="Write a program that creates SmallBasic programs." D[54]="" D[55]="The user can input a set of commands like:" For i=1 To Array.GetItemCount(D) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(sfile,i,D[i]) EndFor EndSub Sub keywords k[1]="Write" k[2]="program" k[3]="Graphics" k[4]="draw" k[5]="date" k[6]="number" k[7]="that" k[8]="challenge" For i=1 To Array.GetItemCount(k) ' The following line could be harmful and has been automatically commented. ' File.WriteLine(kfile,i,k[i]) EndFor EndSub End>BSK175-0.sb< Start>BSL471.sb< TX="H L M400 D A-30 F110 T-120 F60 T120 F90 T-120 F140 T-120 F50 T-60 F92 L M30 Z CRED TX=TX+"M-30 T15 M10 D T255 F80 F-80 T-255 M10 T255 D F80 H A0 L M250 T60 D TX=TX+"F140 T-120 F140 T-120 F50 T-60 F92 L M30 Z CRED TX=TX+"M-30 T15 M10 D T255 F80 F-80 T-255 M10 T255 D F80 H L M240 T180 D TX=TX+"T-90 F110 R F45 R F110 R F45 T120 M20 Z CRED H L M160 R R TX=TX+"T-90 D F110 T135 F150 T-135 F50 T-45 F80 T-45 F50 T-135 M150 T-135 D F110 F-110 Z T-15 M15 CRED M-15 T15 A0 M13 T-45 D F90 F-90 A0 M13 T-45 D F90 F-90 T45 M80 R M20 TX=TX+"D F110 T135 F150 T-135 F50 T-45 F80 T-45 F50 T-135 M150 T-135 D F110 F-110 Z T-15 M15 CRED M-15 A90 M13 T-45 D F90 F-90 A90 M13 T-45 D F90 F-90 A90 M90 L M105 R TX=TX+"D F110 T135 F150 T-135 F50 T-45 F80 T-45 F50 T-135 M150 T-135 D Z T-15 M15 CRED M-15 A90 M13 T-45 D F90 F-90 A90 M13 T-45 D F90 F-90 A90 M90 TX=TX+"L M80 T45 D F40 T135 F110 L F37 L F75 T-45 F50 T-135 M110 Z A90 T-15 M15 CRED tt=ldtext.Split (TX " ") Turtle.Speed =10 GraphicsWindow.Title="Turtle CharDraw GraphicsWindow.PenWidth =4 GraphicsWindow.PenColor="darkblue GraphicsWindow.BackgroundColor ="TEAL GraphicsWindow.Width=1200 For x=1 To Array.GetItemCount (tt) If Text.StartsWith (tt[x] "A") Then Turtle.Angle=Text.GetSubTextToEnd(tt[x] 2) elseIf Text.StartsWith (tt[x] "T") Then Turtle.Angle=turtle.Angle +Text.GetSubTextToEnd(tt[x] 2) elseIf Text.StartsWith (tt[x] "F") Then Turtle.Move (Text.GetSubTextToEnd(tt[x] 2)) elseIf Text.StartsWith (tt[x] "V") Then pz=ldtext.Split (Text.GetSubTextToEnd(tt[x] 2) ";") Turtle.Moveto (pz[1] pz[2]) elseIf Text.StartsWith (tt[x] "L") Then Turtle.TurnLeft () elseIf Text.StartsWith (tt[x] "R") Then Turtle.TurnRight() elseIf Text.StartsWith (tt[x] "M") Then Turtle.PenUp () Turtle.Move (Text.GetSubTextToEnd(tt[x] 2)) elseIf Text.StartsWith (tt[x] "D") Then Turtle.PenDown() elseIf Text.StartsWith (tt[x] "H") Then if text.EndsWith (tt[x] "H") then Turtle.PenUp () endif Turtle.MoveTo (GraphicsWindow.Width/2 GraphicsWindow.Height/2 ) Turtle.PenDown () Turtle.Angle=0 elseIf Text.StartsWith (tt[x] "Z") Then LDShapes.RasteriseTurtleLines () elseIf Text.StartsWith (tt[x] "C") Then LDGraphicsWindow.FloodFill (Turtle.X Turtle.Y Text.GetSubTextToEnd(tt[x] 2)) EndIf EndFor End>BSL471.sb< Start>BSM205.sb< args=0 LDUtilities.FixFlickr () GraphicsWindow.PenWidth =1 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.PenColor="cyan pall="ancient Egypt ii=imagelist.LoadImage (Flickr.GetRandomPicture (pall)) GraphicsWindow.Title=pall tx= Shapes.AddText ("Egypt") LDShapes.Font (tx "vivaldi" 20 "false" "false") ldShapes.Centre (tx 180 160) While "true i=i+1.5 If Math.Remainder (i 180)=0 Then ii=imagelist.LoadImage (Flickr.GetRandomPicture (pall)) mo=mo+1 endif If Math.Remainder( mo 2)=0 then ff=math.Abs(LDMath.Sin (i))+.6 GraphicsWindow.PenWidth =math.Abs(LDMath.Sin (i))*9 Else ff=1 endif GraphicsWindow.PenColor=LDColours.HSLtoRGB (Math.Remainder (i 180) 1 .6) pldrw() If Math.Remainder( mo 2)=0 then ff=math.Abs(LDMath.Sin (i))+.6 GraphicsWindow.PenWidth =math.Abs(LDMath.Sin (i))*3 GraphicsWindow.PenColor="darkblue pldrw() endif GraphicsWindow.PenWidth =1 If Math.Remainder( mo 2)=1 then ff=math.Abs(LDMath.Sin (i))+.6 Else ff=1 endif LDShapes.penColour (tx GraphicsWindow.PenColor ) Shapes.Zoom (tx ff*5 3*ff) Program.Delay (25) If Math.Remainder( mo 2)=0 then GraphicsWindow.PenColor="darkblue ff=math.Abs(LDMath.Sin (i))+.6 GraphicsWindow.PenWidth =math.Abs(LDMath.Sin (i))*11 pldrw () else GraphicsWindow.DrawResizedImage (ii 0 0 GraphicsWindow.Width GraphicsWindow.Height) 'GraphicsWindow.BrushColor="darkblue 'GraphicsWindow.FillRectangle (0 0 330 230) endif endwhile Sub pldrw LDCall.Function2 ("odrw" 35+35*ff 100) LDCall.Function2 ("ldrw" 35+67*ff 100) LDCall.Function2 ("ddrw" 35+80*ff 100) EndSub Sub ldrw LDCall.Function4("aline" args[1] args[2] 50*ff, -75) EndSub Sub lldrw oc= GraphicsWindow.PenColor GraphicsWindow.penColor=GraphicsWindow.BackgroundColor LDCall.Function4("aline" args[1] args[2] 40*ff, -75) GraphicsWindow.PenColor=oc LDCall.Function4("aline" mm[1] mm[2] 10*ff, -75) EndSub Sub odrw GraphicsWindow.DrawEllipse (args[1] args[2]-30*ff 28*ff 28*ff) EndSub Sub vdrw s115=args[1] s100=args[2] LDCall.Function4("aline" s115 s100 55*ff, -65) LDCall.Function4("aline" s115 s100 55*ff, -110) endsub Sub idrw s115=args[1] s100=args[2] LDCall.Function4("aline" s115 s100 30*ff, -75) endsub Sub adrw s115=args[1] s100=args[2] GraphicsWindow.DrawEllipse (s115 s100-30*ff 28*ff 28*ff) LDCall.Function4("aline" s115+22*ff s100 30*ff, -75) endsub Sub pdrw s115=args[1] s100=args[2] GraphicsWindow.DrawEllipse (s115 s100-30*ff 28*ff 28*ff) LDCall.Function4("aline" s115+8*ff s100-30*ff, 50*ff, 180-75) endsub Sub ddrw s115=args[1] s100=args[2] GraphicsWindow.DrawEllipse (s115 s100-30*ff 28*ff 28*ff) LDCall.Function4("aline" s115+22*ff s100 50*ff, -75) endsub Sub zdrw s115=args[1] s100=args[2] LDCall.Function4("aline" s115 s100 30*ff, -55) GraphicsWindow.DrawLine (mm[1] mm[2] mm[1]-13*ff mm[2]) GraphicsWindow.DrawLine (s115 s100 s115+15*ff s100) endsub Sub aline mm= LDMath.Convert2Cartesian (args[1] args[2] args[3] args[4]) GraphicsWindow.DrawLine (args[1] args[2] mm[1] mm[2]) EndSub End>BSM205.sb< Start>BSP033-0.sb< ' World Clock ' Copyright (c) 2014 Nonki Takahashi. The MIT License. ' Version: 0.2b ' Last update: 2014-11-17 ' Program ID: BSP033-0 ' GraphicsWindow.Title = "World Clock 0.2b" cityLocal = "Tokyo" city["Sydney"] ="local=+10;DST=+1(10-3);hemisphere=south;" city["Tokyo"] = "local=+9;DST=0;hemeiphere=north;" city["Kolkata"] = "local=+5.5;DST=0;hemeiphere=north;" city["Colombo"] = "local=+5.5;DST=0;hemeiphere=north;" city["Cairo"] = "local=+2;DST=+1(5-9);hemeiphere=north;" city["London"] = "local=0;DST=+1(4-10);hemisphere=north;" city["Accra"] = "local=0;DST=0;hemeiphere=north;" city["Rio de Janeiro"] = "local=-3;DST=+1(11-2);hemeiphere=south;" city["Buenos Aires"] = "local=-3;DST=0;hemeiphere=south;" city["Seatle"] = "local=-8;DST=+1(3-10);hemisphere=north;" bc = "#000000" colorDay = "#CCCCCC" colorNight = "#666666" colorMidNight = "#333333" colorHourHand = "#FF9900" colorText = "#FFFFFF" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = bc nCity = Array.GetItemCount(city) index = Array.GetAllIndices(city) deltaLocal = city[cityLocal]["local"] GraphicsWindow.FontName = "Trebuchet MS" width = Math.Floor((gw - 110) / 24) height = Math.Floor((gh - 60) / nCity) For i = 1 To nCity x = 10 y = 50 + (i - 1) * height GraphicsWindow.BrushColor = colorText GraphicsWindow.DrawText(x, y + height / 2 - 10, index[i]) x = 100 hourLocal = city[index[i]]["local"] * 1 If hourLocal < 0 Then hourLocal = hourLocal + 24 EndIf If 0 < hourLocal - Math.Floor(hourLocal) Then half = "True" Else half = "False" EndIf For hourUTC = 0 To 23 If 6 <= hourLocal And hourLocal < 18 Then GraphicsWindow.BrushColor = colorDay ElseIf 18 <= hourLocal Then GraphicsWindow.BrushColor = colorNight Else GraphicsWindow.BrushColor = colorMidNight EndIf If (hourUTC = 0) And half Then GraphicsWindow.FillRectangle(x, y + 10, width / 2 - 1, height - 20) If 6 <= (hourLocal + 0.5) And (hourLocal + 0.5) < 18 Then GraphicsWindow.BrushColor = colorDay ElseIf 18 <= (hourLocal + 0.5) Then GraphicsWindow.BrushColor = colorNight Else GraphicsWindow.BrushColor = colorMidNight EndIf GraphicsWindow.FillRectangle(x + width / 2, y + 10, width - 1, height - 20) ElseIf (hourUTC = 23) And half Then If 6 <= (hourLocal + 0.5) And (hourLocal + 0.5) < 18 Then GraphicsWindow.BrushColor = colorDay ElseIf 18 <= (hourLocal + 0.5) Then GraphicsWindow.BrushColor = colorNight Else GraphicsWindow.BrushColor = colorMidNight EndIf GraphicsWindow.FillRectangle(x + width / 2, y + 10, width / 2 - 1, height - 20) ElseIf half Then If 6 <= (hourLocal + 0.5) And (hourLocal + 0.5) < 18 Then GraphicsWindow.BrushColor = colorDay ElseIf 18 <= (hourLocal + 0.5) Then GraphicsWindow.BrushColor = colorNight Else GraphicsWindow.BrushColor = colorMidNight EndIf GraphicsWindow.FillRectangle(x + width / 2, y + 10, width - 1, height - 20) Else GraphicsWindow.FillRectangle(x, y + 10, width - 1, height - 20) EndIf If half Then If 6 <= (hourLocal + 0.5) And (hourLocal + 0.5) < 18 Then GraphicsWindow.BrushColor = colorMidNight Else GraphicsWindow.BrushColor = colorDay EndIf GraphicsWindow.DrawText(x + width / 2, y + 10, Math.Floor(hourLocal + 0.5)) Else If 6 <= hourLocal And hourLocal < 18 Then GraphicsWindow.BrushColor = colorMidNight Else GraphicsWindow.BrushColor = colorDay EndIf GraphicsWindow.DrawText(x, y + 10, hourLocal) EndIf x = x + width hourLocal = hourLocal + 1 If 24 <= hourLocal Then hourLocal = hourLocal - 24 EndIf EndFor EndFor y = 60 GraphicsWindow.PenColor = colorHourHand hourHand = Shapes.AddLine(0, 0, 0, nCity * height - 20) Shapes.SetOpacity(hourHand, 70) GraphicsWindow.BrushColor = colorText objCity = Shapes.Addtext("Local Time") Shapes.Move(objCity, 10, 10) GraphicsWindow.DrawText(gw / 2, 10, "UTC") GraphicsWindow.FontSize = 30 objLocal = Shapes.AddText("00:00") Shapes.Move(objLocal, 100, 10) objUTC = Shapes.AddText("00:00") Shapes.Move(objUTC, gw / 2 + 90, 10) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" objBar = Shapes.AddRectangle(gw, height) Shapes.SetOpacity(objBar, 20) Shapes.HideShape(objBar) iCity = "" Timer.Interval = 500 Timer.Tick = OnTick Sub OnTick hourUTC = Clock.Hour - city[cityLocal]["local"] If hourUTC < 0 Then hourUTC = hourUTC + 24 EndIf If 24 <= hourUTC Then hourUTC = hourUTC - 24 EndIf minute = Clock.Minute hour = hourUTC hourUTC = hourUTC + minute / 60 x = 100 + Math.Floor(hourUTC * width) Shapes.Move(hourHand, x, y) GetTime() Shapes.SetText(objUTC, time) GetCity() If iCity = "" Then Shapes.HideShape(objBar) Shapes.SetText(objCity, "Local Time") Shapes.SetText(objLocal, "00:00") Else _y = 50 + (i - 1) * height Shapes.Move(objBar, 0, _y) Shapes.ShowShape(objBar) Shapes.SetText(objCity, iCity) hour = hour + city[iCity]["local"] If hour < 0 Then hour = hour + 24 ElseIf 23 < hour Then hour = hour - 24 EndIf frac = hour - Math.Floor(hour) If 0 < frac Then minute = Math.Floor(minute + frac * 60) hour = Math.Floor(hour - frac) If 60 <= minute Then minute = minute - 60 hour = hour + 1 If 23 < hour Then hour = hour - 24 EndIf EndIf EndIf GetTime() Shapes.SetText(objLocal, time) EndIf EndSub Sub GetTime ' param hour, minute ' return time - "hh:mm" len = Text.GetLength(hour) time = Text.Append(Text.GetSubTextToEnd("00", len + 1), hour) time = time + ":" len = Text.GetLength(minute) time = time + Text.GetSubTextToEnd("00", len + 1) + minute EndSub Sub GetCity ' get city from mouse pointer my = GraphicsWindow.MouseY i = Math.Floor((my - 50) / height + 1) If 1 <= i And i <= nCity Then iCity = index[i] Else iCity = "" EndIf EndSub End>BSP033-0.sb< Start>BSP033-1.sb< ' World Clock ' Copyright (c) 2014 Nonki Takahashi. The MIT License. ' Version: 0.3b ' Last update: 2014-11-18 ' Program ID: BSP033-1 ' GraphicsWindow.Title = "World Clock 0.3b" cityLocal = "Tokyo" city["Sydney"] ="local=+10;DST=+1;fromDST=10;toDST=3;" city["Tokyo"] = "local=+9;DST=0;" city["Kolkata"] = "local=+5.5;DST=0;" city["Colombo"] = "local=+5.5;DST=0;" city["Cairo"] = "local=+2;DST=+1;fromDST=5;toDST=9;" city["London"] = "local=0;DST=+1;fromDST=4;toDST=10;" city["Accra"] = "local=0;DST=0;" city["Rio de Janeiro"] = "local=-3;DST=+1;fromDST=11;toDST=2;" city["Buenos Aires"] = "local=-3;DST=0;" city["Seatle"] = "local=-8;DST=+1;fromDST=3;toDST=10;" bc = "#000000" colorMorning = "#CCCCCC" colorDay = "#EEEEEE" colorNight = "#666666" colorMidNight = "#333333" colorHourHand = "#FF9900" colorText = "#FFFFFF" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = bc nCity = Array.GetItemCount(city) index = Array.GetAllIndices(city) deltaLocal = city[cityLocal]["local"] GraphicsWindow.FontName = "Trebuchet MS" width = Math.Floor((gw - 110) / 24) height = Math.Floor((gh - 60) / nCity) For i = 1 To nCity CalcDST() x = 10 y = 50 + (i - 1) * height GraphicsWindow.BrushColor = colorText GraphicsWindow.DrawText(x, y + height / 2 - 10, index[i]) x = 100 hourLocal = city[index[i]]["local"] * 1 If hourLocal < 0 Then hourLocal = hourLocal + 24 EndIf If 0 < hourLocal - Math.Floor(hourLocal) Then half = "True" Else half = "False" EndIf For hourUTC = 0 To 23 hour = hourLocal SetBandColor() If (hourUTC = 0) And half Then GraphicsWindow.FillRectangle(x, y + 10, width / 2 - 1, height - 20) hour = hourLocal + 0.5 SetBandColor() GraphicsWindow.FillRectangle(x + width / 2, y + 10, width - 1, height - 20) ElseIf (hourUTC = 23) And half Then hour = hourLocal + 0.5 SetBandColor() GraphicsWindow.FillRectangle(x + width / 2, y + 10, width / 2 - 1, height - 20) ElseIf half Then hour = hourLocal + 0.5 SetBandColor() GraphicsWindow.FillRectangle(x + width / 2, y + 10, width - 1, height - 20) Else GraphicsWindow.FillRectangle(x, y + 10, width - 1, height - 20) EndIf If half Then hour = hourLocal + 0.5 SetHourColor() GraphicsWindow.DrawText(x + width / 2, y + 10, Math.Floor(hour)) Else hour = hourLocal SetHourColor() GraphicsWindow.DrawText(x, y + 10, hourLocal) EndIf x = x + width hourLocal = hourLocal + 1 If 24 <= hourLocal Then hourLocal = hourLocal - 24 EndIf EndFor EndFor y = 60 GraphicsWindow.PenColor = colorHourHand hourHand = Shapes.AddLine(0, 0, 0, nCity * height - 20) Shapes.SetOpacity(hourHand, 70) GraphicsWindow.BrushColor = colorText objCity = Shapes.Addtext("Local Time") Shapes.Move(objCity, 10, 10) GraphicsWindow.DrawText(gw / 2, 10, "UTC") Program.Delay(200) GraphicsWindow.FontSize = 30 objLocal = Shapes.AddText("00:00") Shapes.Move(objLocal, 100, 10) objUTC = Shapes.AddText("00:00") Shapes.Move(objUTC, gw / 2 + 90, 10) GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" objBar = Shapes.AddRectangle(gw, height) Shapes.SetOpacity(objBar, 20) Shapes.HideShape(objBar) iCity = "" Timer.Interval = 500 Timer.Tick = OnTick Sub CalcDST ' param i If 0 < city[index[i]]["DST"] Then month = Clock.Month If city[index[i]]["fromDST"] < city[index[i]]["toDST"] Then If (city[index[i]]["fromDST"] <= month) And (month <= city[index[i]]["toDST"]) Then city[index[i]]["local"] = city[index[i]]["local"] + city[index[i]]["DST"] EndIf Else If ((1 <= month) And (month <= city[index[i]]["toDST"])) Or ((city[index[i]]["fromDST"] <= month) And (month <= 12)) Then city[index[i]]["local"] = city[index[i]]["local"] + city[index[i]]["DST"] EndIf EndIf EndIf EndSub Sub GetTime ' param hour, minute ' return time - "hh:mm" len = Text.GetLength(hour) time = Text.Append(Text.GetSubTextToEnd("00", len + 1), hour) time = time + ":" len = Text.GetLength(minute) time = time + Text.GetSubTextToEnd("00", len + 1) + minute EndSub Sub GetCity ' get city from mouse pointer my = GraphicsWindow.MouseY i = Math.Floor((my - 50) / height + 1) If 1 <= i And i <= nCity Then iCity = index[i] Else iCity = "" EndIf EndSub Sub OnTick hourUTC = Clock.Hour - city[cityLocal]["local"] If hourUTC < 0 Then hourUTC = hourUTC + 24 EndIf If 24 <= hourUTC Then hourUTC = hourUTC - 24 EndIf minute = Clock.Minute hour = hourUTC hourUTC = hourUTC + minute / 60 x = 100 + Math.Floor(hourUTC * width) Shapes.Move(hourHand, x, y) GetTime() Shapes.SetText(objUTC, time) GetCity() If iCity = "" Then Shapes.HideShape(objBar) Shapes.SetText(objCity, "Local Time") Shapes.SetText(objLocal, "00:00") Else _y = 50 + (i - 1) * height Shapes.Move(objBar, 0, _y) Shapes.ShowShape(objBar) Shapes.SetText(objCity, iCity) hour = hour + city[iCity]["local"] If hour < 0 Then hour = hour + 24 ElseIf 23 < hour Then hour = hour - 24 EndIf frac = hour - Math.Floor(hour) If 0 < frac Then minute = Math.Floor(minute + frac * 60) hour = Math.Floor(hour - frac) If 60 <= minute Then minute = minute - 60 hour = hour + 1 If 23 < hour Then hour = hour - 24 EndIf EndIf EndIf GetTime() Shapes.SetText(objLocal, time) EndIf EndSub Sub SetBandColor ' param hour If 23 < hour Then hour = hour - 24 EndIf If 6 <= hour And hour < 12 Then GraphicsWindow.BrushColor = colorMorning ElseIf 12 <= hour And hour < 18 Then GraphicsWindow.BrushColor = colorDay ElseIf 18 <= hour Then GraphicsWindow.BrushColor = colorNight Else GraphicsWindow.BrushColor = colorMidNight EndIf EndSub Sub SetHourColor ' param hour If 23 < hour Then hour = hour - 24 EndIf If 6 <= hour And hour < 18 Then GraphicsWindow.BrushColor = colorMidNight Else GraphicsWindow.BrushColor = colorDay EndIf EndSub End>BSP033-1.sb< Start>BSP033.sb< ' World Clock ' Copyright (c) 2014 Nonki Takahashi. The MIT License. ' Version: 0.1a ' Last update: 2014-11-11 ' Program ID: ' GraphicsWindow.Title = "World Clock 0.1a" cityLocal = "Tokyo" city["Sydney"] ="local=+10;DST=+1;hemisphere=south;" city["Tokyo"] = "local=+9;DST=0;hemeiphere=north;" city["London"] = "local=0;DST=+1;hemisphere=north;" city["Seatle"] = "local=-8;DST=+1;hemisphere=north;" bc = "#000000" colorDay = "#CCCCCC" colorNight = "#666666" colorMidNight = "#333333" colorHourHand = "#FF9900" colorText = "#FFFFFF" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = bc nCity = Array.GetItemCount(city) index = Array.GetAllIndices(city) deltaLocal = city[cityLocal]["local"] GraphicsWindow.FontName = "Trebuchet MS" width = Math.Floor((gw - 110) / 24) height = Math.Floor((gh - 60) / nCity) For i = 1 To nCity x = 10 y = 50 + (i - 1) * height GraphicsWindow.BrushColor = colorText GraphicsWindow.DrawText(x, y + height / 2 - 10, index[i]) x = 100 hourLocal = city[index[i]]["local"] * 1 If hourLocal < 0 Then hourLocal = hourLocal + 24 EndIf For hourGMT = 0 To 23 If 6 <= hourLocal And hourLocal < 18 Then GraphicsWindow.BrushColor = colorDay ElseIf 18 <= hourLocal Then GraphicsWindow.BrushColor = colorNight Else GraphicsWindow.BrushColor = colorMidNight EndIf GraphicsWindow.FillRectangle(x, y + 10, width - 1, height - 20) If 6 <= hourLocal And hourLocal < 18 Then GraphicsWindow.BrushColor = colorMidNight Else GraphicsWindow.BrushColor = colorDay EndIf GraphicsWindow.DrawText(x, y + 10, hourLocal) x = x + width hourLocal = hourLocal + 1 If 24 <= hourLocal Then hourLocal = hourLocal - 24 EndIf EndFor EndFor y = 60 GraphicsWindow.PenColor = colorHourHand hourHand = Shapes.AddLine(0, 0, 0, gh - 80) Timer.Interval = 500 Timer.Tick = OnTick Sub OnTick hourGMT = Clock.Hour - city[cityLocal]["local"] If hourGMT < 0 Then hourGMT = hourGMT + 24 EndIf If 24 <= hourGMT Then hourGMT = hourGMT - 24 EndIf hourGMT = hourGMT + Clock.Minute / 60 x = 100 + Math.Floor(hourGMT * width) Shapes.Move(hourHand, x, y) EndSub End>BSP033.sb< Start>BSV343.sb< 'Count down timer - Compliments of codingCat aka Matthew L. Parets count = 1024 hold = "true" GraphicsWindow.Show() GraphicsWindow.Width = 280 GraphicsWindow.Height = 80 GraphicsWindow.FontSize = 25 GraphicsWindow.BrushColor = "blue" goButton = Controls.AddButton("Go!!",200,5) Controls.SetSize(goButton,75,45) GraphicsWindow.FontSize = 10 GraphicsWindow.BrushColor = "black" addButton = Controls.addbutton("Plus 1kb", 200,52) Controls.SetSize(addButton, 75,23) Controls.ButtonClicked = buttonPress GraphicsWindow.FontSize = 30 GraphicsWindow.FontItalic = "true" While count >= 1 While hold = "true" EndWhile count = count - 1 displayCount() EndWhile Program.End() Sub buttonPress If Controls.LastClickedButton = goButton Then If hold = "true" Then Controls.SetButtonCaption(goButton,"Stop") hold = "false" Else Controls.SetButtonCaption(goButton,"Go!!") hold = "true" EndIf ElseIf Controls.LastClickedButton = addButton then count = count + 1024 displayCount() EndIf EndSub Sub displayCount GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor GraphicsWindow.fillRectangle(5,5,195,85) GraphicsWindow.BrushColor = "blue" indent = Text.GetLength(count)-1 GraphicsWindow.DrawText(170-(indent * 19),20,count) EndSub End>BSV343.sb< Start>BSW035-0.sb< Initialise() While 0=0 angle = angle + 1 If angle = 360 Then angle = 0 EndIf radians = Math.GetRadians(angle) X = (radius * 0.7) * Math.Cos(radians) + radius Y = (radius * 0.7) * Math.Sin(radians) + radius Shapes.Rotate(gameWheel, angle) Shapes.Move(nameTag, X - wName / 2, Y - hName / 2) Shapes.Rotate(nameTag, angle) Program.Delay(20) EndWhile Sub Initialise LF = Text.GetCharacter(10) path = "http://rickmurphy.byethost5.com/SmallBasic/ProgramListing/GameWheel/assets/images/game-wheel.png" image = ImageList.LoadImage(path) If ImageList.GetWidthOfImage(image) = 0 Then GraphicsWindow.ShowMessage("Image D/load failed" + LF + "Click OK to end program", "Connection ERROR!") Program.End() EndIf radius = ImageList.GetWidthOfImage(image) / 2 gameWheel = Shapes.AddImage(image) GraphicsWindow.FontName = "Courier New" GraphicsWindow.BrushColor = "Black" name = "myName" nameTag = Shapes.AddText(name) hName = 12 wName = Text.GetLength(name) * hName * 0.6 EndSub End>BSW035-0.sb< Start>BSW035.sb< Initialise() While 0=0 angle = angle + 1 If angle = 360 Then angle = 0 EndIf radians = Math.GetRadians(angle) X = radius * Math.Cos(radians) + radius '+ more Math to Rotate nameTag Y = radius * Math.Sin(radians) + radius Shapes.Rotate(gameWheel, angle) Shapes.Move(nameTag, X, Y) Shapes.Rotate(nameTag, angle) Program.Delay(20) EndWhile Sub Initialise LF = Text.GetCharacter(10) path = "http://rickmurphy.byethost5.com/SmallBasic/ProgramListing/GameWheel/assets/images/game-wheel.png" image = ImageList.LoadImage(path) If ImageList.GetWidthOfImage(image) = 0 Then GraphicsWindow.ShowMessage("Image D/load failed" + LF + "Click OK to end program", "Connection ERROR!") Program.End() EndIf radius = ImageList.GetWidthOfImage(image) / 2 gameWheel = Shapes.AddImage(image) nameTag = Shapes.AddText("myName") EndSub End>BSW035.sb< Start>BSZ306.sb< 'Initialise, get SmallBasic files in directory containing this file, choose a file, then Parse it 'The Parse1 makes a copy with indentation sorted out and lists variables and the lines on which they are set 'The Parse2 finds all lines where the variables are used 'Finally any potential unitialised varibles are identified Init() GetFiles() SetFile() Parse1() Output1() Parse2() Output2() Unititialised() Sub Init 'List of keywords which have indentation following them Array.SetValue("Indents",1,"For") Array.SetValue("Indents",2,"If") Array.SetValue("Indents",3,"Else") Array.SetValue("Indents",4,"ElseIf") Array.SetValue("Indents",5,"Sub") Array.SetValue("Indents",6,"While") 'List of keywords that return indentation (outdent) Array.SetValue("Outdents",1,"EndFor") Array.SetValue("Outdents",2,"EndIf") Array.SetValue("Outdents",3,"Else") Array.SetValue("Outdents",4,"ElseIf") Array.SetValue("Outdents",5,"EndSub") Array.SetValue("Outdents",6,"EndWhile") 'Text colour TextWindow.ForegroundColor = "White" EndSub Sub GetFiles 'Get all the files in the current program directory dir = Program.Directory lendir = Text.GetLength(dir)+2 ' The following line could be harmful and has been automatically commented. ' File.GetFiles(dir,"files") 'Remove the directory path and store the files that are SB (*.sb) in Array SBFiles For i = 1 To Array.GetItemCount("files") filename = Array.GetValue("files",i) filename = Text.GetSubTextToEnd(filename,lendir) If (Text.EndsWith(filename,".sb")) Then Array.SetValue("SBfiles",Array.GetItemCount("SBfiles")+1,filename) EndIf EndFor 'Remove the orginal files Array - we won't need it again For i = Array.GetItemCount("files") To 1 Step -1 Array.RemoveValue("files",i) EndFor 'Write out a list of SB files and their index number For i = 1 To Array.GetItemCount("SBfiles") TextWindow.WriteLine(i+" : "+Array.GetValue("SBfiles",i)) EndFor EndSub Sub SetFile 'Read the index number for selected SB file to work on TextWindow.WriteLine("") TextWindow.WriteLine("Enter file number") ifile = TextWindow.ReadNumber() TextWindow.WriteLine("") 'Flag to output line numbers in output file TextWindow.WriteLine("Include line numbers in output file Y/N") answer = TextWindow.Read() TextWindow.WriteLine("") If (Text.StartsWith(answer,"Y") Or Text.StartsWith(answer,"y")) Then linenumbers = "True" Else linenumbers = "False" EndIf 'Make a copy of the file to work on since we don't want any chance of destroying the original Infile = dir+"\"+Array.GetValue("SBfiles",ifile) Outfile = dir+"\Indent-"+Array.GetValue("SBfiles",ifile) ' The following line could be harmful and has been automatically commented. ' File.CopyFile(Infile,Outfile) EndSub Sub Parse1 'level is the indentation level level = 0 'Read each line (max lines 10000) For line = 1 To 10000 ' The following line could be harmful and has been automatically commented. ' SBline = File.ReadLine(Outfile,line) 'If read error then we are finished ' The following line could be harmful and has been automatically commented. ' If (File.LastError <> "") Then Goto Finished EndIf 'Remove all white space from the start of the line While (Text.StartsWith(SBline," ")) SBline = Text.GetSubTextToEnd(SBline,2) EndWhile 'Identify variables in line GetVariables() 'Overwrite indented line to copy file Indent() EndFor Finished: 'Alphabetically sort variables SortVar() EndSub Sub GetVariables 'Make a copy of the line to work with variable = SBline 'Ignore anything to the right of "'" (comments) pos = Text.GetIndexOf(variable,"'") If (pos > 0) Then variable = Text.GetSubText(variable,1,pos-1) EndIf 'A variable is immediately before an equals pos = Text.GetIndexOf(variable,"=") If (pos > 1) Then 'Remove = and all text to the right of it and store in variable variable = Text.GetSubText(variable,1,pos-1) While (Text.EndsWith(variable," ")) variable = Text.GetSubText(variable,1,Text.GetLength(variable)-1) EndWhile 'Remove all text to the left of the last " " in variable pos = Text.GetIndexOf(variable," ") While (pos > 0) variable = Text.GetSubText(variable,pos+1,Text.GetLength(variable)-pos) pos = Text.GetIndexOf(variable," ") EndWhile 'If the variable doesn't contain "(" ")" "<" ">" or "." then it is probably a user variable (Returns 0 if not found, not -1 as documentation suggests) If (Text.GetIndexOf(variable,"(") = 0 And Text.GetIndexOf(variable,")") = 0 And Text.GetIndexOf(variable,"<") = 0 And Text.GetIndexOf(variable,">") = 0 And Text.GetIndexOf(variable,".") = 0) Then 'Add it to an list of variables if we haven't already got it If (Array.ContainsValue("Var",variable) = "False") Then Array.SetValue("Var",Array.GetItemCount("Var")+1,variable) EndIf 'Add the line number of this occurence Array.SetValue(variable,Array.GetItemCount(variable)+1,line) EndIf EndIf EndSub Sub Indent 'convert to lower case to do comparisons with keywords keyword = Text.ConvertToLowerCase(SBline) 'Remove all text to the right of any " " len = Text.GetIndexOf(keyword," ")-1 If (len > 1) Then keyword = Text.GetSubText(keyword,1,len) EndIf 'Remove all text to the right of any "(" len = Text.GetIndexOf(keyword,"(")-1 If (len > 1) Then keyword = Text.GetSubText(keyword,1,len) EndIf 'Set a flag if we are going to indent the next line - also replace the keyword with the Capitalised version indent = 0 For i = 1 To Array.GetItemCount("Indents") command = Array.GetValue("Indents",i) If (keyword = Text.ConvertToLowerCase(command)) Then indent = 1 SBline = command+Text.GetSubTextToEnd(SBline,Text.GetLength(command)+1) EndIf EndFor 'Set a flag if we are going to outdent this line - also replace the keyword with the Capitalised version outdent = 0 For i = 1 To Array.GetItemCount("Outdents") command = Array.GetValue("Outdents",i) If (keyword = Text.ConvertToLowerCase(command)) Then outdent = 1 SBline = command+Text.GetSubTextToEnd(SBline,Text.GetLength(command)+1) EndIf EndFor 'Outdent level-1 If (outdent = 1) Then level = level-1 EndIf 'Apply indentation to current level For i = 1 To level SBline = " "+SBline EndFor 'Indent level+1 If (indent = 1) Then level = level+1 EndIf 'Add line numbers if required If (linenumbers) Then SBline = SBline+"' "+line EndIf 'Output indented line to copy file ' The following line could be harmful and has been automatically commented. ' File.WriteLine(Outfile,line,SBline) EndSub Sub SortVar 'bubble sort variables For i = 1 To Array.GetItemCount("Var")-1 For j = i+1 To Array.GetItemCount("Var") iVar = Array.GetValue("Var",i) jVar = Array.GetValue("Var",j) iValue = 0 jValue = 0 char = 0 While (iValue = jValue) char = char+1 iValue = Text.GetCharacterCode(Text.GetSubText(iVar,char,1)) jValue = Text.GetCharacterCode(Text.GetSubText(jVar,char,1)) EndWhile If (jValue < iValue) Then Array.SetValue("Var",i,jVar) Array.SetValue("Var",j,iVar) EndIf EndFor EndFor EndSub Sub Output1 'Output some statistics on the variables and where they are set TextWindow.WriteLine("Lines "+line) TextWindow.WriteLine("") TextWindow.WriteLine("Variables "+Array.GetItemCount("Var")) TextWindow.WriteLine("") For i = 1 To Array.GetItemCount("Var") variable = Array.GetValue("Var",i) TextWindow.ForegroundColor = "Red" TextWindow.Write(variable) TextWindow.ForegroundColor = "White" TextWindow.Write(" Set on "+Array.GetItemCount(variable)+" line(s) ") For j = 1 To Array.GetItemCount(variable) TextWindow.Write(Array.GetValue(variable,j)+" ") EndFor TextWindow.WriteLine("") EndFor TextWindow.WriteLine("") EndSub Sub Parse2 'Read each line (max lines 10000) For line = 1 To 10000 ' The following line could be harmful and has been automatically commented. ' SBline = File.ReadLine(Outfile,line) 'If read error then we are finished ' The following line could be harmful and has been automatically commented. ' If (File.LastError <> "") Then Goto Finished EndIf 'Ignore anything to the right of "'" (comments) pos = Text.GetIndexOf(SBline,"'") If (pos > 0) Then SBline = Text.GetSubText(SBline,1,pos-1) EndIf 'Store of line SBlineStore = SBline 'Check each variable in line - redo if a substring found For i = 1 To Array.GetItemCount("Var") 'Restore line, since it might have been truncated after finding sub-strings SBline = SBlineStore variable = Array.GetValue("Var",i) redo: pos = Text.GetIndexOf(SBline,variable) If (pos > 0) then 'Check this occurence is not a sub-string substring = 0 before = pos-1 after = pos+Text.GetLength(variable) If (before >= 1) Then unicode = Text.GetCharacterCode(Text.GetSubText(SBline,before,1)) 'These unicodes are a-z, A-Z and 0-9 - if the characters either side of the variable are one of these, then it is probably a substring of something else 'e.g. "red" is a substring of "reduce" and should not be counted as an instance of variable "red" If ((unicode >= 65 And unicode <= 90) Or (unicode >= 97 And unicode <= 122) Or (unicode >= 48 And unicode <= 57)) Then substring = 1 'If we found a substring, there may still be a valid variable later on the same line If (pos < Text.GetLength(SBline)) Then SBline = Text.GetSubTextToEnd(SBline,pos+1) Goto redo EndIf EndIf EndIf If (after <= Text.GetLength(SBline)) Then unicode = Text.GetCharacterCode(Text.GetSubText(SBline,after,1)) If ((unicode >= 65 And unicode <= 90) Or (unicode >= 97 And unicode <= 122) Or (unicode >= 48 And unicode <= 57)) Then substring = 1 If (pos < Text.GetLength(SBline)) Then SBline = Text.GetSubTextToEnd(SBline,pos+1) Goto redo EndIf EndIf EndIf 'If not a substring then add to Array and line number If (substring = 0) Then 'Add the line number of this occurence Array.SetValue(variable+"X",Array.GetItemCount(variable+"X")+1,line) EndIf EndIf EndFor EndFor EndSub Sub Output2 'Output some statistics on the variables and where they are used For i = 1 To Array.GetItemCount("Var") variable = Array.GetValue("Var",i) TextWindow.ForegroundColor = "Red" TextWindow.Write(variable) TextWindow.ForegroundColor = "White" TextWindow.Write(" Used on "+Array.GetItemCount(variable+"X")+" line(s) ") For j = 1 To Array.GetItemCount(variable+"X") TextWindow.Write(Array.GetValue(variable+"X",j)+" ") EndFor TextWindow.WriteLine("") EndFor TextWindow.WriteLine("") EndSub Sub Unititialised 'Uninitialised variables are used before they are set - this may not be correct if it is set in a later subroutine that is called earlier found = 0 For i = 1 To Array.GetItemCount("Var") variable = Array.GetValue("Var",i) If (Array.GetValue(variable+"X",1) < Array.GetValue(variable,1)) Then TextWindow.Write("Possible uninitialised variable ") TextWindow.ForegroundColor = "Red" TextWindow.WriteLine(variable) TextWindow.ForegroundColor = "White" found = 1 EndIf EndFor If (found = 0) Then TextWindow.WriteLine("No uninitialised variables found") EndIf TextWindow.WriteLine("") EndSub End>BSZ306.sb< Start>BTB864.sb< X = -2.0 Y = -1.4 width = 3.0 height = 3.0 winWidth = GraphicsWindow.Width winHeight = GraphicsWindow.Height Hue = 0 Saturation = 50 Lightness = 50 precision = 2 stripy = "False" For nowX = X To X+width Step width/winWidth*precision screenY = 0 For nowY = Y To Y+height Step height/winHeight*precision realVal = nowX imagVal = nowY InMandelbrot() GraphicsWindow.BrushColor = color GraphicsWindow.FillRectangle(screenX,screenY,precision,precision) screenY = screenY+precision EndFor screenX = screenX+precision EndFor Sub InMandelbrot realCopy = realVal imagCopy = imagVal For i = 1 To 20 a = realCopy b = imagCopy SquareComplex() imagCopy = squareImag+imagVal realCopy = squareReal+realVal dist = realCopy*realCopy+imagCopy*imagCopy If dist>4 Then Hue = i*360/20 HSL_2_RGB() color = GraphicsWindow.GetColorFromRGB(RedCompo,GreenCompo,BlueCompo) i = 20 ElseIf i = 19 And stripy <> "True" Then Hue = 360 HSL_2_RGB() color = GraphicsWindow.GetColorFromRGB(RedCompo,GreenCompo,BlueCompo) EndIf EndFor EndSub Sub HSL_2_RGB H = Hue/360 S = Saturation/100 L = Lightness/100 If L < 0.5 Then tmp1 = L+L*S Else tmp1 = L+S-L*S EndIf tmp2 = 2*L-tmp1 tmpRGB[1] = H+1/3 tmpRGB[2] = H tmpRGB[3] = H-1/3 If 6*tmpRGB[1] < 1 Then RedCompo = tmp2+(tmp1-tmp2)*6*tmpRGB[1] ElseIf 2*tmpRGB[1] < 1 Then RedCompo = tmp1 ElseIf 3*tmpRGB[1] < 2 Then RedCompo = tmp2+(tmp1-tmp2)*(2/3-tmpRGB[1])*6 Else RedCompo = tmp2 EndIf If 6*tmpRGB[2] < 1 Then GreenCompo = tmp2+(tmp1-tmp2)*6*tmpRGB[2] ElseIf 2*tmpRGB[2] < 1 Then GreenCompo = tmp1 ElseIf 3*tmpRGB[2] < 2 Then GreenCompo = tmp2+(tmp1-tmp2)*(2/3-tmpRGB[2])*6 Else GreenCompo = tmp2 EndIf If 6*tmpRGB[3] < 1 Then BlueCompo = tmp2+(tmp1-tmp2)*6*tmpRGB[3] ElseIf 2*tmpRGB[3] < 1 Then BlueCompo = tmp1 ElseIf 3*tmpRGB[3] < 2 Then BlueCompo = tmp2+(tmp1-tmp2)*(2/3-tmpRGB[3])*6 Else BlueCompo = tmp2 EndIf BlueCompo = Math.Round(Math.Max(BlueCompo*255,0)) RedCompo = Math.Round(Math.Max(RedCompo*255,0)) GreenCompo = Math.Round(Math.Max(GreenCompo*255,0)) EndSub Sub SquareComplex squareReal = a*a-b*b squareImag = 2*a*b EndSub End>BTB864.sb< Start>BTD342.sb< ' mahreen miangul ApRil 2017 ' Sprite S-W-A-T-F SpaceBar ' Cannon Move XZ Fire F GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Width = "1288" GraphicsWindow.Height = "666" GraphicsWindow.BackgroundColor="skyblue" GraphicsWindow.KeyDown = onkeyDown dx=-5 dy=0 by=2 ' ball speed Y-direction cannon1_x = 644 cannon1_y = 566 sprite1_x = 0 sprite1_y = 20 cannon = Shapes.AddRectangle(50,100) Shapes.Move(cannon, cannon1_x, cannon1_y) GraphicsWindow.BrushColor="Black" Ball=Shapes.AddEllipse(40,40) Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) Shapes.HideShape(Ball) Timer.interval=500 Timer.tick=OnTimerTick '----------------- Draw Hill, Lake, Sun,Cloud-------------------------------------------------------------------------------------------------------- ' Hill GraphicsWindow.brushColor = "tan" GraphicsWindow.fillEllipse(-88,505,620,288) GraphicsWindow.fillEllipse(211,388,622,366) GraphicsWindow.fillEllipse(211,388,1888,666) ' Lake GraphicsWindow.BrushColor = "SkyBlue" GraphicsWindow.PenColor = "LightSlateGray" SnowGlobe = Shapes.AddEllipse(600,200) Shapes.Move(SnowGlobe,666,420) ' Sun GraphicsWindow.BrushColor = "yellow" GraphicsWindow.fillEllipse(1100,10,150,150) GraphicsWindow.BrushColor = "darkslategray" GraphicsWindow.FillEllipse(1130,40,15,45) GraphicsWindow.FillEllipse(1190,40,15,45) GraphicsWindow.penColor = "darkslategray" GraphicsWindow.penwidth = 11 GraphicsWindow.drawline(1140,120,1200,110) ' Clouds GraphicsWindow.PenColor = "darkslategray" GraphicsWindow.PenWidth = 6 GraphicsWindow.DrawEllipse(80,40,100,100) GraphicsWindow.DrawEllipse(50,60,40,50) GraphicsWindow.DrawEllipse(60,16,70,50) GraphicsWindow.DrawEllipse(130,14,70,40) GraphicsWindow.DrawEllipse(150,50,80,50) GraphicsWindow.DrawEllipse(150,90,70,70) GraphicsWindow.DrawEllipse(70,100,95,70) GraphicsWindow.brushColor = "lightgray" GraphicsWindow.fillEllipse(80,40,100,100) GraphicsWindow.fillEllipse(50,60,40,50) GraphicsWindow.fillEllipse(60,16,70,50) GraphicsWindow.fillEllipse(130,14,70,40) GraphicsWindow.fillEllipse(150,50,80,50) GraphicsWindow.fillEllipse(150,90,70,70) GraphicsWindow.fillEllipse(70,100,95,70) '--------------------Font Animation ----------------------------------------------------------------------------------------- GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 77 GraphicsWindow.FontItalic = "True" GraphicsWindow.BrushColor = "lightyellow" ' Text shadow color GraphicsWindow.DrawText(25, 555, "mahreen miangul!") ' Shadow position/text gold= GraphicsWindow.getcolorfromrgb(121,94,40) GraphicsWindow.BrushColor=gold GraphicsWindow.BrushColor = gold ' Text color GraphicsWindow.DrawText(20, 550, "mahreen miangul!") ' Position and text ' ------------------------Ducks Data------------------------------------------------------------ sprite_init() ' <--------- all shape data is input here!! For M=1 to 6 ' <--------- you make 5 Cycles ss=s[M] ' <--------- scale 5 data N=1 ' <--------- shapes array index=1 for i=1 To 14 ' <------ max shape number is 14 GraphicsWindow.PenWidth = shape[N][i]["pw"] GraphicsWindow.BrushColor = shape[N][i]["bc"] GraphicsWindow.penColor = shape[N][i]["pc"] If shape[N][i]["func"]="ell" Then shp[N][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss) ElseIf shape[N][i]["func"]="rect" Then shp[N][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss) ElseIf shape[N][i]["func"]="tri" Then shp[N][i] = Shapes.Addtriangle(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss, shape[N][i]["x3"]*ss, shape[N][i]["y3"]*ss) ElseIf shape[N][i]["func"]="line" Then shp[N][i] = Shapes.Addline(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss) EndIf Shapes.Animate(shp[N][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 500) ' <---- shx[],shY[] M=1 to 5 Shapes.Rotate(shp[N][i], Shape[N][i]["angle"]) EndFor endfor ' Add shapes // (1)(2)(3)(4)(5)(6)(7), (8)HOUSE ,(9)Crab , (10)Gorilla ,(11)Rocket ,u7)Hallowen , (8)House For N=1 to 26 ss=s[N] for i=1 To 47 ' <------ max shape number is 47 GraphicsWindow.PenWidth = shape[N][i]["pw"] GraphicsWindow.BrushColor = shape[N][i]["bc"] GraphicsWindow.penColor = shape[N][i]["pc"] If shape[N][i]["func"]="ell" Then shp[N][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss) ElseIf shape[N][i]["func"]="rect" Then shp[N][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss) ElseIf shape[N][i]["func"]="tri" Then shp[N][i] = Shapes.Addtriangle(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss, shape[N][i]["x3"]*ss, shape[N][i]["y3"]*ss) ElseIf shape[N][i]["func"]="line" Then shp[N][i] = Shapes.Addline(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss) EndIf Shapes.Animate(shp[N][i], shape[N][i]["x"]*ss+shX[N], shape[N][i]["y"]*ss+shY[N], 500) Shapes.Rotate(shp[N][i], Shape[N][i]["angle"]) EndFor endfor '-----------------------------------------Animation Shape and Cannon------------------------------------------------------------- shape_init() '   Cycle and Tree Shapes data N=0 M=0 shapes_add() '  Cycle Shape N=1 For M=1 to 8   shapes_add()  '  Tree Shape endfor 'Animate Cycle dZ = 0.1 zoom = 1 ddx=4 ddy=4 While 0=0   zoom = zoom - dZ   For i = 1 To Array.GetItemCount(shape[0])     If Array.ContainsValue(shape[0][i], "eye") Then       Shapes.Zoom(shp[0][i], 1, zoom)     ElseIf Array.ContainsValue(shape[0][i], "mouth") Then       Shapes.Zoom(shp[0][i], zoom, zoom)     EndIf     shapes.Move(shp[0][i],shapes.GetLeft(shp[0][i])+ddx,shapes.Gettop(shp[0][i])+ddy)   shapes.Move(shp[0][i],shapes.GetLeft(shp[0][i]),shapes.Gettop(shp[0][i])) EndFor   If zoom = 0 Or zoom = 1 Then     dZ = -dZ   EndIf   Program.Delay(100) EndWhile ''''''''''''''''''''''''''' Sub OnTimerTick Timer.Pause() Shapes.HideShape(Ball) Shapes.Move(Ball,cannon1_x+5,cannon1_y+30) EndSub ' Keys S, W, A, T, X,Z,F , SpaceBar works Sub OnKeyDown key= GraphicsWindow.LastKey If key="S" Then ddx=4 ElseIf Key="W"then ddx=-4 ElseIf Key="A"then ddy=4 ElseIf key="T"Then ddy=-4 ElseIf key="Space" Then ddx=0 'WhT ddy=0 EndIf If Key = "X" Then Shapes.Rotate(cannon,angle+5) angle=angle+5 ElseIf Key = "Z" Then Shapes.Rotate(cannon,angle-5) angle=angle-5 ElseIf Key="F" then Shapes.Animate(ball,GraphicsWindow.width/2,sprite1_y-60,600) Shapes.ShowShape(Ball) Timer.Resume() EndIf EndSub '--------------------------------------------Add Shapes-------------------------------------------------------------------------------------- Sub shapes_add   ss=s[M]    '  <--------- scale  data   for i=1 To Array.GetItemCount(shape[N])      GraphicsWindow.PenWidth = shape[N][i]["pw"]     GraphicsWindow.BrushColor = shape[N][i]["bc"]     GraphicsWindow.penColor = shape[N][i]["pc"]     If shape[N][i]["func"]="ell" Then       shp[M][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)     ElseIf shape[N][i]["func"]="rect" Then       shp[M][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)     ElseIf shape[N][i]["func"]="tri" Then       shp[M][i] = Shapes.Addtriangle(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss, shape[N][i]["x3"]*ss, shape[N][i]["y3"]*ss)     EndIf   �� Shapes.Animate(shp[M][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 500)   EndFor EndSub '-----------------------------------------------------Data Shapes------------------------------------------------------------- Sub shape_init   ' Data Cycle ' Table key: W = width; H = height; X = X rel to the body; Y = Y rel to body; R = rotate angle" shape[0][1] = "func=ell;x=520;y=90;width=30;height=20;bc=bisque;tag=ear"'left   shape[0][2] = "func=ell;x=520;y=150;width=30;height=20;bc=bisque;tag=ear"'right shape[0][3] = "func=ell;x=500;y=95;width=70;height=70;bc=purple;pc=darkslategray;pW=2" 'face shape[0][4] = "func=ell;x=520;y=120;width=30;height=10;bc=sienna;tag=nose" shape[0][5] = "func=ell;x=510;y=115;width=10;height=30;bc=pink;tag=mouth" shape[0][6] = "func=ell;x=530;y=102;width=30;height=20;bc=cyan;pc=darkslategray;pW=2;tag=eye"'eye1 shape[0][7] = "func=ell;x=530;y=128;width=30;height=20;bc=cyan;pc=darkslategray;pW=2;tag=eye"'eye2 shape[0][8] = "func=rect;x=440;y=115;width=50;height=8;bc=green;tag=mouth"'hand1 shape[0][9] = "func=rect;x=440;y=140;width=50;height=8;bc=green;tag=mouth"'hand2 shape[0][10] = "func=rect;x=355;y=120;width=60;height=6;bc=sienna;tag=mouth"'leg1 shape[0][11] = "func=rect;x=355;y=138;width=60;height=6;bc=sienna;tag=mouth"'leg2 shape[0][12] = "func=rect;x=400;y=120;width=100;height=22;bc=darkgoldenrod;pc=darkslategray;pW=2"'body shape[0][13] = "func=tri;x1=566;y1=100;x2=611;y2=130;x3=566;y3=160;bc=gold;angle=0;pw=2;tag=head" '  Data Tree   shape[1][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2"   shape[1][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2   shape[1][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2   shape[1][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2   shape[1][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2   shape[1][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2   shape[1][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2   shape[1][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2   shape[1][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2   shape[1][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   shape[1][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   shape[1][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   shape[1][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0   '  scale and   start XY position   s   = "0=1.1;1=0.8;2=0.8;3=0.8;4=0.8;5=0.8;6=0.8;7=0.8;8=0.8"   shX = "0=0;1=10;2=60;3=122;4=144;5=955;6=1100;7=766;8=666"   shY = "0=0;1=188;2=180;3=177;4=177;5=80;6=110;7=80;8=100" endsub Sub sprite_init ' Duck Data ' duck 1 s[1] = .1 shX[1] = 822 shY[1] = 455 shape[1][1] = "func=ell;x=99;y=0;width=56;height=24;bc=#DFCA54;pc=#000000;pw=2;" ' Head shape[1][2] = "func=ell;x=129;y=6;width=15;height=6;bc=#DF3954;pc=#000000;pw=2;" ' Eye shape[1][3] = "func=ell;x=105;y=12;width=16;height=36;angle=45;bc=#00CA54;pc=#000000;pw=2;" ' Neck shape[1][4] = "func=tri;x=50;y=5;x1=21;y1=0;x2=0;y2=57;x3=29;y3=57;bc=#DFCA54;pc=#000000;pw=2;" 'Wing shape[1][5] = "func=ell;x=1;y=38;width=108;height=31;bc=#DFCA54;pc=#000000;pw=2;" ' Body shape[1][6] = "func=tri;x=37;y=0;x1=7;y1=0;x2=0;y2=57;x3=29;y3=57;bc=#DF8754;pc=#000000;pw=2;" 'Wing shape[1][7] = "func=ell;x=144;y=15;width=29;height=9;angle=13;bc=#DF8754;pc=#000000;pw=2;" 'Mouth shape[1][8] = "func=line;x=8;y=60;x1=0;y1=8;x2=49;y2=7;pc=#DF3954;pw=2;" shape[1][9] = "func=line;x=0;y=70;x1=9;y1=0;x2=0;y2=10;pc=#DF3954;pw=2;" s[2]=.16 shX[2] = 777 shY[2] = 500 'duck 3 s[3]=.2 shX[3] = 788 shY[3] = 533 'duck 4 s[4]=.28 shX[4] = 922 shY[4] = 500 'duck 5 s[5]=.3 shX[5] = 866 shY[5] = 500 'uck 6 s[6]=.32 shX[6] = 888 shY[6] = 500 ' duck 7 s[8] = .5 ' House Data shX[8] = 88 shY[8] = 55 shape[8][1] = "func=rect;x=800;y=280;width=210;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A4 shape[8][2] = "func=rect;x=777;y=310;width=258;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A3 shape[8][3] = "func=rect;x=755;y=340;width=277;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A2 shape[8][4] = "func=rect;x=766;y=370;width=272;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A1 shape[8][5] = "func=tri;x=480;y=340;x1=222;y1=60;x2=262;y2=8;x3=320;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[8][6] = "func=tri;x=480;y=320;x1=244;y1=50;x2=280;y2=6;x3=320;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2 shape[8][7] = "func=tri;x=480;y=300;x1=267;y1=40;x2=298;y2=4;x3=320;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3 shape[8][8] = "func=tri;x=480;y=280;x1=292;y1=30;x2=320;y2=2;x3=320;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4 shape[8][9] = "func=tri;x=480;y=340;x1=530;y1=60;x2=585;y2=8;x3=636;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1 shape[8][10] = "func=tri;x=480;y=320;x1=530;y1=50;x2=566;y2=6;x3=608;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2 shape[8][11] = "func=tri;x=480;y=300;x1=530;y1=40;x2=548;y2=4;x3=580;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3 shape[8][12] = "func=tri;x=480;y=280;x1=530;y1=30;x2=530;y2=2;x3=555;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4 shape[8][13] = "func=rect;x=743;y=397;width=333;height=333;bc=snow;pc=darkslategray;pw=2"'Body Structpw=2ure shape[8][14] = "func=rect;x=766;y=608;width=100;height=122;bc=saddlebrown;pc=darkslategray;pw=2"'DoorA shape[8][15] = "func=ell;x=766;y=573;width=100;height=80;bc=saddlebrown;pw=2"'pc=saddlebrown;"'DoorB shape[8][16] ="func=ell;x=788;y=684;width=10;height=10;bc=yellow;pc=darcksategray;pw=2"'DoorC shape[8][17] ="func=rect;x=944;y=480;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowA shape[8][18] ="func=ell;x=944;y=428;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowB shape[8][19] = "func=rect;x=955;y=473;width=80;height=111;bc=skyblue;pc=darkslategray;pw=2"'windowC shape[8][20] = "func=ell;x=955;y=442;width=80;height=88;bc=skyblue;pc=darkslategray;pw=2"'windowD shape[8][21] ="func=line;x=877;y=451;x1=80;y1=30;x2=155;y2=30;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 1 shape[8][22] ="func=line;x=8977;y=451;x1=80;y1=60;x2=155;y2=60;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 2 shape[8][23] ="func=line;x=877;y=451;x1=80;y1=90;x2=155;y2=90;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 3 shape[8][24] ="func=line;x=900;y=395;x1=95;y1=44;x2=95;y2=188;bc=dodgerblue;pc=darkslategray;pw=2"'Window Grill 4 shape[8][25] ="func=rect;x=922;y=242;width=80;height=100;bc=crimson;pc=darkslategray;pw=2"'Chimny 1 shape[8][26] ="func=rect;x=911;y=241;width=100;height=20;bc=firebrick;pe;fi=False;x=340;y=72;width=200;height=113;pw=0;bc=#80FFFFFF;name=TextBox 2;" endsub End>BTD342.sb< Start>BTD666.sb< Start() Controls.ButtonClicked = ButtonClicked Sub Start GraphicsWindow.Title = "My Office" GraphicsWindow.Height = 255 GraphicsWindow.Width = 275 'GraphicsWindow.Top = 'GraphicsWindow.Left = GraphicsWindow.FontBold = 0 GraphicsWindow.FontName = "Book Antiqua" GraphicsWindow.FontSize = 15 GraphicsWindow.BrushColor = "Black" Hintergrund = ImageList.LoadImage(Program.Directory + "\HintergrundR.bmp") GraphicsWindow.DrawImage(Hintergrund, 1, 1) EingabeFeld = Controls.AddTextBox(12.5, 12.5) Controls.SetSize(EingabeFeld, 250, 25) Bans = Controls.AddButton("Answer", 12.5, 42.5) Bdel = Controls.AddButton("Delete", 137.5, 42.5) Back = Controls.AddButton("Back", 162.5, 202.5) B0 = Controls.AddButton("0", 12.5, 202.5) B1 = Controls.AddButton("1", 12.5, 162.5) B2 = Controls.AddButton("2", 62.5, 162.5) B3 = Controls.AddButton("3", 112.5, 162.5) B4 = Controls.AddButton("4", 12.5, 122.5) B5 = Controls.AddButton("5", 62.5, 122.5) B6 = Controls.AddButton("6", 112.5, 122.5) B7 = Controls.AddButton("7", 12.5, 82.5) B8 = Controls.AddButton("8", 62.5, 82.5) B9 = Controls.AddButton("9", 112.5, 82.5) Bko = Controls.AddButton(".", 62.5, 202.5) Bmi = Controls.AddButton("-", 212.5, 162.5) Bpl = Controls.AddButton("+", 162.5, 162.5) Bdu = Controls.AddButton("/", 212.5, 122.5) Bmal = Controls.AddButton("x", 162.5, 122.5) Bgl = Controls.AddButton("=", 112.5, 202.5) Bkla = Controls.AddButton("(", 162.5, 82.5) Bklz = Controls.AddButton(")", 212.5, 82.5) Controls.SetSize(Bans, 125, 40) Controls.SetSize(Bdel, 125, 40) Controls.SetSize(Back, 100, 40) Controls.SetSize(B0, 50, 40) Controls.SetSize(B1, 50, 40) Controls.SetSize(B2, 50, 40) Controls.SetSize(B3, 50, 40) Controls.SetSize(B4, 50, 40) Controls.SetSize(B5, 50, 40) Controls.SetSize(B6, 50, 40) Controls.SetSize(B7, 50, 40) Controls.SetSize(B8, 50, 40) Controls.SetSize(B9, 50, 40) Controls.SetSize(Bko, 50, 40) Controls.SetSize(Bmi, 50, 40) Controls.SetSize(Bpl, 50, 40) Controls.SetSize(Bdu, 50, 40) Controls.SetSize(Bmal, 50, 40) Controls.SetSize(Bgl, 50, 40) Controls.SetSize(Bkla, 50, 40) Controls.SetSize(Bklz, 50, 40) x = 0 EndSub Sub ButtonClicked LB = Controls.LastClickedButton If LB = Bans Then ElseIf LB = Bdel Then x = 0 Controls.SetTextBoxText(EingabeFeld, 0) ElseIf LB = Back Then Process.Start(Program.Directory + "\My Office.exe") Program.End() ElseIf LB = B0 Then x = x + "0" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B1 Then x = x + "1" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B2 Then x = x + "2" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B3 Then x = x + "3" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B4 Then x = x + "4" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B5 Then x = x + "5" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B6 Then x = x + "6" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B7 Then x = x + "7" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B8 Then x = x + "8" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = B9 Then x = x + "9" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bko Then x = x + "." Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bmi Then x = x + " - " Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bpl Then x = x + " + " Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bdu Then x = x + " / " Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bmal Then x = x + " * " Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bgl Then 'y = x x = x + " = "' + y Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bkla Then x = x + "(" Controls.SetTextBoxText(EingabeFeld, x) ElseIf LB = Bklz Then x = x + ")" Controls.SetTextBoxText(EingabeFeld, x) EndIf EndSub End>BTD666.sb< Start>BTG300-0.sb< 'Eventhandler Controls.ButtonClicked = OnButtonClicked 'Initialisation Init() FillTextBoxes() 'Mainloop While ContinuFlag1 = "True" If (ContinuFlag2 = "False") Then 'Show new index if it has changed FillTextBoxes() ContinuFlag2 = "True" EndIf EndWhile 'Save all data before program end with button "end" 'No save if you breack the program, because it is not possible Save() Program.End() '******************* ' * SUBROUTINES * '******************* Sub Init 'Initialisation Path and Filename p = "C:\" 'Paht from directory database Path = "C:\SB-Database" 'Fullpath database FN = "\Adresses.SBD" 'Filename database ' If database directory not exist, create it ' The following line could be harmful and has been automatically commented. ' Dir = File.GetDirectories(p) If (Array.ContainsValue(DIR, Path) = "False") Then ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(Path) EndIf 'Initialisation window GraphicsWindow.Top = 10 GraphicsWindow.Left = 10 GraphicsWindow.Height = 480 GraphicsWindow.Width = 620 GraphicsWindow.Title = " AddressManager " GraphicsWindow.CanResize = "False" GraphicsWindow.FontName = "Arrial" GraphicsWindow.FontSize = 14 FontHight = 24 ContinuFlag1 = "True" 'Flags controles the main loop ContinuFlag2 = "True" PB = 40 'Position text vor button PTB = 170 'Postion button GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = "LightBlue" GraphicsWindow.BrushColor = "PowderBlue" GraphicsWindow.PenColor = "LightGray" GraphicsWindow.PenWidth = 1 GraphicsWindow.FillRectangle(PB-5,45,560,FontHight*11+20) For i = 1 to 10 GraphicsWindow.DrawLine(PB-1,i*25+50,552+PB,i*25+48) EndFor GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FillRectangle(PB-7,363,574,84) GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FillRectangle(PB-5,365,570,80) 'Initialisation Textboxes GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Gray" GraphicsWindow.PenWidth = 2 Address = "Address:" GraphicsWindow.DrawText(PB, 50, Address) TBAddress = Controls.AddTextBox(PTB, 50) Controls.SetSize(TBAddress,420,FontHight) AcademicTitle = "Academic Title:" GraphicsWindow.DrawText(PB, 75, AcademicTitle) TBAcademicTitle = Controls.AddTextBox(PTB, 75) Controls.SetSize(TBAcademicTitle,420,FontHight) FirstName = "First Name:" GraphicsWindow.DrawText(PB, 100, FirstName) TBFirstName = Controls.AddTextBox(PTB, 100) Controls.SetSize(TBFirstName,420,FontHight) LastName = "Last Name:" GraphicsWindow.DrawText(PB, 125, LastName) TBLastName = Controls.AddTextBox(PTB, 125) Controls.SetSize(TBLastName,420,FontHight) StreetAndHouseNumber = "Street & number:" GraphicsWindow.DrawText(PB, 150, StreetAndHouseNumber) TBStreetAndHouseNumber = Controls.AddTextBox(PTB, 150) Controls.SetSize(TBStreetAndHouseNumber,420,FontHight) PostCode = "Post Code:" GraphicsWindow.DrawText(PB, 175, PostCode) TBPostCode = Controls.AddTextBox(PTB, 175) Controls.SetSize(TBPostCode,140,FontHight) Place = "City:" GraphicsWindow.DrawText(PB, 200, Place) TBPlace = Controls.AddTextBox(PTB, 200) Controls.SetSize(TBPlace,280,FontHight) TelephoneNumber = "Telephone:" GraphicsWindow.DrawText(PB, 225, TelephoneNumber) TBTelephoneNumber = Controls.AddTextBox(PTB, 225) Controls.SetSize(TBTelephoneNumber,280,FontHight) MobileNumber = "Mobile phone:" GraphicsWindow.DrawText(PB, 250, MobileNumber) TBMobileNumber = Controls.AddTextBox(PTB, 250) Controls.SetSize(TBMobileNumber,280,FontHight) FaxNumber = "Fax:" GraphicsWindow.DrawText(PB, 275, FaxNumber) TBFaxNumber = Controls.AddTextBox(PTB, 275) Controls.SetSize(TBFaxNumber,280,FontHight) EMailAddress = "E-Mail:" GraphicsWindow.DrawText(PB, 300, EMailAddress) TBEMailAddress = Controls.AddTextBox(PTB, 300) Controls.SetSize(TBEMailAddress,420,FontHight) 'Initialisation controle button GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 16 B1 = Controls.AddButton(" << ", 47, 370) BB = Controls.AddButton(" < ", 107, 370) BC = Controls.AddButton(" Save ", 175,370) BH = Controls.AddButton(" Help ", 300,370) BE = Controls.AddButton(" Close ", 390,370) BF = Controls.AddButton(" > ", 500, 370) BL = Controls.AddButton(" >> ", 550, 370) BD = Controls.AddButton(" Add ", 300,410) Controls.ShowControl(B1) Controls.ShowControl(BB) Controls.ShowControl(BC) Controls.ShowControl(BH) Controls.ShowControl(BE) Controls.ShowControl(BF) Controls.ShowControl(Bl) Controls.ShowControl(BD) GraphicsWindow.FontBold = "False" GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "Black" Load() If (Index = 0) Then 'Nothing present, then start at the beginning Index = 1 EndIf EndSub 'Init Sub FillArray Anschr[Index] = Index Anschr[Index][Address] = Controls.GetTextBoxText(TBAddress) Anschr[Index][AcademicTitle] = Controls.GetTextBoxText(TBAcademicTitle) Anschr[Index][FirstName] = Controls.GetTextBoxText(TBFirstName) Anschr[Index][LastName] = Controls.GetTextBoxText(TBLastName) Anschr[Index][StreetAndHouseNumber] = Controls.GetTextBoxText(TBStreetAndHouseNumber) Anschr[Index][PostCode] = Controls.GetTextBoxText(TBPostCode) Anschr[Index][Place] = Controls.GetTextBoxText(TBPlace) Anschr[Index][TelephoneNumber] = Controls.GetTextBoxText(TBTelephoneNumber) Anschr[Index][MobileNumber] = Controls.GetTextBoxText(TBMobileNumber) Anschr[Index][FaxNumber] = Controls.GetTextBoxText(TBFaxNumber) Anschr[Index][EMailAddress] = Controls.GetTextBoxText(TBEMailAddress) EndSub 'FillArray Sub FillTextBoxes 'Output current index to textboxes Controls.SetTextBoxText(TBAddress, Anschr[Index][Address]) Controls.SetTextBoxText(TBAcademicTitle, Anschr[Index][AcademicTitle]) Controls.SetTextBoxText(TBFirstName, Anschr[Index][FirstName]) Controls.SetTextBoxText(TBLastName, Anschr[Index][LastName]) Controls.SetTextBoxText(TBStreetAndHouseNumber, Anschr[Index][StreetAndHouseNumber]) Controls.SetTextBoxText(TBPostCode, Anschr[Index][PostCode]) Controls.SetTextBoxText(TBPlace, Anschr[Index][Place]) Controls.SetTextBoxText(TBTelephoneNumber, Anschr[Index][TelephoneNumber]) Controls.SetTextBoxText(TBMobileNumber, Anschr[Index][MobileNumber]) Controls.SetTextBoxText(TBFaxNumber, Anschr[Index][FaxNumber]) Controls.SetTextBoxText(TBEMailAddress, Anschr[Index][EMailAddress]) EndSub 'FillTextBoxes Sub Load ' The following line could be harmful and has been automatically commented. ' Anschr = File.ReadContents(Path+FN) Index = Array.GetItemCount(Anschr)+1 EndSub 'Load Sub Save FillArray() ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path+FN, Anschr) EndSub 'Save Sub Delete NIndex = Array.GetItemCount(Anschr) For i = Index + 1 to NIndex + 1 Index = i - 1 Anschr[Index] = Index Anschr[Index][Address] = Anschr[i][Address] Anschr[Index][AcademicTitle] = Anschr[i][AcademicTitle] Anschr[Index][FirstName] = Anschr[i][FirstName] Anschr[Index][LastName] = Anschr[i][LastName] Anschr[Index][StreetAndHouseNumber] = Anschr[i][StreetAndHouseNumber] Anschr[Index][PostCode] = Anschr[i][PostCode] Anschr[Index][Place] = Anschr[i][Place] Anschr[Index][TelephoneNumber] = Anschr[i][TelephoneNumber] Anschr[Index][MobileNumber] = Anschr[i][MobileNumber] Anschr[Index][FaxNumber] = Anschr[i][FaxNumber] Anschr[Index][EMailAddress] = Anschr[i][EMailAddress] EndFor EndSub 'Delete Sub OnButtonClicked MaxIDNr = Array.GetItemCount(Anschr) + 1 CButton = Controls.LastClickedButton If CButton = B1 Then ' << FillArray() Index = 1 ContinuFlag2 = "False" EndIf If CButton = BB Then ' < FillArray() Index = Index - 1 If (Index < 1) Then Index = 1 EndIf ContinuFlag2 = "False" EndIf If CButton = BC Then 'Save Save() EndIf If CButton = BH Then 'Help notice = "Fill in the information needed and click Add to log an adderess" GraphicsWindow.ShowMessage(notice, "Help") EndIf If CButton = BE Then 'End ContinuFlag1 = "False" ContinuFlag2 = "False" EndIf If CButton = BF Then ' > FillArray() Index = Index + 1 If (Index > MaxIDNr) Then Index = MaxIDNr EndIf ContinuFlag2 = "False" EndIf If CButton = BL Then ' >> FillArray() Index = Array.GetItemCount(Anschr) + 1 ContinuFlag2 = "False" EndIf If CButton = BD Then 'Delete Delete() ContinuFlag2 = "False" EndIf EndSub 'OnButtonClicked End>BTG300-0.sb< Start>BTG300.sb< 'Eventhandler Controls.ButtonClicked = OnButtonClicked 'Initialisation Init() FillTextBoxes() 'Mainloop While ContinuFlag1 = "True" If (ContinuFlag2 = "False") Then 'Show new index if it has changed FillTextBoxes() ContinuFlag2 = "True" EndIf EndWhile 'Save all data before program end with button "end" 'No save if you breack the program, because it is not possible Save() Program.End() '******************* ' * SUBROUTINES * '******************* Sub Init 'Initialisation Path and Filename p = "C:\" 'Paht from directory database Path = "C:\SB-Database" 'Fullpath database FN = "\Adresses.SBD" 'Filename database ' If database directory not exist, create it ' The following line could be harmful and has been automatically commented. ' Dir = File.GetDirectories(p) If (Array.ContainsValue(DIR, Path) = "False") Then ' The following line could be harmful and has been automatically commented. ' File.CreateDirectory(Path) EndIf 'Initialisation window GraphicsWindow.Top = 10 GraphicsWindow.Left = 10 GraphicsWindow.Height = 480 GraphicsWindow.Width = 620 GraphicsWindow.Title = " Addressmanager " GraphicsWindow.CanResize = "False" GraphicsWindow.FontName = "Arrial" GraphicsWindow.FontSize = 14 FontHight = 24 ContinuFlag1 = "True" 'Flags controles the main loop ContinuFlag2 = "True" PB = 40 'Position text vor button PTB = 170 'Postion button GraphicsWindow.Clear() GraphicsWindow.BackgroundColor = "LightBlue" GraphicsWindow.BrushColor = "PowderBlue" GraphicsWindow.PenColor = "LightGray" GraphicsWindow.PenWidth = 1 GraphicsWindow.FillRectangle(PB-5,45,560,FontHight*11+20) For i = 1 to 10 GraphicsWindow.DrawLine(PB-1,i*25+50,552+PB,i*25+48) EndFor GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FillRectangle(PB-7,363,574,84) GraphicsWindow.BrushColor = "LightGray" GraphicsWindow.FillRectangle(PB-5,365,570,80) 'Initialisation Textboxes GraphicsWindow.BrushColor = "Black" GraphicsWindow.PenColor = "Gray" GraphicsWindow.PenWidth = 2 Address = "Anrede:" GraphicsWindow.DrawText(PB, 50, Address) TBAddress = Controls.AddTextBox(PTB, 50) Controls.SetSize(TBAddress,420,FontHight) AcademicTitle = "Titel:" GraphicsWindow.DrawText(PB, 75, AcademicTitle) TBAcademicTitle = Controls.AddTextBox(PTB, 75) Controls.SetSize(TBAcademicTitle,420,FontHight) FirstName = "Vorname:" GraphicsWindow.DrawText(PB, 100, FirstName) TBFirstName = Controls.AddTextBox(PTB, 100) Controls.SetSize(TBFirstName,420,FontHight) LastName = "Nachname:" GraphicsWindow.DrawText(PB, 125, LastName) TBLastName = Controls.AddTextBox(PTB, 125) Controls.SetSize(TBLastName,420,FontHight) StreetAndHouseNumber = "Straße u. HausNr:" GraphicsWindow.DrawText(PB, 150, StreetAndHouseNumber) TBStreetAndHouseNumber = Controls.AddTextBox(PTB, 150) Controls.SetSize(TBStreetAndHouseNumber,420,FontHight) PostCode = "Postleitzahl:" GraphicsWindow.DrawText(PB, 175, PostCode) TBPostCode = Controls.AddTextBox(PTB, 175) Controls.SetSize(TBPostCode,140,FontHight) Place = "Ort:" GraphicsWindow.DrawText(PB, 200, Place) TBPlace = Controls.AddTextBox(PTB, 200) Controls.SetSize(TBPlace,280,FontHight) TelephoneNumber = "Telefonnummer:" GraphicsWindow.DrawText(PB, 225, TelephoneNumber) TBTelephoneNumber = Controls.AddTextBox(PTB, 225) Controls.SetSize(TBTelephoneNumber,280,FontHight) MobileNumber = "Mobilnummer:" GraphicsWindow.DrawText(PB, 250, MobileNumber) TBMobileNumber = Controls.AddTextBox(PTB, 250) Controls.SetSize(TBMobileNumber,280,FontHight) FaxNumber = "Faxnummer:" GraphicsWindow.DrawText(PB, 275, FaxNumber) TBFaxNumber = Controls.AddTextBox(PTB, 275) Controls.SetSize(TBFaxNumber,280,FontHight) EMailAddress = "Mailadresse:" GraphicsWindow.DrawText(PB, 300, EMailAddress) TBEMailAddress = Controls.AddTextBox(PTB, 300) Controls.SetSize(TBEMailAddress,420,FontHight) 'Initialisation controle button GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 16 B1 = Controls.AddButton(" << ", 47, 370) BB = Controls.AddButton(" < ", 107, 370) BC = Controls.AddButton(" Speichern ", 175,370) BH = Controls.AddButton(" Hilfe ", 300,370) BE = Controls.AddButton(" E N D E ", 390,370) BF = Controls.AddButton(" > ", 500, 370) BL = Controls.AddButton(" >> ", 550, 370) BD = Controls.AddButton(" Löschen ", 300,410) Controls.ShowControl(B1) Controls.ShowControl(BB) Controls.ShowControl(BC) Controls.ShowControl(BH) Controls.ShowControl(BE) Controls.ShowControl(BF) Controls.ShowControl(Bl) Controls.ShowControl(BD) GraphicsWindow.FontBold = "False" GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "Black" Load() If (Index = 0) Then 'Nothing present, then start at the beginning Index = 1 EndIf EndSub 'Init Sub FillArray Anschr[Index] = Index Anschr[Index][Address] = Controls.GetTextBoxText(TBAddress) Anschr[Index][AcademicTitle] = Controls.GetTextBoxText(TBAcademicTitle) Anschr[Index][FirstName] = Controls.GetTextBoxText(TBFirstName) Anschr[Index][LastName] = Controls.GetTextBoxText(TBLastName) Anschr[Index][StreetAndHouseNumber] = Controls.GetTextBoxText(TBStreetAndHouseNumber) Anschr[Index][PostCode] = Controls.GetTextBoxText(TBPostCode) Anschr[Index][Place] = Controls.GetTextBoxText(TBPlace) Anschr[Index][TelephoneNumber] = Controls.GetTextBoxText(TBTelephoneNumber) Anschr[Index][MobileNumber] = Controls.GetTextBoxText(TBMobileNumber) Anschr[Index][FaxNumber] = Controls.GetTextBoxText(TBFaxNumber) Anschr[Index][EMailAddress] = Controls.GetTextBoxText(TBEMailAddress) EndSub 'FillArray Sub FillTextBoxes 'Output current index to textboxes Controls.SetTextBoxText(TBAddress, Anschr[Index][Address]) Controls.SetTextBoxText(TBAcademicTitle, Anschr[Index][AcademicTitle]) Controls.SetTextBoxText(TBFirstName, Anschr[Index][FirstName]) Controls.SetTextBoxText(TBLastName, Anschr[Index][LastName]) Controls.SetTextBoxText(TBStreetAndHouseNumber, Anschr[Index][StreetAndHouseNumber]) Controls.SetTextBoxText(TBPostCode, Anschr[Index][PostCode]) Controls.SetTextBoxText(TBPlace, Anschr[Index][Place]) Controls.SetTextBoxText(TBTelephoneNumber, Anschr[Index][TelephoneNumber]) Controls.SetTextBoxText(TBMobileNumber, Anschr[Index][MobileNumber]) Controls.SetTextBoxText(TBFaxNumber, Anschr[Index][FaxNumber]) Controls.SetTextBoxText(TBEMailAddress, Anschr[Index][EMailAddress]) EndSub 'FillTextBoxes Sub Load ' The following line could be harmful and has been automatically commented. ' Anschr = File.ReadContents(Path+FN) Index = Array.GetItemCount(Anschr)+1 EndSub 'Load Sub Save FillArray() ' The following line could be harmful and has been automatically commented. ' File.WriteContents(path+FN, Anschr) EndSub 'Save Sub Delete NIndex = Array.GetItemCount(Anschr) For i = Index + 1 to NIndex + 1 Index = i - 1 Anschr[Index] = Index Anschr[Index][Address] = Anschr[i][Address] Anschr[Index][AcademicTitle] = Anschr[i][AcademicTitle] Anschr[Index][FirstName] = Anschr[i][FirstName] Anschr[Index][LastName] = Anschr[i][LastName] Anschr[Index][StreetAndHouseNumber] = Anschr[i][StreetAndHouseNumber] Anschr[Index][PostCode] = Anschr[i][PostCode] Anschr[Index][Place] = Anschr[i][Place] Anschr[Index][TelephoneNumber] = Anschr[i][TelephoneNumber] Anschr[Index][MobileNumber] = Anschr[i][MobileNumber] Anschr[Index][FaxNumber] = Anschr[i][FaxNumber] Anschr[Index][EMailAddress] = Anschr[i][EMailAddress] EndFor EndSub 'Delete Sub OnButtonClicked MaxIDNr = Array.GetItemCount(Anschr) + 1 CButton = Controls.LastClickedButton If CButton = B1 Then ' << FillArray() Index = 1 ContinuFlag2 = "False" EndIf If CButton = BB Then ' < FillArray() Index = Index - 1 If (Index < 1) Then Index = 1 EndIf ContinuFlag2 = "False" EndIf If CButton = BC Then 'Save Save() EndIf If CButton = BH Then 'Help notice = "Helf Dir selbst, dann hilft Dir Gott!" GraphicsWindow.ShowMessage(notice, "Hilfe") EndIf If CButton = BE Then 'End ContinuFlag1 = "False" ContinuFlag2 = "False" EndIf If CButton = BF Then ' > FillArray() Index = Index + 1 If (Index > MaxIDNr) Then Index = MaxIDNr EndIf ContinuFlag2 = "False" EndIf If CButton = BL Then ' >> FillArray() Index = Array.GetItemCount(Anschr) + 1 ContinuFlag2 = "False" EndIf If CButton = BD Then 'Delete Delete() ContinuFlag2 = "False" EndIf EndSub 'OnButtonClicked End>BTG300.sb< Start>BTG660-2.sb< sr = "" an = "" rt = "" os = "" cns = 0 ops = 0 zmW = 0 zmH = 0 Click() GraphicsWindow.Title="PolygonShapes Akiva 16/X-2017 | 8/II-2019" gw = 1250 gh = 860 GraphicsWindow.Width= gw GraphicsWindow.Height= gh GraphicsWindow.MouseMove = OnMouseMove GraphicsWindow.Left= (Desktop.Width - GraphicsWindow.Width) / 2 GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height) / 2 LDGraphicsWindow.Resize = 0 GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(0,105,0) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(0,0,0) t1 = Controls.AddTextBox(903,770) Controls.SetSize(t1,270,22) LDDialogs.ToolTip(t1,"t1>Https://www.Google.ru/") t11 = Controls.AddTextBox(1068,2) Controls.SetSize(t11,70,25) t12 = Controls.AddTextBox(1140,2) Controls.SetSize(t12,70,25) t14 = Controls.AddTextBox(921,2) Controls.SetSize(t14,70,25) t15 = Controls.AddTextBox(993,2) Controls.SetSize(t15,70,25) GraphicsWindow.FontSize = 12 ts10 = Controls.AddTextBox(30,830) Controls.SetSize(ts10,45,25) ts10a = Controls.AddTextBox(30,800) Controls.SetSize(ts10a,45,25) ts11 = Controls.AddTextBox(235,800) Controls.SetSize(ts11,45,25) ts11a = Controls.AddTextBox(235,830) Controls.SetSize(ts11a,45,25) ts12 = Controls.AddTextBox(435,830) Controls.SetSize(ts12,45,25) ts12a = Controls.AddTextBox(435,800) Controls.SetSize(ts12a,45,25) ts13 = Controls.AddTextBox(633,830) Controls.SetSize(ts13,45,25) ts13a = Controls.AddTextBox(633,800) Controls.SetSize(ts13a,45,25) ts14 = Controls.AddTextBox(835,830) Controls.SetSize(ts14,45,25) ts14a = Controls.AddTextBox(835,800) Controls.SetSize(ts14a,45,25) sl10 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl10, 76, 830) LDControls.SliderValue(sl10, 0) sl10a = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl10a, 76, 800) LDControls.SliderValue(sl10a, 0) sl11 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl11, 280, 800) LDControls.SliderValue(sl11, 0) sl11a = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl11a, 280, 830) LDControls.SliderValue(sl11a, 0) sl12 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl12, 481, 830) LDControls.SliderValue(sl12, 0) sl12a = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl12a, 481, 800) LDControls.SliderValue(sl12a, 0) sl13 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl13, 679, 830) LDControls.SliderValue(sl13, 0) sl13a = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl13a, 679, 800) LDControls.SliderValue(sl13a, 0) sl14 = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl14, 880, 830) LDControls.SliderValue(sl14, 0) sl14a = LDControls.AddSlider(150, 35, "H") Shapes.Move(sl14a, 880, 800) LDControls.SliderValue(sl14a, 0) GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(255,255,255) cr1[1] = LDControls.AddRadioButton("H","cr1") cr1[2] = LDControls.AddRadioButton("V","cr1") cr1[3] = LDControls.AddRadioButton("DD","cr1") cr1[4] = LDControls.AddRadioButton("DU","cr1") cr1[5] = LDControls.AddRadioButton("R","cr1") For j = 1 To 5 Shapes.Move(cr1[j],1175, 765 + (20 * (j)) - 28) EndFor LDControls.RadioButtonSet(cr1[5]) LDDialogs.ToolTip(cr1[5],"Gradient") cr2[1] = LDControls.AddRadioButton("E ","cr2") cr2[2] = LDControls.AddRadioButton("D ","cr2") cr2[3] = LDControls.AddRadioButton("S ","cr2") For i = 1 To 3 Shapes.Move(cr2[i],1220, 805 + (20 * (i)) - 28) EndFor LDControls.RadioButtonSet(cr2[2]) LDDialogs.ToolTip(cr2[2],"Material") GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(0,0,0) btn[1] = "Animate" btn[2] = "Rotate" btn[3] = "Zoom" btn[4] = "Opacity" btn[5] = "Flickr" btn[6] = "SB.com " btn[7] = "Remove" btn[8] = "Grid" btn[9] = "AddBrowser" btn[10] = "GradientFrm" nButton = Array.GetItemCount(btn) For i = 1 To nButton b1[i] = Controls.AddButton(btn[i],(87 * (i)-55),770) Controls.SetSize(b1[i],85,25) EndFor GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(0,0,0) GraphicsWindow.FontSize = 12 ls[1] = "LDShapes.AddRegularPolygon" ls[2] = "LDShapes.AddStar" ls[3] = "Shapes.AddEllipse" ls[4] = "Shapes.AddRectangle" ls[5] = "Shapes.AddImage" ls[6] = "Shapes.AddText" ls[7] = "LDShapes.AddPolygon" ls[8] = "Shapes.AddLine" ls[9] = "Icosaledron" ls[10] = "Arrow" ls[11] = "Cube" ls[12] = "Cone" ls[13] = "Pipe" ls[14] = "Pyramid" ls[15] = "Sphere" ls[16] = "Rectangle" ls[17] = "Spot " list = LDSort.ByValue(ls) listBox = LDControls.AddListBox(list,230,370) Shapes.Move(listBox,982,30) LDControls.ListBoxItemChanged = OnListBoxItemChanged Sub OnListBoxItemChanged GraphicsWindow.PenWidth = 0 If (list[LDControls.LastListBoxIndex]) = ls[1] Then rbClicked() Grad() rp = LDShapes.AddRegularPolygon(cns,w) Shapes.Move(rp,x1,y1) LDShapes.BrushGradientShape(rp,LDShapes.BrushGradient(gr2,g)) aa = 0 sr = rp an = rp rt = rp zm = rp os = rp ElseIf (list[LDControls.LastListBoxIndex]) = ls[2] Then 'AddStar Grad() rbClicked() ps = LDShapes.AddStar(n,w,h) Shapes.Move(ps,X1,Y1) LDShapes.BrushGradientShape(ps,LDShapes.BrushGradient(gr2,g)) aa = 0 sr = ps an = ps rt = ps zm = ps os = ps ElseIf (list[LDControls.LastListBoxIndex]) = ls[3] Then Grad() rbClicked() ell = Shapes.AddEllipse(w,h) Shapes.Move(ell,X1,Y1) LDShapes.BrushGradientShape(ell,LDShapes.BrushGradient(gr2,g)) aa = 0 sr = ell an = ell rt = ell zm = ell os = ell ElseIf (list[LDControls.LastListBoxIndex]) = ls[4] Then Grad() rbClicked() rc = Shapes.AddRectangle(w,h) Shapes.Move(rc,X1,Y1) LDShapes.BrushGradientShape(rc,LDShapes.BrushGradient(gr2,g)) aa = 0 sr = rc an = rc rt = rc zm = rc os = rc ElseIf (list[LDControls.LastListBoxIndex]) = ls[5] Then im = Shapes.AddImage(Controls.GetTextBoxText(t1)) Shapes.Move(im,x1,y1) aa = 0 sr = im an = im rt = im zm = im os = im ElseIf (list[LDControls.LastListBoxIndex]) = ls[6] Then GraphicsWindow.BrushColor = FCDialogs.AskForColor() GraphicsWindow.FontSize = p GraphicsWindow.FontName = "David" tx = Shapes.AddText(Controls.GetTextBoxText(t1)) Shapes.Move(tx,X1,Y1) aa = 0 sr = tx an = tx rt = tx zm = tx os = tx ElseIf (list[LDControls.LastListBoxIndex]) = ls[7] Then Grad() rbClicked() pl = LDShapes.AddPolygon(plg) LDShapes.BrushGradientShape(pl,LDShapes.BrushGradient(gr2,(g))) plg = 0 sr = pl an = pl rt = pl os = pl ElseIf (list[LDControls.LastListBoxIndex]) = ls[8] Then GraphicsWindow.PenWidth = p GraphicsWindow.PenColor = FCDialogs.AskForColor() ln = Shapes.AddLine(x1,y1,x2,y2) aa = 0 sr = ln an = ln rt = ln os = ln ElseIf (list[LDControls.LastListBoxIndex]) = ls[9] Then ' Icosaledron Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddIcosahedron(view3D2,w,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[10] Then 'Arrow Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddArrow(view3D2,h,w,ng,anm,18,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[11] Then ' Cube Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddCube(view3D2,w,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[12] Then ' Cone Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddCone(view3D2,w,0,h,18,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[13] Then ' Pipe Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddPipe(view3D2,h,ng,anm,18,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[14] Then ' Pyramid Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddPyramid(view3D2,ng,h,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[15] Then ' Sphere Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddSphere(view3D2,w,15,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[16] Then ' Rectangle Grad() rbClicked2() ColorGradient() view3d2=LD3DView.AddView(gw,gh,"true") LD3DView.ResetCamera(view3D2,0,0,0,0,-1,0,"","","") LD3DView.MoveCamera(view3D2,0,0,0,-150) brush3=LDShapes.BrushGradient(gr2,cr1) figure1=LD3DView.AddRectangle(view3D2,w,h,brush3,g2) Gr3D() LD3DView.AnimateRotation(view3D2,figure1,n,cns,p,0,360,5,-1) sr = view3d2 ElseIf (list[LDControls.LastListBoxIndex]) = ls[17] Then ' AddSpot view3D = LD3DView.AddView(gw,gh,"true") spot = LD3DView.AddSpotLight(view3D,"Green",0.75,0.75,2,0,0,-1,45,100) LD3DView.AddDirectionalLight(view3D,"White",-1,-1,-1) LD3DView.AddDirectionalLight(view3D,"Yellow",1,1,1) LD3DView.AddAmbientLight(view3D,"Brown") points = "0 0 0: x150 0 0: x150 w10 0: 0 w10 0: 0 0 h10: x150 0 h10: x150 w10 h10: 0 w10 h10" indices = "0 2 1 0 3 2 4 5 6 4 6 7 1 2 5 2 6 5 4 7 0 7 3 0 7 6 2 7 2 3 0 1 5 0 5 4" LD3DView.ResetCamera(view3D,0,0,180, 0, 0, -30, "","","") p1=ldtext.Replace(points, "x150", anm) '25 p1=ldtext.Replace(p1, "h10", zmw) '65 p1=ldtext.Replace(p1, "w10", ops) '75 nx=1 object[n] = LD3DView.AddGeometry(view3D,p1,indices,"",LDColours.HSLtoRGB (ng, 1, .65),"D") LD3DView.TranslateGeometry(view3D,object[nx],-10,-40,0) LD3DView.AnimateRotation(view3D,object[nx], n, cns, p, 0, 360, zmh,-1) sr = view3D EndIf EndSub Controls.ButtonClicked = Click OnSlider() Sub Click If (Controls.LastClickedButton = b1[1]) Then 'Animate Shapes.Animate(an,X1,Y1,anm) aa = 0 ElseIf (Controls.LastClickedButton = b1[2]) Then 'Rotate Shapes.Rotate(rt, ng) ng = 0 ElseIf (Controls.LastClickedButton = b1[3]) Then 'Zoom Shapes.Zoom(zm,zmH,zmW) ElseIf (Controls.LastClickedButton = b1[4]) Then 'Opasity Shapes.SetOpacity(os,ops) ElseIf (Controls.LastClickedButton = b1[5]) Then 'Flickr a = Flickr.GetRandomPicture(Controls.GetTextBoxText(t1)) GraphicsWindow.DrawResizedImage(a,0,0,1270,870) ElseIf (Controls.LastClickedButton = b1[6]) Then ' AddBrowser(1) bw1 = LDControls.AddBrowser(875,700,"http://smallbasic.com/smallbasic.com/doc.aspx?o=Array.") Shapes.Move(bw1, 10, 30) sr = bw1 ElseIf (Controls.LastClickedButton = b1[7]) Then 'Remove Shapes.Remove(sr) ElseIf (Controls.LastClickedButton = b1[8]) Then 'Grid GraphicsWindow.PenColor = FCDialogs.AskForColor() GraphicsWindow.PenWidth = 0.1 For gg = 1 To 240 Step n GraphicsWindow.DrawLine(4 * gg,4,4 * gg,750) EndFor For vv = 1 To 190 Step n GraphicsWindow.DrawLine(4,4 * vv,970,4 * vv) EndFor ElseIf (Controls.LastClickedButton = b1[9]) Then 'AddBrowser(2) bw2 = LDControls.AddBrowser(965,730,Controls.GetTextBoxText(t1)) Shapes.Move(bw2, 10, 30) sr = bw2 ElseIf (Controls.LastClickedButton = b1[10]) Then rbClicked() Gradient() EndIf GraphicsWindow.PenWidth = 0 EndSub GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(0,0,0) OnComboBoxItemChanged() cb[1] = ";;;;;<>" cb[2] = ";;;;;;<>" cb[3] = ";;;;;<>" cb[4] = ";;;;;<>" cb[5] = ";;<>" cb[6] = ";;;;<>" cb[7] = ";;;<>" cb[9] = ";;;<" cb[11] = "; ;;;;;<>" cb[12] = ";;;;;;;;;<>" cb[13] = ",;;;;;<>" cb[14] = ";;;;;;;<>" cb[15] = ";;;;;;;;<>" cb[16] = ";;;;;;;<>" cb[17] = ";;;;;;<>" cb[18] = ";;;;;;;<>" cb[19] = ";;;;;;;;<>" cb[20] = ";;<>" cb[21] = ";<>" cb[22] = ";;<>" cb[23] = ";;<>" cb[24] = ";<>;;<>" cb[25] = ";<>" cb[26] = ";<>" cb[27] = " " cb[28] = " " cb[29] = " " cb[30] = "Good luck and prosperity(Удачи Вам и благополучие). Akiva 16/X-2017 | 8/II-2019" comboBox = LDControls.AddComboBox(cb,850,550) Shapes.Move(comboBox,20,5) LDDialogs.ToolTip(comboBox,"Help") LDControls.ComboBoxItemChanged = OnComboBoxItemChanged Sub OnComboBoxItemChanged EndSub Sub rbClicked lrb = LDControls.LastRadioButton 'Выбор градиента If lrb = cr1[1] Then g = "H" ElseIf lrb = cr1[2] Then g = "V" ElseIf lrb = cr1[3] Then g = "DD" ElseIf lrb = cr1[4] Then g = "DU" ElseIf lrb = cr1[5] Then g = "R" EndIf EndSub Sub OnMouseMove Controls.SetTextBoxText(t11, Math.Ceiling(GraphicsWindow.MouseX)) Controls.SetTextBoxText(t12, Math.Ceiling(GraphicsWindow.Mousey)) EndSub Sub Gradient ' для формы gr11[1] = FCDialogs.AskForColor() gr11[2] = FCDialogs.AskForColor() gr11[3] = FCDialogs.AskForColor() For i = 1 To 3 brush = LDShapes.BrushGradient(gr11,g) LDShapes.BrushGradientBackground(Brush) EndFor EndSub LDControls.SliderChanged = OnSlider Sub OnSlider sv10 = LDControls.SliderGetValue(sl10) w = Math.Ceiling(sv10 * 3.0) LDDialogs.ToolTip(ts10,"Width(w)") Controls.SetTextBoxText(ts10, w) sv10a = LDControls.SliderGetValue(sl10a) h = Math.Ceiling(sv10a * 3.0) LDDialogs.ToolTip(ts10a,"Height(h)") Controls.SetTextBoxText(ts10a, h) sv11 = LDControls.SliderGetValue(sl11) anm = Math.Ceiling(sv11 * 2.55) LDDialogs.ToolTip(ts11, "Animaty(anm)") Controls.SetTextBoxText(ts11, anm) sv11a = LDControls.SliderGetValue(sl11a) n = Math.Ceiling(sv11a * 1.0) LDDialogs.ToolTip(ts11a, "Grid(n)") Controls.SetTextBoxText(ts11a, n) sv12 = LDControls.SliderGetValue(sl12) p = Math.Ceiling(sv12 * 1.0) LDDialogs.ToolTip(ts12, "PenWidth(P)") Controls.SetTextBoxText(ts12, p) sv12a = LDControls.SliderGetValue(sl12a) ops = Math.Ceiling(sv12a * 1.0) LDDialogs.ToolTip(ts12a, "Opacity(ops)") Controls.SetTextBoxText(ts12a, ops) sv13 = LDControls.SliderGetValue(sl13) ng = Math.Ceiling(sv13 * 3.6) LDDialogs.ToolTip(ts13,"ng") Controls.SetTextBoxText(ts13, ng) sv13a = LDControls.SliderGetValue(sl13a) cns = Math.Ceiling(sv13a * 1.0) LDDialogs.ToolTip(ts13a,"Corners(cns)") Controls.SetTextBoxText(ts13a, cns) sv14 = LDControls.SliderGetValue(sl14) zmH = Math.Ceiling(sv14 * 1.0) LDDialogs.ToolTip(ts14, "ZoomHeight(zmh)") Controls.SetTextBoxText(ts14, zmH) sv14a = LDControls.SliderGetValue(sl14a) zmW = Math.Ceiling(sv14a * 1.0) LDDialogs.ToolTip(ts14a, "ZoomWidth(zmw)") Controls.SetTextBoxText(ts14a,zmW) EndSub Sub Grad 'для фигур gr2[1] = FCDialogs.AskForColor() gr2[2] = FCDialogs.AskForColor() gr2[3] = FCDialogs.AskForColor() EndSub GraphicsWindow.MouseDown = Down Sub Down GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(250,250,250) x = GraphicsWindow.MouseX y = Graphicswindow.MouseY aa = aa + 1 GraphicsWindow.FillEllipse(x, y, 2, 2) If aa = 1 Then X1 = x Y1 = y plg[0][" X "] = x plg[0][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 2 Then X2 = x Y2 = y plg[1][" X "] = x plg[1][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 3 Then X3 = x y3 = y plg[2][" X "] = x plg[2][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 4 Then plg[3][" X "] = x plg[3][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 5 Then plg[4][" X "] = x plg[4][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 6 Then plg[5][" X "] = x plg[5][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 7 Then plg[6][" X "] = x plg[6][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 8 Then plg[7][" X "] = x plg[7][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 9 Then plg[8][" X "] = x plg[8][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) ElseIf aa = 10 Then plg[9][" X "] = x plg[9][" Y "] = y Controls.SetTextBoxText(t14,x) Controls.SetTextBoxText(t15,y) aa = 0 EndIf EndSub Sub pn GraphicsWindow.PenWidth = p GraphicsWindow.PenColor = FCDialogs.AskForColor() EndSub Sub ColorGradient color[1]="#FFD700" color[2]="#FF00FF" color[3]="#DC143C" brush3=LDShapes.BrushGradient(color,"H") EndSub Sub rbClicked2 lrb2 = LDControls.LastRadioButton ' If lrb2 = cr2[1] Then g2 = "E" ElseIf lrb2 = cr2[2] Then g2 = "D" ElseIf lrb2 = cr2[3] Then g2 = "S" EndIf EndSub Sub Gr3D LD3DView.AddDirectionalLight(view3D2,"Red",-1,0,0) LD3DView.AddDirectionalLight(view3D2,"Green",0,-1,0) LD3DView.AddDirectionalLight(view3D2,"Blue",0,0,-1) LD3DView.AddDirectionalLight(view3D2,"Gray",1,0,0) LD3DView.AddDirectionalLight(view3D2,"Magenta",0,1,0) LD3DView.AddDirectionalLight(view3D2,"Cyan",0,0,1) EndSub End>BTG660-2.sb< Start>BTK359.sb< deff[1]="{13!^1 5!{15 !F 25!R %1!^1+1.925!} deff[2]="{1!^1 40!{95 !R 91.5!F %1!^1*1.025!} deff[3]="{40!^1 5!^2 45!{15 !F %2!R %1!^1+1.76!^2*0.9!} deff[0]="{1!w %1!l 61.05!w %1!r 120!w %1!l 61.05!w %1 GraphicsWindow.Width =800 GraphicsWindow.Height=800 GraphicsWindow.Title ="Turtle Samples While "true For o=0 to 3 var[1]=10 Turtle.x=400 Turtle.y=400 Turtle.Angle=0 ix=0 line= LDText.Split (deff[o],"!" ) Turtle.Speed =10 GraphicsWindow.BackgroundColor="teal GraphicsWindow.PenColor="darkblue GraphicsWindow.PenWidth =1 rrw=( text.GetSubTextToEnd(line[1],2)) nLines =Array.GetItemCount (line) proc() If o=0 then var[1]=10 proc() endif Program.Delay (3333) LDShapes.RemoveTurtleLines () endfor endwhile Sub proc For tt=1 To rrw 'main loop repeat For wi = 2 To nLines ttt: linee=text.ConvertToUpperCase (line[wi]) tt1: 'TextWindow.WriteLine (linee) repp() If Text.StartsWith(linee,"^") then vv=text.GetSubText (linee 2 1) df=text.GetSubText (linee 3 1) If df=" " then var[vv]=Text.GetSubTextToEnd (linee 4) ElseIf df="+" then var[vv]=var[vv]+Text.GetSubTextToEnd (linee 4) ElseIf df="-" then var[vv]=var[vv]-Text.GetSubTextToEnd (linee 4) ElseIf df="*" then var[vv]=var[vv]*Text.GetSubTextToEnd (linee 4) ElseIf df="/" then var[vv]=var[vv]/Text.GetSubTextToEnd (linee 4) endif ElseIf Text.StartsWith(linee, "~") Then Program.Delay (Text.GetSubTextToEnd(linee, 2)) ElseIf Text.StartsWith(linee, "{") Then dp=dp+1 mt[dp][1]=wi+1 mt[dp][2]=Text.GetSubTextToEnd (linee 2) ElseIf Text.StartsWith(linee, "}") Then mt[dp][2]=mt[dp][2]-1 If mt[dp][2]>0 then wi= mt[dp][1] Goto ttt Else dp=dp-1 endif ElseIf Text.StartsWith(linee, "W") Then if var[0]<3 then Stack.PushValue ("ss" tt) Stack.PushValue ("ss" wi) var[0]=var[0]+1 var[1]=var[1]/1.2 'GraphicsWindow.Title=var[0] proc() var[1]=var[1]*1.2 var[0]=var[0]-1 wi=Stack.PopValue ("ss") tt=Stack.PopValue ("ss") Else linee=LDText.Replace(linee "W" "F") Goto tt1 endif ElseIf Text.StartsWith(linee, "U") Then Turtle.PenUp() ElseIf Text.StartsWith(linee, "D") Then Turtle.PenDown() ElseIf Text.StartsWith(linee, "R") Then dist=text.GetSubTextToEnd (linee 3) Turtle.Turn(dist) ElseIf Text.StartsWith(linee, "L") Then dist=text.GetSubTextToEnd (linee 3) Turtle.Turn(-dist) ElseIf Text.StartsWith(linee, "F") Then dist=text.GetSubTextToEnd (linee 3) ix=ix+1 ic=math.Remainder (ix 256) GraphicsWindow.PenColor =GraphicsWindow.GetColorFromRGB (Math.GetRandomNumber (ic) 0 ic) Turtle.Move (dist) endif EndFor EndFor EndSub Sub repp For r=1 To 9 linee=ldtext.Replace (linee "%"+r var[r]) EndFor EndSub End>BTK359.sb< Start>BTN178-0.sb< ' Text to Binary and Binary to Text conversion (c) Amir CPS [ BTN178 ] ' ADDED: Binary to Base64 and Base64 to Binary WhTurner 2013-02-05 GraphicsWindow.Width = 500 GraphicsWindow.Height = 300 GraphicsWindow.Title = "Text to Binary : Binary to Text [ and Base64-conversion ]" TextBox = Controls.AddMultiLineTextBox(10,10) Controls.SetSize(TextBox,460,250) ButtonTB = Controls.AddButton("Text to Binary",10,265) ButtonBT = Controls.AddButton("Binary to Text",120,265) ButtonB64=Controls.AddButton("Binary to Base64",225,265) Button64B=Controls.AddButton("Base64 to Binary",350,265) Controls.ButtonClicked = onClick Sub onClick LastButton = Controls.LastClickedButton If LastButton = "Button1" Then ConvertToBinary() ElseIf LastButton="Button2" then ConvertToText() elseif LastButton="Button3" then ConvertToBase64() elseif LastButton="Button4" then ConvertFromBase64() EndIf EndSub Sub ConvertToBinary String = Controls.GetTextBoxText(TextBox) For i = 1 To Text.GetLength(String) CharCode = Text.GetCharacterCode(Text.GetSubText(String,i,1)) temp = CharCode 'convert ascii codes into binary bit = "" binval = "" Count = 0 While CharCode > 0 bit[Count] = Math.Remainder(CharCode,2) CharCode = Math.Floor(CharCode / 2) Count = Count + 1 EndWhile For j = Array.GetItemCount(bit) To 0 Step -1 binval = Text.Append(binval,bit[j]) EndFor 'add leading zero to make binary value even if temp = 13 Or temp = 10 Then lead = 10 Else lead = 8 EndIf For b = 0 To lead - Text.GetLength(binval) binval = Text.Append(0,binval) EndFor longbin = Text.Append(longbin,binval) EndFor Controls.SetTextBoxText(TextBox,longbin) longbin = "" EndSub Sub ConvertToText Longstring="" Binary = Controls.GetTextBoxText(TextBox) If Math.Remainder(Text.GetLength(Binary),8) <> 0 Then GraphicsWindow.ShowMessage("Binary is uneven","Error") Else For g = 1 To Text.GetLength(Binary) Step 8 Binarychar = Text.GetSubText(Binary,g,8) 'Convert binary to decimal For bit_Count = 1 To Text.GetLength(Binarychar) binaryNum = binaryNum + Text.GetSubText(Binarychar,Text.GetLength(Binarychar)-bit_Count+1,1)*Math.Power(2,bit_Count-1) EndFor 'get char from ascci code Char = Text.GetCharacter(binaryNum) binaryNum = "" 'append char LongString = Text.Append(LongString,Char) EndFor Controls.SetTextBoxText(TextBox,LongString) LongString = "" EndIf EndSub Sub ConvertToBase64 Longstring="" Binary = Controls.GetTextBoxText(TextBox) If Math.Remainder(Text.GetLength(Binary),8) <> 0 Then GraphicsWindow.ShowMessage("Binary is uneven","Error") Else If Math.Remainder(Text.GetLength(Binary),6) <> 0 Then xx=6-Math.Remainder(Text.GetLength(Binary),6) Binary=text.Append(Binary,text.GetSubText("00000",1,xx)) endif For g = 1 To Text.GetLength(Binary) Step 6 Binarychar = Text.GetSubText(Binary,g,6) ''111111 'Convert binary to decimal '0 - 63 For bit_Count = 1 To Text.GetLength(Binarychar) ''6 binaryNum = binaryNum * 2 + Text.GetSubText(Binarychar,bit_Count,1) EndFor If binaryNum<26 Then B64=text.GetCharacter(binaryNum+65) ElseIf binaryNum<52 then B64=text.GetCharacter(binaryNum+71) ElseIf binaryNum<62 then B64=text.GetCharacter(binaryNum-4) ElseIf binaryNum=62 then B64="+" ElseIf binaryNum=63 then B64="/" endif Longstring=text.Append(Longstring,B64) binaryNum="" EndFor endif Controls.SetTextBoxText(TextBox,LongString) EndSub 'ConvertToBase64 Sub ConvertFromBase64 Longbin="" String = Controls.GetTextBoxText(TextBox) For i = 1 To Text.GetLength(String) CharCode = Text.GetCharacterCode(Text.GetSubText(String,i,1)) If CharCode=43 Then temp=62 elseif CharCode=47 Then temp=63 elseif CharCode<58 Then temp=CharCode+4 elseif CharCode<91 Then temp=CharCode-65 elseif CharCode<123 Then temp=CharCode-71 EndIf 'convert ascii codes into binary bit = "" binval = "" Count = 0 While temp > 0 bit[Count] = Math.Remainder(temp,2) temp = Math.Floor(temp / 2) Count = Count + 1 EndWhile For j = Array.GetItemCount(bit) To 0 Step -1 binval = Text.Append(binval,bit[j]) EndFor xx=6-text.GetLength(binval) binval=text.Append(Text.GetSubText("000000",1,xx),binval) Longbin=text.Append(Longbin,binval) EndFor xx=8-math.Remainder(text.GetLength(Longbin),8) If xx<8 then Longbin=text.Append(Longbin,text.GetSubText("00000000",1,xx)) endif Controls.SetTextBoxText(TextBox,longbin) longbin = "" endsub 'ConvertFromBase64 End>BTN178-0.sb< Start>BTN178.sb< GraphicsWindow.Width = 400 GraphicsWindow.Height = 300 GraphicsWindow.Title = "Text to Binary : Binary to Text" TextBox = Controls.AddMultiLineTextBox(10,10) Controls.SetSize(TextBox,380,250) ButtonTB = Controls.AddButton("Convert to Binary",10,265) ButtonBT = Controls.AddButton("Convert to Text",140,265) Controls.ButtonClicked = onClick Sub onClick LastButton = Controls.LastClickedButton If LastButton = "Button1" Then ConvertToBinary() Else ConvertToText() EndIf EndSub Sub ConvertToBinary String = Controls.GetTextBoxText(TextBox) For i = 1 To Text.GetLength(String) CharCode = Text.GetCharacterCode(Text.GetSubText(String,i,1)) temp = CharCode 'convert ascii codes into binary bit = "" binval = "" Count = 0 While CharCode > 0 bit[Count] = Math.Remainder(CharCode,2) CharCode = Math.Floor(CharCode / 2) Count = Count + 1 EndWhile For j = Array.GetItemCount(bit) To 0 Step -1 binval = Text.Append(binval,bit[j]) EndFor 'add leading zero to make binary value even if temp = 13 Or temp = 10 Then lead = 10 Else lead = 8 EndIf For b = 0 To lead - Text.GetLength(binval) binval = Text.Append(0,binval) EndFor longbin = Text.Append(longbin,binval) EndFor Controls.SetTextBoxText(TextBox,longbin) longbin = "" EndSub Sub ConvertToText Binary = Controls.GetTextBoxText(TextBox) If Math.Remainder(Text.GetLength(Binary),8) <> 0 Then GraphicsWindow.ShowMessage("Binary is uneven","Error") Else For g = 1 To Text.GetLength(Binary) Step 8 Binarychar = Text.GetSubText(Binary,g,8) 'Convert binary to decimal For bit_Count = 1 To Text.GetLength(Binarychar) binaryNum = binaryNum + Text.GetSubText(Binarychar,Text.GetLength(Binarychar)-bit_Count+1,1)*Math.Power(2,bit_Count-1) EndFor 'get char from ascci code Char = Text.GetCharacter(binaryNum) binaryNum = "" 'append char LongString = Text.Append(LongString,Char) EndFor Controls.SetTextBoxText(TextBox,LongString) LongString = "" EndIf EndSub End>BTN178.sb< Start>BTQ589-0.sb< '2.Make a shape bounce from top to bottom from a standing start under the influence of gravity. 'http://smallbasic.com/program/?BTQ589-0 GraphicsWindow.BackgroundColor = "#01456B" GraphicsWindow.BrushColor = "#05A34C" GraphicsWindow.PenWidth = 0 size = 30 ball = Shapes.AddEllipse(size size) X = GraphicsWindow.Width /2 - size /2 dY = 0 weight = 1 While 0=0 'Move Enemy dY = dY + weight Y = Y + dY 'Resolve Collision If Y >= GraphicsWindow.Height - size Then dY = -dY - weight 'change direction up (weight is still positive) EndIf 'Update Frame Shapes.Move(ball X Y) FrameRate() EndWhile '=================================================== 'SUBROUTINES Sub FrameRate delay = Clock.ElapsedMilliseconds - start If 15 - delay > 0 Then Program.Delay(15 - delay) EndIf start = Clock.ElapsedMilliseconds EndSub End>BTQ589-0.sb< Start>BTS032.sb< GraphicsWindow.BackgroundColor="teal GraphicsWindow.brushColor ="darkgray GraphicsWindow.PenWidth =0 GraphicsWindow.Height=555 GraphicsWindow.Title="Uroboros For r=0 To 360 Step 2 es=Shapes.AddEllipse (30 30) ee[r]=LDFastShapes.ShapeIndex (es) ldfastShapes.Move (ee[r] LDMath.cos(r)*200+250 LDMath.Sin(r)*200+250) ' LDShapes.AnimateOpacity (ee 1300 0) ' Program.Delay (5) EndFor LDFastShapes.Update () While "true i=i+2 For r=0 To 4 ldfastShapes.SetOpacity (ee[math.Remainder (i+r*2 360)] 0) EndFor LDFastShapes.Zoom (ee[math.Remainder (i-2 360)] 1.5 1.5) LDFastShapes.Update () Program.Delay (20) For r=0 To 4 ldfastShapes.SetOpacity (ee[math.Remainder (i+r*2 360)] 100) EndFor LDFastShapes.Zoom (ee[math.Remainder (i-2 360)] 1 1) LDFastShapes.Update () EndWhile End>BTS032.sb< Start>BTV547.sb< LDUtilities.ShowNoShapeErrors="False nullc="darkblue GraphicsWindow.BackgroundColor =nullc fullc="lightgreen GraphicsWindow.BrushColor=fullc GraphicsWindow.PenColor="black GraphicsWindow.Height=140 GraphicsWindow.Title="LCD nums" aa=33 ay=30 tt=8 ss[1][1]=0 ss[1][2]=tt ss[2][1]=10 ss[2][2]=0 ss[3][1]=aa+10 ss[3][2]=0 ss[4][1]=aa+20 ss[4][2]=tt ss[5][1]=aa+10 ss[5][2]=tt*2 ss[6][1]=10 ss[6][2]=tt*2 sw[1][1]=0 sw[1][2]=0 sw[2][1]=tt sw[2][2]=10 sw[3][1]=tt sw[3][2]=ay+10 sw[4][1]=0 sw[4][2]=ay+20 sw[5][1]=-tt sw[5][2]=ay+10 sw[6][1]=-tt sw[6][2]=10 num=25803 For t=0 To 4 For x=0 To 2 b=x+1 sh[t][b]=ldShapes.AddPolygon (ss) Shapes.Move(sh[t][b],100+t*aa*2.85,10+x*50) EndFor For xx=0 To 1 For x=0 To 1 b=x+xx*2+4 sh[t][b]=ldShapes.AddPolygon (sw) Shapes.Move(sh[t][b],100+xx*(aa+20)+t*aa*2.85,10+x*50+tt) EndFor EndFor EndFor args=0 LDEvents.MouseWheel =mww For x=0 To Array.GetItemCount (sh) For y=1 To 7 ldShapes.AnimateOpacity (sh[x][y],500,10) EndFor Program.Delay (500) EndFor zm=1 LDCall.Function2 ("nset",0,"111o11o") LDCall.Function2 ("nset",1,"1111oo1") LDCall.Function2 ("nset",3,"1o1") LDCall.Function2 ("nset",4,"11100") Sub mww If FCKeyboard.IsControlPressed then zm=zm+ LDEvents.LastMouseWheelDelta/10 If zm<0.3 Then zm=0.3 ElseIf zm>1.2 then zm=1.2 endif For x=0 To Array.GetItemCount (sh) For y=1 To 7 Shapes.Zoom (sh[x][y],zm,zm) EndFor EndFor Else num=num+LDEvents.LastMouseWheelDelta nums=text.Append ("00000",num) nums=text.GetSubTextToEnd (nums,text.GetLength (nums)-4) For qx=0 To 4 ldcall.Function2("cset",qx,text.GetSubText (nums,qx+1,1)) EndFor EndIf endsub Sub nset' nm=number, bt="oooooo1"bits(1-7) nm=args[1] bt=args[2] For x=1 To 7 If text.IsSubText (".o0_O ",Text.GetSubText (bt,x,1)) then LDShapes.BrushColour (sh[nm][x],nullc) Else LDShapes.BrushColour (sh[nm][x],fullc) endif endfor endsub Sub cset ii=args[1] j=args[2] If j=2 then LDCall.Function2 ("nset",ii,"111o11o") elseIf j=5 then LDCall.Function2 ("nset",ii,"1111oo1") elseIf j=0 then LDCall.Function2 ("nset",ii,"1o11111") elseIf j=3 then LDCall.Function2 ("nset",ii,"1110011") elseIf j=8 then LDCall.Function2 ("nset",ii,"1111111") elseIf j=1 then LDCall.Function2 ("nset",ii,"0000011") elseIf j=7 then LDCall.Function2 ("nset",ii,"1000011") elseIf j=9 then LDCall.Function2 ("nset",ii,"1111011") elseIf j=6 then LDCall.Function2 ("nset",ii,"1111101") elseIf j=4 then LDCall.Function2 ("nset",ii,"o1o1o11") endif EndSub End>BTV547.sb< Start>BTW377.sb< GraphicsWindow.Width=1600 GraphicsWindow.Height=900 GraphicsWindow.Top =10 GraphicsWindow.Left=10 GraphicsWindow.Title ="3D Lab GraphicsWindow.BackgroundColor="darkblue view3D = LD3DView.AddView(900,900,"true") LD3DView.AddDirectionalLight (view3D,"white",-1 ,-1 ,-1) LD3DView.AutoControl ("true" "true", -1 3) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#555555") LD3DView.ResetCamera(view3D,-30,15,30, 5, 0, -3, "","","") p=3 q=4 For t=0 To 361 Step .2 r=ldmath.Cos(q*t)+2 px=ldmath.cos (t*p)*r pz=ldmath. sin(t*p)*r py=-ldmath.Sin (t*q) If t>.4 Then pp=ox+":"+oz+":"+oy+":" pp=pp+px+":"+pz+":"+py+":" LD3DView.AddTube(view3D pp .4 20 LDColours.HSLtoRGB (math.Remainder (t 360) 1 .6) "D") endif ox=oox oy=ooy oz=ooz oox=px ooy=py ooz=pz EndFor GraphicsWindow.KeyDown=kdd ya=6 rtt=1 LDEvents.MouseWheel =mww r35=5 While "true For aa=0 To 362 Step 2 px= LDMath.Cos(aa) py= LDMath.sin (aa) If rtt=1 then LD3DView.ResetCamera(view3D, px*r35,py*r35,ya ,-px, -py, -.5, "","","") Else aa=aa-2 endif Program.Delay (22) EndFor EndWhile Sub kdd If GraphicsWindow.LastKey="Space" Then rtt= 1-rtt EndIf EndSub Sub mww ya=ya+ LDEvents.LastMouseWheelDelta/2 GraphicsWindow.Title =ya endsub End>BTW377.sb< Start>BTW400.sb< 'SB code GraphicsWindow.Title = "Lines" GraphicsWindow.BackgroundColor = "darkkhaki" GraphicsWindow.Width = "1080" GraphicsWindow.height = "550" GraphicsWindow.PenWidth = 2 ' 1A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "Gold GraphicsWindow.drawellipse(230,30,30,30) GraphicsWindow.fillellipse(230,30,30,30) GraphicsWindow.drawellipse(262,30,30,30) GraphicsWindow.fillellipse(262,30,30,30) GraphicsWindow.drawellipse(294,30,30,30) GraphicsWindow.fillellipse(294,30,30,30) GraphicsWindow.drawellipse(326,30,30,30) GraphicsWindow.fillellipse(326,30,30,30) ' 1B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(237,37,15,15) GraphicsWindow.fillellipse(237,37,15,15) GraphicsWindow.drawellipse(269,37,15,15) GraphicsWindow.fillellipse(269,37,15,15) GraphicsWindow.drawellipse(301,37,15,15) GraphicsWindow.fillellipse(301,37,15,15) GraphicsWindow.drawellipse(333,37,15,15) GraphicsWindow.fillellipse(333,37,15,15) ' 2A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "Gold GraphicsWindow.drawellipse(200,60,30,30) GraphicsWindow.fillellipse(200,60,30,30) GraphicsWindow.drawellipse(230,60,30,30) GraphicsWindow.fillellipse(230,60,30,30) GraphicsWindow.drawellipse(262,60,30,30) GraphicsWindow.fillellipse(262,60,30,30) GraphicsWindow.drawellipse(294,60,30,30) GraphicsWindow.fillellipse(294,60,30,30) GraphicsWindow.drawellipse(326,60,30,30) GraphicsWindow.fillellipse(326,60,30,30) GraphicsWindow.drawellipse(358,60,30,30) GraphicsWindow.fillellipse(358,60,30,30) ' 2B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(207,67,15,15) GraphicsWindow.fillellipse(207,67,15,15) GraphicsWindow.drawellipse(237,67,15,15) GraphicsWindow.fillellipse(237,67,15,15) GraphicsWindow.drawellipse(269,67,15,15) GraphicsWindow.fillellipse(269,67,15,15) GraphicsWindow.drawellipse(301,67,15,15) GraphicsWindow.fillellipse(301,67,15,15) GraphicsWindow.drawellipse(333,67,15,15) GraphicsWindow.fillellipse(333,67,15,15) GraphicsWindow.drawellipse(365,67,15,15) GraphicsWindow.fillellipse(365,67,15,15) ' 3A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "Gold GraphicsWindow.drawellipse(200,93,30,30) GraphicsWindow.fillellipse(200,93,30,30) GraphicsWindow.drawellipse(230,93,30,30) GraphicsWindow.fillellipse(230,93,30,30) GraphicsWindow.drawellipse(326,93,30,30) GraphicsWindow.fillellipse(326,93,30,30) GraphicsWindow.drawellipse(358,93,30,30) GraphicsWindow.fillellipse(358,93,30,30) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "black GraphicsWindow.drawellipse(262,93,30,30) GraphicsWindow.fillellipse(262,93,30,30) GraphicsWindow.drawellipse(294,93,30,30) GraphicsWindow.fillellipse(294,93,30,30) ' 3B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(207,100,15,15) GraphicsWindow.fillellipse(207,100,15,15) GraphicsWindow.drawellipse(237,100,15,15) GraphicsWindow.fillellipse(237,100,15,15) GraphicsWindow.drawellipse(333,100,15,15) GraphicsWindow.fillellipse(333,100,15,15) GraphicsWindow.drawellipse(365,100,15,15) GraphicsWindow.fillellipse(365,100,15,15) 'GraphicsWindow.penColor = "black 'GraphicsWindow.BrushColor = "darkslategray 'GraphicsWindow.drawellipse(269,100,15,15) 'GraphicsWindow.fillellipse(269,100,15,15) 'GraphicsWindow.drawellipse(301,100,15,15) 'GraphicsWindow.fillellipse(301,100,15,15) ' Eyes scale = 4 x0 = 60 * scale y0 = 24 * scale ' Eyes GraphicsWindow.BrushColor = "dimgray" GraphicsWindow.PenColor = "white" '"darkslategray" 'GraphicsWindow.PenWidth = 1 oEyeLeft2 = Shapes.AddEllipse(4 * scale, 4 * scale) Shapes.Move(oEyeLeft2, x0 + 7 * scale, y0 + 1 * scale) oEyeRight2 = Shapes.AddEllipse(4 * scale, 4 * scale) Shapes.Move(oEyeRight2, x0 + 15 * scale, y0 + 1 * scale) GraphicsWindow.PenWidth = 2 ' 4A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "Gold GraphicsWindow.drawellipse(200,123,30,30) GraphicsWindow.fillellipse(200,123,30,30) GraphicsWindow.drawellipse(358,123,30,30) GraphicsWindow.fillellipse(358,123,30,30) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "orangered GraphicsWindow.drawellipse(230,123,30,30) GraphicsWindow.fillellipse(230,123,30,30) GraphicsWindow.drawellipse(262,123,30,30) GraphicsWindow.fillellipse(262,123,30,30) GraphicsWindow.drawellipse(294,123,30,30) GraphicsWindow.fillellipse(294,123,30,30) GraphicsWindow.drawellipse(326,123,30,30) GraphicsWindow.fillellipse(326,123,30,30) ' 4B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(207,130,15,15) GraphicsWindow.fillellipse(207,130,15,15) GraphicsWindow.drawellipse(365,130,15,15) GraphicsWindow.fillellipse(365,130,15,15) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "firebrick GraphicsWindow.drawellipse(237,130,15,15) GraphicsWindow.fillellipse(237,130,15,15) GraphicsWindow.drawellipse(269,130,15,15) GraphicsWindow.fillellipse(269,130,15,15) GraphicsWindow.drawellipse(301,130,15,15) GraphicsWindow.fillellipse(301,130,15,15) GraphicsWindow.drawellipse(333,130,15,15) GraphicsWindow.fillellipse(333,130,15,15) ' 5A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "Gold GraphicsWindow.drawellipse(230,155,30,30) GraphicsWindow.fillellipse(230,155,30,30) GraphicsWindow.drawellipse(326,155,30,30) GraphicsWindow.fillellipse(326,155,30,30) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "orangered GraphicsWindow.drawellipse(262,155,30,30) GraphicsWindow.fillellipse(262,155,30,30) GraphicsWindow.drawellipse(294,155,30,30) GraphicsWindow.fillellipse(294,155,30,30) ' 5B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(237,162,15,15) GraphicsWindow.fillellipse(237,162,15,15) GraphicsWindow.drawellipse(333,162,15,15) GraphicsWindow.fillellipse(333,162,15,15) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "firebrick GraphicsWindow.drawellipse(269,162,15,15) GraphicsWindow.fillellipse(269,162,15,15) GraphicsWindow.drawellipse(301,162,15,15) GraphicsWindow.fillellipse(301,162,15,15) ' 6A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "Gold GraphicsWindow.drawellipse(200,188,30,30) GraphicsWindow.fillellipse(200,188,30,30) GraphicsWindow.drawellipse(230,188,30,30) GraphicsWindow.fillellipse(230,188,30,30) GraphicsWindow.drawellipse(326,188,30,30) GraphicsWindow.fillellipse(326,188,30,30) GraphicsWindow.drawellipse(357,188,30,30) GraphicsWindow.fillellipse(357,188,30,30) GraphicsWindow.drawellipse(388,188,30,30) GraphicsWindow.fillellipse(388,188,30,30) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "orangered GraphicsWindow.drawellipse(262,188,30,30) GraphicsWindow.fillellipse(262,188,30,30) GraphicsWindow.drawellipse(294,188,30,30) GraphicsWindow.fillellipse(294,188,30,30) ' 6B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(207,195,15,15) GraphicsWindow.fillellipse(207,195,15,15) GraphicsWindow.drawellipse(237,195,15,15) GraphicsWindow.fillellipse(237,195,15,15) GraphicsWindow.drawellipse(333,195,15,15) GraphicsWindow.fillellipse(333,195,15,15) GraphicsWindow.drawellipse(365,195,15,15) GraphicsWindow.fillellipse(365,195,15,15) GraphicsWindow.drawellipse(395,195,15,15) GraphicsWindow.fillellipse(395,195,15,15) GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "firebrick GraphicsWindow.drawellipse(269,195,15,15) GraphicsWindow.fillellipse(269,195,15,15) GraphicsWindow.drawellipse(301,195,15,15) GraphicsWindow.fillellipse(301,195,15,15) ' 7A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "gold GraphicsWindow.drawellipse(170,220,30,30) GraphicsWindow.fillellipse(170,220,30,30) GraphicsWindow.drawellipse(420,220,30,30) GraphicsWindow.fillellipse(420,220,30,30) GraphicsWindow.drawellipse(200,220,30,30) GraphicsWindow.fillellipse(200,220,30,30) GraphicsWindow.drawellipse(388,220,30,30) GraphicsWindow.fillellipse(388,220,30,30) GraphicsWindow.drawellipse(230,220,30,30) GraphicsWindow.fillellipse(230,220,30,30) GraphicsWindow.drawellipse(262,220,30,30) GraphicsWindow.fillellipse(262,220,30,30) GraphicsWindow.drawellipse(294,220,30,30) GraphicsWindow.fillellipse(294,220,30,30) GraphicsWindow.drawellipse(326,220,30,30) GraphicsWindow.fillellipse(326,220,30,30) GraphicsWindow.drawellipse(357,220,30,30) GraphicsWindow.fillellipse(357,220,30,30) ' 7B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(177,227,15,15) GraphicsWindow.fillellipse(177,227,15,15) GraphicsWindow.drawellipse(427,227,15,15) GraphicsWindow.fillellipse(427,227,15,15) GraphicsWindow.drawellipse(207,227,15,15) GraphicsWindow.fillellipse(207,227,15,15) GraphicsWindow.drawellipse(395,227,15,15) GraphicsWindow.fillellipse(395,227,15,15) GraphicsWindow.drawellipse(237,227,15,15) GraphicsWindow.fillellipse(237,227,15,15) GraphicsWindow.drawellipse(269,227,15,15) GraphicsWindow.fillellipse(269,227,15,15) GraphicsWindow.drawellipse(301,227,15,15) GraphicsWindow.fillellipse(301,227,15,15) GraphicsWindow.drawellipse(333,227,15,15) GraphicsWindow.fillellipse(333,227,15,15) GraphicsWindow.drawellipse(365,227,15,15) GraphicsWindow.fillellipse(365,227,15,15) ' 8A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "gold GraphicsWindow.drawellipse(170,250,30,30) GraphicsWindow.fillellipse(170,250,30,30) GraphicsWindow.drawellipse(420,250,30,30) GraphicsWindow.fillellipse(420,250,30,30) GraphicsWindow.drawellipse(200,250,30,30) GraphicsWindow.fillellipse(200,250,30,30) GraphicsWindow.drawellipse(388,250,30,30) GraphicsWindow.fillellipse(388,250,30,30) GraphicsWindow.drawellipse(262,250,30,30) GraphicsWindow.fillellipse(262,250,30,30) GraphicsWindow.drawellipse(326,250,30,30) GraphicsWindow.fillellipse(326,250,30,30) GraphicsWindow.drawellipse(230,250,30,30) GraphicsWindow.fillellipse(230,250,30,30) GraphicsWindow.drawellipse(294,250,30,30) GraphicsWindow.fillellipse(294,250,30,30) GraphicsWindow.drawellipse(357,250,30,30) GraphicsWindow.fillellipse(357,250,30,30) ' 8B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(177,257,15,15) GraphicsWindow.fillellipse(177,257,15,15) GraphicsWindow.drawellipse(427,257,15,15) GraphicsWindow.fillellipse(427,257,15,15) GraphicsWindow.drawellipse(207,257,15,15) GraphicsWindow.fillellipse(207,257,15,15) GraphicsWindow.drawellipse(395,257,15,15) GraphicsWindow.fillellipse(395,257,15,15) GraphicsWindow.drawellipse(269,257,15,15) GraphicsWindow.fillellipse(269,257,15,15) GraphicsWindow.drawellipse(333,257,15,15) GraphicsWindow.fillellipse(333,257,15,15) GraphicsWindow.drawellipse(237,257,15,15) GraphicsWindow.fillellipse(237,257,15,15) GraphicsWindow.drawellipse(301,257,15,15) GraphicsWindow.fillellipse(301,257,15,15) GraphicsWindow.drawellipse(365,257,15,15) GraphicsWindow.fillellipse(365,257,15,15) ' 9A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "gold GraphicsWindow.drawellipse(170,282,30,30) GraphicsWindow.fillellipse(170,282,30,30) GraphicsWindow.drawellipse(420,282,30,30) GraphicsWindow.fillellipse(420,282,30,30) GraphicsWindow.drawellipse(200,282,30,30) GraphicsWindow.fillellipse(200,282,30,30) GraphicsWindow.drawellipse(388,282,30,30) GraphicsWindow.fillellipse(388,282,30,30) GraphicsWindow.drawellipse(230,282,30,30) GraphicsWindow.fillellipse(230,282,30,30) GraphicsWindow.drawellipse(294,282,30,30) GraphicsWindow.fillellipse(294,282,30,30) GraphicsWindow.drawellipse(357,282,30,30) GraphicsWindow.fillellipse(357,282,30,30) GraphicsWindow.drawellipse(262,282,30,30) GraphicsWindow.fillellipse(262,282,30,30) GraphicsWindow.drawellipse(326,282,30,30) GraphicsWindow.fillellipse(326,282,30,30) ' 9B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(177,289,15,15) GraphicsWindow.fillellipse(177,289,15,15) GraphicsWindow.drawellipse(427,289,15,15) GraphicsWindow.fillellipse(427,289,15,15) GraphicsWindow.drawellipse(207,289,15,15) GraphicsWindow.fillellipse(207,289,15,15) GraphicsWindow.drawellipse(395,289,15,15) GraphicsWindow.fillellipse(395,289,15,15) GraphicsWindow.drawellipse(237,289,15,15) GraphicsWindow.fillellipse(237,289,15,15) GraphicsWindow.drawellipse(301,289,15,15) GraphicsWindow.fillellipse(301,289,15,15) GraphicsWindow.drawellipse(365,289,15,15) GraphicsWindow.fillellipse(365,289,15,15) GraphicsWindow.drawellipse(333,289,15,15) GraphicsWindow.fillellipse(333,289,15,15) GraphicsWindow.drawellipse(269,289,15,15) GraphicsWindow.fillellipse(269,289,15,15) ' 10A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "gold GraphicsWindow.drawellipse(200,315,30,30) GraphicsWindow.fillellipse(200,315,30,30) GraphicsWindow.drawellipse(388,315,30,30) GraphicsWindow.fillellipse(388,315,30,30) GraphicsWindow.drawellipse(230,315,30,30) GraphicsWindow.fillellipse(230,315,30,30) GraphicsWindow.drawellipse(357,315,30,30) GraphicsWindow.fillellipse(357,315,30,30) GraphicsWindow.drawellipse(294,315,30,30) GraphicsWindow.fillellipse(294,315,30,30) GraphicsWindow.drawellipse(262,315,30,30) GraphicsWindow.fillellipse(262,315,30,30) GraphicsWindow.drawellipse(326,315,30,30) GraphicsWindow.fillellipse(326,315,30,30) ' 10B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(207,322,15,15) GraphicsWindow.fillellipse(207,322,15,15) GraphicsWindow.drawellipse(395,322,15,15) GraphicsWindow.fillellipse(395,322,15,15) GraphicsWindow.drawellipse(237,322,15,15) GraphicsWindow.fillellipse(237,322,15,15) GraphicsWindow.drawellipse(364,322,15,15) GraphicsWindow.fillellipse(364,322,15,15) GraphicsWindow.drawellipse(302,322,15,15) GraphicsWindow.fillellipse(302,322,15,15) GraphicsWindow.drawellipse(268,322,15,15) GraphicsWindow.fillellipse(268,322,15,15) GraphicsWindow.drawellipse(333,322,15,15) GraphicsWindow.fillellipse(333,322,15,15) ' 11A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "gold GraphicsWindow.drawellipse(230,345,30,30) GraphicsWindow.fillellipse(230,345,30,30) GraphicsWindow.drawellipse(357,345,30,30) GraphicsWindow.fillellipse(357,345,30,30) GraphicsWindow.drawellipse(294,345,30,30) GraphicsWindow.fillellipse(294,345,30,30) GraphicsWindow.drawellipse(262,345,30,30) GraphicsWindow.fillellipse(262,345,30,30) GraphicsWindow.drawellipse(326,345,30,30) GraphicsWindow.fillellipse(326,345,30,30) ' 11B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "darkgoldenrod GraphicsWindow.drawellipse(237,352,15,15) GraphicsWindow.fillellipse(237,352,15,15) GraphicsWindow.drawellipse(364,352,15,15) GraphicsWindow.fillellipse(364,352,15,15) GraphicsWindow.drawellipse(302,352,15,15) GraphicsWindow.fillellipse(302,352,15,15) GraphicsWindow.drawellipse(268,352,15,15) GraphicsWindow.fillellipse(268,352,15,15) GraphicsWindow.drawellipse(333,352,15,15) GraphicsWindow.fillellipse(333,352,15,15) ' 12A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "orangered GraphicsWindow.drawellipse(262,377,30,30) GraphicsWindow.fillellipse(262,377,30,30) GraphicsWindow.drawellipse(326,377,30,30) GraphicsWindow.fillellipse(326,377,30,30) ' 12B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "firebrick GraphicsWindow.drawellipse(270,383,15,15) GraphicsWindow.fillellipse(270,383,15,15) GraphicsWindow.drawellipse(333,383,15,15) GraphicsWindow.fillellipse(333,383,15,15) ' 13A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "orangered GraphicsWindow.drawellipse(262,409,30,30) GraphicsWindow.fillellipse(262,409,30,30) GraphicsWindow.drawellipse(326,409,30,30) GraphicsWindow.fillellipse(326,409,30,30) ' 13B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "firebrick GraphicsWindow.drawellipse(270,415,15,15) GraphicsWindow.fillellipse(270,415,15,15) GraphicsWindow.drawellipse(333,415,15,15) GraphicsWindow.fillellipse(333,415,15,15) ' 14A GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "orangered GraphicsWindow.drawellipse(230,440,30,30) GraphicsWindow.fillellipse(230,440,30,30) GraphicsWindow.drawellipse(360,440,30,30) GraphicsWindow.fillellipse(360,440,30,30) GraphicsWindow.drawellipse(294,440,30,30) GraphicsWindow.fillellipse(294,440,30,30) GraphicsWindow.drawellipse(262,440,30,30) GraphicsWindow.fillellipse(262,440,30,30) GraphicsWindow.drawellipse(326,440,30,30) GraphicsWindow.fillellipse(326,440,30,30) ' 14B GraphicsWindow.penColor = "black GraphicsWindow.BrushColor = "firebrick GraphicsWindow.drawellipse(237,447,15,15) GraphicsWindow.fillellipse(237,447,15,15) GraphicsWindow.drawellipse(368,447,15,15) GraphicsWindow.fillellipse(368,447,15,15) GraphicsWindow.drawellipse(302,447,15,15) GraphicsWindow.fillellipse(302,447,15,15) GraphicsWindow.drawellipse(270,447,15,15) GraphicsWindow.fillellipse(270,447,15,15) GraphicsWindow.drawellipse(333,447,15,15) GraphicsWindow.fillellipse(333,447,15,15) ' Blink start While "True" Program.Delay(2900) Shapes.HideShape(oEyeLeft2) Shapes.HideShape(oEyeRight2) Program.Delay(100) Shapes.ShowShape(oEyeLeft2) Shapes.ShowShape(oEyeRight2) EndWhile End>BTW400.sb< Start>BVD340.sb< GraphicsWindow.Width=900 GraphicsWindow.Height=900 GraphicsWindow.Left=10 GraphicsWindow.Top=1 GraphicsWindow.penColor="black GraphicsWindow.BrushColor="transparent GraphicsWindow.PenWidth=2 GraphicsWindow.BackgroundColor="midnightblue Shapes.AddEllipse (1 1) p=ldShapes.AddRegularPolygon (6 258) LDShapes.BrushColour (p "#aa00aaaa") LDShapes.Centre (p 450 450) ldShapes.RotateAbout (p 450 450 90) p=ldShapes.AddRegularPolygon (3 300) LDShapes.Centre (p 450 450) LDShapes.BrushColour (p "#aa00aaaa") p=ldShapes.AddRegularPolygon (3 300) LDShapes.Centre (p 450 450) LDShapes.BrushColour (p "#aa00aaaa") ldShapes.RotateAbout (p 450 450 180) p=Shapes.AddLine(0 0 0 600) LDShapes.Centre (p 450 450) p=Shapes.AddLine(0 0 0 600) LDShapes.Centre (p 450 450) ldShapes.RotateAbout (p 450 450 60) p=Shapes.AddLine(0 0 0 600) LDShapes.Centre (p 450 450) ldShapes.RotateAbout (p 450 450, -60) p=Shapes.AddLine(0 0 516 0) LDShapes.Centre (p 450 450) p=Shapes.AddLine(0 0 516 0) LDShapes.Centre (p 450 450) ldShapes.RotateAbout (p 450 450 60) p=Shapes.AddLine(0 0 516 0) LDShapes.Centre (p 450 450) ldShapes.RotateAbout (p 450 450, -60) for f=0 To 2 p=ldShapes.AddRegularPolygon (6 75) LDShapes.Centre (p 450 300+f*150) LDShapes.BrushColour(p "#aaccaaaa") EndFor for f=0 To 1 p=ldShapes.AddRegularPolygon (6 75) LDShapes.Centre (p 580 375+f*150) EndFor for f=0 To 1 p=ldShapes.AddRegularPolygon (6 75) LDShapes.Centre (p 320 375+f*150) EndFor shapes.addline(190 450 578 225) shapes.addline(190 450 578 670) shapes.addline(578 225 578 600) Shapes.AddLine(320 225 320 670) Shapes.AddLine(320 225 707 450) Shapes.AddLine(320 670 707 450) shapes.addline(318 375 450 600) shapes.addline(580 375 450 600) shapes.addline(318 375 580 375) GraphicsWindow.MouseMove=mmm Sub mmm GraphicsWindow.Title=GraphicsWindow.MouseX +" : "+ GraphicsWindow.MouseY EndSub End>BVD340.sb< Start>BVD417.sb< Turtle.Show () Turtle.PenUp () GraphicsWindow.KeyDown =kkk Timer.Interval=500 Timer.Tick=tyy dd=30 GraphicsWindow.BackgroundColor ="teal GraphicsWindow.PenWidth=8 GraphicsWindow.Title ="Turtlesnake Sub kkk lk= GraphicsWindow.LastKey If lk="Left" Then Turtle.TurnLeft () ElseIf lk="Right" then Turtle.TurnRight () EndIf EndSub Sub tyy ox=turtle.X oy=Turtle.y GraphicsWindow.PenColor =LDColours.HSLtoRGB (tc*5 1 .6) Turtle.Move (dd) ss=Shapes.AddLine (ox oy Turtle.X Turtle.y) LDQueue.Enqueue ("tt" ss) tc=tc+1 If tc>9 Then '----------trail length shapes.Remove (LDQueue.Dequeue("tt")) EndIf EndSub End>BVD417.sb< Start>BVJ146-0.sb< ' Molecular Structure of Ozone ' Version 0.2 ' Copyright © 2019 Nonki Takahashi. The MIT License. ' Last update 2019-11-18 ' Program ID BVJ146-0 GraphicsWindow.Title = "Molecular Structure of Ozone" bg = "LightGray" pc = "DimGray" GraphicsWindow.BackgroundColor = bg atom["C"] = "color=Black;size=150;" atom["O"] = "color=#EE0000;size=100;" atom["H"] = "color=White;size=50;" gap = 20 a = 116.8 ' [degree] gw = GraphicsWindow.Width gh = GraphicsWindow.Height mol = "O_3" DrawMolecularName() ' draw line (1) x1 = gw / 2 y1 = gh * 0.4 size = atom["O"]["size"] r = size / 2 + size / 2 + gap _ah = Math.GetRadians(a / 2) x2 = x1 - r * Math.Sin(_ah) y2 = y1 + r * Math.Cos(_ah) n = 2 DrawLine() ' draw O (1) ox = x2 oy = y2 bc = atom["O"]["color"] opt = "" FillCircle() ' draw line (2) x2 = x1 + r * Math.Sin(_ah) n = 1 DrawLine() ' draw O (2) ox = x2 opt = "-" FillCircle() ' draw O (3) ox = x1 oy = y1 opt = "+" FillCircle() Sub DrawLine GraphicsWindow.PenColor = pc If n = 2 Then GraphicsWindow.PenWidth = 12 GraphicsWindow.DrawLine(x1, y1, x2, y2) GraphicsWindow.PenColor = bg EndIf GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawLine(x1, y1, x2, y2) EndSub Sub DrawMolecularName GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" x = 30 For p = 1 To Text.GetLength(mol) c = Text.GetSubText(mol, p, 1) If c = "_" Then y = 35 p = p + 1 fs = 20 c = Text.GetSubText(mol, p, 1) Else y = 20 fs = 30 EndIf GraphicsWindow.FontSize = fs GraphicsWindow.DrawText(x, y, c) x = x + fs * 0.7 EndFor EndSub Sub FillCircle GraphicsWindow.BrushColor = bc GraphicsWindow.FillEllipse(ox - size / 2, oy - size / 2, size, size) If opt <> "" Then GraphicsWindow.FontSize = 35 GraphicsWindow.BrushColor = pc GraphicsWindow.DrawText(ox + size / 2, oy - size / 2, opt) EndIf EndSub End>BVJ146-0.sb< Start>BVK045.sb< 'File Cleaner ImportedFile=Program.Directory+"\ZCP924.sb" NewFile=Program.Directory+"\ZCP924NEW.sb" ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(NewFile) For x=1 to 999 ' The following line could be harmful and has been automatically commented. ' MyLine= File.readline(ImportedFile,x) MyIndex=text.getindexof(myline,"The following line could be") if Myindex >0 then x=x+1 ' The following line could be harmful and has been automatically commented. ' MyLine= File.readline(ImportedFile,x) Myline = text.GetSubTextToEnd(Myline,2) endif if text.getindexof(myline,"END PROGRAM")>0 Then x=99999 EndIf ' The following line could be harmful and has been automatically commented. ' File.writeline(NewFile,x,Myline) endfor End>BVK045.sb< Start>BVM529.sb< 'Sorting Prototype - Created by Matthew L. Parets aka codingCat. No rights reserved. Use and distribute at your pleasure 'This program creates a random lists of numbers and letters and then 'sorts the list first by numbers, and then by letters. The number and word 'lists are treated as match sets and are swapped together during the sort. ' 'To compare the words a CompareString method is used. This is to get 'around the fact that SmallBasic will not usefully do a greater/less 'comparison of strings of text. Has this been true from day one? Is this 'a bug in version 1.1? RandomizeArrays() TextWindow.WriteLine("Unsorted Records") TextWindow.WriteLine("-------------------------------------------") DisplayRecords() TextWindow.WriteLine("") SortByNumber() TextWindow.WriteLine("Records Sorted by numbers") TextWindow.WriteLine("-------------------------------------------") DisplayRecords() TextWindow.WriteLine("") SortByWords() TextWindow.WriteLine("Records Sorted by words") TextWindow.WriteLine("-------------------------------------------") DisplayRecords() TextWindow.WriteLine("") Sub RandomizeArrays For i = 1 To 10 numbers[i] = Math.GetRandomNumber(999) EndFor For i = 1 To 10 word = "" For j = 1 To 4 word = word + Text.GetCharacter(64 + Math.GetRandomNumber(26)) EndFor words[i] = word EndFor EndSub Sub DisplayRecords For i =1 To Array.GetItemCount(words) TextWindow.Write("Record #" + i + ": ") TextWindow.Write(numbers[i] + " = ") TextWindow.WriteLine(words[i]) EndFor EndSub Sub SortByNumber length = Array.GetItemCount(numbers) For i = 1 To length 'A terrible, but easy to understand selection sort For j = 1 To length 'Compare every entry to every other entry If numbers[i] < numbers[j] Then 'If they are out of order numTemp = numbers[i] 'swap them to the correct order numbers[i] = numbers[j] numbers[j] = numTemp wordTemp = words[i] 'swap the matching words at the same time words[i] = words[j] words[j] = wordTemp EndIf EndFor EndFor EndSub Sub SortByWords length = Array.GetItemCount(words) For swi = 1 To length 'A terrible, but easy to understand selection sort For swj = 1 To length 'Compare every entry to every other entry left = words[swi] 'pull the words from the array right = words[swj] CompareStrings() 'Compare the strings giving a greater/less/equal evaluation If less = "true" Then 'If they are out of order wordTemp = words[swi] 'Swap them to the correct order words[swi] = words[swj] words[swj] = wordTemp numTemp = numbers[swi] 'Swap the matching numbers at the same time numbers[swi] = numbers[swj] numbers[swj] = numTemp EndIf EndFor EndFor EndSub 'Needed to compare to strings - I am amazed that I haven't noticed that 'Small basic doesn't do greater/less comparisons on strings before now Sub CompareStrings greater = "False" 'state of the comparison equal = "False" less = "False" match = "False" csi = 1 While match <> "True" And csi <= Text.GetLength(left) And csi <= Text.GetLength(right) lc = Text.GetSubText(left,csi,1) rc = Text.GetSubText(right,csi,1) If Text.GetCharacterCode(lc) <> Text.GetCharacterCode(rc) then 'compare individual characters match = "True" If Text.GetCharacterCode(lc) > Text.GetCharacterCode(rc) Then greater = "True" Else less = "True" EndIf EndIf csi = csi + 1 EndWhile If match = "False" Then 'If equal at the end of the comparison If Text.GetLength(left) = Text.GetLength(right) Then 'base the result on the length equal = "True" elseIf Text.GetLength(left) > Text.GetLength(right) Then greater = "True" Else less = "True" EndIf EndIf EndSub End>BVM529.sb< Start>BVN078.sb< 'LAMP 'commands start="mainl[subject::lamp]%%" tout="sout>>%" vout="sout>>#" fout="fout>>" input="uin<<" clearscreen="$cls" delayt="$dly_%" delayv="$dly_#" srch="$src_" comment="//" done="$fin" newvar="$set_" edvart="$edv_%" edvarv="$edv_#" comparee="$cmp(=)_" comparen="$cmp(<>)_" compareg="$cmp(>)_" comparel="$cmp(<)_" naddv="nadd>>#" nsubv="nsub>>#" ndivv="ndiv>>#" nmulv="nmul>>#" nranv="nran>>#" naddt="nadd>>%" nsubt="nsub>>%" ndivt="ndiv>>%" nmult="nmul>>%" nrant="nran>>%" line=0 read="" run=0 boot=0 v=0 filename=Program.GetArgument(1) While read<>done line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) If Text.StartsWith(read,start) then run=1 TextWindow.WriteLine("Build Successful!") TextWindow.Clear() EndIf If Text.StartsWith(read,newvar) Then find=7 end=7 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=7 then v=Text.GetSubText(read,6,1) EndIf If end=8 then v=Text.GetSubText(read,6,2) EndIf If end=9 then v=Text.GetSubText(read,6,3) EndIf If end=10 then v=Text.GetSubText(read,6,4) EndIf If end=11 then v=Text.GetSubText(read,6,5) EndIf If end=12 then v=Text.GetSubText(read,6,6) EndIf If end=13 then v=Text.GetSubText(read,6,7) EndIf If end=14 then v=Text.GetSubText(read,6,8) EndIf If end=15 then v=Text.GetSubText(read,6,9) EndIf value=text.GetSubTextToEnd(read,end+1) variable[v]=value EndIf If Text.StartsWith(read,tout) Then write=Text.GetSubTextToEnd(read,8) TextWindow.WriteLine(write) EndIf If Text.StartsWith(read,vout) Then getv=Text.GetSubTextToEnd(read,8) TextWindow.WriteLine(variable[getv]) EndIf If Text.StartsWith(read,fout) Then find=7 end=7 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=8 then a=Text.GetSubText(read,7,1) b=text.GetSubTextToEnd(read,end+1) EndIf If end=9 then a=Text.GetSubText(read,7,2) b=text.GetSubTextToEnd(read,end+1) EndIf If end=10 then a=Text.GetSubText(read,7,3) b=text.GetSubTextToEnd(read,end+1) EndIf If end=11 then a=Text.GetSubText(read,7,4) b=text.GetSubTextToEnd(read,end+1) EndIf If end=12 then a=Text.GetSubText(read,7,5) b=text.GetSubTextToEnd(read,end+1) EndIf If end=13 then a=Text.GetSubText(read,7,6) b=text.GetSubTextToEnd(read,end+1) EndIf If end=14 then a=Text.GetSubText(read,7,7) b=text.GetSubTextToEnd(read,end+1) EndIf If end=15 then a=Text.GetSubText(read,7,8) b=text.GetSubTextToEnd(read,end+1) EndIf If end=16 then a=Text.GetSubText(read,7,9) b=text.GetSubTextToEnd(read,end+1) EndIf TextWindow.WriteLine(variable[a]+" "+variable[b]) EndIf If Text.StartsWith(read,input) Then inv=Text.GetSubTextToEnd(read,6) variable[inv]=textwindow.Read() EndIf If Text.StartsWith(read,comment)Then line=line EndIf If Text.StartsWith(read,clearscreen) Then TextWindow.Clear() EndIf If Text.StartsWith(read,delayt) Then time=text.GetSubTextToEnd(read,7) Program.Delay(time) EndIf If Text.StartsWith(read,delayv) Then getdv=text.GetSubTextToEnd(read,7) time=variable[getdv] Program.Delay(time) EndIf If Text.StartsWith(read,srch) Then lines=text.GetSubTextToEnd(read,6) line=line+lines EndIf If read=done Then TextWindow.WriteLine("") TextWindow.Pause() Program.End() EndIf If Text.StartsWith(read,edvart) Then find=7 end=8 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=9 then wv=Text.GetSubText(read,7,1) nh=text.GetSubTextToEnd(read,end) EndIf If end=10 then wv=Text.GetSubText(read,7,2) nh=text.GetSubTextToEnd(read,end) EndIf If end=11 then wv=Text.GetSubText(read,7,3) nh=text.GetSubTextToEnd(read,end) EndIf If end=12 then wv=Text.GetSubText(read,7,4) nh=text.GetSubTextToEnd(read,end) EndIf If end=13 then wv=Text.GetSubText(read,7,5) nh=text.GetSubTextToEnd(read,end) EndIf If end=14 then wv=Text.GetSubText(read,7,6) nh=text.GetSubTextToEnd(read,end) EndIf If end=15 then wv=Text.GetSubText(read,7,7) nh=text.GetSubTextToEnd(read,end) EndIf If end=16 then wv=Text.GetSubText(read,7,8) nh=text.GetSubTextToEnd(read,end) EndIf If end=17 then wv=Text.GetSubText(read,7,9) nh=text.GetSubTextToEnd(read,end) EndIf variable[wv]=variable[wv]+nh endif If Text.StartsWith(read,edvarv) Then find=7 end=8 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=9 then wv=Text.GetSubText(read,7,1) nh=text.GetSubTextToEnd(read,end) EndIf If end=10 then wv=Text.GetSubText(read,7,2) nh=text.GetSubTextToEnd(read,end) EndIf If end=11 then wv=Text.GetSubText(read,7,3) nh=text.GetSubTextToEnd(read,end) EndIf If end=12 then wv=Text.GetSubText(read,7,4) nh=text.GetSubTextToEnd(read,end) EndIf If end=13 then wv=Text.GetSubText(read,7,5) nh=text.GetSubTextToEnd(read,end) EndIf If end=14 then wv=Text.GetSubText(read,7,6) nh=text.GetSubTextToEnd(read,end) EndIf If end=15 then wv=Text.GetSubText(read,7,7) nh=text.GetSubTextToEnd(read,end) EndIf If end=16 then wv=Text.GetSubText(read,7,8) nh=text.GetSubTextToEnd(read,end) EndIf If end=17 then wv=Text.GetSubText(read,7,9) nh=text.GetSubTextToEnd(read,end) EndIf variable[wv]=variable[wv]+variable[nh] endif If Text.StartsWith(read,nrant) Then max=text.GetSubTextToEnd(read,8) line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=Math.GetRandomNumber(max) EndIf If Text.StartsWith(read,nranv) Then vm=text.GetSubTextToEnd(read,8) line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=Math.GetRandomNumber(variable[vm]) EndIf If Text.StartsWith(read,naddt) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then n1=Text.GetSubText(read,8,1) n2=text.GetSubTextToEnd(read,end) EndIf If end=11 then n1=Text.GetSubText(read,8,2) n2=text.GetSubTextToEnd(read,end) EndIf If end=12 then n1=Text.GetSubText(read,8,3) n2=text.GetSubTextToEnd(read,end) EndIf If end=13 then n1=Text.GetSubText(read,8,4) n2=text.GetSubTextToEnd(read,end) EndIf If end=14 then n1=Text.GetSubText(read,8,5) n2=text.GetSubTextToEnd(read,end) EndIf If end=15 then n1=Text.GetSubText(read,8,6) n2=text.GetSubTextToEnd(read,end) EndIf If end=16 then n1=Text.GetSubText(read,8,7) n2=text.GetSubTextToEnd(read,end) EndIf If end=17 then n1=Text.GetSubText(read,8,8) n2=text.GetSubTextToEnd(read,end) EndIf If end=18 then n1=Text.GetSubText(read,8,9) n2=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=n1+n1 endif If Text.StartsWith(read,nsubt) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then n1=Text.GetSubText(read,8,1) n2=text.GetSubTextToEnd(read,end) EndIf If end=11 then n1=Text.GetSubText(read,8,2) n2=text.GetSubTextToEnd(read,end) EndIf If end=12 then n1=Text.GetSubText(read,8,3) n2=text.GetSubTextToEnd(read,end) EndIf If end=13 then n1=Text.GetSubText(read,8,4) n2=text.GetSubTextToEnd(read,end) EndIf If end=14 then n1=Text.GetSubText(read,8,5) n2=text.GetSubTextToEnd(read,end) EndIf If end=15 then n1=Text.GetSubText(read,8,6) n2=text.GetSubTextToEnd(read,end) EndIf If end=16 then n1=Text.GetSubText(read,8,7) n2=text.GetSubTextToEnd(read,end) EndIf If end=17 then n1=Text.GetSubText(read,8,8) n2=text.GetSubTextToEnd(read,end) EndIf If end=18 then n1=Text.GetSubText(read,8,9) n2=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=n1-n1 endif If Text.StartsWith(read,ndivt) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then n1=Text.GetSubText(read,8,1) n2=text.GetSubTextToEnd(read,end) EndIf If end=11 then n1=Text.GetSubText(read,8,2) n2=text.GetSubTextToEnd(read,end) EndIf If end=12 then n1=Text.GetSubText(read,8,3) n2=text.GetSubTextToEnd(read,end) EndIf If end=13 then n1=Text.GetSubText(read,8,4) n2=text.GetSubTextToEnd(read,end) EndIf If end=14 then n1=Text.GetSubText(read,8,5) n2=text.GetSubTextToEnd(read,end) EndIf If end=15 then n1=Text.GetSubText(read,8,6) n2=text.GetSubTextToEnd(read,end) EndIf If end=16 then n1=Text.GetSubText(read,8,7) n2=text.GetSubTextToEnd(read,end) EndIf If end=17 then n1=Text.GetSubText(read,8,8) n2=text.GetSubTextToEnd(read,end) EndIf If end=18 then n1=Text.GetSubText(read,8,9) n2=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=n1/n1 endif If Text.StartsWith(read,nmult) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then n1=Text.GetSubText(read,8,1) n2=text.GetSubTextToEnd(read,end) EndIf If end=11 then n1=Text.GetSubText(read,8,2) n2=text.GetSubTextToEnd(read,end) EndIf If end=12 then n1=Text.GetSubText(read,8,3) n2=text.GetSubTextToEnd(read,end) EndIf If end=13 then n1=Text.GetSubText(read,8,4) n2=text.GetSubTextToEnd(read,end) EndIf If end=14 then n1=Text.GetSubText(read,8,5) n2=text.GetSubTextToEnd(read,end) EndIf If end=15 then n1=Text.GetSubText(read,8,6) n2=text.GetSubTextToEnd(read,end) EndIf If end=16 then n1=Text.GetSubText(read,8,7) n2=text.GetSubTextToEnd(read,end) EndIf If end=17 then n1=Text.GetSubText(read,8,8) n2=text.GetSubTextToEnd(read,end) EndIf If end=18 then n1=Text.GetSubText(read,8,9) n2=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=n1*n1 endif ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Text.StartsWith(read,naddv) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then c=Text.GetSubText(read,8,1) d=text.GetSubTextToEnd(read,end) EndIf If end=11 then c=Text.GetSubText(read,8,2) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,8,3) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,8,4) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,8,5) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,8,6) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,8,7) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,8,8) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,8,9) d=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=variable[c]+variable[d] endif If Text.StartsWith(read,nsubv) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then c=Text.GetSubText(read,8,1) d=text.GetSubTextToEnd(read,end) EndIf If end=11 then c=Text.GetSubText(read,8,2) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,8,3) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,8,4) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,8,5) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,8,6) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,8,7) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,8,8) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,8,9) d=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=variable[c]-variable[d] endif If Text.StartsWith(read,ndivv) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then c=Text.GetSubText(read,8,1) d=text.GetSubTextToEnd(read,end) EndIf If end=11 then c=Text.GetSubText(read,8,2) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,8,3) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,8,4) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,8,5) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,8,6) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,8,7) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,8,8) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,8,9) d=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=variable[c]/variable[d] endif If Text.StartsWith(read,nmulv) Then find=8 end=9 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=10 then c=Text.GetSubText(read,8,1) d=text.GetSubTextToEnd(read,end) EndIf If end=11 then c=Text.GetSubText(read,8,2) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,8,3) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,8,4) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,8,5) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,8,6) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,8,7) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,8,8) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,8,9) d=text.GetSubTextToEnd(read,end) EndIf line=line+1 ' The following line could be harmful and has been automatically commented. ' read=File.ReadLine(filename,line) getname=Text.GetSubTextToEnd(read,2) variable[getname]=variable[c]*variable[d] endif If Text.StartsWith(read,comparee) Then find=9 end=10 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=11 then c=Text.GetSubText(read,9,1) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,9,2) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,9,3) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,9,4) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,9,5) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,9,6) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,9,7) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,9,8) d=text.GetSubTextToEnd(read,end) EndIf If end=19 then c=Text.GetSubText(read,9,9) d=text.GetSubTextToEnd(read,end) EndIf If variable[c]=variable[d] or variable[c]=text.ConvertToLowerCase(variable[d]) or variable[c]=text.ConvertToUpperCase(variable[d]) then line=line Else line=line+1 endif EndIf If Text.StartsWith(read,comparen) Then find=9 end=10 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=11 then c=Text.GetSubText(read,9,1) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,9,2) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,9,3) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,9,4) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,9,5) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,9,6) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,9,7) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,9,8) d=text.GetSubTextToEnd(read,end) EndIf If end=19 then c=Text.GetSubText(read,9,9) d=text.GetSubTextToEnd(read,end) EndIf If variable[c]<>variable[d] or variable[c]<>text.ConvertToLowerCase(variable[d]) or variable[c]<>text.ConvertToUpperCase(variable[d]) then line=line Else line=line+1 endif EndIf If Text.StartsWith(read,compareg) Then find=9 end=10 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=11 then c=Text.GetSubText(read,9,1) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,9,2) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,9,3) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,9,4) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,9,5) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,9,6) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,9,7) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,9,8) d=text.GetSubTextToEnd(read,end) EndIf If end=19 then c=Text.GetSubText(read,9,9) d=text.GetSubTextToEnd(read,end) EndIf If variable[c]>variable[d] or variable[c]>text.ConvertToLowerCase(variable[d]) or variable[c]>text.ConvertToUpperCase(variable[d]) then line=line Else line=line+1 endif EndIf If Text.StartsWith(read,comparel) Then find=9 end=10 getsub=" " While getsub<>"|" getsub=Text.GetSubText(read,find,1) If getsub="|" then end=end EndIf If getsub<>"|" then find=find+1 end=end+1 getsub=Text.GetSubText(read,find,1) endif EndWhile If end=11 then c=Text.GetSubText(read,9,1) d=text.GetSubTextToEnd(read,end) EndIf If end=12 then c=Text.GetSubText(read,9,2) d=text.GetSubTextToEnd(read,end) EndIf If end=13 then c=Text.GetSubText(read,9,3) d=text.GetSubTextToEnd(read,end) EndIf If end=14 then c=Text.GetSubText(read,9,4) d=text.GetSubTextToEnd(read,end) EndIf If end=15 then c=Text.GetSubText(read,9,5) d=text.GetSubTextToEnd(read,end) EndIf If end=16 then c=Text.GetSubText(read,9,6) d=text.GetSubTextToEnd(read,end) EndIf If end=17 then c=Text.GetSubText(read,9,7) d=text.GetSubTextToEnd(read,end) EndIf If end=18 then c=Text.GetSubText(read,9,8) d=text.GetSubTextToEnd(read,end) EndIf If end=19 then c=Text.GetSubText(read,9,9) d=text.GetSubTextToEnd(read,end) EndIf If variable[c]BVN078.sb< Start>BVN282.sb< rectangle = Shapes.AddRectangle(GraphicsWindow.Width GraphicsWindow.Height) scale = 1 While scale > 0 scale = scale - 0.01 Shapes.Zoom(rectangle scale scale) Program.Delay(15) EndWhile TextWindow.WriteLine("Left: " + Shapes.GetLeft(rectangle)) TextWindow.WriteLine("Top: " + Shapes.GetTop(rectangle)) End>BVN282.sb< Start>BVN526.sb< sl=LDControls.AddSlider (30 300 "V") For r=0 to 0 sz[r]=LDControls.AddSlider (30 200 "V") Controls.Move(sz[r] r*44 333) LDControls.SliderValue (sz[r] 55) endfor LDControls.SliderChanged=sll GraphicsWindow.Width=1300 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor="teal GraphicsWindow.Left=5 GraphicsWindow.Top=5 ii=ImageList.LoadImage ("e:\grl.png") ii1=ImageList.LoadImage ("e:\grro.png") LDControls.SliderValue (sl 75) ll=ldtext.Split (" z: , y: ,z: " ",") Timer.Interval=750 Timer.Tick=sss dss="true oo=Shapes.AddEllipse (11 11) LDShapes.BrushColour (oo "red") sh=shapes.AddImage (i2) ' LDimage.MakeTransparent (ii1 LDImage.GetPixel (ii1 px py)) Shapes.Move (sh 600 0) LDShapes.ZIndex (sh ,-1) LDShapes.SetShapeEvent (sh) LDShapes.ShapeEvent=see Sub see If LDShapes.LastEventType="MouseDown" Then Shapes.Move (oo GraphicsWindow.MouseX GraphicsWindow.MouseY) dnn="true endif endsub While "true If dnn Then dnn="false ttl="" px=Shapes.GetLeft (oo)-600 py=shapes.GetTop (oo) For r=0 To 0 zz[r]=(LDControls.SliderGetValue (sz[r])-50)*15 ttl=ttl+ll[r+1]+zz[r] EndFor GraphicsWindow.Title= px+" : "+py+ttl Shapes.Remove (sh) sh=shapes.AddImage (i2) Shapes.Move (sh 600 0) LDShapes.SetShapeEvent (sh) LDShapes.ZIndex (sh ,-1) LDImage.NormalMap (sh px py zz[0] ii1 .4 3) EndIf endwhile Sub sll If LDControls.LastSlider=sl then vv=ldmath.FixDecimal (LDControls.SliderGetValue (sl)/100*10 3)-5 GraphicsWindow.Title= vv i2=LDImage.HeightMap2NormalMap (ii vv) GraphicsWindow.DrawImage (i2 0 0) Else dss="true endif EndSub Sub sss If dss Then dss="false dnn="true endif EndSub End>BVN526.sb< Start>BVN976.sb< GraphicsWindow.backgroundcolor="black" GraphicsWindow.width=1300 GraphicsWindow.height=800 startx=20 side=35 bingo="BINGO" numCards=6 For i=0 to numCards-1 x=startx startingX[i]=x 'upper left corner of the card y=50 createCard() allCards[i]=card showCard() startx=startx+side*6 endfor GraphicsWindow.BrushColor="magenta" x=60 y=250 player=1 For i=1 to numCards GraphicsWindow.DrawText(x,y,"PLAYER "+i) x=x+side*6 endfor createBingoBalls() ballCount=0 GraphicsWindow.brushcolor="Black" button=Controls.AddButton("CALL NEXT NUMBER", 20,300) Controls.ButtonClicked=nextNumber bbX=20 bbY=375 bbDiam=30 Sub createCard For col=0 To 4 createColumn() endfor endsub sub createColumn For row=0 To 4 If row=2 And col=2 then 'center square card[row][col]=0 Else num=math.GetRandomNumber(15)+15*col duplicate() While dup="True" num=math.GetRandomNumber(15)+15*col duplicate() endwhile card[row][col]=num endif endfor endsub Sub duplicate dup="False" For r=0 To 4 If num=card[r][col] then dup="True" EndIf endfor endsub Sub showCard GraphicsWindow.fontbold="True" GraphicsWindow.fontsize=18 GraphicsWindow.fontname="Arial" For row=0 To 4 For col=0 To 4 drawSquare() x=x+side+2 EndFor x=startx y=y+side+2 endfor bX=x+10 bY=25 GraphicsWindow.brushcolor="yellow" For b=1 To 5 GraphicsWindow.DrawText(bX,bY,text.GetSubText(bingo,b,1)) bX=bX+side+2 endfor endsub sub drawSquare cardNum=card[row][col] GraphicsWindow.brushcolor="white" GraphicsWindow.FillRectangle(x,y,side,side) graphicswindow.brushcolor="black" If card[row][col]>=10 then GraphicsWindow.DrawText(x+9,y+9,cardNum) Else GraphicsWindow.DrawText(x+16,y+9,cardNum) endif 'center square red If row=2 And col=2 then GraphicsWindow.brushcolor="red" GraphicsWindow.FillRectangle(x,y,side,side) endif endsub Sub createBingoBalls For i=0 To 74 If i+1<=15 Then letter="B" Else If i+1<=30 Then letter="I" Else If i+1<=45 Then letter="N" Else If i+1<=60 then letter="G" Else letter="O" EndIf EndIf EndIf EndIf bb[i]=letter+(i+1) endfor endsub Sub nextNumber 'call a random number bbNum=math.GetRandomNumber(75)-1 'index of bb chooseBingoBall() While chosen="True" bbNum=math.GetRandomNumber(75)-1 'index of bb chooseBingoBall() endwhile ball=bb[bbNum] ballCount=ballCount+1 If ballCount=75 Then Shapes.Remove(button) endif 'mark chosen bb[bbNum]="*" showBall() if Math.Remainder(ballCount,25)=0 Then 'new row bbY=bbY+40 bbX=20 else bbX=bbX+bbDiam+10 endif checkCards() 'check which (if any) cards contain the number endsub Sub chooseBingoBall chosen="False" If bb[bbNum]="*" Then chosen="True" endif endsub Sub showBall GraphicsWindow.brushcolor="cyan" GraphicsWindow.FillEllipse(bbX,bbY,bbDiam,bbDiam) GraphicsWindow.brushcolor="black" GraphicsWindow.fontsize=12 graphicswindow.drawtext(bbX+5,bbY+10,ball) endsub Sub checkCards 'see if bingo number called is contained in one or more cards ' get the column let=text.GetSubText(ball,1,1) column=text.GetIndexOf(bingo,let)-1 For c=0 To numCards-1 card=allCards[c] checkOneCard() endfor If ballCount>=4 Then checkForWinners() endif endsub Sub checkOneCard foundNumber="False" For rr=0 To 4 If let+card[rr][column]=ball Then startX=startingX[c] card[rr][column]="*"+card[rr][column] 'mark called allCards[c][rr][column]=card[rr][column] drawCalledSquare() endif endfor endsub Sub drawCalledSquare GraphicsWindow.fontbold="True" GraphicsWindow.fontsize=18 GraphicsWindow.fontname="Arial" cardNum=text.GetSubTextToEnd(card[rr][column],2) 'GraphicsWindow.brushcolor="cyan" GraphicsWindow.brushcolor="white" x=startX+column*(side+2) y=50+rr*(side+2) GraphicsWindow.FillRectangle(x,y,side,side) GraphicsWindow.brushcolor="cyan" GraphicsWindow.FillEllipse(x,y,side,side) GraphicsWindow.brushcolor="black" GraphicsWindow.pencolor="black" GraphicsWindow.DrawEllipse(x,y,side,side) If cardNum >=10 then GraphicsWindow.DrawText(x+9,y+9,cardNum) Else GraphicsWindow.DrawText(x+16,y+9,cardNum) endif endsub Sub checkForWinners 'For each card. check rows, cols, 2 diagonals for marked (* in first character) squares winMessage="" For c=0 To numCards-1 win="False" card=allCards[c] 'printCard() checkRows() checkCols() checkDiag1() 'upper left to lower right checkDiag2() If win="True" Then GraphicsWindow.BackgroundColor="green" Controls.HideControl(button) GraphicsWindow.brushcolor="black" GraphicsWindow.fontsize=30 GraphicsWindow.DrawText(40,600,winMessage) endif endfor endsub Sub checkRows For rr=0 To 4 checkOneRow() endfor endsub Sub checkOneRow count=0 For column=0 To 4 firstChar=text.GetSubText(card[rr][column],1,1) If firstChar="*" Then count=count+1 endif endfor if count=4 and rr=2 or count=5 Then winMessage=winMessage+" "+"PLAYER "+(c+1)+" WINS!! " win="True" endif endsub Sub checkCols For cc=0 To 4 checkOneCol() endfor endsub Sub checkOneCol count=0 For row=0 To 4 firstChar=text.GetSubText(card[row][cc],1,1) If firstChar="*" Then count=count+1 endif endfor if count=4 and cc=2 or count=5 Then winMessage=winMessage+" "+"PLAYER "+(c+1)+" WINS!! " win="True" endif endsub Sub checkDiag1 count=0 For num=0 To 4 firstChar=text.GetSubText(card[num][num],1,1) If firstChar="*" Then count=count+1 endif endfor if count=4 Then winMessage=winMessage+" "+"PLAYER "+(c+1)+" WINS!! " win="True" endif endsub Sub checkDiag2 count=0 For num=0 To 4 firstChar=text.GetSubText(card[num][4-num],1,1) If firstChar="*" Then count=count+1 endif endfor if count=4 Then winMessage=winMessage+" "+"PLAYER "+(c+1)+" WINS!! " win="True" endif endsub End>BVN976.sb< Start>BVP613.sb< numBox = 5 For i = 1 To numBox GraphicsWindow.DrawText(10,30*i, "Textbox "+i) textBox[i] = Controls.AddTextBox(100,30*i) EndFor GraphicsWindow.DrawText(10,30*i, "Comments") comments = Controls.AddTextBox(100,30*i) TextBoxFocus.SetFocus(textBox[1]) return = 0 lastBox = 0 GraphicsWindow.KeyUp = OnKeyUp While ("True") getBox() If (currentBox > 0) Then If (return = 1) Then Controls.SetTextBoxText(comments,"Validating textbox "+currentBox) currentBox = currentBox+1 If (currentBox > numBox) Then currentBox = 1 EndIf TextBoxFocus.SetFocus(textBox[currentBox]) Program.Delay(1000) ElseIf (currentBox <> lastBox And lastBox > 0) Then Controls.SetTextBoxText(comments,"Validating textbox "+lastBox) Program.Delay(1000) Else Controls.SetTextBoxText(comments,"Focus is textbox "+currentBox) EndIf EndIf lastBox = currentBox return = 0 Program.Delay(20) EndWhile Sub OnKeyUp If (GraphicsWindow.LastKey = "Return") Then return = 1 EndIf EndSub Sub getBox currentBox = 0 For i = 1 To numBox If (TextBoxFocus.IsFocus(textBox[i])) Then currentBox = i EndIf EndFor EndSub End>BVP613.sb< Start>BVQ196.sb< ' mahreen miangul JuLy 2017 ' House Drawing GraphicsWindow.top=0 GraphicsWindow.left=155 'GraphicsWindow.Left = 0.1 * (Desktop.Width - GraphicsWindow.Width) ' 0.5 'GraphicsWindow.Top = 0.1 * (Desktop.Height - GraphicsWindow.Height) ' 0.5 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.BackgroundColor="NavajoWhite" GraphicsWindow.Width = "1080" GraphicsWindow.Height = "420" SPRITE_init() ' <--------- all shape data is input here!! add_shapes() ' <--------- all shapes are added here!! ' Add Sprites Sub add_shapes For M=1 to Array.GetItemCount(s) ' types shapes // House For N=1 to Array.GetItemCount(s[M]) ' repeat number // House=1 ss=s[M][N] ' scale _shx=shx[M][N] ' base point _X _shY=shY[M][N] ' base point _Y _shape=shape[M] ' temporary shape data NMB=M+":"+N ' shape index for i=1 To Array.GetItemCount(_shape) GraphicsWindow.PenWidth = _shape[i]["pw"] GraphicsWindow.BrushColor = _shape[i]["bc"] GraphicsWindow.penColor = _shape[i]["pc"] If _shape[i]["func"]="ell" Then shp[NMB][i] = Shapes.AddEllipse(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="rect" Then shp[NMB][i] = Shapes.AddRectangle(_shape[i]["width"]*ss, _shape[i]["height"]*ss) ElseIf _shape[i]["func"]="tri" Then shp[NMB][i] = Shapes.Addtriangle(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss, _shape[i]["x3"]*ss, _shape[i]["y3"]*ss) ElseIf shape[N][i]["func"]="line" Then shp[NMB][i] = Shapes.Addline(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss) EndIf Shapes.Animate(shp[NMB][i], _shape[i]["x"]*ss+_shX, _shape[i]["y"]*ss+_shY, 500) Shapes.Rotate(shp[NMB][i], _Shape[i]["angle"]) EndFor endfor endfor EndSub Sub SPRITE_init ' House s[1]="1=1" shX[1]="1=420" shY[1]="1=180" shape[1][1] = "func=rect;x=40;y=58;width=17;height=25;angle=0;bc=saddlebrown;pc=darkslategray;pw=2;" ' Cimney 1 shape[1][2] = "func=rect;x=38;y=55;width=22;height=6;angle=0;bc=saddlebrown;pc=darkslategray;pw=2;" '<--------Chimney 2 shape[1][3] = "func=tri;x=0;y=0;x1=-20;y1=115;x2=98;y2=48;x3=215;y3=115;bc=darkgray;pc=darkslategray;pw=2" shape[1][4] = "func=tri;x=0;y=0;x1=-5;y1=112;x2=98;y2=55;x3=198;y3=112;bc=red;pc=darkslategray;pw=2" shape[1][5] = "func=rect;x=0;y=115;width=191;height=100;bc=NavajoWhite;pc=darkslategray;pw=2" shape[1][6] = "func=line;x=20;y=64;x1=60;y1=0;x2=90;y2=0;angle=0;pc=darkslategray;pw=2;" shape[1][7] = "func=line;x=20;y=65;x1=52;y1=5;x2=100;y2=5;angle=0;pc=darkslategray;pw=2;" shape[1][8] = "func=line;x=20;y=66;x1=42;y1=10;x2=114;y2=10;angle=0;pc=darkslategray;pw=2;" shape[1][9] = "func=line;x=20;y=67;x1=32;y1=15;x2=124;y2=15;angle=0;pc=darkslategray;pw=2;" shape[1][10] = "func=line;x=20;y=68;x1=22;y1=20;x2=134;y2=20;angle=0;pc=darkslategray;pw=2;" shape[1][11] = "func=line;x=20;y=69;x1=6;y1=25;x2=144;y2=25;pc=#000000;pw=2;" shape[1][12] = "func=line;x=20;y=70;x1=0;y1=30;x2=154;y2=30;angle=0;pc=darkslategray;pw=2;" shape[1][13] = "func=line;x=20;y=71;x1=-12;y1=35;x2=164;y2=35;angle=0;pc=darkslategray;pw=2;" shape[1][14] = "func=rect;x=70;y=141;width=33;height=66;bc=gainsboro;pc=darkslategray;pw=2"'<-------- Door shape[1][15] = "func=rect;x=67;y=206;width=39;height=12;bc=gray;pc=darkslategray;pw=2" shape[1][16] = "func=ell;x=92;y=171;width=5;height=5;bc=darkslategray;pc=darkslategray;pw=2" shape[1][17] = "func=rect;x=18;y=145;width=30;height=50;bc=DarkTurquoise;pc=darkslategray;pw=2"'<----------Window 1 shape[1][18] = "func=rect;x=12;y=190;width=40;height=8;bc=red;pc=darkslategray;pw=2"'<----------Window Base 1 shape[1][19] = "func=line;x=0;y=0;x1=18;y1=170;x2=48;y2=170;angle=0;pc=darkslategray;pw=2;" shape[1][20] = "func=line;x=0;y=0;x1=33;y1=147;x2=33;y2=190;angle=0;pc=darkslategray;pw=2;" shape[1][21] = "func=ell;x=57;y=148;width=10;height=10;bc=yellow;pc=darkslategray;pw=2"'<----------Knob1 shape[1][22] = "func=rect;x=59;y=155;width=6;height=12;bc=yellow;pc=darkslategray;pw=2"'<----------Knob1 shape[1][23] = "func=line;x=0;y=0;x1=60;y1=159;x2=65;y2=159;angle=0;pc=darkslategray;pw=2;" shape[1][24] = "func=line;x=0;y=0;x1=60;y1=162;x2=65;y2=162;angle=0;pc=darkslategray;pw=2;" shape[1][25] = "func=line;x=0;y=0;x1=60;y1=165;x2=65;y2=165;angle=0;pc=darkslategray;pw=2;" shape[1][26] = "func=rect;x=128;y=145;width=50;height=50;bc=DarkTurquoise;pc=darkslategray;pw=2"'<----------Window 2 shape[1][27] = "func=rect;x=123;y=190;width=60;height=8;bc=red;pc=darkslategray;pw=2"'<----------Window Base 2 shape[1][28] = "func=line;x=112;y=0;x1=15;y1=170;x2=65;y2=170;angle=0;pc=darkslategray;pw=2;" shape[1][29] = "func=line;x=0;y=0;x1=152;y1=145;x2=152;y2=190;angle=0;pc=darkslategray;pw=2;" endsub End>BVQ196.sb< Start>BVR189-0.sb< ' Kappa Cygnid ' Version 0.2 ' はくちょう座κ流星群 ' Copyright © 2016-2017 Nonki Takahshi. The MIT License. ' Program ID BVR189-0 ' ' Reference: ' http://en.wikipedia.org/wiki/List_of_stars_in_Cygnus title = "Kappa Cygnid" r = 430 ' [px] delay = 100 ' [ms] Init() Cal_Init() InitStars() ra = radiant["ra"] dec = radiant["dec"] Mapping() rot = ra tilt = dec GraphicsWindow.Title = title + " RA=" + rot + "h Dec=" + tilt + "°" DrawRA() DrawDec() Shapes_Init() scale = 1 iMin = 1 iMax = 107 Shapes_Add() DrawStars() DrawCalendar() DrawMeteorShower() While "True" If keyDown Then If key = "Right" Then rot = rot + 0.25 If 24 <= rot Then rot = rot - 24 EndIf ElseIf key = "Left" Then rot = rot - 0.25 If rot < 0 Then rot = rot + 24 EndIf ElseIf key = "Up" Then If tilt <= 85 Then tilt = tilt + 5 EndIf ElseIf key = "Down" Then If -85 <= tilt Then tilt = tilt - 5 EndIf ElseIf key = "Add" Then r = r * 1.2 ElseIf key = "Subtract" Then r = r / 1.2 EndIf GraphicsWindow.Title = title + " RA=" + rot + "h Dec=" + tilt + "°" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0, 0, gw, gh) DrawRA() DrawDec() DrawStars() keyDown = "False" EndIf Program.Delay(delay) EndWhile Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" ox = gw / 2 oy = gh * 0.4 rot = 0 ' rotation tilt = 0 monthX = 40 monthY = 20 calendarX = gw - 270 calendarY = gh - 150 year = 2017 month = 8 GraphicsWindow.KeyDown = OnKeyDown EndSub Sub OnKeyDown keyDown = "True" key = GraphicsWindow.LastKey EndSub Sub DrawRA GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "#666666" For ra = 0 To 23 For dec = -90 To 90 Step 5 Mapping() If -90 < dec Then DrawLine() EndIf xLast = x yLast = y zLast = z EndFor EndFor EndSub Sub DrawDec GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "#666666" For dec = -80 To 80 Step 10 For ra = 0 To 24 Step 0.2 Mapping() If 0 < ra Then DrawLine() EndIf xLast = x yLast = y zLast = z EndFor EndFor EndSub Sub DrawLine visible = "False" If 0 <= z And 0 <= zLast Then If 0 <= x And x < gw And 0 <= y And y < gh Then visible = "True" ElseIf 0 <= xLast And xLast < gw And 0 <= yLast And yLast < gh Then visible = "True" EndIf EndIf If visible Then GraphicsWindow.DrawLine(xLast, yLast, x, y) EndIf EndSub Sub DrawStars GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" n = Array.GetItemCount(star) index = Array.GetAllIndices(star) For i = 1 To n ra = star[index[i]]["ra"] dec = star[index[i]]["dec"] Mapping() If ell[index[i]] <> "" Then Shapes.Remove(ell[index[i]]) ell[index[i]] = "" EndIf If 0 <= z Then mag = star[index[i]]["mag"] d = 16 / mag ell[index[i]] = Shapes.AddEllipse(d, d) Shapes.Move(ell[index[i]], x - d / 2, y - d / 2) EndIf EndFor GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "Blue" n = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) For i = 1 To n e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] Mapping() x1 = x y1 = y z1 = z ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] Mapping() x2 = x y2 = y z2 = z If connect[index[i]] <> "" Then Shapes.Remove(connect[index[i]]) connect[index[i]] = "" EndIf visible = "False" If 0 <= z1 And 0 <= z2 Then If 0 <= x1 And x1 <= gw And 0 <= y1 And y1 <= gh Then visible = "True" ElseIf 0 <= x2 And x2 <= gw And 0 <= y2 And y2 <= gh Then visible = "True" EndIf If visible Then connect[index[i]] = Shapes.AddLine(x1, y1, x2, y2) EndIf EndIf EndFor EndSub Sub DrawMeteorShower ra = radiant["RA"] dec = radiant["Dec"] Mapping() rx = x ry = y GraphicsWindow.PenColor = "White" While "True" Program.Delay(2000) angle = Math.GetRandomNumber(360) _a = Math.GetRadians(angle) r1 = Math.GetRandomNumber(100) + 50 r2 = r1 * 2.5 x1 = rx + r1 * Math.Sin(_a) y1 = ry - r1 * Math.Cos(_a) x2 = rx + r2 * Math.Sin(_a) y2 = ry - r2 * Math.Cos(_a) meteor = Shapes.AddLine(x1, y1, x2, y2) For op = 100 To 0 Step -5 Shapes.SetOpacity(meteor, op) Program.Delay(50) EndFor Shapes.Remove(meteor) EndWhile EndSub Sub DrawCalendar GraphicsWindow.BrushColor = "White" If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 30 txt = Shapes.AddText(months[month]) Shapes.Move(txt, monthX, monthY) If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 40 txt = Shapes.AddText(year) Shapes.Move(txt, monthX, monthY + 30) sBuf = year + "," + month Command_GetArgs() iYear = sArg[1] if iYear = "" Then Goto lEnd Endif If Math.Remainder(iYear, 4) = 0 And Math.Remainder(iYear, 100) > 0 Or Math.Remainder(iYear, 400) = 0 Then iDoM[2] = iDoM[2] + 1 Endif iNoL = Math.Floor((iYear - 1) / 4) - Math.Floor((iYear - 1) / 100) + Math.Floor((iYear - 1) / 400) ' number of leap year iWoY = Math.Remainder((iYear + iNoL), 7) ' week of year iMonth = sArg[2] If iMonth = "" Then iM0 = 1 iM1 = 12 Else iM0 = iMonth iM1 = iMonth Endif iDoY = 0 ' days of year iNoM = 1 ' number of month For iM = iM0 To iM1 While iNoM < iM iDoY = iDoY + iDoM[iNoM] iNoM = iNoM + 1 EndWhile Cal_DrawMonth() EndFor lEnd: EndSub Sub Mapping ' param ra - right asension [h] ' param rot - rotation [h] ' param dec - declination [deg] ' param tilt - tilt [deg] ' param r - radius [px] ' return x, y - position in the graphics window [px] ' return z - visible if 0 <= z If Text.IsSubText(ra, " ") Then _ra = Text.GetSubText(ra, 1, 2) _ra = _ra + Text.GetSubText(ra, 4, 2) / 60 _ra = _ra + Text.GetSubText(ra, 7, 5) / 3600 ra = _ra EndIf If Text.IsSubText(dec, " ") Then _dec = Text.GetSubText(dec, 2, 2) _dec = _dec + Text.GetSubText(dec, 5, 2) / 60 _dec = _dec + Text.GetSubText(dec, 8, 5) / 3600 _dec = _dec * Text.Append(Text.GetSubText(dec, 1, 1), "1") dec = _dec EndIf φ = Math.GetRadians((ra - rot) * 15) θ = Math.GetRadians(dec) x = ox - r * Math.Sin(φ) * Math.Cos(θ) y = oy - r * Math.Sin(θ) z = r * Math.Cos(φ) * Math.Cos(θ) If tilt <> 0 Then _z = z _y = y - oy τ = Math.GetRadians(tilt) z = Math.Cos(τ) * _z - Math.Sin(τ) * _y y = oy + Math.Sin(τ) * _z + Math.Cos(τ) * _y EndIf EndSub Sub InitStars ' Initialize stars in Cygnus ' index: Flamsteed designation ' RA (Right ascension), Dec (Declination), Mag (Apparent magnitude) star["Deneb"] = "ra=20 41 25.91;dec=+45 16 49.2;mag=1.25;fd=50;" star["γ Cyg"] = "ra=20 22 13.70;dec=+40 15 24.1;mag=2.23;fd=37;" star["ε Cyg"] = "ra=20 46 12.43;dec=+33 58 10.0;mag=2.48;fd=53;" star["δ Cyg"] = "ra=19 44 58.44;dec=+45 07 50.5;mag=2.86;fd=18;" star["Albireo A"] = "ra=19 30 43.29;dec=+27 57 34.9;mag=3.05;fd=6;" star["ζ Cyg"] = "ra=21 12 56.18;dec=+30 13 37.5;mag=3.21;fd=64;" star["ξ Cyg"] = "ra=21 04 55.86;dec=+43 55 40.3;mag=3.72;fd=62;" star["τ Cyg"] = "ra=21 14 47.35;dec=+38 02 39.6;mag=3.74;fd=65;" star["ι Cyg"] = "ra=19 29 42.34;dec=+51 43 46.1;mag=3.76;fd=10;" star["κ Cyg"] = "ra=19 17 06.11;dec=+53 22 05.4;mag=3.80;fd=1;" star["ο1 Cyg"] = "ra=20 13 37.90;dec=+46 44 28.8;mag=3.80;fd=31;" star["η Cyg"] = "ra=19 56 18.40;dec=+35 05 00.6;mag=3.89;fd=21;" star["ν Cyg"] = "ra=20 57 10.41;dec=+41 10 01.9;mag=3.94;fd=58;" star["ο2 Cyg"] = "ra=20 15 28.32;dec=+47 42 51.1;mag=3.96;fd=32;" star["ρ Cyg"] = "ra=21 33 58.87;dec=+45 35 31.4;mag=3.98;fd=73;" star["41 Cyg"] = "ra=20 29 23.73;dec=+30 22 06.8;mag=4.01;fd=41;" star["52 Cyg"] = "ra=20 45 39.76;dec=+30 43 10.8;mag=4.22;fd=52;" star["σ Cyg"] = "ra=21 17 24.95;dec=+39 23 40.9;mag=4.22;fd=67;" star["π2 Cyg"] = "ra=21 46 47.61;dec=+49 18 34.5;mag=4.23;fd=81;" star["33 Cyg"] = "ra=20 13 23.80;dec=+56 34 03.1;mag=4.28;fd=33;" star["υ Cyg"] = "ra=21 17 55.07;dec=+34 53 48.8;mag=4.41;fd=66;" star["39 Cyg"] = "ra=20 23 51.60;dec=+32 11 24.7;mag=4.43;fd=39;" star["θ Cyg"] = "ra=19 36 26.54;dec=+50 13 13.7;mag=4.49;fd=13;" star["λ Cyg"] = "ra=20 47 24.53;dec=+36 29 26.7;mag=4.53;fd=54;" star["63 Cyg"] = "ra=21 06 36.09;dec=+47 38 54.3;mag=4.56;fd=63;" star["47 Cyg A"] = "ra=20 33 54.19;dec=+35 15 03.1;mag=4.61;fd=47;" star["φ Cyg"] = "ra=19 39 22.60;dec=+30 09 11.6;mag=4.68;fd=12;" star["π1 Cyg"] = "ra=21 42 05.66;dec=+51 11 22.7;mag=4.69;fd=80;" star["μ1 Cyg"] = "ra=21 44 08.59;dec=+28 44 33.4;mag=4.69;fd=78;" star["8 Cyg"] = "ra=19 31 46.32;dec=+34 27 10.7;mag=4.74;fd=8;" star["59 Cyg"] = "ra=20 59 49.55;dec=+47 31 15.4;mag=4.74;fd=59;" star["P Cyg"] = "ra=20 17 47.20;dec=+38 01 58.6;mag=4.77;fd=34;" star["30 Cyg"] = "ra=20 13 18.04;dec=+46 48 56.4;mag=4.80;fd=30;" star["57 Cyg"] = "ra=20 53 14.75;dec=+44 23 14.2;mag=4.80;fd=57;" star["55 Cyg"] = "ra=20 48 56.29;dec=+46 06 50.9;mag=4.81;fd=55;" star["72 Cyg"] = "ra=21 34 46.48;dec=+38 32 01.8;mag=4.87;fd=72;" star["15 Cyg"] = "ra=19 44 16.55;dec=+37 21 15.4;mag=4.89;fd=15;" star["ψ Cyg"] = "ra=19 55 37.82;dec=+52 26 20.5;mag=4.91;fd=24;" star["28 Cyg"] = "ra=20 09 25.62;dec=+36 50 22.5;mag=4.93;fd=28;" star["29 Cyg"] = "ra=20 14 31.98;dec=+36 48 22.1;mag=4.93;fd=29;" star["T Cyg"] = "ra=20 47 10.72;dec=+34 22 26.8;mag=4.93;" star["ω1 Cyg"] = "ra=20 30 03.53;dec=+48 57 05.6;mag=4.94;fd=45;" star["22 Cyg"] = "ra=19 55 51.76;dec=+38 29 12.1;mag=4.95;fd=22;" star["HD 189276"] = "ra=19 55 55.39;dec=+58 50 45.7;mag=4.98;" star["2 Cyg"] = "ra=19 24 07.57;dec=+29 37 16.7;mag=4.99;fd=2;" star["17 Cyg"] = "ra=19 46 25.58;dec=+33 43 43.3;mag=5.00;fd=17;" star["20 Cyg"] = "ra=19 50 37.73;dec=+52 59 17.4;mag=5.03;fd=20;" star["68 Cyg"] = "ra=21 18 27.18;dec=+43 56 45.5;mag=5.04;fd=68;" star["74 Cyg"] = "ra=21 36 56.98;dec=+40 24 48.6;mag=5.04;fd=74;" star["26 Cyg"] = "ra=20 01 21.55;dec=+50 06 16.8;mag=5.06;fd=26;" star["56 Cyg"] = "ra=20 50 04.83;dec=+44 03 32.3;mag=5.06;fd=56;" star["75 Cyg"] = "ra=21 40 11.06;dec=+43 16 25.7;mag=5.09;fd=75;" star["Albireo B"] = "ra=19 30 45.40;dec=+27 57 55.0;mag=5.12;fd=6;" star["23 Cyg"] = "ra=19 53 17.37;dec=+57 31 24.5;mag=5.14;fd=23;" star["35 Cyg"] = "ra=20 18 39.07;dec=+34 58 58.0;mag=5.14;fd=35;" star["25 Cyg"] = "ra=19 59 55.20;dec=+37 02 34.4;mag=5.15;fd=25;" star["4 Cyg"] = "ra=19 26 09.12;dec=+36 19 04.3;mag=5.17;fd=4;" star["19 Cyg"] = "ra=19 50 33.99;dec=+38 43 19.8;mag=5.18;fd=19;" star["61 Cyg A"] = "ra=21 06 50.84;dec=+38 44 29.4;mag=5.20;fd=61;" star["71 Cyg"] = "ra=21 29 26.91;dec=+46 32 25.2;mag=5.22;fd=71;" star["70 Cyg"] = "ra=21 27 21.36;dec=+37 07 00.5;mag=5.30;fd=70;" star["27 Cyg"] = "ra=20 06 21.93;dec=+35 58 24.7;mag=5.38;fd=27;" star["60 Cyg"] = "ra=21 01 10.92;dec=+46 09 20.8;mag=5.38;fd=60;" star["9 Cyg"] = "ra=19 34 50.92;dec=+29 27 46.5;mag=5.39;fd=9;" star["14 Cyg"] = "ra=19 39 26.47;dec=+42 49 05.6;mag=5.41;fd=14;" star["51 Cyg"] = "ra=20 42 12.63;dec=+50 20 24.1;mag=5.41;fd=51;" star["ω2 Cyg"] = "ra=20 31 18.81;dec=+49 13 13.3;mag=5.44;fd=46;" star["49 Cyg"] = "ra=20 41 02.60;dec=+32 18 28.0;mag=5.51;fd=49;" star["49 Cyg"] = "ra=20 41 02.54;dec=+32 18 26.3;mag=5.53;fd=49;" star["V1942 Cyg"] = "ra=22 02 56.68;dec=+44 38 59.8;mag=5.57;" star["36 Cyg"] = "ra=20 18 28.63;dec=+36 59 59.1;mag=5.58;fd=36;" star["V389 Cyg"] = "ra=21 08 38.87;dec=+30 12 20.5;mag=5.60;" star["V1768 Cyg"] = "ra=20 04 36.18;dec=+32 13 07.0;mag=5.62;" star["40 Cyg"] = "ra=20 27 34.27;dec=+38 26 25.9;mag=5.63;fd=40;" star["V380 Cyg"] = "ra=19 50 37.33;dec=+40 35 59.2;mag=5.68;" star["V2140 Cyg"] = "ra=20 55 49.81;dec=+47 25 03.6;mag=5.68;" star["79 Cyg"] = "ra=21 43 25.63;dec=+38 17 01.0;mag=5.69;fd=79;" star["7 Cyg"] = "ra=19 27 25.97;dec=+52 19 13.8;mag=5.73;fd=7;" star["Gl 777"] = "ra=20 03 36.95;dec=+29 53 53.1;mag=5.73;" star["43 Cyg"] = "ra=20 27 02.21;dec=+49 22 59.6;mag=5.73;fd=43;" star["77 Cyg"] = "ra=21 42 22.94;dec=+41 04 37.3;mag=5.73;fd=77;" star["DT Cyg"] = "ra=21 06 30.24;dec=+31 11 04.8;mag=5.77;" star["V2015 Cyg"] = "ra=20 33 54.84;dec=+46 41 37.9;mag=5.78;" star["V2119 Cyg"] = "ra=20 23 44.37;dec=+37 28 35.2;mag=5.87;" star["V1762 Cyg"] = "ra=19 08 25.88;dec=+52 25 33.1;mag=5.88;" star["V1143 Cyg"] = "ra=19 38 41.15;dec=+54 58 24.2;mag=5.89;" star["V1334 Cyg"] = "ra=21 19 22.18;dec=+38 14 14.9;mag=5.89;" star["42 Cyg"] = "ra=20 29 20.39;dec=+36 27 17.0;mag=5.90;fd=42;" star["69 Cyg"] = "ra=21 25 47.02;dec=+36 40 02.7;mag=5.93;fd=69;" star["W Cyg"] = "ra=21 36 02.44;dec=+45 22 28.5;mag=5.96;" star["V460 Cyg"] = "ra=21 42 01.08;dec=+35 30 36.7;mag=5.98;" star["16 Cyg A"] = "ra=19 41 49.09;dec=+50 31 31.6;mag=5.99;fd=16;" star["V1743 Cyg"] = "ra=19 33 41.60;dec=+49 15 44.4;mag=6.00;" star["11 Cyg"] = "ra=19 35 48.30;dec=+36 56 40.4;mag=6.03;fd=11;" star["61 Cyg B"] = "ra=21 06 52.19;dec=+38 44 03.9;mag=6.05;fd=61;" star["V2130 Cyg"] = "ra=20 39 33.31;dec=+40 34 46.8;mag=6.07;" star["76 Cyg"] = "ra=21 41 34.27;dec=+40 48 19.2;mag=6.07;fd=76;" star["V1339 Cyg"] = "ra=21 42 08.35;dec=+45 45 56.7;mag=6.11;" star["μ2 Cyg"] = "ra=21 44 08.46;dec=+28 44 34.5;mag=6.12;fd=78;" star["V2093 Cyg"] = "ra=19 50 46.87;dec=+37 49 34.7;mag=6.13;" star["V2100 Cyg"] = "ra=19 59 15.34;dec=+52 03 20.5;mag=6.14;" star["CP Cyg"] = "ra=21 37 27.88;dec=+44 41 47.8;mag=6.19;" star["V1619 Cyg"] = "ra=21 51 04.97;dec=+39 32 11.9;mag=6.20;" star["44 Cyg"] = "ra=20 30 59.23;dec=+36 56 09.1;mag=6.21;fd=44;" star["16 Cyg"] = "ra=19 41 52.10;dec=+50 31 04.5;mag=6.25;fd=16;" star["V819 Cyg"] = "ra=19 53 01.25;dec=+47 48 27.9;mag=6.30;" star["48 Cyg"] = "ra=20 37 31.77;dec=+31 34 21.1;mag=6.32;fd=48;" star["V2136 Cyg"] = "ra=20 49 54.64;dec=+46 39 40.8;mag=6.33;" star["V1817 Cyg"] = "ra=19 31 13.56;dec=+55 43 54.8;mag=6.37;" star["V2090 Cyg"] = "ra=19 44 38.17;dec=+34 24 51.0;mag=6.39;" star["V2173 Cyg"] = "ra=21 57 02.20;dec=+48 40 07.0;mag=6.42;" star["V1351 Cyg"] = "ra=19 42 04.13;dec=+55 27 47.9;mag=6.42;" star["V1765 Cyg"] = "ra=19 48 50.60;dec=+33 26 14.3;mag=6.42;" star["V1773 Cyg"] = "ra=20 18 49.67;dec=+46 19 20.0;mag=6.46;" star["HD 203857"] = "ra=21 23 48.39;dec=+37 21 05.4;mag=6.46;" star["X Cyg"] = "ra=20 43 24.20;dec=+35 35 16.1;mag=6.48;" star["V1276 Cyg"] = "ra=19 42 49.10;dec=+29 19 54.0;mag=6.49;" star["V1584 Cyg"] = "ra=20 19 56.04;dec=+46 50 14.3;mag=6.49;" star["HD 185269"] = "ra=19 37 11.74;dec=+28 29 59.5;mag=6.67;" star["HD 197037"] = "ra=20 39 33s;dec=+42 14 55″;mag=6.81;" edge = "1=Deneb-γ Cyg;2=γ Cyg-ε Cyg;3=ε Cyg-ζ Cyg;4=ζ Cyg-μ1 Cyg;" edge = edge + "5=γ Cyg-δ Cyg;6=δ Cyg-θ Cyg;7=θ Cyg-ι Cyg;8=ι Cyg-κ Cyg;" edge = edge + "9=γ Cyg-η Cyg;10=η Cyg-Albireo A;" radiant = "ra=19 00 00.00;dec=+55 00 00.0;" EndSub Sub Cal_Init ' Calendar | Initialize days of month WQ = Text.GetCharacter(34) CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) iDoM = "1=31;2=28;3=31;4=30;5=31;6=30;7=31;8=31;9=30;10=31;11=30;12=31;" months = "1=January;2=February;3=March;4=April;5=May;6=June;7=July;" months = months + "8=August;9=September;10=October;11=November;12=December;" symbols = "1=♑;2=♒;3=♓;4=♈;5=♉;6=♊;7=♋;8=♌;9=♍;10=♎;11=♏;12=♐;" EndSub Sub Cal_DrawMonth ' Calendar | Print month ' param iM - month ' param iDoY - days of year ' param iWoY - week of year If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 16 GraphicsWindow.FontName = "Consolas" iW = Math.Remainder((iDoY + iWoY), 7) line = "SUN MON TUE WED THU FRI SAT" + CRLF iWoM = 0 While iWoM < iW line = line + " " iWoM = iWoM + 1 EndWhile For iD = 1 To iDoM[iM] If iD < 10 Then line = line + " " + iD + " " Else line = line + " " + iD + " " EndIf If Math.Remainder(iWoM, 7) = 6 Then line = line + CRLF EndIf iWoM = iWoM + 1 EndFor If Math.Remainder(iWoM, 7) > 0 Then line = line + CRLF EndIf cal = Shapes.AddText(line) Shapes.Move(cal, calendarX, calendarY) EndSub Sub Command_GetArgs ' Command line | Get arguments ' param sBuf - input buffer ' return sArg[] - arguments ' return iN - number of arguments iP = 1 ' buffer pointer iN = 1 ' number of args iC = Text.GetIndexOf(sBuf, ",") ' index of comma While iC > iP sArg[iN] = Text.GetSubText(sBuf, iP, iC - iP) iP = iC + 1 iN = iN + 1 iC = Text.GetIndexOf(sBuf, ",") EndWhile iE = Text.GetLength(sBuf) + 1 ' end of buffer sArg[iN] = Text.GetSubText(sBuf, iP, iE - iP) EndSub Sub Math_CartesianToPolar ' Math | convert cartesian coodinate to polar coordinate ' param x, y - cartesian coordinate ' return r, a - polar coordinate r = Math.SquareRoot(x * x + y * y) If x = 0 And y > 0 Then a = 90 ' [degree] ElseIf x = 0 And y < 0 Then a = -90 ElseIf x = 0 Then a = 0 Else a = Math.ArcTan(y / x) * 180 / Math.Pi EndIf If x < 0 Then a = a + 180 ElseIf x > 0 And y < 0 Then a = a + 360 EndIf EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_Add ' Shapes | add shapes as shapes data ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - 1 if same scale ' return shWidth, shHeight - total size of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param iMin, iMax - shape indices to add ' return shWidth, shHeight - total size of shapes For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init ' Shapes | Initialize shapes data ' return shX, shY - current position of shapes ' return shape - array of shapes shX = 60 ' x offset shY = 131 ' y offset shape = "" shape[1] = "func=tri;x=201;y=38;x1=9;y1=0;x2=0;y2=78;x3=19;y3=78;angle=22;bc=#F0F0F0;pw=0;" shape[2] = "func=tri;x=10;y=126;x1=9;y1=0;x2=0;y2=78;x3=19;y3=78;angle=290;bc=#F0F0F0;pw=0;" shape[3] = "func=ell;x=44;y=151;width=68;height=30;angle=325;bc=#F0F0F0;pw=0;" shape[4] = "func=ell;x=137;y=105;width=68;height=30;angle=352;bc=#F0F0F0;pw=0;" shape[5] = "func=tri;x=114;y=126;x1=22;y1=0;x2=0;y2=66;x3=45;y3=66;angle=145;bc=#F0F0F0;pw=0;" shape[6] = "func=ell;x=147;y=178;width=15;height=17;bc=#F0F0F0;pw=0;" shape[7] = "func=rect;x=137;y=150;width=15;height=38;angle=329;bc=#F0F0F0;pw=0;" shape[8] = "func=rect;x=158;y=185;width=15;height=38;angle=327;bc=#F0F0F0;pw=0;" shape[9] = "func=ell;x=167;y=202;width=25;height=38;angle=329;bc=#F0F0F0;pw=0;" shape[10] = "func=ell;x=214;y=32;width=7;height=47;angle=17;bc=#F0F0F0;pw=0;" shape[11] = "func=ell;x=0;y=135;width=7;height=47;angle=293;bc=#F0F0F0;pw=0;" shape[12] = "func=ell;x=0;y=126;width=7;height=47;angle=298;bc=#F0F0F0;pw=0;" shape[13] = "func=ell;x=3;y=120;width=7;height=47;angle=304;bc=#F0F0F0;pw=0;" shape[14] = "func=ell;x=10;y=116;width=7;height=47;angle=309;bc=#F0F0F0;pw=0;" shape[15] = "func=ell;x=20;y=115;width=7;height=47;angle=312;bc=#F0F0F0;pw=0;" shape[16] = "func=ell;x=205;y=36;width=7;height=47;angle=11;bc=#F0F0F0;pw=0;" shape[17] = "func=ell;x=198;y=42;width=7;height=47;angle=2;bc=#F0F0F0;pw=0;" shape[18] = "func=ell;x=191;y=46;width=7;height=47;angle=355;bc=#F0F0F0;pw=0;" shape[19] = "func=ell;x=184;y=48;width=7;height=47;angle=350;bc=#F0F0F0;pw=0;" shape[20] = "func=tri;x=15;y=135;x1=16;y1=0;x2=0;y2=45;x3=33;y3=45;angle=126;bc=#D4D4D4;pw=0;" shape[21] = "func=tri;x=181;y=60;x1=16;y1=0;x2=0;y2=45;x3=33;y3=45;angle=180;bc=#D4D4D4;pw=0;" shape[22] = "func=ell;x=178;y=52;width=7;height=47;angle=345;bc=#F0F0F0;pw=0;" shape[23] = "func=ell;x=172;y=55;width=7;height=47;angle=342;bc=#F0F0F0;pw=0;" shape[24] = "func=ell;x=166;y=59;width=7;height=47;angle=342;bc=#F0F0F0;pw=0;" shape[25] = "func=ell;x=160;y=62;width=7;height=47;angle=342;bc=#F0F0F0;pw=0;" shape[26] = "func=ell;x=155;y=67;width=7;height=47;angle=339;bc=#F0F0F0;pw=0;" shape[27] = "func=ell;x=26;y=111;width=7;height=47;angle=315;bc=#F0F0F0;pw=0;" shape[28] = "func=ell;x=34;y=109;width=7;height=47;angle=319;bc=#F0F0F0;pw=0;" shape[29] = "func=ell;x=39;y=104;width=7;height=47;angle=319;bc=#F0F0F0;pw=0;" shape[30] = "func=ell;x=46;y=101;width=7;height=47;angle=321;bc=#F0F0F0;pw=0;" shape[31] = "func=ell;x=55;y=102;width=7;height=47;angle=324;bc=#F0F0F0;pw=0;" shape[32] = "func=rect;x=30;y=119;width=57;height=44;angle=332;bc=#D4D4D4;pw=0;" shape[33] = "func=rect;x=141;y=74;width=57;height=40;angle=326;bc=#D4D4D4;pw=0;" shape[34] = "func=ell;x=148;y=66;width=7;height=47;angle=336;bc=#F0F0F0;pw=0;" shape[35] = "func=ell;x=140;y=64;width=7;height=47;angle=336;bc=#F0F0F0;pw=0;" shape[36] = "func=ell;x=132;y=61;width=7;height=47;angle=336;bc=#F0F0F0;pw=0;" shape[37] = "func=ell;x=124;y=61;width=7;height=47;angle=336;bc=#F0F0F0;pw=0;" shape[38] = "func=ell;x=116;y=59;width=7;height=47;angle=336;bc=#F0F0F0;pw=0;" shape[39] = "func=ell;x=58;y=98;width=7;height=47;angle=327;bc=#F0F0F0;pw=0;" shape[40] = "func=ell;x=63;y=93;width=7;height=47;angle=327;bc=#F0F0F0;pw=0;" shape[41] = "func=ell;x=68;y=87;width=7;height=47;angle=332;bc=#F0F0F0;pw=0;" shape[42] = "func=ell;x=74;y=84;width=7;height=47;angle=332;bc=#F0F0F0;pw=0;" shape[43] = "func=rect;x=61;y=102;width=49;height=36;angle=323;bc=#D4D4D4;pw=0;" shape[44] = "func=rect;x=112;y=83;width=49;height=36;angle=350;bc=#D4D4D4;pw=0;" shape[45] = "func=ell;x=199;y=68;width=8;height=39;angle=17;bc=#F0F0F0;pw=0;" shape[46] = "func=ell;x=193;y=69;width=8;height=39;angle=10;bc=#F0F0F0;pw=0;" shape[47] = "func=ell;x=186;y=74;width=8;height=39;angle=5;bc=#F0F0F0;pw=0;" shape[48] = "func=ell;x=178;y=78;width=8;height=39;angle=3;bc=#F0F0F0;pw=0;" shape[49] = "func=ell;x=170;y=86;width=8;height=39;angle=354;bc=#F0F0F0;pw=0;" shape[50] = "func=ell;x=29;y=146;width=8;height=39;angle=296;bc=#F0F0F0;pw=0;" shape[51] = "func=ell;x=35;y=140;width=8;height=39;angle=303;bc=#F0F0F0;pw=0;" shape[52] = "func=ell;x=43;y=136;width=8;height=39;angle=308;bc=#F0F0F0;pw=0;" shape[53] = "func=ell;x=49;y=131;width=8;height=39;angle=314;bc=#F0F0F0;pw=0;" shape[54] = "func=ell;x=58;y=130;width=8;height=39;angle=321;bc=#F0F0F0;pw=0;" shape[55] = "func=ell;x=164;y=87;width=8;height=39;angle=344;bc=#F0F0F0;pw=0;" shape[56] = "func=ell;x=156;y=88;width=8;height=39;angle=344;bc=#F0F0F0;pw=0;" shape[57] = "func=ell;x=149;y=92;width=8;height=39;angle=344;bc=#F0F0F0;pw=0;" shape[58] = "func=ell;x=141;y=94;width=8;height=39;angle=344;bc=#F0F0F0;pw=0;" shape[59] = "func=ell;x=134;y=95;width=8;height=39;angle=336;bc=#F0F0F0;pw=0;" shape[60] = "func=ell;x=65;y=128;width=8;height=39;angle=329;bc=#F0F0F0;pw=0;" shape[61] = "func=ell;x=72;y=124;width=8;height=39;angle=329;bc=#F0F0F0;pw=0;" shape[62] = "func=ell;x=79;y=120;width=8;height=39;angle=329;bc=#F0F0F0;pw=0;" shape[63] = "func=ell;x=86;y=116;width=8;height=39;angle=329;bc=#F0F0F0;pw=0;" shape[64] = "func=ell;x=93;y=115;width=8;height=39;angle=329;bc=#F0F0F0;pw=0;" shape[65] = "func=rect;x=41;y=141;width=65;height=19;angle=328;bc=#D4D4D4;pw=0;" shape[66] = "func=rect;x=132;y=102;width=65;height=19;angle=352;bc=#D4D4D4;pw=0;" shape[67] = "func=ell;x=191;y=98;width=8;height=26;angle=17;bc=#F0F0F0;pw=0;" shape[68] = "func=ell;x=183;y=99;width=8;height=26;angle=10;bc=#F0F0F0;pw=0;" shape[69] = "func=ell;x=175;y=102;width=8;height=26;angle=10;bc=#F0F0F0;pw=0;" shape[70] = "func=ell;x=166;y=103;width=8;height=26;bc=#F0F0F0;pw=0;" shape[71] = "func=ell;x=157;y=106;width=8;height=26;angle=358;bc=#F0F0F0;pw=0;" shape[72] = "func=ell;x=149;y=107;width=8;height=26;angle=351;bc=#F0F0F0;pw=0;" shape[73] = "func=ell;x=139;y=106;width=8;height=26;angle=350;bc=#F0F0F0;pw=0;" shape[74] = "func=ell;x=130;y=110;width=8;height=26;angle=348;bc=#F0F0F0;pw=0;" shape[75] = "func=ell;x=48;y=160;width=8;height=26;angle=308;bc=#F0F0F0;pw=0;" shape[76] = "func=ell;x=53;y=155;width=8;height=26;angle=315;bc=#F0F0F0;pw=0;" shape[77] = "func=ell;x=62;y=152;width=8;height=26;angle=315;bc=#F0F0F0;pw=0;" shape[78] = "func=ell;x=68;y=148;width=8;height=26;angle=317;bc=#F0F0F0;pw=0;" shape[79] = "func=ell;x=77;y=144;width=8;height=26;angle=317;bc=#F0F0F0;pw=0;" shape[80] = "func=ell;x=85;y=139;width=8;height=26;angle=322;bc=#F0F0F0;pw=0;" shape[81] = "func=ell;x=90;y=133;width=8;height=26;angle=324;bc=#F0F0F0;pw=0;" shape[82] = "func=ell;x=98;y=130;width=8;height=26;angle=335;bc=#F0F0F0;pw=0;" shape[83] = "func=tri;x=186;y=230;x1=6;y1=0;x2=0;y2=29;x3=12;y3=29;angle=147;bc=#FF9E42;pw=0;" shape[84] = "func=tri;x=179;y=227;x1=7;y1=0;x2=0;y2=9;x3=14;y3=9;angle=354;bc=#000000;pw=0;" shape[85] = "func=ell;x=182;y=222;width=6;height=5;bc=#000000;pw=0;" shape[86] = "func=ell;x=89;y=6;width=9;height=54;angle=344;bc=#F0F0F0;pw=0;" shape[87] = "func=ell;x=80;y=4;width=9;height=54;angle=341;bc=#F0F0F0;pw=0;" shape[88] = "func=ell;x=70;y=2;width=9;height=54;angle=340;bc=#F0F0F0;pw=0;" shape[89] = "func=ell;x=62;y=5;width=9;height=54;angle=339;bc=#F0F0F0;pw=0;" shape[90] = "func=ell;x=58;y=15;width=9;height=54;angle=335;bc=#F0F0F0;pw=0;" shape[91] = "func=ell;x=53;y=23;width=9;height=54;angle=334;bc=#F0F0F0;pw=0;" shape[92] = "func=tri;x=54;y=25;x1=22;y1=0;x2=0;y2=35;x3=45;y3=35;angle=337;bc=#D4D4D4;pw=0;" shape[93] = "func=ell;x=68;y=41;width=61;height=107;angle=337;bc=#F0F0F0;pw=0;" shape[94] = "func=rect;x=62;y=63;width=10;height=30;angle=304;bc=#2E2E2E;pw=0;" shape[95] = "func=rect;x=103;y=45;width=10;height=30;angle=9;bc=#2E2E2E;pw=0;" shape[96] = "func=rect;x=112;y=47;width=9;height=33;angle=336;bc=#2E2E2E;pw=0;" shape[97] = "func=rect;x=58;y=70;width=9;height=33;angle=343;bc=#2E2E2E;pw=0;" shape[98] = "func=tri;x=54;y=93;x1=14;y1=0;x2=0;y2=26;x3=28;y3=26;angle=345;bc=#2E2E2E;pw=0;" shape[99] = "func=tri;x=112;y=69;x1=13;y1=0;x2=0;y2=25;x3=27;y3=25;angle=329;bc=#2E2E2E;pw=0;" shape[100] = "func=ell;x=58;y=103;width=5;height=26;angle=11;bc=#000000;pw=0;" shape[101] = "func=ell;x=67;y=100;width=5;height=26;angle=345;bc=#000000;pw=0;" shape[102] = "func=ell;x=75;y=96;width=5;height=26;angle=307;bc=#000000;pw=0;" shape[103] = "func=ell;x=127;y=76;width=5;height=26;angle=335;bc=#000000;pw=0;" shape[104] = "func=ell;x=118;y=80;width=5;height=26;angle=6;bc=#000000;pw=0;" shape[105] = "func=ell;x=136;y=70;width=5;height=26;angle=295;bc=#000000;pw=0;" shape[106] = "func=ell;x=52;y=64;width=11;height=14;bc=#2E2E2E;pw=0;" shape[107] = "func=ell;x=106;y=42;width=11;height=14;bc=#2E2E2E;pw=0;" EndSub End>BVR189-0.sb< Start>BVR189.sb< ' Kappa Cygnid ' Version 0.1 ' はくちょう座κ流星群 ' Copyright © 2016 Nonki Takahshi. The MIT License. ' Program ID ' ' Reference: ' http://en.wikipedia.org/wiki/List_of_stars_in_Cygnus title = "Kappa Cygnid" r = 430 ' [px] delay = 100 ' [ms] Init() Cal_Init() InitStars() ra = radiant["ra"] dec = radiant["dec"] Mapping() rot = ra tilt = dec GraphicsWindow.Title = title + " RA=" + rot + "h Dec=" + tilt + "°" DrawRA() DrawDec() DrawStars() DrawCalendar() DrawMeteorShower() While "True" If keyDown Then If key = "Right" Then rot = rot + 0.25 If 24 <= rot Then rot = rot - 24 EndIf ElseIf key = "Left" Then rot = rot - 0.25 If rot < 0 Then rot = rot + 24 EndIf ElseIf key = "Up" Then If tilt <= 85 Then tilt = tilt + 5 EndIf ElseIf key = "Down" Then If -85 <= tilt Then tilt = tilt - 5 EndIf ElseIf key = "Add" Then r = r * 1.2 ElseIf key = "Subtract" Then r = r / 1.2 EndIf GraphicsWindow.Title = title + " RA=" + rot + "h Dec=" + tilt + "°" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillRectangle(0, 0, gw, gh) DrawRA() DrawDec() DrawStars() keyDown = "False" EndIf Program.Delay(delay) EndWhile Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "Black" ox = gw / 2 oy = gh * 0.4 rot = 0 ' rotation tilt = 0 monthX = 40 monthY = 20 calendarX = gw - 270 calendarY = gh - 150 year = 2016 month = 8 GraphicsWindow.KeyDown = OnKeyDown EndSub Sub OnKeyDown keyDown = "True" key = GraphicsWindow.LastKey EndSub Sub DrawRA GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "#666666" For ra = 0 To 23 For dec = -90 To 90 Step 5 Mapping() If -90 < dec Then DrawLine() EndIf xLast = x yLast = y zLast = z EndFor EndFor EndSub Sub DrawDec GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "#666666" For dec = -80 To 80 Step 10 For ra = 0 To 24 Step 0.2 Mapping() If 0 < ra Then DrawLine() EndIf xLast = x yLast = y zLast = z EndFor EndFor EndSub Sub DrawLine visible = "False" If 0 <= z And 0 <= zLast Then If 0 <= x And x < gw And 0 <= y And y < gh Then visible = "True" ElseIf 0 <= xLast And xLast < gw And 0 <= yLast And yLast < gh Then visible = "True" EndIf EndIf If visible Then GraphicsWindow.DrawLine(xLast, yLast, x, y) EndIf EndSub Sub DrawStars GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor = "White" n = Array.GetItemCount(star) index = Array.GetAllIndices(star) For i = 1 To n ra = star[index[i]]["ra"] dec = star[index[i]]["dec"] Mapping() If ell[index[i]] <> "" Then Shapes.Remove(ell[index[i]]) ell[index[i]] = "" EndIf If 0 <= z Then mag = star[index[i]]["mag"] d = 16 / mag ell[index[i]] = Shapes.AddEllipse(d, d) Shapes.Move(ell[index[i]], x - d / 2, y - d / 2) EndIf EndFor GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "LightGray" n = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) For i = 1 To n e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] Mapping() x1 = x y1 = y z1 = z ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] Mapping() x2 = x y2 = y z2 = z If connect[index[i]] <> "" Then Shapes.Remove(connect[index[i]]) connect[index[i]] = "" EndIf visible = "False" If 0 <= z1 And 0 <= z2 Then If 0 <= x1 And x1 <= gw And 0 <= y1 And y1 <= gh Then visible = "True" ElseIf 0 <= x2 And x2 <= gw And 0 <= y2 And y2 <= gh Then visible = "True" EndIf If visible Then connect[index[i]] = Shapes.AddLine(x1, y1, x2, y2) EndIf EndIf EndFor EndSub Sub DrawMeteorShower ra = radiant["RA"] dec = radiant["Dec"] Mapping() rx = x ry = y GraphicsWindow.PenColor = "White" While "True" Program.Delay(2000) angle = Math.GetRandomNumber(360) _a = Math.GetRadians(angle) r1 = Math.GetRandomNumber(100) + 50 r2 = r1 * 2.5 x1 = rx + r1 * Math.Sin(_a) y1 = ry - r1 * Math.Cos(_a) x2 = rx + r2 * Math.Sin(_a) y2 = ry - r2 * Math.Cos(_a) meteor = Shapes.AddLine(x1, y1, x2, y2) For op = 100 To 0 Step -5 Shapes.SetOpacity(meteor, op) Program.Delay(50) EndFor Shapes.Remove(meteor) EndWhile EndSub Sub DrawCalendar GraphicsWindow.BrushColor = "White" If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 30 txt = Shapes.AddText(months[month]) Shapes.Move(txt, monthX, monthY) If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 40 txt = Shapes.AddText(year) Shapes.Move(txt, monthX, monthY + 30) sBuf = year + "," + month Command_GetArgs() iYear = sArg[1] if iYear = "" Then Goto lEnd Endif If Math.Remainder(iYear, 4) = 0 And Math.Remainder(iYear, 100) > 0 Or Math.Remainder(iYear, 400) = 0 Then iDoM[2] = iDoM[2] + 1 Endif iNoL = Math.Floor((iYear - 1) / 4) - Math.Floor((iYear - 1) / 100) + Math.Floor((iYear - 1) / 400) ' number of leap year iWoY = Math.Remainder((iYear + iNoL), 7) ' week of year iMonth = sArg[2] If iMonth = "" Then iM0 = 1 iM1 = 12 Else iM0 = iMonth iM1 = iMonth Endif iDoY = 0 ' days of year iNoM = 1 ' number of month For iM = iM0 To iM1 While iNoM < iM iDoY = iDoY + iDoM[iNoM] iNoM = iNoM + 1 EndWhile Cal_DrawMonth() EndFor lEnd: EndSub Sub Mapping ' param ra - right asension [h] ' param rot - rotation [h] ' param dec - declination [deg] ' param tilt - tilt [deg] ' param r - radius [px] ' return x, y - position in the graphics window [px] ' return z - visible if 0 <= z If Text.IsSubText(ra, " ") Then _ra = Text.GetSubText(ra, 1, 2) _ra = _ra + Text.GetSubText(ra, 4, 2) / 60 _ra = _ra + Text.GetSubText(ra, 7, 5) / 3600 ra = _ra EndIf If Text.IsSubText(dec, " ") Then _dec = Text.GetSubText(dec, 2, 2) _dec = _dec + Text.GetSubText(dec, 5, 2) / 60 _dec = _dec + Text.GetSubText(dec, 8, 5) / 3600 _dec = _dec * Text.Append(Text.GetSubText(dec, 1, 1), "1") dec = _dec EndIf φ = Math.GetRadians((ra - rot) * 15) θ = Math.GetRadians(dec) x = ox - r * Math.Sin(φ) * Math.Cos(θ) y = oy - r * Math.Sin(θ) z = r * Math.Cos(φ) * Math.Cos(θ) If tilt <> 0 Then _z = z _y = y - oy τ = Math.GetRadians(tilt) z = Math.Cos(τ) * _z - Math.Sin(τ) * _y y = oy + Math.Sin(τ) * _z + Math.Cos(τ) * _y EndIf EndSub Sub InitStars ' Initialize stars in Cygnus ' index: Flamsteed designation ' RA (Right ascension), Dec (Declination), Mag (Apparent magnitude) star["Deneb"] = "ra=20 41 25.91;dec=+45 16 49.2;mag=1.25;fd=50;" star["γ Cyg"] = "ra=20 22 13.70;dec=+40 15 24.1;mag=2.23;fd=37;" star["ε Cyg"] = "ra=20 46 12.43;dec=+33 58 10.0;mag=2.48;fd=53;" star["δ Cyg"] = "ra=19 44 58.44;dec=+45 07 50.5;mag=2.86;fd=18;" star["Albireo A"] = "ra=19 30 43.29;dec=+27 57 34.9;mag=3.05;fd=6;" star["ζ Cyg"] = "ra=21 12 56.18;dec=+30 13 37.5;mag=3.21;fd=64;" star["ξ Cyg"] = "ra=21 04 55.86;dec=+43 55 40.3;mag=3.72;fd=62;" star["τ Cyg"] = "ra=21 14 47.35;dec=+38 02 39.6;mag=3.74;fd=65;" star["ι Cyg"] = "ra=19 29 42.34;dec=+51 43 46.1;mag=3.76;fd=10;" star["κ Cyg"] = "ra=19 17 06.11;dec=+53 22 05.4;mag=3.80;fd=1;" star["ο1 Cyg"] = "ra=20 13 37.90;dec=+46 44 28.8;mag=3.80;fd=31;" star["η Cyg"] = "ra=19 56 18.40;dec=+35 05 00.6;mag=3.89;fd=21;" star["ν Cyg"] = "ra=20 57 10.41;dec=+41 10 01.9;mag=3.94;fd=58;" star["ο2 Cyg"] = "ra=20 15 28.32;dec=+47 42 51.1;mag=3.96;fd=32;" star["ρ Cyg"] = "ra=21 33 58.87;dec=+45 35 31.4;mag=3.98;fd=73;" star["41 Cyg"] = "ra=20 29 23.73;dec=+30 22 06.8;mag=4.01;fd=41;" star["52 Cyg"] = "ra=20 45 39.76;dec=+30 43 10.8;mag=4.22;fd=52;" star["σ Cyg"] = "ra=21 17 24.95;dec=+39 23 40.9;mag=4.22;fd=67;" star["π2 Cyg"] = "ra=21 46 47.61;dec=+49 18 34.5;mag=4.23;fd=81;" star["33 Cyg"] = "ra=20 13 23.80;dec=+56 34 03.1;mag=4.28;fd=33;" star["υ Cyg"] = "ra=21 17 55.07;dec=+34 53 48.8;mag=4.41;fd=66;" star["39 Cyg"] = "ra=20 23 51.60;dec=+32 11 24.7;mag=4.43;fd=39;" star["θ Cyg"] = "ra=19 36 26.54;dec=+50 13 13.7;mag=4.49;fd=13;" star["λ Cyg"] = "ra=20 47 24.53;dec=+36 29 26.7;mag=4.53;fd=54;" star["63 Cyg"] = "ra=21 06 36.09;dec=+47 38 54.3;mag=4.56;fd=63;" star["47 Cyg A"] = "ra=20 33 54.19;dec=+35 15 03.1;mag=4.61;fd=47;" star["φ Cyg"] = "ra=19 39 22.60;dec=+30 09 11.6;mag=4.68;fd=12;" star["π1 Cyg"] = "ra=21 42 05.66;dec=+51 11 22.7;mag=4.69;fd=80;" star["μ1 Cyg"] = "ra=21 44 08.59;dec=+28 44 33.4;mag=4.69;fd=78;" star["8 Cyg"] = "ra=19 31 46.32;dec=+34 27 10.7;mag=4.74;fd=8;" star["59 Cyg"] = "ra=20 59 49.55;dec=+47 31 15.4;mag=4.74;fd=59;" star["P Cyg"] = "ra=20 17 47.20;dec=+38 01 58.6;mag=4.77;fd=34;" star["30 Cyg"] = "ra=20 13 18.04;dec=+46 48 56.4;mag=4.80;fd=30;" star["57 Cyg"] = "ra=20 53 14.75;dec=+44 23 14.2;mag=4.80;fd=57;" star["55 Cyg"] = "ra=20 48 56.29;dec=+46 06 50.9;mag=4.81;fd=55;" star["72 Cyg"] = "ra=21 34 46.48;dec=+38 32 01.8;mag=4.87;fd=72;" star["15 Cyg"] = "ra=19 44 16.55;dec=+37 21 15.4;mag=4.89;fd=15;" star["ψ Cyg"] = "ra=19 55 37.82;dec=+52 26 20.5;mag=4.91;fd=24;" star["28 Cyg"] = "ra=20 09 25.62;dec=+36 50 22.5;mag=4.93;fd=28;" star["29 Cyg"] = "ra=20 14 31.98;dec=+36 48 22.1;mag=4.93;fd=29;" star["T Cyg"] = "ra=20 47 10.72;dec=+34 22 26.8;mag=4.93;" star["ω1 Cyg"] = "ra=20 30 03.53;dec=+48 57 05.6;mag=4.94;fd=45;" star["22 Cyg"] = "ra=19 55 51.76;dec=+38 29 12.1;mag=4.95;fd=22;" star["HD 189276"] = "ra=19 55 55.39;dec=+58 50 45.7;mag=4.98;" star["2 Cyg"] = "ra=19 24 07.57;dec=+29 37 16.7;mag=4.99;fd=2;" star["17 Cyg"] = "ra=19 46 25.58;dec=+33 43 43.3;mag=5.00;fd=17;" star["20 Cyg"] = "ra=19 50 37.73;dec=+52 59 17.4;mag=5.03;fd=20;" star["68 Cyg"] = "ra=21 18 27.18;dec=+43 56 45.5;mag=5.04;fd=68;" star["74 Cyg"] = "ra=21 36 56.98;dec=+40 24 48.6;mag=5.04;fd=74;" star["26 Cyg"] = "ra=20 01 21.55;dec=+50 06 16.8;mag=5.06;fd=26;" star["56 Cyg"] = "ra=20 50 04.83;dec=+44 03 32.3;mag=5.06;fd=56;" star["75 Cyg"] = "ra=21 40 11.06;dec=+43 16 25.7;mag=5.09;fd=75;" star["Albireo B"] = "ra=19 30 45.40;dec=+27 57 55.0;mag=5.12;fd=6;" star["23 Cyg"] = "ra=19 53 17.37;dec=+57 31 24.5;mag=5.14;fd=23;" star["35 Cyg"] = "ra=20 18 39.07;dec=+34 58 58.0;mag=5.14;fd=35;" star["25 Cyg"] = "ra=19 59 55.20;dec=+37 02 34.4;mag=5.15;fd=25;" star["4 Cyg"] = "ra=19 26 09.12;dec=+36 19 04.3;mag=5.17;fd=4;" star["19 Cyg"] = "ra=19 50 33.99;dec=+38 43 19.8;mag=5.18;fd=19;" star["61 Cyg A"] = "ra=21 06 50.84;dec=+38 44 29.4;mag=5.20;fd=61;" star["71 Cyg"] = "ra=21 29 26.91;dec=+46 32 25.2;mag=5.22;fd=71;" star["70 Cyg"] = "ra=21 27 21.36;dec=+37 07 00.5;mag=5.30;fd=70;" star["27 Cyg"] = "ra=20 06 21.93;dec=+35 58 24.7;mag=5.38;fd=27;" star["60 Cyg"] = "ra=21 01 10.92;dec=+46 09 20.8;mag=5.38;fd=60;" star["9 Cyg"] = "ra=19 34 50.92;dec=+29 27 46.5;mag=5.39;fd=9;" star["14 Cyg"] = "ra=19 39 26.47;dec=+42 49 05.6;mag=5.41;fd=14;" star["51 Cyg"] = "ra=20 42 12.63;dec=+50 20 24.1;mag=5.41;fd=51;" star["ω2 Cyg"] = "ra=20 31 18.81;dec=+49 13 13.3;mag=5.44;fd=46;" star["49 Cyg"] = "ra=20 41 02.60;dec=+32 18 28.0;mag=5.51;fd=49;" star["49 Cyg"] = "ra=20 41 02.54;dec=+32 18 26.3;mag=5.53;fd=49;" star["V1942 Cyg"] = "ra=22 02 56.68;dec=+44 38 59.8;mag=5.57;" star["36 Cyg"] = "ra=20 18 28.63;dec=+36 59 59.1;mag=5.58;fd=36;" star["V389 Cyg"] = "ra=21 08 38.87;dec=+30 12 20.5;mag=5.60;" star["V1768 Cyg"] = "ra=20 04 36.18;dec=+32 13 07.0;mag=5.62;" star["40 Cyg"] = "ra=20 27 34.27;dec=+38 26 25.9;mag=5.63;fd=40;" star["V380 Cyg"] = "ra=19 50 37.33;dec=+40 35 59.2;mag=5.68;" star["V2140 Cyg"] = "ra=20 55 49.81;dec=+47 25 03.6;mag=5.68;" star["79 Cyg"] = "ra=21 43 25.63;dec=+38 17 01.0;mag=5.69;fd=79;" star["7 Cyg"] = "ra=19 27 25.97;dec=+52 19 13.8;mag=5.73;fd=7;" star["Gl 777"] = "ra=20 03 36.95;dec=+29 53 53.1;mag=5.73;" star["43 Cyg"] = "ra=20 27 02.21;dec=+49 22 59.6;mag=5.73;fd=43;" star["77 Cyg"] = "ra=21 42 22.94;dec=+41 04 37.3;mag=5.73;fd=77;" star["DT Cyg"] = "ra=21 06 30.24;dec=+31 11 04.8;mag=5.77;" star["V2015 Cyg"] = "ra=20 33 54.84;dec=+46 41 37.9;mag=5.78;" star["V2119 Cyg"] = "ra=20 23 44.37;dec=+37 28 35.2;mag=5.87;" star["V1762 Cyg"] = "ra=19 08 25.88;dec=+52 25 33.1;mag=5.88;" star["V1143 Cyg"] = "ra=19 38 41.15;dec=+54 58 24.2;mag=5.89;" star["V1334 Cyg"] = "ra=21 19 22.18;dec=+38 14 14.9;mag=5.89;" star["42 Cyg"] = "ra=20 29 20.39;dec=+36 27 17.0;mag=5.90;fd=42;" star["69 Cyg"] = "ra=21 25 47.02;dec=+36 40 02.7;mag=5.93;fd=69;" star["W Cyg"] = "ra=21 36 02.44;dec=+45 22 28.5;mag=5.96;" star["V460 Cyg"] = "ra=21 42 01.08;dec=+35 30 36.7;mag=5.98;" star["16 Cyg A"] = "ra=19 41 49.09;dec=+50 31 31.6;mag=5.99;fd=16;" star["V1743 Cyg"] = "ra=19 33 41.60;dec=+49 15 44.4;mag=6.00;" star["11 Cyg"] = "ra=19 35 48.30;dec=+36 56 40.4;mag=6.03;fd=11;" star["61 Cyg B"] = "ra=21 06 52.19;dec=+38 44 03.9;mag=6.05;fd=61;" star["V2130 Cyg"] = "ra=20 39 33.31;dec=+40 34 46.8;mag=6.07;" star["76 Cyg"] = "ra=21 41 34.27;dec=+40 48 19.2;mag=6.07;fd=76;" star["V1339 Cyg"] = "ra=21 42 08.35;dec=+45 45 56.7;mag=6.11;" star["μ2 Cyg"] = "ra=21 44 08.46;dec=+28 44 34.5;mag=6.12;fd=78;" star["V2093 Cyg"] = "ra=19 50 46.87;dec=+37 49 34.7;mag=6.13;" star["V2100 Cyg"] = "ra=19 59 15.34;dec=+52 03 20.5;mag=6.14;" star["CP Cyg"] = "ra=21 37 27.88;dec=+44 41 47.8;mag=6.19;" star["V1619 Cyg"] = "ra=21 51 04.97;dec=+39 32 11.9;mag=6.20;" star["44 Cyg"] = "ra=20 30 59.23;dec=+36 56 09.1;mag=6.21;fd=44;" star["16 Cyg"] = "ra=19 41 52.10;dec=+50 31 04.5;mag=6.25;fd=16;" star["V819 Cyg"] = "ra=19 53 01.25;dec=+47 48 27.9;mag=6.30;" star["48 Cyg"] = "ra=20 37 31.77;dec=+31 34 21.1;mag=6.32;fd=48;" star["V2136 Cyg"] = "ra=20 49 54.64;dec=+46 39 40.8;mag=6.33;" star["V1817 Cyg"] = "ra=19 31 13.56;dec=+55 43 54.8;mag=6.37;" star["V2090 Cyg"] = "ra=19 44 38.17;dec=+34 24 51.0;mag=6.39;" star["V2173 Cyg"] = "ra=21 57 02.20;dec=+48 40 07.0;mag=6.42;" star["V1351 Cyg"] = "ra=19 42 04.13;dec=+55 27 47.9;mag=6.42;" star["V1765 Cyg"] = "ra=19 48 50.60;dec=+33 26 14.3;mag=6.42;" star["V1773 Cyg"] = "ra=20 18 49.67;dec=+46 19 20.0;mag=6.46;" star["HD 203857"] = "ra=21 23 48.39;dec=+37 21 05.4;mag=6.46;" star["X Cyg"] = "ra=20 43 24.20;dec=+35 35 16.1;mag=6.48;" star["V1276 Cyg"] = "ra=19 42 49.10;dec=+29 19 54.0;mag=6.49;" star["V1584 Cyg"] = "ra=20 19 56.04;dec=+46 50 14.3;mag=6.49;" star["HD 185269"] = "ra=19 37 11.74;dec=+28 29 59.5;mag=6.67;" star["HD 197037"] = "ra=20 39 33s;dec=+42 14 55″;mag=6.81;" edge = "1=Deneb-γ Cyg;2=γ Cyg-ε Cyg;3=ε Cyg-ζ Cyg;4=ζ Cyg-μ1 Cyg;" edge = edge + "5=γ Cyg-δ Cyg;6=δ Cyg-θ Cyg;7=θ Cyg-ι Cyg;8=ι Cyg-κ Cyg;" edge = edge + "9=γ Cyg-η Cyg;10=η Cyg-Albireo A;" radiant = "ra=19 00 00.00;dec=+55 00 00.0;" EndSub Sub Cal_Init ' Calendar | Initialize days of month WQ = Text.GetCharacter(34) CRLF = Text.GetCharacter(13) + Text.GetCharacter(10) iDoM = "1=31;2=28;3=31;4=30;5=31;6=30;7=31;8=31;9=30;10=31;11=30;12=31;" months = "1=January;2=February;3=March;4=April;5=May;6=June;7=July;" months = months + "8=August;9=September;10=October;11=November;12=December;" symbols = "1=♑;2=♒;3=♓;4=♈;5=♉;6=♊;7=♋;8=♌;9=♍;10=♎;11=♏;12=♐;" EndSub Sub Cal_DrawMonth ' Calendar | Print month ' param iM - month ' param iDoY - days of year ' param iWoY - week of year If silverlight Then Program.Delay(msWait) EndIf GraphicsWindow.FontSize = 16 GraphicsWindow.FontName = "Consolas" iW = Math.Remainder((iDoY + iWoY), 7) line = "SUN MON TUE WED THU FRI SAT" + CRLF iWoM = 0 While iWoM < iW line = line + " " iWoM = iWoM + 1 EndWhile For iD = 1 To iDoM[iM] If iD < 10 Then line = line + " " + iD + " " Else line = line + " " + iD + " " EndIf If Math.Remainder(iWoM, 7) = 6 Then line = line + CRLF EndIf iWoM = iWoM + 1 EndFor If Math.Remainder(iWoM, 7) > 0 Then line = line + CRLF EndIf cal = Shapes.AddText(line) Shapes.Move(cal, calendarX, calendarY) EndSub Sub Command_GetArgs ' Command line | Get arguments ' param sBuf - input buffer ' return sArg[] - arguments ' return iN - number of arguments iP = 1 ' buffer pointer iN = 1 ' number of args iC = Text.GetIndexOf(sBuf, ",") ' index of comma While iC > iP sArg[iN] = Text.GetSubText(sBuf, iP, iC - iP) iP = iC + 1 iN = iN + 1 iC = Text.GetIndexOf(sBuf, ",") EndWhile iE = Text.GetLength(sBuf) + 1 ' end of buffer sArg[iN] = Text.GetSubText(sBuf, iP, iE - iP) EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub End>BVR189.sb< Start>BVT539.sb< ' Painting Program By NaochanON 2012/04/12 ' this program requires DATA EXTENSION ' If "Save" , cropped screen shot is saved in your program.directory as named automatically Init_View() Pen3() ' gets pen Icon Eraser3() ' gets eraser Icon color_Palette() ' make palette OtherButton() ' add Flickr Album Save Clear buttons GraphicsWindow.MouseDown=onmousedown GraphicsWindow.MouseMove=onmousemove Controls.ButtonClicked=Onbutton Sub onmousemove MX2= GraphicsWindow.MouseX MY2= GraphicsWindow.MouseY If MX2<75 Then Shapes.hideShape(seraser0) ' hide pen and eraser Shapes.HideShape(spen0) endif If (110"" Then FN2= Program.Directory+"\"+FilePlus.GetFileName(FLKN)+"_"+NN+fileplus.GetFileExtension(FLKN) ' <--- Data Extension ElseIf FN<>"" and FLKN="" then FN2= Program.Directory+"\"+FilePlus.GetFileName(FN)+"_"+NN+fileplus.GetFileExtension(FN) ' <--- Data Extension ElseIf FN="" and FLKN="" then FN2= Program.Directory+"\Paint_"+NN+".jpg" endif PictureTools.SaveImage(Crop,FN2) ' <--- Data Extension EndSub Sub color_Palette GraphicsWindow.FontSize=13 mark="1=R▲.;2=R.▲;3=G▲.;4=G.▲;5=B▲.;6=B.▲;7=R▼.;8=R.▼;9=G▼.;10=G.▼;11=B▼.;12=B.▼" ' button name base="0000FF0000" For i= 1 To 3 ' color number up mark=1 to 6 GraphicsWindow.BrushColor="#"+Text.GetSubText(base,5-2*(i-1),6) ' Red;#FF0000, Green;#00FF00, Blue;#0000FF btnNum=2*(i-1)+1 btn[btnNum]=Controls.AddButton(mark[btnNum],10+50*(btnnum-1),30) btn[btnNum+1]=Controls.AddButton(mark[btnNum],10+50*(btnnum),30) EndFor For i= 1 To 3 ' color number down mark=7 to 12 GraphicsWindow.BrushColor="#"+Text.GetSubText(base,5-2*(i-1),6) ' Red;#FF0000, Green;#00FF00, Blue;#0000FF btnNum=2*(i-1)+1+6 btn[btnNum]=Controls.AddButton(mark[btnNum],10+50*(btnnum-1-6),60) btn[btnNum+1]=Controls.AddButton(mark[btnNum],10+50*(btnnum-6),60) EndFor GraphicsWindow.BrushColor=get_color color_Name() EndSub Sub change_Color If text.IsSubText(nm,"▲") Then cnum=text.GetSubTextToEnd(controls.LastClickedButton,7) ' Button6 --> cnum= 6 r[cnum]=r[cnum]+1 If r[cnum]>16 Then r[cnum]=16 EndIf ElseIf text.IsSubText(nm,"▼") then cnum=text.GetSubTextToEnd(controls.LastClickedButton,7)-6 r[cnum]=r[cnum]-1 If r[cnum]<1 Then r[cnum]=1 EndIf EndIf get_color=Text.GetSubText(get_color,1,cnum)+Text.GetSubText(HexName,r[cnum],1)+Text.GetSubTextToEnd(get_color,cnum+2)' color code EndSub Sub color_name GraphicsWindow.BrushColor="Red" GraphicsWindow.FontSize=15 Shapes.Remove(sgc) sgc=Shapes.AddText(get_color) ' color name Hexa shapes.Move(sgc,305,5) GraphicsWindow.BrushColor= get_color GraphicsWindow.FillRectangle(310,30,60,60) ' color Box EndSub Sub Pen_Up_Down If MX>515 Then pensize=pensize+1 If pensize>15 then pensize=15 EndIf ElseIf MX<515 then Pensize=Pensize-1 If pensize<1 then pensize=1 EndIf EndIf Shapes.setText(spsize,pensize) ER=0 EndSub Sub Eraser_Up_Down If MX>675 Then ERsize=ERsize+1 If ERsize>15 then ERsize=15 EndIf ElseIf MX<675 then ERsize=ERsize-1 If ERsize<1 then ERsize=1 EndIf EndIf Shapes.setText(sERAsize,ERsize) ER=1 EndSub Sub Init_View GL=150 GT=50 GW=900 GH=600 MH=105 MW=75 GraphicsWindow.Left=GL GraphicsWindow.Top=GT GraphicsWindow.Width=GW GraphicsWindow.Height=GH GraphicsWindow.BackgroundColor="White" GraphicsWindow.Show() GraphicsWindow.BrushColor="LightCyan" GraphicsWindow.FillRectangle(0,0,900,MH) ' Pen Eraser Color select area GraphicsWindow.FillRectangle(0,0,MW,600) GraphicsWindow.BrushColor="Red" GraphicsWindow.FontSize=15 GraphicsWindow.DrawText(30,5,"Push and change color") HexName="0123456789ABCDEF" ' Hex number get_color="#000FFF" ' initial color For i=1 To 3 r[i]=1 ' set initial color number r[i+3]=16 EndFor Pensize=4 ' initial pensize ERsize=6 ' initial erasersize spsize=Shapes.AddText(pensize) Shapes.Move(spsize,470,75) sERAsize=Shapes.AddText(ERsize) Shapes.Move(sERAsize,660,75) GraphicsWindow.BrushColor="Navy" FN="" ' Initial FileName for save FLKN="" ' Initial Flickr Name for save EndSub Sub Pen3 url2="http://www.nesoup.com/free_1/material_73_1_s.png" ' Pen Free material pen = ImageList.LoadImage(url2) spen0=Shapes.AddImage(pen) Shapes.Move(spen0,450,10) ' for pen writing Shapes.Zoom(spen0,0.5,0.5) spen1=Shapes.AddImage(pen) Shapes.Move(spen1,450,10) Shapes.Zoom(spen1,0.5,0.5) ' let small spen2=Shapes.AddImage(pen) Shapes.Move(spen2,520,10) ' let large GraphicsWindow.DrawRectangle(460,70,40,30) ' size area Endsub Sub Eraser3 url1="http://chiru.eco.to/images/symbol/082_044_blue.gif" 'Eraser Free material eraser= ImageList.LoadImage(url1) seraser0=Shapes.AddImage(eraser) ' for erase Shapes.Zoom(seraser0,0.25,0.25) Shapes.Move(seraser0,600,0) seraser1=Shapes.AddImage(eraser) Shapes.Zoom(seraser1,0.25,0.25) ' let small Shapes.Move(seraser1,600,0) seraser2=Shapes.AddImage(eraser) Shapes.Zoom(seraser2,0.8,0.8) ' let larg Shapes.Move(seraser2,680,0) GraphicsWindow.DrawRectangle(650,70,40,30) ' size area EndSub Sub otherbutton FLKR= Controls.AddButton("Flickr",5,120) Controls.SetSize(FLKR,60,40) ALBM= Controls.AddButton("Album",5,200) Controls.SetSize(ALBM,60,40) CLR=Controls.AddButton("Clear",5,280) Controls.SetSize(CLR,60,40) SAV=Controls.AddButton("Save",5,360) Controls.SetSize(SAV,60,40) EndSub End>BVT539.sb< Start>BVX165.sb< gw=598 gh=428 distW=10 distH=10 oX=0 oY=0 ' GraphicsWindow.Hide() ' GraphicsWindow.Width=gw GraphicsWindow.Height=gh GraphicsWindow.Top=40 GraphicsWindow.Left=40 ' For i = 1 To Math.Ceiling(gh/distH) x=oX y=oY+(distH*i) GraphicsWindow.FillRectangle(x,y,gw,1) EndFor For i = 1 To Math.Ceiling(gw/distW) x=oX+(distW*i) y=oY GraphicsWindow.FillRectangle(x,y,1,gh) EndFor ' GraphicsWindow.Show() End>BVX165.sb< Start>BVZ484.sb< DR=30 NN=20 args=0 LDCall.Function5("cmmk" 80 50 3 nn-1 1) LDCall.Function5("cmmk" 45 110 10 20 22) LDCall.Function5("cmmk" 45 110 1 6 33) LDCall.Function5("cmmk" 115 110 1 12 48) LDCall.Function5("cmmk" 115 110 16 20 43) DR=23 NN=15 LDCall.Function5("cmmk1" 60 80 2 5, 18) LDCall.Function5("cmmk1" 85 117 7 10, 39) LDCall.Function5("cmmk1" 110 80 12 15, 60) GraphicsWindow.MouseDown=mmm GraphicsWindow.Width=600 GraphicsWindow.Height=600 GraphicsWindow.BackgroundColor="tan GraphicsWindow.Title="Spinner Sub mmm dll=2 EndSub Sub cmmk cx=args[1] cy=args[2] g=args[5] ix=g-1 i0=ix For i=args[3] To args[4] points[ix][1]=math.Round(DR*(1+Math.Sin((i-1)/NN*math.pi*2))*10)/10+cx points[ix][2]=math.Round(DR*(1+Math.cos((i-1)/NN*math.pi*2))*10)/10+cy ix=ix+1 EndFor cnt=args[4] ddy=0.0000000001 drs=0 cx2=1 cy2=1 ji=0 For j=args[3] To cnt jj=jj+1 _x=points[ji+i0][1] _y=points[ji+i0][2] r=math.SquareRoot((_x-cx2)*(_x-cx2)+(_y-cy2)*(_y-cy2)) If (_y-cy2)<0 Then s=math.ArcTan((_x-cx2)/(_y-cy2+ddy)) Else s=math.ArcTan((_x-cx2)/(_y-cy2+ddy))-Math.pi EndIf _x2=_x+cx-r*math.sin(s-drs)'' points[ji+i0][1]=_x2 _y2=_y+cy-r*math.cos(s-drs)'' points[ji+i0][2]=_y2 ji=ji+1 EndFor EndSub Sub cmmk1 cx=args[1] cy=args[2] g=args[5] ix=g-1 i0=ix For i=args[4] To args[3] Step -1 points[ix][1]=math.Round(DR*(1+Math.Sin((i-1)/NN*math.pi*2))*10)/10+cx points[ix][2]=math.Round(DR*(1+Math.cos((i-1)/NN*math.pi*2))*10)/10+cy ix=ix+1 EndFor cnt=args[4] ddy=0.0000000001 drs=0 cx2=1 cy2=1 ji=0 For j=cnt To args[3] Step -1 jj=jj+1 _x=points[ji+i0][1] _y=points[ji+i0][2] r=math.SquareRoot((_x-cx2)*(_x-cx2)+(_y-cy2)*(_y-cy2)) ' Length from shapes center If (_y-cy2)<0 Then s=math.ArcTan((_x-cx2)/(_y-cy2+ddy)) Else s=math.ArcTan((_x-cx2)/(_y-cy2+ddy))-Math.pi EndIf _x2=_x+cx-r*math.sin(s-drs)'' points[ji+i0][1]=_x2 _y2=_y+cy-r*math.cos(s-drs)'' points[ji+i0][2]=_y2 ji=ji+1 EndFor EndSub For f=1 To Array.GetItemCount(points) poi[f]=points[f] EndFor GraphicsWindow.PenWidth=0 po=LDShapes.AddPolygon(poi) LDShapes.BrushColour(po "darkblue") LDEffect.DropShadow(po "") dll=2 While 1=1 aa=aa+4.5 LDShapes.RotateAbout(po 300 310 aa) Program.Delay(dll) dll=dll*1.01 EndWhile End>BVZ484.sb< Start>BVZ863.sb< GraphicsWindow.Show() GraphicsWindow.Width = 850 GraphicsWindow.Height = 600 GraphicsWindow.Title = "test" GraphicsWindow.CanResize = "False" textboxusername = Controls.AddTextBox(330,260) textboxpassword = Controls.AddTextBox(330,320) GraphicsWindow.DrawText(330,240,"Username:") GraphicsWindow.DrawText(330,300,"Password:") buttonlogin = Controls.AddButton("Log in",380,370) Controls.ButtonClicked = OnButtonClicked 'load login Sub OnButtonClicked If (Controls.LastClickedButton = buttonlogin) Then textboxusernametext = Controls.GetTextBoxText(textboxusername) textboxpasswordtext = Controls.GetTextBoxText(textboxpassword) EndIf EndSub If ((textboxusernametext = "Administrator") Or (textboxusernametext = "administrator")) And (textboxpasswordtext = 123) Then GraphicsWindow.ShowMessage("hey","general") EndIf End>BVZ863.sb< Start>BWB179.sb< TextWindow.WriteLine("Enter in some text,and i'll tell you how many vowels there are.") txt = TextWindow.Read() txt1 = Text.ConvertToLowerCase(txt) For i = 1 To Text.GetLength(txt1) TempText = Text.GetSubText(txt1,i,1) If TempText = "a" Then vowela = vowela + 1 ElseIf TempText = "e" Then vowele = vowele + 1 ElseIf TempText = "i" Then voweli = voweli + 1 ElseIf TempText = "o" Then vowelo = vowelo + 1 ElseIf TempText = "u" Then vowelu = vowelu + 1 EndIf EndFor TextWindow.WriteLine("how many times 'a' comes up: " + vowela) TextWindow.WriteLine("how many times 'e' comes up: " + vowele) TextWindow.WriteLine("how many times 'i' comes up: " + voweli) TextWindow.WriteLine("how many times 'o' comes up: " + vowelo) TextWindow.WriteLine("how many times 'u' comes up: " + vowelu) End>BWB179.sb< Start>BWD182.sb< ' Molecular Structure of CFC-11 ' Version 0.3 ' Copyright © 2019 Nonki Takahashi. The MIT License. ' Last update 2019-11-20 GraphicsWindow.Title = "Molecular Structure of CFC-11 (Chlorofluorocarbon)" bg = "LightGray" pc = "DimGray" GraphicsWindow.BackgroundColor = bg ' size: Van der Waals radius / 2 [pm] ' 1: single-bond covalent radius [pm] ' 2: double-bond covalent radius [pm] ' 3: triple-bond covalent radius [pm] atom["H"] = "color=White;size=55;1=32;" atom["C"] = "color=Black;size=85;1=75;2=67;3=60;" atom["O"] = "color=#EE0000;size=76;1=63;2=57;3=53;" atom["F"] = "color=YellowGreen;size=73.5;1=64;2=59;3=53;" atom["Cl"] = "color=LimeGreen;size=87.5;1=99;2=95;3=93;" root2 = Math.SquareRoot(2) root3 = Math.SquareRoot(3) mol = "CCl_3F" DrawMolecularName() gw = GraphicsWindow.Width gh = GraphicsWindow.Height _size = atom["Cl"]["size"] size = atom["C"]["size"] n = 1 distance = atom["C"][n] + atom["Cl"][n] gap = distance - size / 2 - _size / 2 d1 = size / 2 d2 = size / 2 + gap opt = "" cx = gw / 2 cy = gh / 2 c = 2 / 3 * root2 s = 1 / 3 ' draw line (1) x1 = cx y1 = cy - d1 x2 = cx y2 = cy - (atom["C"][n] + atom["F"][n]) DrawLine() ' draw F (1) bc = atom["F"]["color"] size = atom["F"]["size"] ox = cx oy = y2 FillCircle() ' draw Cl (2) bc = atom["Cl"]["color"] size = _size ox = cx - distance * root3 / 2 * c oy = cy + distance * s FillCircle() ' draw line (2) x1 = cx - d1 * root3 / 2 * c y1 = cy + d1 * s x2 = cx - d2 * root3 / 2 * c y2 = cy + d2 * s n = 1 DrawLine() ' draw Cl (3) ox = cx + distance * root3 / 2 * c FillCircle() ' draw line (3) x1 = cx + d1 * root3 / 2 * c y1 = cy + d1 * s x2 = cx + d2 * root3 / 2 * c y2 = cy + d2 * s n = 1 DrawLine() ' draw C size = atom["C"]["size"] bc = atom["C"]["color"] ox = cx oy = cy FillCircle() ' draw Cl (4) bc = atom["Cl"]["color"] size = _size ox = cx oy = cy + distance * s FillCircle() Sub DrawLine GraphicsWindow.PenColor = pc If n = 2 Then GraphicsWindow.PenWidth = 12 GraphicsWindow.DrawLine(x1, y1, x2, y2) GraphicsWindow.PenColor = bg EndIf GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawLine(x1, y1, x2, y2) EndSub Sub DrawMolecularName GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" x = 30 For p = 1 To Text.GetLength(mol) c = Text.GetSubText(mol, p, 1) If c = "_" Then y = 35 p = p + 1 fs = 20 c = Text.GetSubText(mol, p, 1) Else y = 20 fs = 30 EndIf GraphicsWindow.FontSize = fs GraphicsWindow.DrawText(x, y, c) x = x + fs * 0.7 EndFor EndSub Sub FillCircle GraphicsWindow.BrushColor = bc GraphicsWindow.FillEllipse(ox - size / 2, oy - size / 2, size, size) If opt <> "" Then GraphicsWindow.FontSize = 35 GraphicsWindow.BrushColor = pc GraphicsWindow.DrawText(ox + size / 2, oy - size / 2, opt) EndIf EndSub End>BWD182.sb< Start>BWG662.sb< calculator: TextWindow.Title= "N.O. Simple Calculator" TextWindow.clear() TextWindow.WriteLine("Created by Nathaniel Ogungbuyi") TextWindow.WriteLine("So to begin please state the first number you want to use.") TextWindow.Write("") num1 = TextWindow.ReadNumber() TextWindow.Pause() TextWindow.WriteLine("Ok so what will be the second number in this equcation?") TextWindow.Write("") num2 = TextWindow.ReadNumber() Textwindow.WriteLine("So finally what is the operator you would like to use (+,-,*, or /)") TextWindow.Write("") op = TextWindow.Read() If (op = "+") Then num3 = num1 + num2 TextWindow.WriteLine(num1 + "+" + num2 + "=" + num3) ElseIf (op = "-") then num3 = num1 - num2 TextWindow.WriteLine(num1 + "-" + num2 + "=" + num3) elseif (op = "*") then num3 = num1 * num2 TextWindow.WriteLine(num1 + "*" + num2 + "=" + num3) Elseif (op = "/") then num3 = num1 / num2 TextWindow.WriteLine(num1 + "/" + num2 + "=" + num3) EndIf TextWindow.WriteLine("Whould you like to caculate another equation? Y for Yes and N for No") TextWindow.Write("") retry = TextWindow.Read() If (retry = "Y" Or "y") Then Goto calculator endif End>BWG662.sb< Start>BWJ493.sb< ' SmallBasic Version 1.0 ' Program: FilterLines (Single Session) ' Changelog: ' Author: Jibba Jabba (Pappa Lapub) ' Website: https://social.msdn.microsoft.com/Forums/en-US/59425a7a-52ce-436d-bc9e-6d3e18f238dc/is-arrayremovevaluearray-index-deprecated-or-obsolete ' ImportURL: http://smallbasic.com/program/? ' The following line could be harmful and has been automatically commented. ' ' Extension: (LitDev LDFile.Length) ' Comment: http://1drv.ms/1z2QGdG (filtered[1].txt) ' filtered[1].txt is a list of 970 words sorted in alphabetical order with 1 word per line. ' Basically I want to pluck a word at random from words. Only using the word once. ' I could be a bit stubborn here, but I wish to host only 1 txt file on the server ' that contains words of 3 or more letters that are sorted in alphabetical order, line by line. ' I might need an upfront word count and the File would need to be d/loaded as a temp file. ' Variables: ' ToDo: ' ================================================================================ linesToRead = 30 filtTxt = "C:\Temp\filtered[1].txt" ' The following line could be harmful and has been automatically commented. ' sumLines = 969 ' sumLines = LDFile.Length(filtTxt) nRead = 0 ' no line read so long readDone = "" ' Array to collect the already read line numbers While nRead < linesToRead ' read until we got desired lines count randLine = Math.GetRandomNumber(sumLines) ' try a random line numer If Text.IsSubText(readDone, randLine) <> "True" Then ' was this line number already accessed ? ' The following line could be harmful and has been automatically commented. ' lineTxt = File.ReadLine(filtTxt, randLine) ' NO, then let's read it ... readDone[Array.GetItemCount(readDone)+1] = randLine ' ... and store it in our colletion TextWindow.WriteLine(lineTxt) ' show it ... nRead = nRead+1 ' or nRead = Array.GetItemCount(readDone) ' ... and update the counter EndIf EndWhile TextWindow.WriteLine("") TextWindow.WriteLine("* Already read lines (now): ["+ nRead +"] as 'index=lineNo' in read order:") TextWindow.WriteLine(readDone) ' Array with collected read line numbers. We can save it to a file for future sessions TextWindow.WriteLine("") End>BWJ493.sb< Start>BWN338.sb< GraphicsWindow.PenColor = "Green" GraphicsWindow.DrawTriangle(100, 300, 200,300, 150, 100) GraphicsWindow.BrushColor= "Green" GraphicsWindow.FillTriangle(100, 300, 200,300, 150, 100) GraphicsWindow.PenColor = "Green" GraphicsWindow.DrawTriangle(400, 300, 500,300, 450, 100) GraphicsWindow.BrushColor= "Green" GraphicsWindow.FillTriangle(400, 300, 500,300, 450, 100) GraphicsWindow.BackgroundColor= "Black" For i = 1 To 1000 GraphicsWindow.BrushColor= "Gold" x = Math.GetRandomNumber(640) y = Math.GetRandomNumber(480) GraphicsWindow.FillEllipse(x, y,10,10) EndFor ' turtle Turtle.Speed = 99 lados = 3 largo = 400/ lados angulo= 360/ lados For i= 1 To lados GraphicsWindow.PenWidth= 15 Turtle.Move(largo) Turtle.Turn(angulo) EndFor Turtle.TurnLeft() For i= 1 To lados GraphicsWindow.PenWidth= 15 Turtle.Move(largo) Turtle.Turn(angulo) EndFor Turtle.Angle= 90 For i= 1 To lados GraphicsWindow.PenWidth= 15 Turtle.Move(largo) Turtle.Turn(angulo) EndFor Turtle.TurnRight() For i= 1 To lados GraphicsWindow.PenWidth= 15 Turtle.Move(largo) Turtle.Turn(angulo) EndFor ' Fractal ' arbolito distancia = 10 angulo = 90 comienzo: If angulo = 0 Then Goto final Else GraphicsWindow.PenColor = "Red" Turtle.Move(distancia) Turtle.Turn(angulo) distancia = distancia - 1 angulo = angulo -10 EndIf Goto comienzo final: TextWindow.ForegroundColor = "White" GraphicsWindow.ShowMessage("MERRY CHRISTMAS", "HELLO") End>BWN338.sb< Start>BWQ781.sb< ' S O L A R I S A T I O N ' program by parYvan Leduc ----April 16th 2016 GraphicsWindow.Title = "Color Solarisation from BW" GraphicsWindow.top= 0 GraphicsWindow.left= 0 GraphicsWindow.Height=600 GraphicsWindow.Width=1200 GraphicsWindow.BackgroundColor="BLACK" image=ImageList.LoadImage("https://rstorage.filemobile.com/storage/25555976/15") workingImage = LDImage.Copy(image) IH=ImageList.GetHeightOfImage(image) IW=ImageList.GetWidthOfImage(image) 'TextWindow.WriteLine("LONGUEUR="+IW) ' 560 PIXELS 'TextWindow.WriteLine("LARGEUR="+IH) ' 372 PIXELS C'EST CE QUE DONNE CANGEO comme maximum GraphicsWindow.Clear() GraphicsWindow.DraWImage(image,0,0) LDImage.OpenWorkingImage(workingImage) For y = 1 To IH For x = 1 To IW hex = LDImage.GetWorkingImagePixel(workingImage,x,y) R=LDColours.GetRed(hex) G=LDColours.Getgreen(hex) B=LDColours.Getblue(hex) R1=R/25 G1=G/25 B1=B/25 ' here is my way and my formula for color solarisation hR=MATH.Floor(Math.Abs((R*1.25*(Math.LOG(R1*10))))) hG=MATH.Floor(Math.ABS((G*0.5*(Math.LOG(G1*10))))) hB=MATH.Floor(MATH.ABS((B*1.5*(Math.LOG(B1*10))))) hue_value=GraphicsWindow.GetColorFromRGB(hR,hG,hB) GraphicsWindow.SetPixel(x-1,y-1,hue_value) LDImage.SetWorkingImagePixel(workingImage,x,y,hue_value) Endfor EndFor LDImage.CloseWorkingImage(workingImage) GraphicsWindow.DrawResizedImage(image,580,0,IW,IH) GraphicsWindow.BrushColor="gray" GraphicsWindow.fontsize="24" GraphicsWindow.DrawText(50,400," Color Solarisation program by Yvan Leduc April 2016") LDImage.SaveAs(workingImage,Program.Directory+"\solarised.png") Sound.PlayBellRing() ' ************************** END OF PROGRAMME *************************************************** End>BWQ781.sb< Start>BWV727.sb< 'Set the treeview data, the first index is the item number and the second is its parent (0 is top level) tree[1][0] = "Level 1" tree[2][1] = "Level 1 1" tree[3][1] = "Level 1 2" tree[4][3] = "Level 1 2 1" tree[5][0] = "Level 2" tree[6][5] = "Level 2 1" tree[7][5] = "Level 2 2" tree[8][0] = "Level 3" 'Create the treeview GraphicsWindow.Show() treeView = LDControls.AddTreeView(tree,200,200) Shapes.Move(treeView,50,50) 'Add a textBox to show the current selection item = Controls.AddTextBox(50,260) 'Set up the initial view LDControls.TreeViewItemChanged = OnTreeViewItemChanged 'Register selection event LDControls.TreeViewSelect(treeView,5) 'Select the second top level item "Level 2' - Note the OnTreeViewItemChanged is also fired with this action 'Add buttons to toggle expand expand = Controls.AddButton("Expand All",50,20) collapse = Controls.AddButton("Collapse All",150,20) Controls.ButtonClicked = OnButtonClicked Sub OnTreeViewItemChanged index = Array.GetAllIndices(tree[LDControls.LastTreeViewIndex]) ' To get the second index (parent) for this item label Controls.SetTextBoxText(item,tree[LDControls.LastTreeViewIndex][index[1]]) EndSub Sub OnButtonClicked If (Controls.LastClickedButton = expand) Then LDControls.TreeViewExpand(treeview,0,"True","True") ElseIf (Controls.LastClickedButton = collapse) Then LDControls.TreeViewSelect(treeView,1) 'Set to first item so we can collapse all LDControls.TreeViewExpand(treeview,0,"False","True") EndIf EndSub End>BWV727.sb< Start>BWX823-0.sb< ' 2012/10/14 16:28:42 Generated ' by Shapes 1.31 Made by Nonki_Takahashi ' Spring connected Ball bouncing program By NaochanON BWX823 Shapes_Init() scale = 1 Shapes_Add() angle = 0 arm_Up() bounce() Sub bounce d0=Math.pi x02= shapes.GetLeft(shape[15]["obj"]) ' End point SW=(X02-X0)/2 ' swing of pendulum A=SW While "true" t=t+0.1 X=(X0+A) + SW*math.Cos(t-d0) ' Ball position X RT=(X02-X)/(X02-X0) For i=1 To 249 Shapes.Move(spring[i],SPRX[i]+(1-RT)*(X02-SPRX[i]),SPRY[i]) endfor Shapes.Move(shape[17]["obj"],shapes.GetLeft(spring[1])-35,y0) ' Program.Delay(50) Sw=SW*0.995 ' reduction by Friction endwhile EndSub Sub spring GraphicsWindow.BrushColor="Brown" GraphicsWindow.PenColor="Brown" DR=shape[17]["width"]*s/2 ' radius x0=shapes.GetLeft(shape[17]["obj"]) y0=shapes.Gettop(shape[17]["obj"]) For i= 250 To 1 Step -1 spring[i]= Shapes.AddEllipse(5,5) Rad=math.GetRadians(320-i*9) SPRX[i]=x0+DR*(1-Math.Cos(rad))+i*1.1+20 ' spring X SPRY[i]=y0-DR*Math.sin(rad)+10 ' spring Y Shapes.Move(spring[i],SPRX[i],SPRY[i]) EndFor EndSub Sub arm_Up armY=shapes.GetTop(shape[10]["obj"]) for i=0 To 3 Shapes.Rotate(shape[10]["obj"], shape[10]["angle"]-i*15) shapes.Move(shape[10]["obj"],shapes.GetLeft(shape[10]["obj"]),armY-shape[10]["width"]/2*Math.Sin(math.GetRadians(i*15))) Shapes.Rotate(shape[11]["obj"], shape[11]["angle"]-i*15) shapes.Move(shape[11]["obj"],shapes.GetLeft(shape[11]["obj"]),armY-shape[10]["width"]*Math.Sin(math.GetRadians(i*15))) Program.Delay(200) endfor EndSub Sub Shapes_Add GraphicsWindow.BackgroundColor="Lightcyan" nShapes = Array.GetItemCount(shape) s = scale For i = 1 To nShapes GraphicsWindow.PenWidth = shape[i]["pw"] * s If shape[i]["pw"] > 0 Then GraphicsWindow.PenColor = shape[i]["pc"] EndIf GraphicsWindow.BrushColor = shape[i]["bc"] If shape[i]["func"] = "rect" Then shape[i]["obj"] = Shapes.AddRectangle(shape[i]["width"]* s, shape[i]["height"] * s) ElseIf shape[i]["func"] = "ell" Then shape[i]["obj"] = Shapes.AddEllipse(shape[i]["width"] * s, shape[i]["height"]* s) ElseIf shape[i]["func"] = "tri" Then shape[i]["obj"] = Shapes.AddTriangle(shape[i]["x1"] * s, shape[i]["y1"] * s, shape[i]["x2"] * s, shape[i]["y2"] * s, shape[i]["x3"] * s, shape[i]["y3"] * s) ElseIf shape[i]["func"] = "line" Then shape[i]["obj"] = Shapes.AddLine(shape[i]["x1"] * s, shape[i]["y1"]* s, shape[i]["x2"] * s, shape[i]["y2"] * s) EndIf Shapes.Move(shape[i]["obj"], shX + shape[i]["x"] * s, shY + shape[i]["y"] * s) If shape[i]["angle"] <> 0 Then Shapes.Rotate(shape[i]["obj"], shape[i]["angle"]) EndIf EndFor spring() EndSub Sub Shapes_Init shX = 102 ' x offset shY = 117 ' y offset shape = "" shape[1] = "func=rect;x=119;y=112;width=366;height=16;bc=#71AC00;pc=#71AC00;pw=8;" shape[2] = "func=rect;x=149;y=128;width=15;height=99;bc=#71AC00;pc=#71AC00;pw=8;" shape[3] = "func=ell;x=42;y=0;width=34;height=45;bc=#EB9869;pc=#EB9869;pw=8;" shape[4] = "func=ell;x=40;y=42;width=33;height=103;bc=#6A5ACD;pc=#6A5ACD;pw=8;" shape[5] = "func=ell;x=40;y=81;width=7;height=5;bc=#6A5ACD;pc=#6A5ACD;pw=8;" shape[6] = "func=rect;x=37;y=140;width=12;height=71;angle=9;bc=#6A5ACD;pc=#6A5ACD;pw=8;" ' left Leg shape[7] = "func=ell;x=30;y=209;width=33;height=13;angle=20;bc=#414C3E;pc=#414C3E;pw=8;" shape[8] = "func=rect;x=63;y=140;width=13;height=68;angle=345;bc=#6A5ACD;pc=#6A5ACD;pw=8;" ' Right Leg shape[9] = "func=ell;x=71;y=203;width=33;height=13;angle=353;bc=#414C3E;pc=#414C3E;pw=8;" shape[10] = "func=rect;x=54;y=71;width=60;height=8;angle=16;bc=#6A5ACD;pc=#000000;pw=1;" ' arm shape[11] = "func=ell;x=112;y=79;width=22;height=13;angle=11;bc=#EB9869;pc=#EB9869;pw=8;" ' hand shape[12] = "func=ell;x=67;y=10;width=7;height=5;bc=#000000;pc=#000000;pw=8;" 'Eye shape[13] = "func=tri;x=74;y=17;x1=4;y1=0;x2=0;y2=12;x3=12;y3=15;angle=98;bc=#EB9869;pc=#EB9869;pw=1;" 'nose shape[14] = "func=line;x=65;y=29;x1=8;y1=3;x2=0;y2=0;pc=#F80800;pw=2;" ' mouse shape[15] = "func=rect;x=438;y=67;width=35;height=44;bc=#000000;pc=#F80800;pw=1;" shape[16] = "func=rect;x=440;y=128;width=15;height=99;bc=#71AC00;pc=#71AC00;pw=8;" shape[17] = "func=ell;x=116;y=71;width=40;height=42;bc=#6A5ACD;pc=#000000;pw=2;" EndSub End>BWX823-0.sb< Start>BWZ204.sb< args=0 GraphicsWindow.PenWidth=0.5 GraphicsWindow.BackgroundColor="tan cm="brown teal red" For zz=0 To 5 For xx=0 To 5 For yy=0 To 5 LDCall.Function4("adds" 300-xx*25.5+zz*25.5 200-yy*30+xx*15+zz*15 30 cm) EndFor EndFor EndFor LDShapes.ShapeEvent=see Sub see ll=LDShapes.LastEventShape If LDShapes.LastEventType="MouseDown" Then Shapes.HideShape(ll) EndIf EndSub Sub adds a=-30 qq=0 sx=Args[1] sy=Args[2] rr=Args[3] qq[1][1]=sx qq[1][2]=sy cc=LDText.Split(Args[4] " ") For t=1 To 3 For n=2 To 4 qq[n][1]=LDMath.cos(a)*rr+sx qq[n][2]=LDMath.Sin(a)*rr+sy a=a+60 EndFor ss=LDShapes.AddPolygon(qq) LDShapes.BrushColour(ss cc[t]) LDShapes.SetShapeEvent(ss) a=a-60 EndFor EndSub End>BWZ204.sb< Start>BWZ589.sb< GraphicsWindow.BackgroundColor="darkblue dw=900 dh=900 GraphicsWindow.width=dw GraphicsWindow.Height=dh GraphicsWindow.Top=10 GraphicsWindow.Left=10 GraphicsWindow.Title="Legohouse 'stacks cubes PArray3D.New ("aa" 39 39 139) For z=1 To 27 For y = 1 To 27 For x = 1 To 27 PArray3D.set("aa" x y z 1) EndFor EndFor EndFor For x=1 To 13 for y=x+14 to 27 For z=1 To 27 PArray3D.set("aa" x y z 0) PArray3D.set("aa" 28-x y z 0) EndFor EndFor EndFor args=0 zmx=27 zmm=1 ymm=1 xmm=1 LDCall.Function4 ("drr" 13 1 27 26) zmm=2 zmx=26 ymm=2 xmm=3 LDCall.Function4 ("drr" 13 1 25 1) zmm=13 zmx=17 ymm=2 xmm=2 LDCall.Function4 ("drr" 9 1 2 1) zmm=27 zmx=27 ymm=15 xmm=12 LDCall.Function4 ("drr" 20 1 16 1) For f=0 to 1 zmm=4+f*16 zmx=9+f*16 ymm=5 xmm=2 LDCall.Function4 ("drr" 9 1 2 1) endfor For z=2 To 26 For y = 14 To 26 For x = 2+y-14 To 26-(y-14) PArray3D.set("aa" x y z 0) EndFor EndFor EndFor For z=28 to 31 For y=1 To 7 PArray3D.set("aa" 15+y y z 1) PArray3D.set("aa" 22-y y+7 z+4 1) EndFor For x=12 to 16 PArray3D.set("aa" 10+x 7 z 1) PArray3D.set("aa" 10+x 7 z+4 1) PArray3D.set("aa" x 14 z 1) PArray3D.set("aa" x 14 z+4 1) endfor endfor Sub drr For z=zmm To zmx For y = ymm To args[1] Step args[2] For x = xmm To args[3] Step args[4] PArray3D.set("aa" x y z 0) EndFor EndFor EndFor EndSub view3D = LD3DView.AddView(dw,dh,"true") 'Will not clip to size if window rescaled LD3DView.AddDirectionalLight (view3D,"cyan",-1 ,-1 ,-1) LD3DView.AddDirectionalLight(view3D,"white",1,1,1) LD3DView.AddAmbientLight(view3D,"#555555") LD3DView.ResetCamera(view3D,-30,15,30, 5, 0, -3, "","","") points = "0 0 0:w1 0 0:w1 1 0:0 1 0: 0 0 1:w1 0 1:w1 1 1:0 1 1" indices = "0 2 1 0 3 2 4 5 6 4 6 7 1 2 5 2 6 5 4 7 0 7 3 0 7 6 2 7 2 3 0 1 5 0 5 4" objectorigin = LD3DView.AddGeometry(view3D,ldtext.Replace (points "w1" 1),indices,"","White","D") oo1= LD3DView.AddGeometry(view3D,ldtext.Replace (points "w1" 2),indices,"","White","D") LD3DView.TranslateGeometry(view3d,objectorigin,0,0,1000) LD3DView.TranslateGeometry(view3d,oo1,0,0,1000) For z=1 To 38 For y=1 To 27 For x=0+Math.Remainder (y 2) To 27 Step 2 If PArray3D.get("aa" x y z)=1 and PArray3D.get("aa" x+1 y z)<>1 then object = LD3DView.CloneObject(view3d,objectorigin) LD3DView.TranslateGeometry(view3d,object,x,y,z-20) object = LD3DView.CloneObject(view3d,objectorigin) LD3DView.TranslateGeometry(view3d,object,x,y,z+20) ElseIf PArray3D.get("aa" x y z)=1 and PArray3D.get("aa" x+1 y z)=1 then object = LD3DView.CloneObject(view3d,oo1) LD3DView.TranslateGeometry(view3d,object,x,y,z-20) object = LD3DView.CloneObject(view3d,oo1) LD3DView.TranslateGeometry(view3d,object,x,y,z+20) elseif PArray3D.get("aa" x y z)<>1 and PArray3D.get("aa" x+1 y z)=1 then object = LD3DView.CloneObject(view3d,objectorigin) LD3DView.TranslateGeometry(view3d,object,x+1,y,z-20) object = LD3DView.CloneObject(view3d,objectorigin) LD3DView.TranslateGeometry(view3d,object,x+1,y,z+20) endif EndFor endfor endfor LDEvents .MouseWheel =mww ww=15 Sub mww ww=ww+LDEvents.LastMouseWheelDelta*5 w1=ldmath.Sin (ww) w2=ldmath.cos (ww) LD3DView.ResetCamera(view3D,w1*50, 15 ,w2*50, -w1*5, 0, -w2*5, "","","") EndSub End>BWZ589.sb< Start>BXB057-1.sb< ' Challenge of month August 2012 Fire works ( Sparkler ) by NaochanON BXB057 gui() fire() Sub gui X0=300 Y0=250 GraphicsWindow.BackgroundColor="black" GraphicsWindow.Hide() GraphicsWindow.BrushColor="Green" GraphicsWindow.penColor="Green" stem=shapes.AddTriangle(0,0,3,200,6,0) Shapes.Move(stem,X0,60) GraphicsWindow.BrushColor="Yellow" GraphicsWindow.penColor="Yellow" GraphicsWindow.FontSize=20 msg=Shapes.AddText("Sparkler") Shapes.Move(msg,250,20) Px="1=0;2=44;3=88" PY="1=0;2=29;3=0" ZM=0.1 NN=200 For K=1 To NN For j=1 To 3 a[k][J]= Shapes.AddTriangle(Px[1],PY[1],Px[2],PY[2],Px[3],PY[3]) Shapes.Zoom(a[k][j],zm,zm) Shapes.Move(a[k][j],X0-44,Y0) EndFor Shapes.Rotate(a[k][2],-70) Shapes.Rotate(a[k][3],72) EndFor GraphicsWindow.BrushColor="Red" GraphicsWindow.penColor="red" base=shapes.AddEllipse(14,50) Shapes.Move(base,X0-4,Y0-4) GraphicsWindow.Show() EndSub Sub fire For k=1 To NN+3 DR=math.GetRandomNumber(300) angle=math.GetRadians(math.GetRandomNumber(180)) newx=DR*math.Cos(angle)+x0 newy=DR*math.sin(angle)+y0 dltime=DR*2.5 For j=1 To 3 Shapes.Animate(a[k][j],newx,newy,dltime) EndFor Program.Delay(dltime/5) zmy=zmy+0.0025 Shapes.Zoom(base,1,1-zmy) If K>3 Then For L=1 To 3 Shapes.HideShape(a[k-3][L]) EndFor EndIf EndFor Shapes.Animate(base,X0,1000,3000) Shapes.Animate(msg,X0,1000,3000) EndSub End>BXB057-1.sb< Start>BXF540.sb< ss=LDDictionary.GetDefinition("Sun") ss=LDText.Replace(ss Text.GetCharacter(13)+Text.GetCharacter(10) " ") st=LDText.Split(text.GetSubText( ss 1 200) " ") mk=Array.GetItemCount(st)-1 lsl=1 LDTextWindow.KeyDown=kkk drww() While 1=1 If rdr Then rdr="false ss=LDDictionary.GetDefinition(st[lsl+1]) ss=LDText.Replace(ss Text.GetCharacter(13)+Text.GetCharacter(10) " ") ss=LDText.Replace(ss "," "_") st=LDText.Split(text.GetSubText( ss 1 200) " ") mk=Array.GetItemCount(st)-1 lsl=1 TextWindow.Clear() drww() EndIf EndWhile Sub kkk lk= LDTextWindow.LastKey If lk="Up" Then lsl=lsl-1 If lsl<1 Then lsl=1 EndIf ElseIf lk="Return" Then rdr="true ElseIf lk="Down" Then lsl=lsl+1 If lsl>mk Then lsl=mk EndIf EndIf drww() EndSub Sub drww TextWindow.CursorLeft=0 TextWindow.CursorTop=3 For f=1 To Array.GetItemCount(st) mm=Math.Max(mm Text.GetLength(st[f])) EndFor TextWindow.ForegroundColor="cyan" ln=Text.GetSubText("╔════════════════════════════════════════════════" 1 mm+3) TextWindow.BackgroundColor="black" TextWindow.Write(" ") TextWindow.BackgroundColor="blue" TextWindow.WriteLine(ln+"╗") TextWindow.BackgroundColor="black" TextWindow.Write(" ") TextWindow.BackgroundColor="blue" ln=Text.GetSubText(ldtext.Replace( text.ConvertToUpperCase (st[1]) "_" " ")+" " 1 mm)+" ║" TextWindow.Write("║ "+ln) TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") ln=Text.GetSubText("╟────────────────────────────────────────────────" 1 mm+3) TextWindow.BackgroundColor="black" TextWindow.Write(" ") TextWindow.BackgroundColor="blue" TextWindow.Write(ln+"╢") TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") For f=2 To Array.GetItemCount(st) TextWindow.BackgroundColor="black" TextWindow.Write(" ") TextWindow.BackgroundColor="blue" TextWindow.Write("║ ") If f-1=lsl Then TextWindow.BackgroundColor="yellow" textWindow.ForegroundColor="black" Else TextWindow.ForegroundColor="cyan" EndIf TextWindow.Write(Text.GetSubText(ldtext.Replace( st[f] "_" " ")+" " 1 mm)) TextWindow.BackgroundColor="blue" TextWindow.ForegroundColor="cyan" TextWindow.Write(" ║") TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") EndFor ln=Text.GetSubText("╚════════════════════════════════════════════════" 1 mm+3) TextWindow.BackgroundColor="black" TextWindow.Write(" ") TextWindow.BackgroundColor="blue" TextWindow.Write(ln+"╝") TextWindow.BackgroundColor="black" TextWindow.WriteLine("▒") ln=Text.GetSubText("▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒" 1 mm+4) TextWindow.WriteLine(" "+ln) EndSub End>BXF540.sb< Start>BXG200.sb< ' SmallBasic Version 1.0 ' Funktion: MD5Compare ' Autor: Pappa Lapub ' Herkunft: ' ImportURL: http://smallbasic.com/program/? ' Extension: LitDev ' Kommentar: Qualitative compare 2 files -> (Not)Identical. Via MD5Hash ' zB./eg.: ' * StandardMD5: 21153693416fb02ee5fb328062bf844c ' 32-stellig ' MD5Hash: ??6P????C.P;??? ' 15 Stellen ' DEK: 1765533548065533655331276553367468059655336553365533 ' 52 Stellen ' HEX: 11fffd3650fffdfffd7ffffd432e503bfffdfffdfffd ' 44 Stellen ' Variablen: ' ' -------------------------------------------------------------------------------- SBTab = Text.GetCharacter(9) SBLF = Text.GetCharacter(10) If Program.ArgumentCount = 2 Then FileExists() File1 = Program.GetArgument(1) File2 = Program.GetArgument(2) TextWindow.WriteLine("Comparing...") TextWindow.WriteLine("File 1: " + File1) TextWindow.WriteLine("File 2: " + File2 + SBLF) Else TextWindow.WriteLine("2 Filepaths required!" + SBLF) Help() EndIf ' The following line could be harmful and has been automatically commented. ' Hash1 = LDEncryption.MD5Hash(File.ReadContents(File1)) ' The following line could be harmful and has been automatically commented. ' Hash2 = LDEncryption.MD5Hash(File.ReadContents(File2)) If Hash1 = Hash2 Then TextWindow.WriteLine("Both files are IDENTICAL !") TextWindow.WriteLine(Text.GetCharacter(7)) TextWindow.WriteLine("MD5Hash: " + Hash1 + SBTab + "(" + Text.GetLength(Hash1) + " Stellen)") ' 14/15-stellig For Pos = 1 To Text.GetLength(Hash1) HashDecVal = Text.GetCharacterCode(Text.GetSubText(Hash1, Pos,1)) HashDecStr = Text.Append(HashDecStr, HashDecVal) HashHexStr = Text.Append(HashHexStr, LDMath.Decimal2Base(HashDecVal,16)) EndFor TextWindow.WriteLine("DEC: " + HashDecStr + SBTab + "(" + Text.GetLength(HashDecStr) + " Stellen)") TextWindow.WriteLine("HEX: " + HashHexStr + SBTab + "(" + Text.GetLength(HashHexStr) + " Stellen)" + SBLF) Else TextWindow.WriteLine("Both Files are DIFFERENT !" + SBLF) 'TextWindow.WriteLine(Text.GetCharacter(7)) EndIf ' ////////// SUBs \\\\\\\\\\\ Sub Help HelpTxt = "Qualitative compare 2 files -> Identical or Diffent." + SBLF ' The following line could be harmful and has been automatically commented. ' HelpTxt = HelpTxt + "Syntax: " + LDFile.GetFile(File.GetSettingsFilePath()) + ".exe filepath1 filepath2 [-?,/?]" + SBLF HelpTxt = HelpTxt + "-------" + SBLF TextWindow.WriteLine(HelpTxt) TextWindow.Pause() Program.End() EndSub Sub FileExists args = "" For N = 1 To 2 If LDCall.Function("FOExist", Program.GetArgument(N)) <> "true" Then TextWindow.WriteLine(Program.GetArgument(N) + " NOT found!" + SBLF) TextWindow.Pause() Program.End() EndIf EndFor EndSub Sub FOExist ' The following line could be harmful and has been automatically commented. ' If File.GetDirectories(args[1]) <> "FAILED" Then return = "false" Else ' The following line could be harmful and has been automatically commented. ' If File.ReadContents(args[1]) <> "" Then return = "true" Else ' The following line could be harmful and has been automatically commented. ' If File.CopyFile(args[1], "C:\Temp\D1u2m3m4y5.dummy") = "FAILED" Then return = "false" ' The following line could be harmful and has been automatically commented. ' File.DeleteFile("C:\Temp\D1u2m3m4y5.dummy") Else return = "true" EndIf EndIf EndIf EndSub End>BXG200.sb< Start>BXG803.sb< title = "Curves and lines" zf=1'--------------------zoom mod="RT" '------------wheel mode ww=0 txtp=0 args=0 stp=0 lww=3 'listvars() LDUtilities.ShowNoShapeErrors="False GraphicsWindow.BackgroundColor="#aabbcc cc=0 lsc=0 inn=0 inpn=0 '------------------------hsb params hu=0 sa=0.9 br=0.5 mcurv=0 pp=0 op=90 lmd=1 nct=6'-----------------------------------------------active nodes+1 GraphicsWindow.DrawEllipse (0,0,2,2) For x=1 to 200'---------------------------------------------------------max nodes nr! cs[x]=Shapes.AddEllipse(15,15) Shapes.HideShape (cs[x]) endfor LDDialogs.AddRightClickMenu(LDText.Split ("All__OFF Nodes__ON Nd_________OFF Lines__ON Ln_________OFF Show__ON Sh_______OFF MakeObject MoveObj__ON Mv_________________OFF MAXnod --Addtxt-- RotMode ZoomMode HueMode SatMode LightMode OpactMode --Txt2Path-- txtclr penwd penclr"," "),"") LDDialogs.RightClickMenu =rmmn GraphicsWindow.KeyDown=kdd GraphicsWindow.Title = title Not = "False=True;True=False;" Form() rtt: rst=0 i=1 px=0 py=0 lmd=1 For x=1 To lsc Shapes.Remove (ls[x]) EndFor cc=0 lsc=0 while i < nct tsl=0 msg = "Add point "+i+" / "+(nct-1) ShowInstruction() GetPoint() If FCKeyboard.IsControlPressed and i>2 Then ox=px[i-2] nx=px[i-1] oy=py[i-2] ny=py[i-1] aag= mathplus.GetDegrees ( MathPlus.ATan2(nx-ox,ny-oy)+Math.Pi/2) If aag>180 Then aag=aag-360 elseIf aag<-180 Then aag=aag+360 endif aag=math.Round(aag) ' rr=ldmath.Convert2Radial (px[i-1],py[i-1],px[i-2],py[i-2]) dx=x-px[i-1] dy=y-py[i-1] dst=math.SquareRoot (dx*dx+dy*dy) qq= LDMath.Convert2Cartesian (px[i-1],py[i-1],dst,aag-90 ) 'GraphicsWindow.Title=aag+" : "+dst x=qq[1] y=qq[2] endif ShowPoint() px[i] = x py[i] = y i=i+1 Endwhile msg = "" ShowInstruction() GraphicsWindow.PenColor = "Gray" For c=0 to nct-4 step 2 dpx[1]=px[1+c] dpy[1]=py[1+c] dpx[2]=px[2+c] dpy[2]=py[2+c] dpx[3]=px[3+c] dpy[3]=py[3+c] GraphicsWindow.PenColor="Gray lsc=lsc+1 ls[lsc]=Shapes.AddLine (dpx[1], dpy[1], dpx[2], dpy[2]) lsc=lsc+1 ls[lsc]=Shapes.AddLine (dpx[2], dpy[2], dpx[3], dpy[3]) GraphicsWindow.PenColor="Red crc=c+1 DrawQuadraticBezier() endfor For f=1 to nct LDShapes.ZIndex(cs[f],5000+f) endfor GraphicsWindow .MouseMove =mmww LDShapes.ShapeEvent=sevv LDEvents.MouseWheel =mwhh While 1=1 Program.Delay(5) If dopann=1 and inn=0 And inpn=0 Then inn=1 mpan () inn=0 dopann =0 ElseIf rst=1 then Goto rtt ElseIf mobj=1 then oo=0 nn=1 For f=1 to nct For g=0 to Array.GetItemCount (lmt[f]) aa= LDText.Split (lmt[f][g],":") oo[nn][1]=aa[1] oo[nn][2]=aa[2] nn=nn+1 endfor endfor mobj=0 'TextWindow.WriteLine (oo) pp=pp+1 pol[pp]=LDShapes.Addpolygon(oo) LDShapes.BrushColour (pol[pp],"Green") Shapes.SetOpacity (pol[pp],80) oo=0 Endif endwhile '---------------------------------subs---------------------------------**************************************** Sub sevv If FCKeyboard.IsShiftPressed Then js= LDShapes.LastEventShape jt= LDShapes.LastEventType If jt="MouseDown" Then vv="" For fx=1 To text.GetLength(js) ct=text.GetSubText (js,fx,1) If Text.IsSubText("0123456789",ct) then vv=TextPlus.Append (vv,ct) endif endfor tsl=vv ndsell () endif endif EndSub Sub hidenodes For zx=1 to 200 Shapes.HideShape (cs[zx]) endfor EndSub Sub mwhh'------------------------------mswheel options--------------------------------- If txtp=1 then If FCKeyboard.IsControlPressed Then fsz=fsz+ldevents.LastMouseWheelDelta For rx=1 To Array.GetItemCount (wtx) LDShapes.Font (wtx[rx],fnt,fsz,fnb,fni) EndFor elseIf txcm=1 then hu=hu+LDEvents.LastMouseWheelDelta*5 GraphicsWindow.Title=hu For rx=1 To Array.GetItemCount (wtx) LDShapes.PenColour (wtx[rx],LDColours.HSLtoRGB (hu+rx*5,sa,br)) EndFor ElseIf pncm=1 then lww=lww+LDEvents.LastMouseWheelDelta*3 If lww<0 then lww=0 endif For tt=1 to nct -1 For tq=1 to Array.GetItemCount(dline[tt]) LDShapes.PenWidth (dline[tt][tq],lww) endfor endfor ElseIf pncl=1 then hu=hu+LDEvents.LastMouseWheelDelta*5 hi=0 For tt=1 to nct -1 For tq=1 to Array.GetItemCount(dline[tt]) LDShapes.PenColour (dline[tt][tq],LDColours.HSLtoRGB (hu+hi,sa,br)) hi=hi+5 endfor endfor else stp=stp+ldevents.LastMouseWheelDelta*3 retxt() endif elseIf mod="RT" Then ann=ann+LDEvents.LastMouseWheelDelta*5 LDShapes.RotateAbout (pol[pp], GraphicsWindow.MouseX , GraphicsWindow.MouseY,ann ) elseif mod="ZM" Then zf=zf+LDEvents.LastMouseWheelDelta/10 Shapes.Zoom (pol[pp],zf,zf) elseif mod="HU" Then hu=hu+LDEvents.LastMouseWheelDelta*5 elseif mod="SA" Then sa=sa+LDEvents.LastMouseWheelDelta/20 GraphicsWindow.Title ="S:"+sa elseif mod="BR" Then br=br+LDEvents.LastMouseWheelDelta/20 GraphicsWindow.Title ="B:"+br elseif mod="OP" Then op=op+LDEvents.LastMouseWheelDelta*5 If op>100 then op=100 ElseIf op<0 then op=0 endif EndIf hu=math.Remainder (hu,360) If sa<0 Then sa=0 ElseIf sa>1 then sa=1 endif If br<0 Then br=0 ElseIf br>1 then br=1 endif LDShapes.BrushColour (pol[pp], LDColours.HSLtoRGB(hu,sa,br)) Shapes.SetOpacity (pol[pp],op) EndSub Sub rmmn'---------------------------------------------------------rightclickmenu-------------*********** lm= LDDialogs.LastRightClickMenuItem If lm=1 Then txcm=0 pncm=0 pncl=0 For x=1 To cc Shapes.HideShape (cs[x]) EndFor For x=1 To lsc Shapes.HideShape (ls[x]) EndFor lmd=0 elseIf lm=2 Then For x=1 To cc Shapes.ShowShape (cs[x]) EndFor elseIf lm=3 Then For x=1 To cc Shapes.HideShape (cs[x]) EndFor elseIf lm=4 Then For xx=1 To lsc Shapes.showShape (ls[xx]) EndFor lmd=1 elseIf lm=5 Then For x=1 To lsc Shapes.HideShape (ls[x]) EndFor lmd=0 elseIf lm=6 Then ssln=1 elseIf lm=7 Then ssln=0 elseIf lm=8 Then mobj=1 elseIf lm=9 Then mcurv=1 elseIf lm=10 Then mcurv=0 elseIf lm=11 Then nd=fcDialogs.AskForTextLine("MAXnodes:") If nd="" then 'nixx else nct=nd rst=1 hidenodes () unlins() endif elseif lm=13 then 'RotMode ZoomMode HueMode SatMode LightMode OpactMode mod="RT elseif lm=14 then mod="ZM elseif lm=15 then mod="HU elseif lm=16 then mod="SA elseif lm=17 then mod="BR elseif lm=18 then mod="OP elseif lm=12 then cd=fcDialogs.AskForTextLine("Char:") Shapes.Remove(tx) tx=Shapes.AddText(cd) Shapes.SetOpacity (cd,60) LDShapes.Font (tx,"Arial",500,"True","False") Shapes.Move(tx,100,100) LDShapes.PenColour (tx,"Gray") LDShapes.ZIndex (tx,-100) elseif lm=19 then 'text2path cd=fcDialogs.AskForTextLine("Text:") ff=LDDialogs.Font(LDText.Split ("Arial 12 True False"," ")) For wx=1 to Text.GetLength (cd) wtx[wx]=shapes.AddText(Text.GetSubText (cd,wx,1)) LDShapes.Font(wtx[wx],ff[1],ff[2],ff[3],ff[4]) fsz=ff[2] fnt=ff[1] fnb=ff[3] fni=ff[4] endfor stp=1 retxt() txtp=1 elseif lm=20 then txcm=1 pncm=0 pncl=0 elseif lm=21 then pncm=1 txcm=0 pncl=0 elseif lm=22 then pncl=1 pncm=0 txcm=0 endif EndSub Sub kdd'---------------------------------------------------keys-------------------------------- lky=GraphicsWindow.LastKey 'GraphicsWindow.Title =lky If lky="Back" Then Shapes.HideShape (cs[cc]) cc=cc-1 i=i-1 msg = "Add point "+i+" / "+(nct-1) ShowInstruction() ElseIf lky="Tab" then tsl=tsl+1 If tsl=nct then tsl=1 endif ndsell() endif EndSub Sub retxt'-------------------------------------------------------text2path********************* co=1 if rmm<>1 then rmm=1 For ft=1 To nct-1 For rx=1 To Array.GetItemCount(lmt[ft]) pq=LDText.Split (lmt[ft][rx],":") pmm[co]=pq co=co+1 EndFor EndFor endif For rx=1 To Array.GetItemCount (wtx) 'ldMath.Convert2Cartesian (qx,qy,d[1]["dst"] ldShapes.Centre (wtx[rx],pmm[rx+stp][1],pmm[rx+stp][2]) LDShapes.ZIndex (wtx[rx],1000+rx) endfor endsub Sub ndsell For kx=1 to nct-1 If Math.Remainder (kx,2)=1 then LDShapes.BrushColour (cs[kx],"Blue") Else LDShapes.BrushColour (cs[kx],"Cyan") EndIf endfor If Math.Remainder (tsl,2)=1 then LDShapes.BrushColour (cs[tsl],"Red") Else LDShapes.BrushColour (cs[tsl],"Magenta") EndIf EndSub Sub Form gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.FontName = "Trebuchet MS" GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 instruction = Shapes.AddText("") Shapes.Move(instruction, 10, 10) GraphicsWindow.MouseDown = OnMouseDown EndSub Sub DrawQuadraticBezier ' param px, py - array of three control points for quadratic Bezier curve ff=0 For k = 0 To 1 Step 0.05 x1 = dpx[1] + k * (dpx[2] - dpx[1]) y1 = dpy[1] + k * (dpy[2] - dpy[1]) x2 = dpx[2] + k * (dpx[3] - dpx[2]) y2 = dpy[2] + k * (dpy[3] - dpy[2]) GraphicsWindow.PenColor = "Gray" if ssln=1 then line = Shapes.AddLine(x1, y1, x2, y2) lmt[crc][0]=x1+":"+y1 EndIf x = x1 + k * (x2 - x1) y = y1 + k * (y2 - y1) If 0 < k Then ff=ff+1 lmt[crc][ff]=x+":"+y GraphicsWindow.PenColor = "Red dline[crc][ff] = Shapes.AddLine(_x, _y, x, y) LDCall.Function4("calcc",_x, _y, x, y) dpar[crc][ff]=cdst+":"+cang EndIf _x = x ' last x _y = y ' last y msg = "k = " + k If ssln=1 then Program.Delay(30) Shapes.Remove(line) EndIf EndFor EndSub Sub GetPoint ' return x, y - clicked point msDwn = "False" While Not[msDwn] Program.Delay(30) EndWhile x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY EndSub Sub mmww if Mouse.IsLeftButtonDown then mx= GraphicsWindow.MouseX my= GraphicsWindow.MouseY If (mx<>omx Or my<>omy) Then dopann=1 endif omx=x omy=y EndIf EndSub Sub OnMouseDown msDwn = "True" If mcurv=1 And mouse.IsLeftButtonDown Then ldShapes.Centre (pol[pp],GraphicsWindow.MouseX,GraphicsWindow.MouseY ) 'mcurv=0 elseif mouse.IsLeftButtonDown and not [FCKeyboard.IsShiftPressed ] then mpan() endif EndSub Sub mpan If tsl>0 Then inpn=1 rmm=0 x= GraphicsWindow.MouseX y= GraphicsWindow.MouseY If FCKeyboard.IsControlPressed and tsl>2 Then i=tsl ox=px[i-2] nx=px[i-1] oy=py[i-2] ny=py[i-1] aag= mathplus.GetDegrees ( MathPlus.ATan2(nx-ox,ny-oy)+Math.Pi/2) If aag>180 Then aag=aag-360 elseIf aag<-180 Then aag=aag+360 endif aag=math.Round(aag) ' rr=ldmath.Convert2Radial (px[i-1],py[i-1],px[i-2],py[i-2]) dx=x-px[i-1] dy=y-py[i-1] dst=math.SquareRoot (dx*dx+dy*dy) qq= LDMath.Convert2Cartesian (px[i-1],py[i-1],dst,aag-90 ) 'GraphicsWindow.Title=aag+" : "+dst x=qq[1] y=qq[2] ElseIf FCKeyboard.IsAltPressed and tsl>1 and tsl< nct-1 then i=tsl ox=px[i+1] nx=px[i-1] oy=py[i+1] ny=py[i-1] aag= mathplus.GetDegrees ( MathPlus.ATan2(nx-ox,ny-oy)+Math.Pi/2) If aag>180 Then aag=aag-360 elseIf aag<-180 Then aag=aag+360 endif aag=math.Round(aag) ' GraphicsWindow.Title =aag dx=px[i+1]-px[i-1] dy=py[i+1]-py[i-1] dst=math.SquareRoot (dx*dx+dy*dy)/2 qq= LDMath.Convert2Cartesian (px[i+1],py[i+1],dst,aag-90 ) 'GraphicsWindow.Title=aag+" : "+dst x=qq[1] y=qq[2] endif px[tsl ] = x py[tsl ] = y ldShapes.Centre (cs[tsl], x,Y ) Shapes.Remove (ls[tsl]) Shapes.Remove (ls[tsl-1]) If tsl>1 and lmd=1 then ls[tsl-1]=Shapes.AddLine (x,y,px[tsl-1],py[tsl-1]) EndIf If tsl1 then DrawQuadraticBezier() endif dpx [3]=px[tsl+2] dpy [3]=py[tsl+2] dpx [1]=x dpy [1]=y dpx [2]=px[tsl+1] dpy [2]=py[tsl+1] crc=tsl If tsl2 Then LDShapes.BrushColour (cs[cc],"Brown") Else LDShapes.BrushColour (cs[cc],"Blue") EndIf EndSub Sub listvars sbb= (FCExtensions.GetAllSubs()) ww=FCExtensions.GetAllVariables() TextWindow.WriteLine (ldtext.Replace (sbb,";",ESLText.CRLF) ) aa=LDArray.Create(Array.GetItemCount(ww)) For f=1 to Array.GetItemCount(ww) LDArray.SetValue(aa,f,ww[f]) endfor LDArray.Sort (aa) For f=1 to Array.GetItemCount(ww) TextWindow.WriteLine (f+":"+LDArray.GetValue (aa,f)) endfor EndSub Sub calcc dx=args[3]-args[1] dy=args[4]-args[2] aag= mathplus.GetDegrees ( MathPlus.ATan2(dx,dy)+Math.Pi/2) If aag>180 Then aag=aag-360 elseIf aag<-180 Then aag=aag+360 endif cang=math.Round(aag) cdst=math.SquareRoot (dx*dx+dy*dy)/2 EndSub End>BXG803.sb< Start>BXK911.sb< GraphicsWindow.Title = "Shinkansen" gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "#222222" GraphicsWindow.BrushColor = "White" scale = 1 ' car #1 Shapes_Init_1() name = "Train 1" Group_Add() i = nGroup grp = group[i] x = grp["x"] + gw tx[1] = x y = grp["y"] Group_Move() tw[1] = grp["width"] car = 2 Shapes_Init_2() For car = 2 To 15 name = "Train " + car Group_Add() i = nGroup grp = group[i] x = tx[car - 1] + tw[car - 1] + 10 tx[car] = x y = grp["y"] Group_Move() tw[car] = grp["width"] EndFor Shapes_Init_1() ' car #16 name = "Train " + car Group_Add() i = nGroup grp = group[i] x = tx[car - 1] + tw[car - 1] + 10 y = grp["y"] Group_Move() angle = 180 Group_Flip() GraphicsWindow.BackgroundColor = "SkyBlue" Program.Delay(200) Timer.Interval=150 Timer.Tick=tmm sub tmm ls=ls+1 ll=LDMath.Sin(ls)/2+.3 GraphicsWindow.BackgroundColor=LDColours.HSLtoRGB(220 .5 ll) EndSub While 1=1 For j = 1 To 330 For i = 1 To car grp = group[i] x = grp["x"] - 40 y = grp["y"] Group_Move() EndFor Program.Delay(40) EndFor For j = 1 To 235 For i = 1 To car grp = group[i] x = grp["x"] + 60 y = grp["y"] Group_Move() EndFor Program.Delay(30) EndFor EndWhile Sub Group_Add Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) nGroup = nGroup + 1 grp = "" grp["name"] = name grp["x"] = shX grp["y"] = shY grp["angle"] = 0 grp["dir"] = 1 Shapes_CalcWidthAndHeight() grp["width"] = shWidth grp["height"] = shHeight grp["cx"] = shWidth / 2 grp["cy"] = shHeight / 2 s = scale grp["scale"] = s For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text|btn", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If Text.IsSubText("text|btn", shp["func"]) Then fs = shp["fs"] GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] If shp["fb"] = "False" Then GraphicsWindow.FontBold = "False" Else GraphicsWindow.FontBold = "True" EndIf EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If shp["func"] = "btn" Then shp["obj"] = Controls.AddButton(shp["caption"], shX + x * s, shY + y * s) Else Shapes.Move(shp["obj"], shX + x * s, shY + y * s) EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor grp["shape"] = shape group[nGroup] = grp y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Group_Flip Stack.PushValue("local", angle) Stack.PushValue("local", j) grp = group[i] gx = grp["x"] gy = grp["y"] shape = grp["shape"] n = Array.GetItemCount(shape) angle = Math.Remainder(angle, 360) If angle < 0 Then angle = angle + 360 EndIf If (angle <= 90) Or (270 < angle) Then sign = 1 Else sign = -1 EndIf If (grp["flip"] <= 90) Or (270 < grp["flip"]) Then lastSign = 1 Else lastSign = -1 EndIf _a = Math.GetRadians(angle) scaleX = Math.Cos(_a) For j = 1 To n shp = shape[j] Shapes.Zoom(shp["obj"], Math.Abs(scaleX), 1) cx = shp["x"] + shp["width"] / 2 fx = (cx - grp["cx"]) * scaleX + grp["cx"] _rx = fx - shp["width"] / 2 shp["rx"] = _rx Shapes.Move(shp["obj"], _rx + gx, shp["y"] + gy) If sign <> lastSign Then If shp["angle"] <> "" Then shp["angle"] = -shp["angle"] Shapes.Rotate(shp["obj"], shp["angle"]) EndIf If shp["func"] = "line" Then Stack.PushValue("local", angle) If sign = -1 Then dx = shp["x2"] - shp["x1"] dy = shp["y2"] - shp["y1"] If dx = 0 Then angle = 0 Else _a = Math.ArcTan(dy / dx) angle = Math.GetDegrees(_a) EndIf Else angle = 0 EndIf Shapes.Rotate(shp["obj"], -2 * angle) angle = Stack.PopValue("local") EndIf EndIf shape[j] = shp EndFor grp["flip"] = angle grp["shape"] = shape group[i] = grp j = Stack.PopValue("local") angle = Stack.PopValue("local") EndSub Sub Group_Move Stack.PushValue("local", j) grp = group[i] s = grp["scale"] grp["x"] = x grp["y"] = y shape = grp["shape"] n = Array.GetItemCount(shape) For j = 1 To n shp = shape[j] _x = shp["rx"] _y = shp["ry"] _w2 = shp["width"] / 2 _h2 = shp["height"] / 2 Shapes.Move(shp["obj"], grp["x"] + (_x - _w2) * s + _w2, grp["y"] + (_y - _h2) * s + _h2) EndFor group[i] = grp j = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight For i = 1 To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Init_1 shX = 95 ' x offset shY = 296 ' y offset shape = "" shape[1] = "func=tri;x=121;y=1;x1=6;y1=0;x2=0;y2=8;x3=13;y3=8;pw=0;bc=#D9D9D9 shape[2] = "func=rect;x=128;y=1;width=6;height=8;pw=0;bc=#D9D9D9 shape[3] = "func=ell;x=128;y=0;width=14;height=2;pw=0;bc=#D9D9D9 shape[4] = "func=rect;x=85;y=19;width=56;height=8;pw=0;bc=#FFFFFF shape[5] = "func=tri;x=61;y=13;x1=23;y1=0;x2=0;y2=28;x3=47;y3=28;pw=1;pc=#D9D9D9;bc=#F2F2F2 shape[6] = "func=ell;x=2;y=38;width=133;height=77;pw=0;bc=#FFFFFF shape[7] = "func=rect;x=94;y=26;width=667;height=69;pw=0;bc=#FFFFFF shape[8] = "func=ell;x=81;y=7;width=122;height=18;pw=0;bc=#FFFFFF shape[9] = "func=rect;x=142;y=7;width=615;height=17;pw=0;bc=#D9D9D9 shape[10] = "func=rect;x=320;y=106;width=140;height=14;pw=0;bc=#262626 shape[11] = "func=rect;x=472;y=106;width=16;height=12;pw=0;bc=#262626 shape[12] = "func=rect;x=189;y=106;width=29;height=14;pw=0;bc=#262626 shape[13] = "func=rect;x=237;y=106;width=21;height=14;pw=0;bc=#262626 shape[14] = "func=rect;x=276;y=106;width=31;height=14;pw=0;bc=#262626 shape[15] = "func=rect;x=68;y=104;width=95;height=13;pw=0;bc=#262626 shape[16] = "func=rect;x=599;y=104;width=95;height=13;pw=0;bc=#262626 shape[17] = "func=ell;x=142;y=106;width=25;height=25;pw=0;bc=#404040 shape[18] = "func=ell;x=68;y=106;width=25;height=25;pw=0;bc=#404040 shape[19] = "func=ell;x=595;y=106;width=25;height=25;pw=0;bc=#404040 shape[20] = "func=ell;x=675;y=106;width=25;height=25;pw=0;bc=#404040 shape[21] = "func=rect;x=10;y=96;width=747;height=14;pw=0;bc=#002060 shape[22] = "func=rect;x=140;y=23;width=617;height=3;pw=0;bc=#002060 shape[23] = "func=tri;x=0;y=96;x1=9;y1=0;x2=0;y2=28;x3=19;y3=28;pw=0;bc=#002060 shape[24] = "func=rect;x=9;y=107;width=45;height=17;pw=0;bc=#002060 shape[25] = "func=ell;x=17;y=69;width=12;height=12;pw=1;pc=#BFBFBF;bc=#A6A6A6 shape[26] = "func=ell;x=93;y=42;width=50;height=23;angle=335.9578;pw=0;bc=#002060 shape[27] = "func=rect;x=132;y=38;width=629;height=30;pw=0;bc=#002060 shape[28] = "func=tri;x=103;y=38;x1=31;y1=0;x2=0;y2=30;x3=62;y3=30;pw=0;bc=#002060 shape[29] = "func=rect;x=130;y=35;width=17;height=53;pw=1;pc=#A6A6A6;bc=Transparent shape[30] = "func=rect;x=158;y=34;width=18;height=57;pw=1;pc=#A6A6A6;bc=Transparent shape[31] = "func=rect;x=637;y=31;width=18;height=57;pw=1;pc=#A6A6A6;bc=Transparent shape[32] = "func=tri;x=22;y=103;x1=31;y1=0;x2=0;y2=21;x3=62;y3=21;angle=180;pw=0;bc=#002060 shape[33] = "func=rect;x=114;y=25;width=9;height=10;pw=1;pc=#D9D9D9;bc=#F2F2F2 shape[34] = "func=rect;x=203;y=43;width=17;height=19;pw=0;bc=#F2F2F2 shape[35] = "func=rect;x=227;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[36] = "func=rect;x=285;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[37] = "func=rect;x=342;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[38] = "func=rect;x=399;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[39] = "func=rect;x=457;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[40] = "func=rect;x=514;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[41] = "func=rect;x=572;y=43;width=48;height=18;pw=0;bc=#F2F2F2 shape[42] = "func=rect;x=162;y=40;width=10;height=19;pw=0;bc=#F2F2F2 shape[43] = "func=rect;x=640;y=40;width=10;height=19;pw=0;bc=#F2F2F2 shape[44] = "func=rect;x=136;y=44;width=5;height=19;pw=0;bc=#F2F2F2 shape[45] = "func=rect;x=144;y=15;width=39;height=4;pw=0;bc=#7F7F7F shape[46] = "func=rect;x=232;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[47] = "func=rect;x=288;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[48] = "func=rect;x=344;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[49] = "func=rect;x=400;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[50] = "func=rect;x=466;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[51] = "func=rect;x=519;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[52] = "func=rect;x=572;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[53] = "func=rect;x=692;y=14;width=39;height=4;pw=0;bc=#7F7F7F shape[54] = "func=rect;x=64;y=38;width=30;height=9;angle=354.8378;pw=0;bc=#FFFFFF shape[55] = "func=line;x=81;y=18;x1=0;y1=0;x2=11;y2=2;pw=1;pc=#D9D9D9;bc=#000000 shape[56] = "func=tri;x=99;y=13;x1=3;y1=0;x2=0;y2=23;x3=6;y3=23;angle=90;pw=0;bc=#F2F2F2 shape[57] = "func=rect;x=93;y=25;width=21;height=11;pw=0;bc=#F2F2F2 shape[58] = "func=line;x=92;y=21;x1=0;y1=0;x2=22;y2=4;pw=1;pc=#D9D9D9;bc=#000000 shape[59] = "func=line;x=88;y=22;x1=0;y1=14;x2=11;y2=0;pw=1;pc=#D9D9D9;bc=#0000001 shape[60] = "func=line;x=64;y=37;x1=0;y1=1;x2=25;y2=0;pw=1;pc=#D9D9D9;bc=#000000 shape[61] = "func=line;x=89;y=35;x1=0;y1=1;x2=25;y2=0;pw=1;pc=#D9D9D9;bc=#000000 EndSub Sub Shapes_Init_2 shX = 0 ' x offset shY = 303 ' y offset shape = "" shape[1] = "func=rect;x=0;y=19;width=746;height=69;pw=0;bc=#FFFFFF shape[2] = "func=rect;x=4;y=0;width=738;height=17;pw=0;bc=#D9D9D9 shape[3] = "func=rect;x=313;y=98;width=140;height=14;pw=0;bc=#262626 shape[4] = "func=rect;x=465;y=98;width=16;height=12;pw=0;bc=#262626 shape[5] = "func=rect;x=183;y=98;width=29;height=14;pw=0;bc=#262626 shape[6] = "func=rect;x=231;y=98;width=21;height=14;pw=0;bc=#262626 shape[7] = "func=rect;x=269;y=98;width=31;height=14;pw=0;bc=#262626 shape[8] = "func=rect;x=61;y=97;width=95;height=13;pw=0;bc=#262626 shape[9] = "func=rect;x=592;y=97;width=95;height=13;pw=0;bc=#262626 shape[10] = "func=ell;x=135;y=98;width=25;height=25;pw=0;bc=#404040 shape[11] = "func=ell;x=61;y=98;width=25;height=25;pw=0;bc=#404040 shape[12] = "func=ell;x=588;y=98;width=25;height=25;pw=0;bc=#404040 shape[13] = "func=ell;x=668;y=98;width=25;height=25;pw=0;bc=#404040 shape[14] = "func=rect;x=4;y=89;width=738;height=14;pw=0;bc=#002060 shape[15] = "func=rect;x=4;y=16;width=738;height=3;pw=0;bc=#002060 shape[16] = "func=rect;x=0;y=31;width=746;height=30;pw=0;bc=#002060 shape[17] = "func=rect;x=19;y=27;width=18;height=57;pw=1;pc=#A6A6A6;bc=Transparent shape[18] = "func=rect;x=721;y=24;width=18;height=57;pw=1;pc=#A6A6A6;bc=Transparent shape[19] = "func=rect;x=191;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[20] = "func=rect;x=249;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[21] = "func=rect;x=306;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[22] = "func=rect;x=363;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[23] = "func=rect;x=421;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[24] = "func=rect;x=478;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[25] = "func=rect;x=536;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[26] = "func=rect;x=22;y=32;width=11;height=20;pw=1;pc=#D9D9D9;bc=#F2F2F2 shape[27] = "func=rect;x=724;y=32;width=11;height=20;pw=1;pc=#D9D9D9;bc=#F2F2F2 shape[28] = "func=rect;x=137;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[29] = "func=rect;x=225;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[30] = "func=rect;x=281;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[31] = "func=rect;x=337;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[32] = "func=rect;x=394;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[33] = "func=rect;x=460;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[34] = "func=rect;x=513;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[35] = "func=rect;x=566;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[36] = "func=rect;x=686;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[37] = "func=rect;x=134;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[38] = "func=rect;x=593;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[39] = "func=rect;x=77;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[40] = "func=rect;x=651;y=36;width=48;height=18;pw=0;bc=#F2F2F2 shape[41] = "func=rect;x=25;y=7;width=39;height=4;pw=0;bc=#7F7F7F shape[42] = "func=rect;x=81;y=7;width=39;height=4;pw=0;bc=#7F7F7F EndSub End>BXK911.sb< Start>BXN264.sb< GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp Screen_Width = 800 Screen_Height = 600 Object_Radius = 100 Object_Corners = 10 Object_VY = 0 Object_Angle = 0 Gravity = 0.5 Friction = 0.98 AirResistance = 0.98 Object_Rotation = 0 Ground = Screen_Height-50 Pi = Math.Pi Corner_TG = -1 GraphicsWindow.Width = Screen_Width GraphicsWindow.Height = Screen_Height Shapes.AddLine(0, Ground, Screen_Width, Ground) GraphicsWindow.PenWidth = 0.3 Shapes.AddLine(Screen_Width/2, 0, Screen_Width/2, Screen_Height) Shapes.AddLine(0, Screen_Height/2, Screen_Width, Screen_Height/2) GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "LightBlue" Line = Shapes.AddLine(0, Screen_Height, 0, 0) Object_Initialize() Object_X = Screen_Width/2 Object_Y = Screen_Height/2 Object_Arrange_Corners() Draw_Text() GraphicsWindow.PenColor = "Green" 'Main loop: While GraphicsWindow.LastKey <> "Escape" Time_Start = Clock.ElapsedMilliseconds Object_VY = Object_VY + Gravity Object_Y = Object_Y + Object_VY Object_Rotation = Object_Rotation * AirResistance Object_Angle = Object_Angle + Object_Rotation Controls() Object_Update() Object_Draw() If(Mouse.IsLeftButtonDown)Then Object_X = GraphicsWindow.MouseX Object_Y = GraphicsWindow.MouseY Object_VY = 0 Object_Arrange_Corners() EndIf Time_Passed = Clock.ElapsedMilliseconds - Time_Start PerfectDelay = 15 - Time_Passed If PerfectDelay > 0 Then Program.Delay(PerfectDelay) EndIf EndWhile Program.End() 'This ends the program when escape is pressed Sub OnKeyDown Key = GraphicsWindow.LastKey If (Key = "Left") Then Left = "True" ElseIf (Key = "Right") Then Right = "True" endif EndSub Sub OnKeyUp Key = GraphicsWindow.LastKey If (Key = "Left") Then Left = "False" ElseIf (Key = "Right") Then Right = "False" endif EndSub Sub Controls If(Left = "True")Then Object_Rotation = Object_Rotation - 0.5 ElseIf(Right = "True")Then Object_Rotation = Object_Rotation + 0.5 EndIf EndSub Sub Object_Arrange_Corners For i = 1 To Object_Corners Corner_X[i] = Object_X + Math.Cos(Object_Angle + Corner_Angle[i]) * Corner_Radius[i] Corner_Y[i] = Object_Y + Math.Sin(Object_Angle + Corner_Angle[i]) * Corner_Radius[i] EndFor EndSub Sub Object_Initialize GraphicsWindow.BrushColor = "Red" GraphicsWindow.PenWidth = 0 For i = 1 To Object_Corners Corner[i] = Shapes.AddEllipse(5,5) Corner_Angle[i] = i*(360/Object_Corners) Corner_Radius[i] = Math.GetRandomNumber(Object_Radius-Object_Radius/3) + Object_Radius/3 EndFor Corner[Object_Corners+1] = Shapes.AddEllipse(10, 10) GraphicsWindow.PenWidth = 1 Xsum = 0 Ysum = 0 'Randomly add Corners in the right angle: For i = 1 To Object_Corners Corner_X[i] = Object_Radius/2 + Math.Cos(Math.GetRadians(Corner_Angle[i])) * Corner_Radius[i] Corner_Y[i] = Object_Radius/2 + Math.Sin(Math.GetRadians(Corner_Angle[i])) * Corner_Radius[i] Xsum = Xsum + Corner_X[i] Ysum = Ysum + Corner_Y[i] EndFor 'Get the Centroid of the Corners: Object_X = Xsum/Object_Corners Object_Y = Ysum/Object_Corners 'Recalculate the radius for each Corner to keep the Objects X and Y as the centroid: For i = 1 To Object_Corners 'Is it possiblle that i made a mistake somewhere?! Xdist = Object_X - Corner_X[i] Ydist = Object_Y - Corner_Y[i] Corner_Radius[i] = Math.SquareRoot(Xdist*Xdist + Ydist*Ydist) EndFor EndSub Sub Object_Update Object_Checkwalls() 'Rotate Object corners For i = 1 To Object_Corners theta = Math.GetRadians(Object_Angle + Corner_Angle[i]) Corner_X[i] = Object_X + Math.Cos(theta) * Corner_Radius[i] Corner_Y[i] = Object_Y + Math.Sin(theta) * Corner_Radius[i] Shapes.Move(Corner[i],Corner_X[i]-2.5,Corner_Y[i]-2.5) endfor 'UPDATE Object Shapes.Move(Corner[Object_Corners+1], Object_X-5, Object_Y-5) EndSub Sub Object_Draw Lasti = Object_Corners For i = 1 To Object_Corners Shapes.Remove(Corner_Line[i]) Corner_Line[i] = Shapes.AddLine(Corner_X[i], Corner_Y[i], Corner_X[Lasti], Corner_Y[Lasti]) Lasti = i EndFor EndSub Sub Object_Checkwalls 'Find lowest corner - we only want one on the ground at any point in time iLow = 1 For i = 2 To Object_Corners If (Corner_Y[i] > Corner_Y[iLow]) Then iLow = i EndIf EndFor 'Check this corner for on the ground and find block centre - due to small rounding errors with the trig we need to to check for 'near' If (Corner_Y[iLow] > Ground Or Math.Abs(Corner_Y[iLow]-Ground) < 1) Then 'if under ground or distance to it <1 then: Corner_Y[iLow] = Ground Object_VY = 0 theta = Math.GetRadians(Object_Angle+Corner_Angle[iLow] + 180) Object_X = Corner_X[iLow] + Math.Cos(theta) * Corner_Radius[iLow] Object_Y = Corner_Y[iLow] + Math.Sin(theta) * Corner_Radius[iLow] Object_Rotation = Object_Rotation * Friction Object_Rotation = Object_Rotation + (Object_X - Corner_X[iLow])*0.002 Shapes.Move(Line, Corner_X[iLow], 0) EndIf EndSub Sub Draw_Text GraphicsWindow.BrushColor = "DeepSkyBlue" GraphicsWindow.DrawText(20, 20, "- Use the mouse to drag and drop the Object") GraphicsWindow.DrawText(20, 40, "- The blue line marks the Corner that is touching the Ground") GraphicsWindow.DrawText(20, 60, "- Use the arrow keys to rotate the Object") EndSub End>BXN264.sb< Start>BXQ447.sb< GraphicsWindow.Show() GraphicsWindow.CanResize = 0 GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.BackgroundColor = "blace" Mouse.HideCursor() Turtle.Show() Turtle.Speed = 10 Res: GraphicsWindow.Clear() Turtle.X = 400 Turtle.Y = 300 T = Math.GetRandomNumber(360) A = 10 While Turtle.X>0 And Turtle.Y>0 GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor() Turtle.Move(A) Turtle.Turn(T) A = A + 2 EndWhile Program.Delay(5000) Goto Res End>BXQ447.sb< Start>BXQ947.sb< 'requires FC Extension. Get The FC Extension@ http://tinyurl.com/ydze8u9 GraphicsWindow.Hide() logincreds = Dialogs.AskForLoginCredentials() If (logincreds = "usename:password") Then '*** GraphicsWindow.ShowMessage("Login Correct","Message") Else Dialogs.ShowMessageAsError("Login Incorrect") EndIf '***put your userame and password where you see usename:password 'by replacing "username" with your username and "password" with 'your password. remember to keep the ":" (colon) End>BXQ947.sb< Start>BXT756.sb< ' Soldier -- By Krueg -- June 2012 ' ARROWS to move ' SPACE or UP to jump ' ESCAPE to quit ' Credit goes to GoToLoop, NaochanON, and litedev for helping to make this program better. ' Thank You for your suggestions! debug = "unTrue" SetupVariables() SetupPlayField() SetupWindow() SetupImages() GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp While lives > 0 'This is the main loop '---------------------------------------------------------------------------------Calculate the jump direction and speed If Jump Then ManY = ManY + JumpCurentSpeed 'Adjust ManY for the jump If JumpCurentSpeed < JumpPower Then 'The man will only fall this fast JumpCurentSpeed = JumpCurentSpeed + JumpInc 'Add for gravity EndIf EndIf If ManY > gh-64 Then 'The man landed on the bottom of the screen Jump = "" ManY = gh-64 'Put the man at the right height ElseIf ManY < 32 Then 'The man hit the roof JumpCurentSpeed = .4 EndIf '---------------------------------------------------------------------------------Falling off platforms, check for stars and spikes If ManY = pfy5-64 And Jump = "" Then 'Check conditions of the bottom row of platforms If (pf5[pfx] > 0 And pf5[pfx] < 50) Or (pf5[pfx-1] > 0 And pf5[pfx-1] < 50) Or (pf5[pfx-2] > 0 And pf5[pfx-2] < 50) Or (pf5[pfx-3] > 0 And pf5[pfx-3] < 50) Or (pf5[pfx-4] > 0 And pf5[pfx-4] < 50) Then Else Jump = "True" JumpCurentSpeed = JumpInc EndIf If pf5[pfx] > 50 And pf5[pfx] < 70 Then 'Did the man hit a star? Shapes.Move(star[pf5[pfx]],-32,pfy5) pf5[pfx] = "" Score = Score + 10 StarCount = StarCount - 1 'Sound.PlayClick() EndIf If pf5[pfx] > 70 And pf5[pfx] < 100 Then 'Did the man hit a spike? HitSpike() EndIf ElseIf ManY = pfy4-64 And Jump = "" Then 'Check conditions of the fourth row of platforms If (pf4[pfx] > 0 And pf4[pfx] < 50) Or (pf4[pfx-1] > 0 And pf4[pfx-1] < 50) Or (pf4[pfx-2] > 0 And pf4[pfx-2] < 50) Or (pf4[pfx-3] > 0 And pf4[pfx-3] < 50) Or (pf4[pfx-4] > 0 And pf4[pfx-4] < 50) Then Else Jump = "True" JumpCurentSpeed = JumpInc EndIf If pf4[pfx] > 50 And pf4[pfx] < 70 Then 'Did the man hit a star? Shapes.Move(star[pf4[pfx]],-32,pfy4) pf4[pfx] = "" Score = Score + 10 StarCount = StarCount - 1 'Sound.PlayClick() EndIf If pf4[pfx] > 70 And pf4[pfx] < 100 Then 'Did the man hit a spike? HitSpike() EndIf ElseIf ManY = pfy3-64 And Jump = "" Then 'Check conditions of the third row of platforms If (pf3[pfx] > 0 And pf3[pfx] < 50) Or (pf3[pfx-1] > 0 And pf3[pfx-1] < 50) Or (pf3[pfx-2] > 0 And pf3[pfx-2] < 50) Or (pf3[pfx-3] > 0 And pf3[pfx-3] < 50) Or (pf3[pfx-4] > 0 And pf3[pfx-4] < 50) Then Else Jump = "True" JumpCurentSpeed = JumpInc EndIf If pf3[pfx] > 50 And pf3[pfx] < 70 Then 'Did the man hit a star? Shapes.Move(star[pf3[pfx]],-32,pfy3) pf3[pfx] = "" Score = Score + 10 StarCount = StarCount - 1 'Sound.PlayClick() EndIf If pf3[pfx] > 70 And pf3[pfx] < 100 Then 'Did the man hit a spike? HitSpike() EndIf ElseIf ManY = pfy2-64 And Jump = "" Then 'Check conditions of the second row of platforms If (pf2[pfx] > 0 And pf2[pfx] < 50) Or (pf2[pfx-1] > 0 And pf2[pfx-1] < 50) Or (pf2[pfx-2] > 0 And pf2[pfx-2] < 50) Or (pf2[pfx-3] > 0 And pf2[pfx-3] < 50) Or (pf2[pfx-4] > 0 And pf2[pfx-4] < 50) Then Else Jump = "True" JumpCurentSpeed = JumpInc EndIf If pf2[pfx] > 50 And pf2[pfx] < 70 Then 'Did the man hit a star? Shapes.Move(star[pf2[pfx]],-32,pfy2) pf2[pfx] = "" Score = Score + 10 StarCount = StarCount - 1 'Sound.PlayClick() EndIf If pf2[pfx] > 70 And pf2[pfx] < 100 Then 'Did the man hit a spike? HitSpike() EndIf ElseIf ManY = pfy1-64 And Jump = "" Then 'Check conditions of the first row of platforms If (pf1[pfx] > 0 And pf1[pfx] < 50) Or (pf1[pfx-1] > 0 And pf1[pfx-1] < 50) Or (pf1[pfx-2] > 0 And pf1[pfx-2] < 50) Or (pf1[pfx-3] > 0 And pf1[pfx-3] < 50) Or (pf1[pfx-4] > 0 And pf1[pfx-4] < 50) Then Else Jump = "True" JumpCurentSpeed = JumpInc EndIf If pf1[pfx] > 50 And pf1[pfx] < 70 Then 'Did the man hit a star? Shapes.Move(star[pf1[pfx]],-32,pfy1) pf1[pfx] = "" Score = Score + 10 StarCount = StarCount - 1 'Sound.PlayClick() EndIf If pf1[pfx] > 70 And pf1[pfx] < 100 Then 'Did the man hit a spike? HitSpike() EndIf EndIf '---------------------------------------------------------------------------------Landing on platforms If JumpCurentSpeed > 0 And ManY < pfy5-32 And ManY > pfy5-64 Then If (pf5[pfx] > 0 And pf5[pfx] < 50) Or (pf5[pfx-1] > 0 And pf5[pfx-1] < 50) Or (pf5[pfx-2] > 0 And pf5[pfx-2] < 50) Or (pf5[pfx-3] > 0 And pf5[pfx-3] < 50) Or (pf5[pfx-4] > 0 And pf5[pfx-4] < 50) Then Jump = "" ManY = pfy5-64 EndIf ElseIf JumpCurentSpeed > 0 And ManY < pfy4-32 And ManY > pfy4-64 Then If (pf4[pfx] > 0 And pf4[pfx] < 50) Or (pf4[pfx-1] > 0 And pf4[pfx-1] < 50) Or (pf4[pfx-2] > 0 And pf4[pfx-2] < 50) Or (pf4[pfx-3] > 0 And pf4[pfx-3] < 50) Or (pf4[pfx-4] > 0 And pf4[pfx-4] < 50) Then Jump = "" ManY = pfy4-64 EndIf ElseIf JumpCurentSpeed > 0 And ManY < pfy3-32 And ManY > pfy3-64 Then If (pf3[pfx] > 0 And pf3[pfx] < 50) Or (pf3[pfx-1] > 0 And pf3[pfx-1] < 50) Or (pf3[pfx-2] > 0 And pf3[pfx-2] < 50) Or (pf3[pfx-3] > 0 And pf3[pfx-3] < 50) Or (pf3[pfx-4] > 0 And pf3[pfx-4] < 50) Then Jump = "" ManY = pfy3-64 EndIf ElseIf JumpCurentSpeed > 0 And ManY < pfy2-32 And ManY > pfy2-64 Then If (pf2[pfx] > 0 And pf2[pfx] < 50) Or (pf2[pfx-1] > 0 And pf2[pfx-1] < 50) Or (pf2[pfx-2] > 0 And pf2[pfx-2] < 50) Or (pf2[pfx-3] > 0 And pf2[pfx-3] < 50) Or (pf2[pfx-4] > 0 And pf2[pfx-4] < 50) Then Jump = "" ManY = pfy2-64 EndIf ElseIf JumpCurentSpeed > 0 And ManY < pfy1-32 And ManY > pfy1-64 Then If (pf1[pfx] > 0 And pf1[pfx] < 50) Or (pf1[pfx-1] > 0 And pf1[pfx-1] < 50) Or (pf1[pfx-2] > 0 And pf1[pfx-2] < 50) Or (pf1[pfx-3] > 0 And pf1[pfx-3] < 50) Or (pf1[pfx-4] > 0 And pf1[pfx-4] < 50) Then Jump = "" ManY = pfy1-64 EndIf EndIf 'If pfx < 0 Then 'Routine to wrap the playfield. ' pfx = pfx + pfw - 25 'The first 25 steps in the array 'ElseIf pfx > pfw Then 'must match the last 25 steps ' pfx = pfx - pfw + 25 'in the SetupPlayField routine. 'EndIf '---------------------------------------------------------------------------------Show playfield from array For i = 1 To 30 pfxt = pfx-18+i t = i * 32 - 160 + bgx pftest = pf1[pfxt] 'Show playfield line 1 If pftest <> "" Then If pftest < 50 Then Shapes.Move(brick[pftest],t,pfy1) ElseIf pftest > 50 and pftest < 70 Then Shapes.Move(star[pftest],t,pfy1-32) ElseIf pftest > 80 and pftest < 100 Then Shapes.Move(spike[pftest],t,pfy1-32) EndIf EndIf pftest = pf2[pfxt] 'Show playfield line 2 If pftest <> "" Then If pftest < 50 Then Shapes.Move(brick[pftest],t,pfy2) ElseIf pftest > 50 and pftest < 70 Then Shapes.Move(star[pftest],t,pfy2-32) ElseIf pftest > 80 and pftest < 100 Then Shapes.Move(spike[pftest],t,pfy2-32) EndIf EndIf pftest = pf3[pfxt] 'Show playfield line 3 If pftest <> "" Then If pftest < 50 Then Shapes.Move(brick[pftest],t,pfy3) ElseIf pftest > 50 and pftest < 70 Then Shapes.Move(star[pftest],t,pfy3-32) ElseIf pftest > 80 and pftest < 100 Then Shapes.Move(spike[pftest],t,pfy3-32) EndIf EndIf pftest = pf4[pfxt] 'Show playfield line 4 If pftest <> "" Then If pftest < 50 Then Shapes.Move(brick[pftest],t,pfy4) ElseIf pftest > 50 and pftest < 70 Then Shapes.Move(star[pftest],t,pfy4-32) ElseIf pftest > 80 and pftest < 100 Then Shapes.Move(spike[pftest],t,pfy4-32) EndIf EndIf pftest = pf5[pfxt] 'Show playfield line 5 this is the ground If pftest <> "" Then If pftest < 50 Then Shapes.Move(ground[pftest],t,pfy5) ElseIf pftest > 50 and pftest < 70 Then Shapes.Move(star[pftest],t,pfy5-32) ElseIf pftest > 80 and pftest < 100 Then Shapes.Move(spike[pftest],t,pfy5-32) ElseIf pftest > 100 and pftest < 110 Then Shapes.Move(icon[pftest],t,pfy5-32) EndIf EndIf EndFor '----------------------------------------------------------------------------Calculate and move background and roofline bgx = bgx + bgInc 'Add the increment to the background X position If bgx < - 32 Then 'Background images repeat every 32 pixels bgx = bgx + 32 pfx = pfx + 1 'Move right on the playfield array ElseIf bgx > 0 Then bgx = bgx - 32 pfx = pfx - 1 'Move left on the playfield array EndIf Shapes.Move(background,bgx,bgy) Shapes.Move(roofline,bgx,bgy) '----------------------------------------------------------------------------Generate animation for the man ManSlide = ManSlide + ManIncIs If ManSlide > 4.9 Then ManSlide = 1 EndIf ManSlideFloor = Math.Floor(ManSlide) If ManDirLast <> ManDir Or ManSlideFloorLast <> ManSlideFloor Then Shapes.Move(Man[ManDir][ManSlideFloor],ManX,ManY) Shapes.ShowShape(man[ManDir][ManSlideFloor]) Shapes.HideShape(man[ManDirLast][ManSlideFloorLast]) EndIf If Jump Then Shapes.Move(man[ManDir][ManSlideFloor],ManX,ManY) EndIf ManDirLast = ManDir ManSlideFloorLast = ManSlideFloor GraphicsWindow.Title = "RUN Little Soldier Dude, RUN! ---- Score = " + Score + " ---- Stars = " + StarCount + " ---- Lives = " + lives While Clock.ElapsedMilliseconds < fps 'Wait here to create a consistant frames per second EndWhile fps = Clock.ElapsedMilliseconds + delay 'Calculate the time to wait for frames per second If debug Then DebugData() EndIf EndWhile Sound.PlayMusic("O5 C8 C8 C8 O4 G8") Sub HitSpike 'The man hit a spike routine Jump = "True" JumpCurentSpeed = -JumpPower / 2 'Give the man a half jump lives = lives - 1 'Take away one life EndSub Sub OnKeyDown key = GraphicsWindow.LastKey If key = "Left" Then 'Left arrow was pressed bgInc = 2 'Background increment to the right ManDir = 1 'The man array for showing his left side ManIncIs = ManInc 'The increment for the man walking animation ElseIf key = "Right" Then 'Right arrow was pressed bgInc = -2 'Background increment to the left ManDir = 2 'The man array for showing his right side ManIncIs = ManInc 'The increment for the man walking animation ElseIf (key = "Up" or key = "Space") And Jump <> "True" Then Jump = "True" 'Turn on the Jump flag JumpCurentSpeed = -JumpPower 'Get the man momentum for the jump ElseIf key = "Escape" Then 'Escape was pressed to quit Program.End() EndIf EndSub Sub OnKeyUp key = GraphicsWindow.LastKey If key = "Right" Or key = "Left" Then bgInc = 0 ManIncIs = "" EndIf EndSub Sub SetupVariables gw = 800 'Window Width gh = 672 'Window Height lives = 5 'Players lives bgx = 0 'Backgound X position bgInc = 0 'Background X increment bgy = 0 'Background Y position 'bggh = gh - 32 'Ground height ManDir = 1 'Man direction 1=left 2=right ManSlide = 1 'Man's slide number for walking animation ManX = gw/2-16 'Man's position X, center on screen ManY = gh-96 'Man's position Y ManInc = .1 'Walking appearance speed JumpPower = 8 'Jump power JumpInc = .2 'Jump Gravity Score = 0 'It's not a game without a score StarCount = 0 'Stars collected delay = 9 'Change this for game speed EndSub Sub SetupPlayField pfx = 14 'Playfield position pfy1 = 128 'Playfield line 1 Y position pfy2 = 256 'Playfield line 2 Y position pfy3 = 384 'Playfield line 3 Y position pfy4 = 512 'Playfield line 4 Y position pfy5 = 640 'Playfield line 5 Y position, the ground level = 1 'Set the level here with plans to create more later pfw = 100 'Playfield width -- not used yet StarCount = 15 '-----------------------------------------------------------------------------------------------Platforms Array '--------------------------These arrays correspond with 5 different levels of platforms and objects on the play field -- pf1 = "18=1", pf1 is the top row of platforms '--------------------------The first number represents the position from the left on the playfield -- pf1 = "18=1", 18 is the position '--------------------------The second number represents the object on that position -- pf1 = "18=1", 1 is the brown bricks '--------------------------These are all 5 blocks wide These are 1 block wide These are 2 blocks wide '--------------------------bricks[1-9] are brown bricks star[51-59] are blue stars icon[101] is the sign pointing right '--------------------------bricks[11-19] are blue bricks star[61-69] are red stars icon[102] is the sign pointing left '--------------------------bricks[21-29] are green bricks spike[81-89] are green spikes '--------------------------bricks[31-39] are red bricks spike[91-99] are red spikes '--------------------------ground[41-49] are ground images '--------------------------The screen will show 25 blocks of the playfield and calculate 30 to push objects off the screen '--------------------------Issues: do not let the same object show up twice on the screen it will blink, that's why there are 9 images, to avoid repeats '--------------------------I chose this method of defining the whole array in one statement versus defining a whole lot of individual variables of the same array pf1 = "18=1;20=65;23=2;25=66;28=3;30=67;33=4;35=68;48=11;53=12" pf2 = "38=31;39=61;40=62;41=63;42=64;43=32" pf3 = "28=21;30=82;31=83;32=84;33=22" pf4 = "18=18;19=55;20=56;23=19;25=57;26=58;27=59" pf5 = "0=41;5=42;10=43;9=101;15=44;20=45;21=91;22=92;23=93;24=94;25=46;30=47;35=48;40=41;45=42;50=43;55=44;56=51;57=52;58=53;59=54;60=45;65=46;70=47;75=48;80=42;85=43;90=44;91=102;95=45;100=46;" EndSub Sub SetupWindow If debug Then TextWindow.Left = gw + 20 TextWindow.Top = 10 TextWindow.Title = "Soldier Dude Debug." EndIf GraphicsWindow.Hide() GraphicsWindow.Height = gh GraphicsWindow.Width = gw GraphicsWindow.Top = 5 GraphicsWindow.Left = 5 GraphicsWindow.Title = "RUN Little Soldier Dude, RUN! ---- Score = " + Score + " ---- Stars = " + StarCount + " ---- Lives = " + lives GraphicsWindow.BackgroundColor = "Black" EndSub Sub SetupImages 'path = Program.Directory + "\" path = "http://krueg.com/sb/soldier/" background = Shapes.AddImage(ImageList.LoadImage(path + "background.png")) Shapes.Move(background,0,32) 'groundline = Shapes.AddImage(ImageList.LoadImage(path + "groundline.png")) 'Shapes.Move(groundline,0,gh-32) roofline = Shapes.AddImage(ImageList.LoadImage(path + "roofline.png")) icon[101] = Shapes.AddImage(ImageList.LoadImage(path + "signright.png")) icon[102] = Shapes.AddImage(ImageList.LoadImage(path + "signleft.png")) Shapes.Move(icon[102],-100,pfy5-32) For i = 1 To 9 brick[i] = Shapes.AddImage(ImageList.LoadImage(path + "5brickbrown.png")) Shapes.Move(brick[i],-160,pfy1) brick[i+10] = Shapes.AddImage(ImageList.LoadImage(path + "5brickblue.png")) Shapes.Move(brick[i+10],-160,pfy2) brick[i+20] = Shapes.AddImage(ImageList.LoadImage(path + "5brickgreen.png")) Shapes.Move(brick[i+20],-160,pfy3) brick[i+30] = Shapes.AddImage(ImageList.LoadImage(path + "5brickred.png")) Shapes.Move(brick[i+30],-160,pfy4) ground[i+40] = Shapes.AddImage(ImageList.LoadImage(path + "5ground.png")) Shapes.Move(ground[i+40],-165,pfy5) star[i+50] = Shapes.AddImage(ImageList.LoadImage(path + "starblue.png")) Shapes.Move(star[i+50],-160,pfy5) star[i+60] = Shapes.AddImage(ImageList.LoadImage(path + "starred.png")) Shapes.Move(star[i+60],-160,pfy5) spike[i+80] = Shapes.AddImage(ImageList.LoadImage(path + "spikegreen.png")) Shapes.Move(spike[i+80],-160,pfy5) spike[i+90] = Shapes.AddImage(ImageList.LoadImage(path + "spikered.png")) Shapes.Move(spike[i+90],-160,pfy5) EndFor manl2 = ImageList.LoadImage(path + "man_l2.png") manr2 = ImageList.LoadImage(path + "man_r2.png") man[1][1] = Shapes.AddImage(ImageList.LoadImage(path + "man_l1.png")) man[1][2] = Shapes.AddImage(manl2) man[1][3] = Shapes.AddImage(ImageList.LoadImage(path + "man_l3.png")) man[1][4] = Shapes.AddImage(manl2) man[2][1] = Shapes.AddImage(ImageList.LoadImage(path + "man_r1.png")) man[2][2] = Shapes.AddImage(manr2) man[2][3] = Shapes.AddImage(ImageList.LoadImage(path + "man_r3.png")) man[2][4] = Shapes.AddImage(manr2) For i = 1 To 4 Shapes.Move(man[1][i],ManX,ManY) Shapes.Zoom(man[1][i],2,2) Shapes.HideShape(man[1][i]) Shapes.Move(man[2][i],ManX,ManY) Shapes.Zoom(man[2][i],2,2) Shapes.HideShape(man[2][i]) EndFor GraphicsWindow.Show() EndSub Sub DebugData TextWindow.Clear() TextWindow.WriteLine("key = " + key) TextWindow.WriteLine("bgInc = " + bgInc) TextWindow.WriteLine("bgx = " + bgx) TextWindow.WriteLine("pfx = " + pfx) TextWindow.WriteLine("Jump = " + Jump) TextWindow.WriteLine("ManX = " + ManX) TextWindow.WriteLine("ManY = " + ManY) TextWindow.WriteLine("JumpCurentSpeed = " + JumpCurentSpeed) TextWindow.WriteLine("") TextWindow.WriteLine("pf1 = " + pf1) TextWindow.WriteLine("pf2 = " + pf2) TextWindow.WriteLine("pf3 = " + pf3) TextWindow.WriteLine("pf4 = " + pf4) TextWindow.WriteLine("pf5 = " + pf5) EndSub End>BXT756.sb< Start>BXZ895.sb< GraphicsWindow.BackgroundColor="teal While "true Turtle.Angle=45 Turtle.Move(30) Turtle.Speed=9 For a=45 To -225 Step -2 Turtle.Angle=a Turtle.Move(2) EndFor Turtle.Move(113) For a=-225 To 45 Step 2 Turtle.Angle=a Turtle.Move(2) EndFor Turtle.Move(90) 'Turtle.PenUp () endwhile End>BXZ895.sb< Start>BXZ994.sb< ' Registers ' Copyright © 2017 Nonki Takahashi. The MIT License. ' Last update 2017-08-30 GraphicsWindow.Title = "Registers" SB_Workaround() Init() n = Array.GetItemCount(register) index = Array.GetAllIndices(register) shY = 90 shX = 80 angle = 0 iMin = 1 i = 1 While i <= n Stack.PushValue("local", i) If Array.GetItemCount(register[index[i]]) = 4 Then InitRegister() Else InitMetalFilmRegister() EndIf iMax = Array.GetItemCount(shape) Shapes_Add() i = Stack.PopValue("local") shX = shX + 100 If gw - 100 < shX Then shY = shY + 120 shX = 80 EndIf i = i + 1 EndWhile Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh line = "Silver" base = "Tan" metal = "MediumTurquoise" digit[0] = "Black" digit[1] = "SaddleBrown" digit[2] = "Crimson" digit[3] = "OrangeRed" digit[4] = "Yellow" digit[5] = "Green" digit[6] = "Blue" digit[7] = "DarkViolet" digit[8] = "Gray" digit[9] = "White" For i = 0 To 9 power[i] = digit[i] EndFor power[-1] = "DarkGoldenrod" power[-2] = "Silver" error["±1"] = digit[1] error["±2"] = digit[2] error["±5"] = power[-1] error["±10"] = power[-2] error["±20"] = "Transparent" register["1MΩ"] = "1=1;2=0;3=5;4=±5;" register["80kΩ"] = "1=8;2=0;3=0;4=2;5=±1;" register["10kΩ"] = "1=1;2=0;3=3;4=±5;" register["4.7kΩ"] = "1=4;2=7;3=2;4=±5;" register["1kΩ"] = "1=1;2=0;3=2;4=±5;" register["220Ω"] = "1=2;2=2;3=1;4=±5;" register["200Ω"] = "1=2;2=0;3=1;4=±5;" EndSub Sub InitRegister ' Initialize carbon film register scale = 4 reg = register[index[i]] c[1] = digit[reg[1]] c[2] = digit[reg[2]] c[3] = power[reg[3]] c[4] = error[reg[4]] shape = "" shape[1] = "func=line;x=0;y=0;x1=1.5;y1=3;x2=1.4;y2=13.5;pc="+line+";pw=0.5;" shape[2] = "func=line;x=0;y=0;x1=9.5;y1=3;x2=9.6;y2=13.5;pc="+line+";pw=0.5;" shape[3] = "func=line;x=0;y=0;x1=1.5;y1=3;x2=2;y2=2.5;pc="+line+";pw=0.5;" shape[4] = "func=line;x=0;y=0;x1=9.5;y1=3;x2=9;y2=2.5;pc="+line+";pw=0.5;" shape[5] = "func=ell;x=2;y=1;width=2;height=3;bc="+base+";" shape[6] = "func=rect;x=2;y=1.5;width=7;height=2;bc="+base+";" shape[7] = "func=ell;x=7;y=1;width=2;height=3;bc="+base+";" shape[8] = "func=rect;x=3;y=1.5;width=0.7;height=2;bc="+c[1]+";" shape[9] = "func=rect;x=4.4;y=1.5;width=0.7;height=2;bc="+c[2]+";" shape[10] = "func=rect;x=5.8;y=1.5;width=0.7;height=2;bc="+c[3]+";" shape[11] = "func=rect;x=7.5;y=1.5;width=0.7;height=2;bc="+c[4]+";" shape[12] = "func=text;x=1.5;y=15;text="+index[i]+";fn=Arial;fs=3;bc=Black;" EndSub Sub InitMetalFilmRegister ' Initialize metal film register scale = 4 reg = register[index[i]] c[1] = digit[reg[1]] c[2] = digit[reg[2]] c[3] = digit[reg[3]] c[4] = power[reg[4]] c[5] = error[reg[5]] shape = "" shape[1] = "func=line;x=0;y=0;x1=1.5;y1=3;x2=1.4;y2=13.5;pc="+line+";pw=0.5;" shape[2] = "func=line;x=0;y=0;x1=9.5;y1=3;x2=9.6;y2=13.5;pc="+line+";pw=0.5;" shape[3] = "func=line;x=0;y=0;x1=1.5;y1=3;x2=2;y2=2.5;pc="+line+";pw=0.5;" shape[4] = "func=line;x=0;y=0;x1=9.5;y1=3;x2=9;y2=2.5;pc="+line+";pw=0.5;" shape[5] = "func=ell;x=2;y=1;width=2;height=3;bc="+metal+";" shape[6] = "func=rect;x=2;y=1.5;width=7;height=2;bc="+metal+";" shape[7] = "func=ell;x=7;y=1;width=2;height=3;bc="+metal+";" shape[8] = "func=rect;x=3;y=1.5;width=0.5;height=2;bc="+c[1]+";" shape[9] = "func=rect;x=4;y=1.5;width=0.5;height=2;bc="+c[2]+";" shape[10] = "func=rect;x=5;y=1.5;width=0.5;height=2;bc="+c[3]+";" shape[11] = "func=rect;x=6;y=1.5;width=0.5;height=2;bc="+c[4]+";" shape[12] = "func=rect;x=7.5;y=1.5;width=0.5;height=2;bc="+c[5]+";" shape[13] = "func=text;x=1.5;y=15;text="+index[i]+";fn=Arial;fs=3;bc=Black;" EndSub Sub Math_CartesianToPolar ' Math | convert cartesian coodinate to polar coordinate ' param x, y - cartesian coordinate ' return r, a - polar coordinate r = Math.SquareRoot(x * x + y * y) If x = 0 And y > 0 Then a = 90 ' [degree] ElseIf x = 0 And y < 0 Then a = -90 ElseIf x = 0 Then a = 0 Else a = Math.ArcTan(y / x) * 180 / Math.Pi EndIf If x < 0 Then a = a + 180 ElseIf x > 0 And y < 0 Then a = a + 360 EndIf EndSub Sub SB_RotateWorkaround ' Small Basic | Rotate workaround for Silverlight ' param shp - current shape ' param x, y - original coordinate ' param alpha - angle [radian] ' returns x, y - workaround coordinate If shp["func"] = "tri" Then x1 = -Math.Floor(shp["x3"] / 2) y1 = -Math.Floor(shp["y3"] / 2) ElseIf shp["func"] = "line" Then x1 = -Math.Floor(Math.Abs(shp["x1"] - shp["x2"]) / 2) y1 = -Math.Floor(Math.Abs(shp["y1"] - shp["y2"]) / 2) EndIf ox = x - x1 oy = y - y1 x = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + ox y = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + oy EndSub Sub SB_Workaround ' Small Basic | Workaround for Silverlight ' returns silverlight - "True" if in remote color = GraphicsWindow.GetPixel(0, 0) If Text.GetLength(color) > 7 Then silverlight = "True" msWait = 300 Else silverlight = "False" EndIf EndSub Sub Shapes_Add ' Shapes | add shapes as shapes data ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - 1 if same scale ' return shWidth, shHeight - total size of shapes ' return shAngle - current angle of shapes Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then If silverlight Then fs = Math.Floor(shp["fs"] * 0.9) Else fs = shp["fs"] EndIf GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(shp["angle"]) SB_RotateWorkaround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then Shapes.Rotate(shp["obj"], shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcRotatePos ' Shapes | Calculate position for rotated shape ' param["x"], param["y"] - position of a shape ' param["width"], param["height"] - size of a shape ' param ["cx"], param["cy"] - center of rotation ' param ["angle"] - rotate angle ' return x, y - rotated position of a shape _cx = param["x"] + param["width"] / 2 _cy = param["y"] + param["height"] / 2 x = _cx - param["cx"] y = _cy - param["cy"] Math_CartesianToPolar() a = a + param["angle"] x = r * Math.Cos(a * Math.Pi / 180) y = r * Math.Sin(a * Math.Pi / 180) _cx = x + param["cx"] _cy = y + param["cy"] x = _cx - param["width"] / 2 y = _cy - param["height"] / 2 EndSub Sub Shapes_CalcWidthAndHeight ' Shapes | Calculate total width and height of shapes ' param iMin, iMax - shape indices to add ' return shWidth, shHeight - total size of shapes For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Move ' Shapes | Move shapes ' param iMin, iMax - shape indices to add ' param shape - array of shapes ' param scale - to zoom ' param x, y - position to move ' return shX, shY - new position of shapes Stack.PushValue("local", i) s = scale shX = x shY = y For i = iMin To iMax shp = shape[i] If silverlight And Text.IsSubText("tri|line", shp["func"]) Then _x = shp["wx"] _y = shp["wy"] Else _x = shp["rx"] _y = shp["ry"] EndIf Shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove ' Shapes | Remove shapes ' param iMin, iMax - shapes indices to remove ' param shape - array of shapes Stack.PushValue("local", i) For i = iMin To iMax shp = shape[i] Shapes.Remove(shp["obj"]) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Rotate ' Shapes | Rotate shapes ' param iMin, iMax - shapes indices to rotate ' param shape - array of shapes ' param cx, cy - rotation center ' param scale - to zoom ' param angle - to rotate Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) s = scale param["angle"] = angle If cx <> "" Then param["cx"] = cx Else cx = "" ' to avoid syntax error param["cx"] = shWidth / 2 EndIf If cy <> "" Then param["cy"] = cy Else cy = "" ' to avoid syntax error param["cy"] = shHeight / 2 EndIf For i = iMin To iMax shp = shape[i] param["x"] = shp["x"] param["y"] = shp["y"] param["width"] = shp["width"] param["height"] = shp["height"] Shapes_CalcRotatePos() shp["rx"] = x shp["ry"] = y If silverlight And Text.IsSubText("tri|line", shp["func"]) Then alpha = Math.GetRadians(angle + shp["angle"]) SB_RotateWorkAround() shp["wx"] = x shp["wy"] = y EndIf Shapes.Move(shp["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shp["obj"], angle + shp["angle"]) shape[i] = shp EndFor y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub End>BXZ994.sb< Start>BZC762.sb< gw=800 GraphicsWindow.width=gw createinvader() While "True" invadermove() Program.Delay(20) EndWhile Sub invadermove For i=1 To 5 invaderX[i] = Shapes.GetLeft(invader[i]) ' Player's new position -X ddy[i]=0 ' speed Y is usually zero If (invaderX[i]<-100 Or gw. -3 , -3 --> +3 ) ddy[i]=ddxy[i]["Y"] ' speed Y changes to +50 ( 0 --> +50) EndIf Shapes.Move(invader[i],Shapes.GetLeft(invader[i])+ddxy[i]["X"],Shapes.GetTop(invader[i])+ddy[i]) ' invader moved EndFor EndSub Sub createinvader For i=1 To 5 invader[i] = Shapes.AddImage("http://i61.tinypic.com/othfeo.png") Shapes.Move(invader[i],i*120,10) ddxy[i]="X=3;Y=50" ' invader's speed // x-direction=3 Y-dirction =50 EndFor EndSub End>BZC762.sb< Start>BZD455.sb< ' Sundial 0.1 ' published as ' Copyright (c) 2012 Nonki Takahashi. All rights reserved. ' ' History : ' 0.1 2012/07/10 Created from Cat's Eyes Clock 0.2. ' itx = 60 ity = 100 rx = GraphicsWindow.Width / 2 ' x pos of rod ry = ity * 3 - 10 ' y pos of rod rw = 10 ' rod width rl = 200 ' rod length sBGColor = "LightGray" sFGColor = "Black" sTitle = "Sundial 0.1" GraphicsWindow.Title = sTitle GraphicsWindow.BrushColor = sFGColor GraphicsWindow.BackgroundColor = sBGColor DrawSundial() InitClock() bTicked = "False" Timer.Interval = 1000 Timer.Tick = OnTick While "True" Program.Delay(500) If bTicked Then DrawClock() DrawShadow() bTicked = "False" EndIf EndWhile Sub DrawSundial ' param rx, ry - rod center position ' param rw, rl - rod width and length GraphicsWindow.BrushColor = "Gray" GraphicsWindow.PenColor = "Gray" oBody = Shapes.AddRectangle(rl, rw) Shapes.Move(oBody, rx, ry - rw / 2) oHead = Shapes.AddEllipse(rw, rw) Shapes.Move(oHead, rx + rl - rw / 2, ry - rw / 2) GraphicsWindow.BrushColor = "Black" ch = 18 cw = 12 GraphicsWindow.FontSize = ch For h = 6 To 18 a = 90 + 360 * h / 24 x = rx + rl * Math.Cos(a / 180 * Math.Pi) - rw / 2 y = ry + rl * Math.Sin(a / 180 * Math.Pi) - rw / 2 oHour = Shapes.AddText(h) If h < 10 Then x = x - cw * 0.5 Else x = x - cw EndIf Shapes.Move(oHour, x, y - ch * 0.65) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.PenColor = "White" oTop = Shapes.AddEllipse(rw, rw) Shapes.Move(oTop, rx - rw / 2, ry - rw / 2) EndSub Sub DrawShadow ' param rx, ry - rod center position ' param rw, rl - rod width and length ' param iHour, iMin, iSec - current time ' If iHour < 6 Or 18 <= iHour Then ' GraphicsWindow.BackgroundColor = "Gray" ' Else ' GraphicsWindow.BackgroundColor = "LightGray" ' EndIf sec = iHour * 3600 + iMin * 60 + iSec a = 90 + 360 * sec / (24 * 3600) If a > 360 Then a = a - 360 EndIf Shapes.Zoom(oHead, 1, 1) x = rx + rl * Math.Cos(a / 180 * Math.Pi) - rw / 2 y = ry + rl * Math.Sin(a / 180 * Math.Pi) - rw / 2 Shapes.Move(oHead, x, y) Shapes.Rotate(oHead, a) Shapes.Zoom(oBody, 1, 1) x = rx + rl * Math.Cos(a / 180 * Math.Pi) / 2 - rl / 2 y = ry + rl * Math.Sin(a / 180 * Math.Pi) / 2 - rw / 2 Shapes.Move(oBody, x, y) Shapes.Rotate(oBody, a) EndSub Sub InitClock ' return oClock - text object for clock GraphicsWindow.FontSize = ity GraphicsWindow.BrushColor = sFGColor oClock = Shapes.AddText("") Shapes.Move(oClock, itx * 1.4, ity * 3) EndSub Sub DrawClock ' param iHour - hour ' param iMin - minute ' param iSec - second If iHour < 10 Then sTime = Text.Append("0", iHour) + ":" Else sTime = iHour + ":" EndIf If iMin < 10 Then sTime = sTime + "0" + iMin + ":" Else sTime = sTime + iMin + ":" EndIf If iSec < 10 Then sTime = sTime + "0" + iSec Else sTime = sTime + iSec EndIf Shapes.SetText(oClock, sTime) EndSub Sub OnTick iHour = Clock.Hour iMin = Clock.Minute iSec = Clock.Second bTicked = "True" EndSub End>BZD455.sb< Start>BZD902.sb< GraphicsWindow.Show() line = Shapes.AddLine(100,100,100,50) marker = Shapes.AddLine(50,50,100,100) marker2 = Shapes.AddLine(50,0,150,100) marker3 = Shapes.AddLine(50,50,200,50) diag = Shapes.AddLine(0,0,GraphicsWindow.Width,GraphicsWindow.Height) For i = 0 To 90 Step 5 Shapes.Rotate(line, i) Shapes.Rotate(marker,i) Shapes.Rotate(marker2,i) Shapes.Rotate(marker3,i) Shapes.Rotate(diag,i) Program.Delay(100) EndFor spinner = Shapes.AddLine(300,200,275,200) For i = 0 To 1500 Shapes.Rotate(spinner,i) Program.Delay(10) EndFor End>BZD902.sb< Start>BZF166.sb< GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.Height=GraphicsWindow.Width GraphicsWindow.Title="Please wait, generating slides... For n=90 To 10 Step -5 GraphicsWindow.Clear() j=j0 j0=j0+1 For y=50 To 200 Step 10 ss=0 i=1 For x=0 To 360 Step .5 cc=LDMath.Convert2Cartesian(300 300 ldmath.sin(x*n)*10+y x) ss[i][1]=cc[1] ss[i][2]=cc[2] i=i+1 EndFor pp=LDShapes.AddPolygon(ss) LDShapes.PenWidth(pp 0) LDShapes.BrushColour(pp LDColours.HSLtoRGB(math.remainder(j*15 360) 1 .6)) LDShapes.ZIndex(pp, -j) LDEffect.DropShadow(pp "") j=j+1 EndFor nn=nn+1 im[nn]=LDGraphicsWindow.Capture("" "false") EndFor GraphicsWindow.Title="Pulsating Flower GraphicsWindow.Clear() While "true For x=1 To Array.GetItemCount(im) GraphicsWindow.DrawImage(im[x] 0 0) Program.Delay(88) EndFor For x=Array.GetItemCount(im) To 1 Step -1 GraphicsWindow.DrawImage(im[x] 0 0) Program.Delay(88) EndFor EndWhile End>BZF166.sb< Start>BZF497-0.sb< 'mahreen miangul 'Animals Animation ' November 2016 GraphicsWindow.Width = 1255 GraphicsWindow.Height = 488 GraphicsWindow.BackgroundColor = "rosybrown" ' 2Animals GraphicsWindow.MouseDown=pngsave Shapes_Init() s = 1.1 '<---- scale 'Draw outline For i = 1 To Array.GetItemCount(shape) GraphicsWindow.PenColor = shape[i]["pc"] '<-------------- pen color If shape[i]["func"]="ell" Then GraphicsWindow.DrawEllipse(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s) elseIf shape[i]["func"]="rect" Then GraphicsWindow.DrawRectangle(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s) ElseIf shape[i]["func"]="tri" then GraphicsWindow.DrawTriangle(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s,shape[i]["x"]*s+shape[i]["x3"]*s, shape[i]["y"]*s+shape[i]["y3"]*s ) elseif shape[i]["func"]="line" then GraphicsWindow.Drawline(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s ) EndIf Program.Delay(30) EndFor ' Add and Animate shapes for solid color GraphicsWindow.PenWidth = 2 For i = 1 To Array.GetItemCount(shape) GraphicsWindow.BrushColor = shape[i]["bc"] ' <-------------- brush color If shape[i]["func"]="ell" Then shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s) ElseIf shape[i]["func"]="rect" Then shp[i] = Shapes.AddRectangle(shape[i]["width"]*s, shape[i]["height"]*s) ElseIf shape[i]["func"]="tri" Then shp[i] = Shapes.Addtriangle(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s, shape[i]["x3"]*s, shape[i]["y3"]*s) ElseIf shape[i]["func"]="line" Then shp[i] = Shapes.Addline(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s) EndIf Shapes.Animate(shp[i], shape[i]["x"]*s, shape[i]["y"]*s, 500) If Shape[i]["angle"]>0 Then Shapes.Rotate(SHP[i], Shape[i]["angle"]) ' <-------------- rotating angle EndIf Program.Delay(50) EndFor While "True" For i=1 To Array.GetItemCount(shape) Shapes.Rotate(SHP[i],Shape[i]["angle"]) ' <-------------- rotating angle EndFor Program.Delay(1500) For i=1 To Array.GetItemCount(shape) Shapes.Rotate(SHP[i], 0) ' <-------------- rotating angle EndFor Program.Delay(500) endwhile Sub pngsave MX= GraphicsWindow.MouseX MY= GraphicsWindow.MouseY GraphicsWindow.BackgroundColor=GraphicsWindow.GetRandomColor() ' "rosybrown" endsub Sub Shapes_Init shX = 100 ' x offset shY = 97 ' y offset shape = "" ' array shape [] contains "func" , "x", "y" , ( "x1","y1","x2","y2","x3","y3") "width" , "height" , "angle" , "bc" , "pc" , "pw" indexes. ' 1 Rocket shape[1] = "func=rect;x=42.516662597656;y=113.800010681153;width=109;height=181;bc=#FF0000;pc=#FF000000;pw=2;" shape[2] = "func=tri;x=0;y=209.333335876465;x1=32;y1=0;x2=0;y2=74;x3=64;y3=74;angle=26;bc=#FFADAD;pc=#FF000000;pw=2;" shape[3] = "func=tri;x=132;y=207.333335876465;x1=31;y1=0;x2=0;y2=79;x3=62;y3=79;angle=337;bc=#FFADAD;pc=#FF000000;pw=2;" shape[4] = "func=line;x=97.366668701172;y=211.900016784668;x1=1.116668701172;y1=0.000000000000;x2=0.000000000000;y2=79.283325195313;pc=#FF000000;pw=2;" shape[5] = "func=tri;x=62.116668701172;y=293.716667175293;x1=36;y1=0;x2=0;y2=30;x3=72;y3=30;bc=#FFADAD;pc=#FF000000;pw=2;" shape[6] = "func=tri;x=35.783355712891;y=0.000000000000;x1=62;y1=0;x2=0;y2=115;x3=124;y3=115;bc=#FFADAD;pc=#FF000000;pw=2;" shape[7] = "func=ell;x=74.116668701172;y=329.283317565918;width=45;height=102;bc=#FF0700;pc=#FF000000;pw=2;" shape[8] = "func=ell;x=79.233337402344;y=341.333335876465;width=34;height=71;bc=#FF7E07;pc=#FF000000;pw=2;" shape[9] = "func=ell;x=86.533332824707;y=355.583335876465;width=19;height=42;bc=#FFFF00;pc=#FF000000;pw=2;" shape[10] = "func=rect;x=33;y=382.333335876465;width=141;height=43;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' 2 SnowMan shape[11] = "func=rect;x=383;y=297;width=38;height=15;angle=29;bc=#68432C;pw=0;" shape[12] = "func=rect;x=300;y=357;width=324;height=113;bc=#FFFFFF;pw=0;"' Boder shape[13] = "func=rect;x=300;y=357;width=324;height=113;bc=lightyellow;pw=0;"' Boder shape[14] = "func=ell;x=415;y=236;width=84;height=73;bc=#FFFFFF;pw=0;" shape[15] = "func=ell;x=399;y=290;width=115;height=97;bc=#FFFFFF;pw=0;" shape[16] = "func=rect;x=433;y=267;width=16;height=6;bc=#000000;pw=0;" shape[17] = "func=rect;x=465;y=267;width=16;height=6;bc=#000000;pw=0;" shape[18] = "func=ell;x=432;y=260;width=18;height=19;bc=#000000;pw=0;" shape[19] = "func=ell;x=464;y=260;width=18;height=19;bc=#000000;pw=0;" shape[20] = "func=rect;x=446;y=287;width=21;height=5;bc=#000000;pw=0;" ' 3 Duk 'The Donald shape[21] = "func=tri;x=303;y=41;x1=47;y1=0;x2=0;y2=22;x3=95;y3=22;bc=red;pw=0;beck" shape[22] = "func=ell;x=268;y=0;width=91;height=73;bc=blue;pw=0;" shape[23] = "func=line;x=172;y=36;x1=0;y1=0;x2=22;y2=0;pc=red;pw=2;blink" shape[24] = "func=ell;x=322;y=25;width=22;height=22;bc=pink;pw=0;eye" shape[25] = "func=tri;x=282;y=58;x1=31;y1=0;x2=0;y2=45;x3=62;y3=45;bc=red;pw=0;neck" shape[26] = "func=tri;x=150;y=80;x1=37;y1=0;x2=0;y2=32;x3=75;y3=32;angle=178;bc=red;pw=0;tail" shape[27] = "func=line;x=91;y=134;x1=0;y1=0;x2=0;y2=36;pc=red;pw=8;Leg1" shape[28] = "func=ell;x=183;y=72;width=164;height=82;bc=yellow;pw=0;body" shape[29] = "func=tri;x=410;y=225;x1=46;y1=0;x2=0;y2=14;x3=93;y3=14;bc=red;pw=0;Leg3" ' <----------for snow man shape[30] = "func=line;x=90;y=169;x1=0;y1=0;x2=14;y2=15;pc=yellow;pw=8;Leg2" ' 4 Gurrila ' The Donkey Kong shape[31] = "func=ell;x=598;y=244;width=110;height=71;bc=yellowgreen;pw=0;" shape[32] = "func=ell;x=551;y=247;width=75;height=23;angle=348;bc=yellow;pc=red;pw=2;" shape[33] = "func=ell;x=697;y=250;width=74;height=22;angle=11;bc=yellow;pc=red;pw=2;" shape[34] = "func=ell;x=613;y=253;width=20;height=22;bc=greenyellow;pc=red;pw=2;" shape[35] = "func=ell;x=691;y=255;width=18;height=20;bc=greenyellow;pc=red;pw=2;" shape[36] = "func=ell;x=540;y=260;width=13;height=16;bc=greenyellow;pc=red;pw=2;" shape[37] = "func=ell;x=547;y=264;width=16;height=18;bc=greenyellow;pc=red;pw=2;" shape[38] = "func=ell;x=761;y=267;width=13;height=13;bc=greenyellow;pc=red;pw=2;" shape[39] = "func=ell;x=752;y=269;width=13;height=15;bc=greenyellow;pc=red;pw=2;" shape[40] = "func=ell;x=581;y=190;width=36;height=67;angle=332;bc=greenyellow;pw=0;" shape[41] = "func=ell;x=700;y=188;width=35;height=67;angle=20;bc=greenyellow;pw=0;" shape[42] = "func=ell;x=576;y=175;width=62;height=43;bc=lime;pw=0;" shape[43] = "func=ell;x=671;y=178;width=60;height=40;bc=lime;pw=0;" shape[44] = "func=ell;x=612;y=139;width=82;height=76;bc=yellow;pw=0;" shape[45] = "func=ell;x=575;y=99;width=81;height=72;bc=deepskyblue;pw=0;" shape[46] = "func=ell;x=649;y=96;width=82;height=74;bc=deepskyblue;pw=0;" shape[47] = "func=ell;x=505;y=87;width=107;height=55;angle=340;bc=cyan;pw=0;" shape[48] = "func=ell;x=695;y=82;width=109;height=59;angle=25;bc=cyan;pw=0;" shape[49] = "func=ell;x=500;y=126;width=43;height=76;angle=341;bc=hotpink;pw=0;" shape[50] = "func=ell;x=763;y=126;width=45;height=72;angle=17;bc=hotpink;pw=0;" shape[51] = "func=ell;x=533;y=176;width=39;height=35;bc=#FDBC90;pc=#834216;pw=2;" shape[52] = "func=ell;x=739;y=176;width=41;height=37;bc=#FDBC90;pc=#834216;pw=2;" shape[53] = "func=tri;x=613;y=0;x1=37;y1=0;x2=0;y2=76;x3=75;y3=76;bc=#834216;pw=0;" shape[54] = "func=tri;x=648;y=5;x1=15;y1=0;x2=0;y2=43;x3=31;y3=43;bc=#834216;pw=0;" shape[55] = "func=ell;x=610;y=46;width=58;height=41;angle=33;bc=#FDBC90;pw=0;" shape[56] = "func=ell;x=638;y=47;width=61;height=41;angle=318;bc=#FDBC90;pw=0;" shape[57] = "func=tri;x=619;y=60;x1=33;y1=0;x2=0;y2=41;x3=67;y3=41;angle=180;bc=#000000;pc=#000000;pw=2;" shape[58] = "func=ell;x=627;y=61;width=28;height=19;angle=349;bc=#FFFFFF;pc=#000000;pw=2;" shape[59] = "func=ell;x=652;y=62;width=30;height=20;angle=16;bc=#FFFFFF;pc=#000000;pw=2;" shape[60] = "func=ell;x=635;y=66;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[61] = "func=ell;x=658;y=67;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[62] = "func=ell;x=623;y=140;width=59;height=60;bc=#FCA76E;pc=#834216;pw=2;" shape[63] = "func=ell;x=650;y=107;width=62;height=55;bc=#FCA76E;pw=0;" shape[64] = "func=ell;x=594;y=107;width=64;height=53;bc=#FCA76E;pw=0;" shape[65] = "func=ell;x=596;y=79;width=118;height=69;bc=#FDBC90;pc=#834216;pw=2;" shape[66] = "func=ell;x=577;y=65;width=35;height=23;angle=38;bc=#FDBC90;pc=#834216;pw=2;" shape[67] = "func=ell;x=694;y=63;width=36;height=23;angle=317;bc=#FDBC90;pc=#834216;pw=2;" shape[68] = "func=ell;x=630;y=74;width=22;height=17;angle=15;bc=#FDBC90;pw=0;" shape[69] = "func=ell;x=656;y=73;width=22;height=18;angle=348;bc=#FDBC90;pw=0;" shape[70] = "func=tri;x=611;y=90;x1=10;y1=0;x2=0;y2=22;x3=20;y3=22;angle=298;bc=#FFFFFF;pc=#000000;pw=2;" shape[71] = "func=tri;x=672;y=91;x1=11;y1=0;x2=0;y2=23;x3=22;y3=23;angle=62;bc=#FFFFFF;pc=#000000;pw=2;" shape[72] = "func=rect;x=625;y=97;width=55;height=21;bc=#FFFFFF;pc=#000000;pw=2;" shape[73] = "func=ell;x=635;y=78;width=15;height=9;angle=23;bc=#834216;pw=0;" shape[74] = "func=ell;x=659;y=77;width=15;height=9;angle=339;bc=#834216;pw=0;" shape[75] = "func=line;x=652;y=97;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[76] = "func=line;x=637;y=98;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[77] = "func=line;x=667;y=99;x1=0;y1=0;x2=0;y2=18;pc=#000000;pw=2;" ' 5 Crab shape[78] = "func=rect;x=909;y=333;width=138;height=81;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[79] = "func=ell;x=896;y=333;width=26;height=80;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[80] = "func=ell;x=1033;y=334;width=26;height=80;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[81] = "func=rect;x=1053;y=332;width=58;height=14;angle=341;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[82] = "func=tri;x=1141;y=290;x1=6;y1=0;x2=0;y2=87;x3=13;y3=87;angle=95;bc=#B5451D;pc=#B55D1D;pw=2;" shape[83] = "func=rect;x=1057;y=357;width=58;height=14;angle=356;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[84] = "func=tri;x=1140;y=339;x1=7;y1=0;x2=0;y2=76;x3=14;y3=76;angle=113;bc=#B5451D;pc=#B55D1D;pw=2;" shape[85] = "func=rect;x=1056;y=379;width=48;height=16;angle=1;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[86] = "func=tri;x=1117;y=370;x1=7;y1=0;x2=0;y2=53;x3=14;y3=53;angle=113;bc=#B5451D;pc=#B55D1D;pw=2;" shape[87] = "func=rect;x=1052;y=406;width=43;height=13;angle=15;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[88] = "func=tri;x=1102;y=407;x1=6;y1=0;x2=0;y2=43;x3=12;y3=43;angle=124;bc=#B5451D;pc=#B55D1D;pw=2;" shape[89] = "func=rect;x=1015;y=310;width=7;height=25;bc=#B5451D;pc=#B55D1D;pw=2;" shape[90] = "func=rect;x=1026;y=308;width=8;height=0;bc=#B5451D;pc=#B55D1D;pw=2;" shape[91] = "func=ell;x=1005;y=295;width=20;height=20;bc=#000000;pc=#B55D1D;pw=2;" shape[92] = "func=rect;x=935;y=310;width=7;height=25;bc=#B5451D;pc=#B55D1D;pw=2;" shape[93] = "func=ell;x=925;y=291;width=20;height=20;bc=#000000;pc=#B55D1D;pw=2;" shape[94] = "func=rect;x=1041;y=3009;width=72;height=14;angle=321;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[95] = "func=ell;x=994;y=233;width=137;height=61;angle=25;bc=#B5451D;pc=#B55D1D;pw=2;" shape[96] = "func=tri;x=1031;y=245;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=31;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[97] = "func=tri;x=1016;y=237;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=25;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[98] = "func=tri;x=1062;y=258;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=26;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[99] = "func=tri;x=1076;y=266;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=28;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[100] = "func=tri;x=1091;y=272;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=22;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[101] = "func=tri;x=1047;y=252;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=31;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[102] = "func=rect;x=864;y=407;width=43;height=13;angle=339;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[103] = "func=tri;x=843;y=410;x1=6;y1=0;x2=0;y2=43;x3=12;y3=43;angle=236;bc=#B5451D;pc=#B55D1D;pw=2;" shape[104] = "func=rect;x=849;y=383;width=48;height=16;angle=348;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[105] = "func=tri;x=819;y=376;x1=6;y1=0;x2=0;y2=55;x3=13;y3=55;angle=250;bc=#B5451D;pc=#B55D1D;pw=2;" shape[106] = "func=rect;x=839;y=360;width=58;height=14;angle=357;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[107] = "func=tri;x=802;y=347;x1=6;y1=0;x2=0;y2=79;x3=12;y3=79;angle=243;bc=#B5451D;pc=#B55D1D;pw=2;" shape[108] = "func=rect;x=843;y=339;width=58;height=14;angle=6;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[109] = "func=tri;x=800;y=313;x1=6;y1=0;x2=0;y2=89;x3=13;y3=89;angle=249;bc=#B5451D;pc=#B55D1D;pw=2;" shape[110] = "func=rect;x=841;y=310;width=69;height=15;angle=37;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[111] = "func=ell;x=842;y=260;width=83;height=34;angle=140;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[112] = "func=line;x=899;y=258;x1=6;y1=0;x2=0;y2=15;pc=#FFFFFF;pw=2;" shape[113] = "func=line;x=882;y=272;x1=19;y1=0;x2=0;y2=2;pc=#FFFFFF;pw=2;" shape[114] = "func=line;x=883;y=273;x1=0;y1=0;x2=0;y2=18;pc=#FFFFFF;pw=2;" shape[115] = "func=line;x=862;y=290;x1=0;y1=5;x2=20;y2=0;pc=#FFFFFF;pw=2;" shape[116] = "func=line;x=958;y=203;x1=0;y1=0;x2=1;y2=0;pc=#FFFFFF;pw=2;" shape[117] = "func=line;x=926;y=352;x1=0;y1=0;x2=15;y2=12;pc=#B5451D;pw=2;" shape[118] = "func=line;x=939;y=365;x1=0;y1=0;x2=2;y2=15;pc=#B5451D;pw=2;" shape[119] = "func=line;x=927;y=377;x1=14;y1=0;x2=0;y2=18;pc=#B5451D;pw=2;" shape[120] = "func=line;x=1010;y=352;x1=14;y1=0;x2=0;y2=9;pc=#B5451D;pw=2;" shape[121] = "func=line;x=1009;y=362;x1=0;y1=0;x2=0;y2=18;pc=#B5451D;pw=2;" shape[122] = "func=line;x=1010;y=381;x1=0;y1=0;x2=8;y2=11;pc=#B5451D;pw=2;" ' 6 Ant shape[123] = "func=rect;x=901;y=75;width=6;height=14;angle=330;bc=yellow;pc=red;pw=2;" shape[124] = "func=rect;x=882;y=45;width=5;height=18;angle=338;bc=yellow;pc=red;pw=2;" shape[125] = "func=rect;x=848;y=26;width=3;height=19;angle=241;bc=lime;pc=red;pw=2;" shape[126] = "func=rect;x=868;y=43;width=6;height=25;angle=294;bc=#000000;pc=#000000;pw=2;" shape[127] = "func=rect;x=880;y=27;width=5;height=20;angle=358;bc=#000000;pc=#000000;pw=2;" shape[128] = "func=rect;x=873;y=20;width=5;height=18;angle=241;bc=#000000;pc=#000000;pw=2;" shape[129] = "func=ell;x=867;y=59;width=46;height=21;bc=#000000;pc=#000000;pw=2;" shape[130] = "func=ell;x=876;y=96;width=54;height=7;angle=6;bc=#907D5B;pc=#5E635B;pw=2;" shape[131] = "func=ell;x=859;y=106;width=25;height=4;angle=289;bc=#5E635B;pc=#5E635B;pw=2;" shape[132] = "func=ell;x=851;y=114;width=19;height=6;angle=347;bc=#907D5B;pc=#5E635B;pw=2;" shape[133] = "func=ell;x=1009;y=124;width=26;height=6;angle=7;bc=#907D5B;pc=#5E635B;pw=2;" shape[134] = "func=ell;x=947;y=95;width=46;height=6;angle=165;bc=#5E635B;pc=#5E635B;pw=2;" shape[135] = "func=ell;x=968;y=104;width=43;height=9;angle=238;bc=#907D5B;pc=#5E635B;pw=2;" shape[136] = "func=rect;x=846;y=30;width=5;height=20;angle=345;bc=#000000;pc=#000000;pw=2;" shape[137] = "func=ell;x=867;y=63;width=11;height=11;bc=#E3D4D1;pc=#000000;pw=2;" shape[138] = "func=ell;x=914;y=95;width=39;height=8;angle=152;bc=#5E635B;pc=#5E635B;pw=2;" shape[139] = "func=ell;x=935;y=103;width=38;height=9;angle=257;bc=#907D5B;pc=#5E635B;pw=2;" shape[140] = "func=ell;x=956;y=123;width=20;height=8;angle=24;bc=#907D5B;pc=#5E635B;pw=2;" shape[141] = "func=ell;x=891;y=88;width=46;height=21;angle=12;bc=#000000;pc=#000000;pw=2;" shape[142] = "func=ell;x=933;y=93;width=46;height=21;bc=#000000;pc=#000000;pw=2;" shape[143] = "func=ell;x=989;y=83;width=73;height=34;angle=352;bc=#000000;pc=#000000;pw=2;" shape[144] = "func=ell;x=878;y=94;width=54;height=7;angle=18;bc=#907D5B;pc=#5E635B;pw=2;" shape[145] = "func=ell;x=852;y=107;width=48;height=7;angle=282;bc=#5E635B;pc=#5E635B;pw=2;" shape[146] = "func=ell;x=840;y=132;width=30;height=5;angle=347;bc=#907D5B;pc=#5E635B;pw=2;" shape[147] = "func=ell;x=949;y=96;width=39;height=8;angle=152;bc=#5E635B;pc=#5E635B;pw=2;" shape[148] = "func=ell;x=931;y=116;width=56;height=8;angle=268;bc=#907D5B;pc=#5E635B;pw=2;" shape[149] = "func=ell;x=959;y=148;width=40;height=5;angle=14;bc=#907D5B;pc=#5E635B;pw=2;" shape[150] = "func=ell;x=923;y=95;width=39;height=8;angle=152;bc=#5E635B;pc=#5E635B;pw=2;" shape[151] = "func=ell;x=963;y=116;width=79;height=9;angle=238;bc=#907D5B;pc=#5E635B;pw=2;" shape[152] = "func=ell;x=1020;y=154;width=30;height=5;angle=14;bc=#907D5B;pc=#5E635B;pw=2;" shape[153] = "func=ell;x=855;y=72;width=14;height=5;angle=348;bc=#000000;pc=#000000;pw=2;" endsub End>BZF497-0.sb< Start>BZF497.sb< 'mahreen miangul 'Animals Animation ' November 2016 GraphicsWindow.Width = 1255 GraphicsWindow.Height = 488 GraphicsWindow.BackgroundColor = "rosybrown" ' 2Animals GraphicsWindow.MouseDown=pngsave Shapes_Init() s = 1.1 '<---- scale 'Draw outline For i = 1 To Array.GetItemCount(shape) GraphicsWindow.PenColor = shape[i]["pc"] '<-------------- pen color GraphicsWindow.DrawEllipse(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s) Program.Delay(30) EndFor ' Add and Animate shapes for solid color GraphicsWindow.PenWidth = 0 For i = 1 To Array.GetItemCount(shape) GraphicsWindow.BrushColor = shape[i]["bc"] ' <-------------- brush color shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s) Shapes.Animate(shp[i], shape[i]["x"]*s, shape[i]["y"]*s, 500) Shapes.Rotate(SHP[i], Shape[i]["angle"]) ' <-------------- rotating angle Program.Delay(50) EndFor While "True" For i=1 To Array.GetItemCount(shape) Shapes.Rotate(SHP[i],Shape[i]["angle"]) ' <-------------- rotating angle EndFor Program.Delay(1500) For i=1 To Array.GetItemCount(shape) Shapes.Rotate(SHP[i], 0) ' <-------------- rotating angle EndFor Program.Delay(500) endwhile Sub pngsave MX= GraphicsWindow.MouseX MY= GraphicsWindow.MouseY GraphicsWindow.BackgroundColor=GraphicsWindow.GetRandomColor() ' "rosybrown" endsub Sub Shapes_Init shX = 100 ' x offset shY = 97 ' y offset shape = "" ' array shape [] contains "func" , "x", "y" , ( "x1","y1","x2","y2","x3","y3") "width" , "height" , "angle" , "bc" , "pc" , "pw" indexes. ' 1 Rocket shape[1] = "func=rect;x=42.516662597656;y=113.800010681153;width=109;height=181;bc=#FF0000;pc=#FF000000;pw=2;" shape[2] = "func=tri;x=0;y=209.333335876465;x1=32;y1=0;x2=0;y2=74;x3=64;y3=74;angle=26;bc=#FFADAD;pc=#FF000000;pw=2;" shape[3] = "func=tri;x=132;y=207.333335876465;x1=31;y1=0;x2=0;y2=79;x3=62;y3=79;angle=337;bc=#FFADAD;pc=#FF000000;pw=2;" shape[4] = "func=line;x=97.366668701172;y=211.900016784668;x1=1.116668701172;y1=0.000000000000;x2=0.000000000000;y2=79.283325195313;pc=#FF000000;pw=2;" shape[5] = "func=tri;x=62.116668701172;y=293.716667175293;x1=36;y1=0;x2=0;y2=30;x3=72;y3=30;bc=#FFADAD;pc=#FF000000;pw=2;" shape[6] = "func=tri;x=35.783355712891;y=0.000000000000;x1=62;y1=0;x2=0;y2=115;x3=124;y3=115;bc=#FFADAD;pc=#FF000000;pw=2;" shape[7] = "func=ell;x=74.116668701172;y=329.283317565918;width=45;height=102;bc=#FF0700;pc=#FF000000;pw=2;" shape[8] = "func=ell;x=79.233337402344;y=341.333335876465;width=34;height=71;bc=#FF7E07;pc=#FF000000;pw=2;" shape[9] = "func=ell;x=86.533332824707;y=355.583335876465;width=19;height=42;bc=#FFFF00;pc=#FF000000;pw=2;" shape[10] = "func=rect;x=33;y=382.333335876465;width=141;height=43;bc=#FFFFFF;pc=#FFFFFF;pw=2;" ' 2 SnowMan shape[11] = "func=rect;x=383;y=297;width=38;height=15;angle=29;bc=#68432C;pw=0;" shape[12] = "func=rect;x=300;y=357;width=324;height=113;bc=#FFFFFF;pw=0;"' Boder shape[13] = "func=rect;x=300;y=357;width=324;height=113;bc=lightyellow;pw=0;"' Boder shape[14] = "func=ell;x=415;y=236;width=84;height=73;bc=#FFFFFF;pw=0;" shape[15] = "func=ell;x=399;y=290;width=115;height=97;bc=#FFFFFF;pw=0;" shape[16] = "func=rect;x=433;y=267;width=16;height=6;bc=#000000;pw=0;" shape[17] = "func=rect;x=465;y=267;width=16;height=6;bc=#000000;pw=0;" shape[18] = "func=ell;x=432;y=260;width=18;height=19;bc=#000000;pw=0;" shape[19] = "func=ell;x=464;y=260;width=18;height=19;bc=#000000;pw=0;" shape[20] = "func=rect;x=446;y=287;width=21;height=5;bc=#000000;pw=0;" ' 3 Duk 'The Donald shape[21] = "func=tri;x=203;y=41;x1=47;y1=0;x2=0;y2=22;x3=95;y3=22;bc=red;pw=0;beck" shape[22] = "func=ell;x=268;y=0;width=91;height=73;bc=blue;pw=0;" shape[23] = "func=line;x=172;y=36;x1=0;y1=0;x2=22;y2=0;pc=red;pw=2;blink" shape[24] = "func=ell;x=322;y=25;width=22;height=22;bc=pink;pw=0;eye" shape[25] = "func=tri;x=282;y=58;x1=31;y1=0;x2=0;y2=45;x3=62;y3=45;bc=red;pw=0;neck" shape[26] = "func=tri;x=150;y=80;x1=37;y1=0;x2=0;y2=32;x3=75;y3=32;angle=178;bc=red;pw=0;tail" shape[27] = "func=line;x=91;y=134;x1=0;y1=0;x2=0;y2=36;pc=red;pw=8;Leg1" shape[28] = "func=ell;x=183;y=72;width=164;height=82;bc=yellow;pw=0;body" shape[29] = "func=tri;x=330;y=180;x1=46;y1=0;x2=0;y2=14;x3=93;y3=14;bc=red;pw=0;Leg3" shape[30] = "func=line;x=90;y=169;x1=0;y1=0;x2=14;y2=15;pc=yellow;pw=8;Leg2" ' 4 Gurrila ' The Donkey Kong shape[31] = "func=ell;x=598;y=244;width=110;height=71;bc=yellowgreen;pw=0;" shape[32] = "func=ell;x=551;y=247;width=75;height=23;angle=348;bc=yellow;pc=red;pw=2;" shape[33] = "func=ell;x=697;y=250;width=74;height=22;angle=11;bc=yellow;pc=red;pw=2;" shape[34] = "func=ell;x=613;y=253;width=20;height=22;bc=greenyellow;pc=red;pw=2;" shape[35] = "func=ell;x=691;y=255;width=18;height=20;bc=greenyellow;pc=red;pw=2;" shape[36] = "func=ell;x=540;y=260;width=13;height=16;bc=greenyellow;pc=red;pw=2;" shape[37] = "func=ell;x=547;y=264;width=16;height=18;bc=greenyellow;pc=red;pw=2;" shape[38] = "func=ell;x=761;y=267;width=13;height=13;bc=greenyellow;pc=red;pw=2;" shape[39] = "func=ell;x=752;y=269;width=13;height=15;bc=greenyellow;pc=red;pw=2;" shape[40] = "func=ell;x=581;y=190;width=36;height=67;angle=332;bc=greenyellow;pw=0;" shape[41] = "func=ell;x=700;y=188;width=35;height=67;angle=20;bc=greenyellow;pw=0;" shape[42] = "func=ell;x=576;y=175;width=62;height=43;bc=lime;pw=0;" shape[43] = "func=ell;x=671;y=178;width=60;height=40;bc=lime;pw=0;" shape[44] = "func=ell;x=612;y=139;width=82;height=76;bc=yellow;pw=0;" shape[45] = "func=ell;x=575;y=99;width=81;height=72;bc=deepskyblue;pw=0;" shape[46] = "func=ell;x=649;y=96;width=82;height=74;bc=deepskyblue;pw=0;" shape[47] = "func=ell;x=505;y=87;width=107;height=55;angle=340;bc=cyan;pw=0;" shape[48] = "func=ell;x=695;y=82;width=109;height=59;angle=25;bc=cyan;pw=0;" shape[49] = "func=ell;x=500;y=126;width=43;height=76;angle=341;bc=hotpink;pw=0;" shape[50] = "func=ell;x=763;y=126;width=45;height=72;angle=17;bc=hotpink;pw=0;" shape[51] = "func=ell;x=533;y=176;width=39;height=35;bc=#FDBC90;pc=#834216;pw=2;" shape[52] = "func=ell;x=739;y=176;width=41;height=37;bc=#FDBC90;pc=#834216;pw=2;" shape[53] = "func=tri;x=613;y=0;x1=37;y1=0;x2=0;y2=76;x3=75;y3=76;bc=#834216;pw=0;" shape[54] = "func=tri;x=648;y=5;x1=15;y1=0;x2=0;y2=43;x3=31;y3=43;bc=#834216;pw=0;" shape[55] = "func=ell;x=610;y=46;width=58;height=41;angle=33;bc=#FDBC90;pw=0;" shape[56] = "func=ell;x=638;y=47;width=61;height=41;angle=318;bc=#FDBC90;pw=0;" shape[57] = "func=tri;x=619;y=60;x1=33;y1=0;x2=0;y2=41;x3=67;y3=41;angle=180;bc=#000000;pc=#000000;pw=2;" shape[58] = "func=ell;x=627;y=61;width=28;height=19;angle=349;bc=#FFFFFF;pc=#000000;pw=2;" shape[59] = "func=ell;x=652;y=62;width=30;height=20;angle=16;bc=#FFFFFF;pc=#000000;pw=2;" shape[60] = "func=ell;x=635;y=66;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[61] = "func=ell;x=658;y=67;width=14;height=15;bc=#000000;pc=#000000;pw=2;" shape[62] = "func=ell;x=623;y=140;width=59;height=60;bc=#FCA76E;pc=#834216;pw=2;" shape[63] = "func=ell;x=650;y=107;width=62;height=55;bc=#FCA76E;pw=0;" shape[64] = "func=ell;x=594;y=107;width=64;height=53;bc=#FCA76E;pw=0;" shape[65] = "func=ell;x=596;y=79;width=118;height=69;bc=#FDBC90;pc=#834216;pw=2;" shape[66] = "func=ell;x=577;y=65;width=35;height=23;angle=38;bc=#FDBC90;pc=#834216;pw=2;" shape[67] = "func=ell;x=694;y=63;width=36;height=23;angle=317;bc=#FDBC90;pc=#834216;pw=2;" shape[68] = "func=ell;x=630;y=74;width=22;height=17;angle=15;bc=#FDBC90;pw=0;" shape[69] = "func=ell;x=656;y=73;width=22;height=18;angle=348;bc=#FDBC90;pw=0;" shape[70] = "func=tri;x=611;y=90;x1=10;y1=0;x2=0;y2=22;x3=20;y3=22;angle=298;bc=#FFFFFF;pc=#000000;pw=2;" shape[71] = "func=tri;x=672;y=91;x1=11;y1=0;x2=0;y2=23;x3=22;y3=23;angle=62;bc=#FFFFFF;pc=#000000;pw=2;" shape[72] = "func=rect;x=625;y=97;width=55;height=21;bc=#FFFFFF;pc=#000000;pw=2;" shape[73] = "func=ell;x=635;y=78;width=15;height=9;angle=23;bc=#834216;pw=0;" shape[74] = "func=ell;x=659;y=77;width=15;height=9;angle=339;bc=#834216;pw=0;" shape[75] = "func=line;x=652;y=97;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[76] = "func=line;x=637;y=98;x1=0;y1=0;x2=0;y2=19;pc=#000000;pw=2;" shape[77] = "func=line;x=667;y=99;x1=0;y1=0;x2=0;y2=18;pc=#000000;pw=2;" ' 5 Crab shape[78] = "func=rect;x=909;y=333;width=138;height=81;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[79] = "func=ell;x=896;y=333;width=26;height=80;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[80] = "func=ell;x=1033;y=334;width=26;height=80;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[81] = "func=rect;x=1053;y=332;width=58;height=14;angle=341;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[82] = "func=tri;x=1141;y=290;x1=6;y1=0;x2=0;y2=87;x3=13;y3=87;angle=95;bc=#B5451D;pc=#B55D1D;pw=2;" shape[83] = "func=rect;x=1057;y=357;width=58;height=14;angle=356;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[84] = "func=tri;x=1140;y=339;x1=7;y1=0;x2=0;y2=76;x3=14;y3=76;angle=113;bc=#B5451D;pc=#B55D1D;pw=2;" shape[85] = "func=rect;x=1056;y=379;width=48;height=16;angle=1;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[86] = "func=tri;x=1117;y=370;x1=7;y1=0;x2=0;y2=53;x3=14;y3=53;angle=113;bc=#B5451D;pc=#B55D1D;pw=2;" shape[87] = "func=rect;x=1052;y=406;width=43;height=13;angle=15;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[88] = "func=tri;x=1102;y=407;x1=6;y1=0;x2=0;y2=43;x3=12;y3=43;angle=124;bc=#B5451D;pc=#B55D1D;pw=2;" shape[89] = "func=rect;x=1015;y=310;width=7;height=25;bc=#B5451D;pc=#B55D1D;pw=2;" shape[90] = "func=rect;x=1026;y=308;width=8;height=0;bc=#B5451D;pc=#B55D1D;pw=2;" shape[91] = "func=ell;x=1005;y=295;width=20;height=20;bc=#000000;pc=#B55D1D;pw=2;" shape[92] = "func=rect;x=935;y=310;width=7;height=25;bc=#B5451D;pc=#B55D1D;pw=2;" shape[93] = "func=ell;x=925;y=291;width=20;height=20;bc=#000000;pc=#B55D1D;pw=2;" shape[94] = "func=rect;x=1041;y=3009;width=72;height=14;angle=321;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[95] = "func=ell;x=994;y=233;width=137;height=61;angle=25;bc=#B5451D;pc=#B55D1D;pw=2;" shape[96] = "func=tri;x=1031;y=245;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=31;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[97] = "func=tri;x=1016;y=237;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=25;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[98] = "func=tri;x=1062;y=258;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=26;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[99] = "func=tri;x=1076;y=266;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=28;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[100] = "func=tri;x=1091;y=272;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=22;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[101] = "func=tri;x=1047;y=252;x1=8;y1=0;x2=0;y2=14;x3=16;y3=14;angle=31;bc=#FFFFFF;pc=#B55D1D;pw=2;" shape[102] = "func=rect;x=864;y=407;width=43;height=13;angle=339;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[103] = "func=tri;x=843;y=410;x1=6;y1=0;x2=0;y2=43;x3=12;y3=43;angle=236;bc=#B5451D;pc=#B55D1D;pw=2;" shape[104] = "func=rect;x=849;y=383;width=48;height=16;angle=348;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[105] = "func=tri;x=819;y=376;x1=6;y1=0;x2=0;y2=55;x3=13;y3=55;angle=250;bc=#B5451D;pc=#B55D1D;pw=2;" shape[106] = "func=rect;x=839;y=360;width=58;height=14;angle=357;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[107] = "func=tri;x=802;y=347;x1=6;y1=0;x2=0;y2=79;x3=12;y3=79;angle=243;bc=#B5451D;pc=#B55D1D;pw=2;" shape[108] = "func=rect;x=843;y=339;width=58;height=14;angle=6;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[109] = "func=tri;x=800;y=313;x1=6;y1=0;x2=0;y2=89;x3=13;y3=89;angle=249;bc=#B5451D;pc=#B55D1D;pw=2;" shape[110] = "func=rect;x=841;y=310;width=69;height=15;angle=37;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[111] = "func=ell;x=842;y=260;width=83;height=34;angle=140;bc=#B55D1D;pc=#B55D1D;pw=2;" shape[112] = "func=line;x=899;y=258;x1=6;y1=0;x2=0;y2=15;pc=#FFFFFF;pw=2;" shape[113] = "func=line;x=882;y=272;x1=19;y1=0;x2=0;y2=2;pc=#FFFFFF;pw=2;" shape[114] = "func=line;x=883;y=273;x1=0;y1=0;x2=0;y2=18;pc=#FFFFFF;pw=2;" shape[115] = "func=line;x=862;y=290;x1=0;y1=5;x2=20;y2=0;pc=#FFFFFF;pw=2;" shape[116] = "func=line;x=958;y=203;x1=0;y1=0;x2=1;y2=0;pc=#FFFFFF;pw=2;" shape[117] = "func=line;x=926;y=352;x1=0;y1=0;x2=15;y2=12;pc=#B5451D;pw=2;" shape[118] = "func=line;x=939;y=365;x1=0;y1=0;x2=2;y2=15;pc=#B5451D;pw=2;" shape[119] = "func=line;x=927;y=377;x1=14;y1=0;x2=0;y2=18;pc=#B5451D;pw=2;" shape[120] = "func=line;x=1010;y=352;x1=14;y1=0;x2=0;y2=9;pc=#B5451D;pw=2;" shape[121] = "func=line;x=1009;y=362;x1=0;y1=0;x2=0;y2=18;pc=#B5451D;pw=2;" shape[122] = "func=line;x=1010;y=381;x1=0;y1=0;x2=8;y2=11;pc=#B5451D;pw=2;" ' 6 Ant shape[123] = "func=rect;x=901;y=75;width=6;height=14;angle=330;bc=yellow;pc=red;pw=2;" shape[124] = "func=rect;x=882;y=45;width=5;height=18;angle=338;bc=yellow;pc=red;pw=2;" shape[125] = "func=rect;x=848;y=26;width=3;height=19;angle=241;bc=lime;pc=red;pw=2;" shape[126] = "func=rect;x=868;y=43;width=6;height=25;angle=294;bc=#000000;pc=#000000;pw=2;" shape[127] = "func=rect;x=880;y=27;width=5;height=20;angle=358;bc=#000000;pc=#000000;pw=2;" shape[128] = "func=rect;x=873;y=20;width=5;height=18;angle=241;bc=#000000;pc=#000000;pw=2;" shape[129] = "func=ell;x=867;y=59;width=46;height=21;bc=#000000;pc=#000000;pw=2;" shape[130] = "func=ell;x=876;y=96;width=54;height=7;angle=6;bc=#907D5B;pc=#5E635B;pw=2;" shape[131] = "func=ell;x=859;y=106;width=25;height=4;angle=289;bc=#5E635B;pc=#5E635B;pw=2;" shape[132] = "func=ell;x=853;y=107;width=19;height=3;angle=347;bc=#907D5B;pc=#5E635B;pw=2;" shape[133] = "func=ell;x=1009;y=124;width=26;height=6;angle=7;bc=#907D5B;pc=#5E635B;pw=2;" shape[134] = "func=ell;x=947;y=95;width=46;height=6;angle=165;bc=#5E635B;pc=#5E635B;pw=2;" shape[135] = "func=ell;x=978;y=104;width=43;height=9;angle=238;bc=#907D5B;pc=#5E635B;pw=2;" shape[136] = "func=rect;x=856;y=30;width=5;height=20;angle=345;bc=#000000;pc=#000000;pw=2;" shape[137] = "func=ell;x=877;y=63;width=11;height=11;bc=#E3D4D1;pc=#000000;pw=2;" shape[138] = "func=ell;x=924;y=95;width=39;height=8;angle=152;bc=#5E635B;pc=#5E635B;pw=2;" shape[139] = "func=ell;x=985;y=103;width=38;height=9;angle=257;bc=#907D5B;pc=#5E635B;pw=2;" shape[140] = "func=ell;x=966;y=123;width=20;height=8;angle=24;bc=#907D5B;pc=#5E635B;pw=2;" shape[141] = "func=ell;x=901;y=88;width=46;height=21;angle=12;bc=#000000;pc=#000000;pw=2;" shape[142] = "func=ell;x=943;y=93;width=46;height=21;bc=#000000;pc=#000000;pw=2;" shape[143] = "func=ell;x=989;y=83;width=73;height=34;angle=352;bc=#000000;pc=#000000;pw=2;" shape[144] = "func=ell;x=878;y=94;width=54;height=7;angle=18;bc=#907D5B;pc=#5E635B;pw=2;" shape[145] = "func=ell;x=852;y=107;width=48;height=7;angle=282;bc=#5E635B;pc=#5E635B;pw=2;" shape[146] = "func=ell;x=840;y=132;width=30;height=5;angle=347;bc=#907D5B;pc=#5E635B;pw=2;" shape[147] = "func=ell;x=949;y=96;width=39;height=8;angle=152;bc=#5E635B;pc=#5E635B;pw=2;" shape[148] = "func=ell;x=931;y=166;width=56;height=8;angle=268;bc=#907D5B;pc=#5E635B;pw=2;" shape[149] = "func=ell;x=959;y=148;width=30;height=5;angle=14;bc=#907D5B;pc=#5E635B;pw=2;" shape[150] = "func=ell;x=923;y=95;width=39;height=8;angle=152;bc=#5E635B;pc=#5E635B;pw=2;" shape[151] = "func=ell;x=963;y=109;width=79;height=9;angle=238;bc=#907D5B;pc=#5E635B;pw=2;" shape[152] = "func=ell;x=1021;y=124;width=30;height=5;angle=14;bc=#907D5B;pc=#5E635B;pw=2;" shape[153] = "func=ell;x=855;y=72;width=14;height=5;angle=348;bc=#000000;pc=#000000;pw=2;" endsub End>BZF497.sb< Start>BZK234.sb< contact[1]["name"] = "Fred" contact[2]["name"] = "Mary" contact[3]["name"] = "David" contact[4]["name"] = "Sam" contact[5]["name"] = "Henry" contact[6]["name"] = "Henrietta" contact[7]["name"] = "Helen" contact[8]["name"] = "Helen" var = "name" sortString() For i = 1 To Array.GetItemCount(contact) TextWindow.WriteLine(contact[i][var]) EndFor Sub sortString For i = 1 To Array.GetItemCount(contact)-1 For j = i+1 To Array.GetItemCount(contact) iVar = contact[i][var] jVar = contact[j][var] iValue = -1 jValue = -1 char = 0 While (iValue = jValue And iValue <> 0) char = char+1 iValue = Text.GetCharacterCode(Text.GetSubText(iVar,char,1)) jValue = Text.GetCharacterCode(Text.GetSubText(jVar,char,1)) EndWhile If (jValue < iValue) Then store = contact[i] contact[i] = contact[j] contact[j] = store EndIf EndFor EndFor EndSub End>BZK234.sb< Start>BZK640.sb< For x=1 To 30 tt[x][1]=1 tt[1][x]=1 EndFor For y=2 To 30 For x=2 To 30 tt[x][y]=tt[x-1][y]+tt[x][y-1] EndFor EndFor GraphicsWindow.Title="Pascal's Triangle Cross GraphicsWindow.FontName="Geometr706 BlkCn BT" GraphicsWindow.FontSize=7 'TextWindow.WriteLine(tt) f20=14 GraphicsWindow.BackgroundColor="tan GraphicsWindow.Width=830 GraphicsWindow.Height=830 GraphicsWindow.Top=1 GraphicsWindow.BrushColor="darkred For y=2 To 30 For x=2 To 30 rr=Math.Remainder(x 2)*f20/2 ll=text.GetLength( tt[x][y]) GraphicsWindow.fillEllipse(x*f20-ll/2 y*f20+rr-ll/2 ll ll) GraphicsWindow.fillEllipse(825-(x*f20-ll/2) y*f20+rr-ll/2 ll ll) GraphicsWindow.fillEllipse(x*f20-ll/2 825-(y*f20+rr-ll/2) ll ll) GraphicsWindow.fillEllipse(825-(x*f20-ll/2) 825-(y*f20+rr-ll/2) ll ll) EndFor EndFor End>BZK640.sb< Start>BZL902.sb< '___________________________________________ 'CLICK THE BUTTON GAME 'MADE BY ROEMERBOY 'ALL RIGHTS RESERVED 'ENJOY IT! '___________________________________________ Start() Controls.ButtonClicked = OnButtonClicked Timer.Tick = Timer1 Sub Start GraphicsWindow.Title = "CLICK THE BUTTON" GraphicsWindow.Height = 780 GraphicsWindow.Width = 1280 GraphicsWindow.CanResize = 1 GraphicsWindow.FontName = "Arial" GraphicsWindow.FontBold = 0 Level1() EndSub Sub Level1 a = 0 P1 = Math.GetRandomNumber(1280) P2 = Math.GetRandomNumber(780) GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = 20 GraphicsWindow.BackgroundColor = "Red" Level1B = Controls.AddButton("CLICK ME!!!!!!!!!", P1, P2) Controls.SetSize(Level1B, 200, 60) Move1() EndSub Sub Level2 a = 1 P1 = Math.GetRandomNumber(1280) P2 = Math.GetRandomNumber(780) GraphicsWindow.BrushColor = "Magenta" Controls.HideControl(Level1B) GraphicsWindow.FontSize = 10 GraphicsWindow.BackgroundColor = "Blue" Level2B = Controls.AddButton("CLICK ME!!!!!!!!!", P1, P2) Controls.SetSize(Level2B, 100, 30) Move2() EndSub Sub Level3 a = 2 P1 = Math.GetRandomNumber(1280) P2 = Math.GetRandomNumber(780) GraphicsWindow.BrushColor = "Brown" Controls.HideControl(Level2B) GraphicsWindow.FontSize = 5 GraphicsWindow.BackgroundColor = "Green" Level3B = Controls.AddButton("CLICK ME!!!!!!!!!", P1, P2) Controls.SetSize(Level3B, 50, 15) Move3() EndSub Sub Level4 a = 3 P1 = Math.GetRandomNumber(1280) P2 = Math.GetRandomNumber(780) GraphicsWindow.BrushColor = "Black" Controls.HideControl(Level3B) GraphicsWindow.FontSize = 4 GraphicsWindow.BackgroundColor = "Gray" Level4B = Controls.AddButton("CLICK ME!!!!!!!!!", P1, P2) Controls.SetSize(Level4B, 25, 10) Move4() EndSub Sub Move1 x = Math.GetRandomNumber(1280) y = Math.GetRandomNumber(780) Shapes.Animate(Level1B, x, y, 9000) Timer.Interval = 9010 EndSub Sub Move2 x = Math.GetRandomNumber(1280) y = Math.GetRandomNumber(780) Shapes.Animate(Level2B, x, y, 5000) Timer.Interval = 5010 EndSub Sub Move3 x = Math.GetRandomNumber(1280) y = Math.GetRandomNumber(780) Shapes.Animate(Level3B, x, y, 1200) Timer.Interval = 1210 EndSub Sub Move4 x = Math.GetRandomNumber(1280) y = Math.GetRandomNumber(780) Shapes.Animate(Level4B, x, y, 500) Timer.Interval = 510 EndSub Sub Timer1 If (a = 0) Then r = Math.GetRandomNumber(1280) s = Math.GetRandomNumber(780) Shapes.Animate(Level1B, r, s, 10000) ElseIf (a = 1) Then r = Math.GetRandomNumber(1280) s = Math.GetRandomNumber(780) Shapes.Animate(Level2B, r, s, 5010) ElseIf (a = 2) Then r = Math.GetRandomNumber(1280) s = Math.GetRandomNumber(780) Shapes.Animate(Level3B, r, s, 1210) ElseIf (a = 3) Then r = Math.GetRandomNumber(1280) s = Math.GetRandomNumber(780) Shapes.Animate(Level4B, r, s, 510) EndIf Endsub Sub OnButtonClicked LastButton = Controls.LastClickedButton If (LastButton = Level1B) Then Sound.PlayBellRing() GraphicsWindow.ShowMessage("You clicked the first Button! Now you can go to level two. Good luck!", "Second Level") Level2() ElseIf (LastButton = Level2B) Then Sound.PlayBellRing() GraphicsWindow.ShowMessage("You clicked the second Button! Wow. But the next level will be much harder!", "Third Level") Level3() ElseIf (LastButton = Level3B) Then Sound.PlayBellRing() GraphicsWindow.ShowMessage("You clicked the third Button! The next level is to hard for you. Hehehe", "Fourth Level") Level4() ElseIf (LastButton = Level4B) Then Sound.PlayBellRing() GraphicsWindow.ShowMessage("Wow! I thought, you can't do this level.... Congratulations! You are the lucky winner. :D", "O.O You won!") Program.End() EndIf EndSub End>BZL902.sb< Start>BZM916.sb< cc[1]=" ### ### ### ### # # ## ## ## ### ## # # # # # # # # ## ### ## ## ### # # # # # # # # ### # # ## # ### ## ### ### ### # ### cc[2]=" # # # # # # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # ## # # # # # # # # # # # # # # # # cc[3]=" ### ### # # # # # ## # # # ### # # ### # ## # # # # # ### ## # # # # # # # ### # # # # ### ## ## # # ### # # # # cc[4]=" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # ## cc[5]=" # # ### ### ### ### ## ## ## # ## # # ## # # ### # # # # # # # ## # # # # # # ### ### ### ### ## # ## # # ### # # # GraphicsWindow.PenWidth=0 GraphicsWindow.BackgroundColor="tan GraphicsWindow.BrushColor="darkblue GraphicsWindow.Width=1500 GraphicsWindow.Title="Qled Display ix="AEIOUBCDFGHJKLMNPRSTVWXYZ1234567890Q " TXT=" the playlist of songs 1234567890 tu= Text.ConvertToUpperCase(txt) For x=0 To 150 For y=0 To 6 b=Shapes.AddRectangle(8 8) Shapes.Move(b x*9 y*9+30) d=Math.Floor(x/4)+1 n=Math.Remainder(x 4)+4*(Text.GetIndexOf(ix text.GetSubText(tu d 1))-1)+1 ' TextWindow.WriteLine(d+" :: "+n) If Text.GetSubText(cc[y] n 1)="#" Then LDShapes.BrushColour(b "tan") EndIf EndFor EndFor ss=LDShapes.GetAllShapes() For f=1 To 33 tu=Text.GetSubTextToEnd(tu 2) y=0 GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle(0 200 1500 50) GraphicsWindow.BrushColor="darkred For i=1 To Array.GetItemCount(ss) x=Math.Floor(i/7) d=Math.Floor(x/4)+1 n=Math.Remainder(x 4)+4*(Text.GetIndexOf(ix text.GetSubText(tu d 1))-1)+1 If y>0 and y<6 Then If Text.GetSubText(cc[y] n 1)="#" Then LDShapes.BrushColour(ss[i] "tan") If d=1 Then e=shapes.addEllipse(4 4) shapes.move(e 1500 y*5+200) shapes.Animate(e (x+f*4)*5+20 y*5+200 150) EndIf Else LDShapes.BrushColour(ss[i] "darkblue") EndIf EndIf y=y+1 If y>6 Then y=0 EndIf EndFor Program.Delay(52) EndFor End>BZM916.sb< Start>BZN148.sb< 'Spin/Roll Effect Example - by Matthew L. Parets aka codingCat 'The effect suggests the spinning of a slot machine wheel 'This effect takes advantage of the fact that small basic layers 'shapes as they are created. New shapes are created on top 'of previous created shapes. GraphicsWindow.Show() GraphicsWindow.PenColor = "Black" ' Change to white to see the full effect circ = Shapes.AddEllipse(25,25) 'A shape on the wheel GraphicsWindow.BrushColor = "black" ' Change to white to see the full effect bottom = Shapes.AddRectangle(30,30) 'The rectangles will be created on top of the circle top = Shapes.AddRectangle(30,30) Shapes.Move(top, 300,100) 'Move the rectangles to the middle of the screen Shapes.Move(bottom, 300,160) Shapes.Move(circ, 303,100) 'hide the circle behind the top rectangle circY = 100 'Starting place for circle While "True" circY = circY + 1 'Move the circle down a dot If circY > 160 Then 'Are we fully behind the bottom rectangle? circY = 100 'Move up behind the top rectangle EndIf Shapes.Move(circ, 303,circY) 'Move the circle Program.Delay(10) 'wait for a second EndWhile End>BZN148.sb< Start>BZN186.sb< 'Hang a man for Small Basic 'You'll need to have a "word.txt" in the same folder as the script. 'First line is the number of words, i.e. 10, each conscutive line is a word. 'I recomend the "100 words" series from houghton mifflin books 'The words are out of the norm, but should be fimilar. ''should only need these once GraphicsWindow.Show() GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "Hanger" MuteSound = "True" InitialSetup() 'This is all the stuff that we need in the begining of the game Sub InitialSetup 'We can play forever, so clear the screen each time we run. GraphicsWindow.Clear() 'Get the word. read a random line from a file. ' The following line could be harmful and has been automatically commented. ' word = Text.ConvertToUpperCase(File.ReadLine(Program.Directory+"\Words.txt",Math.GetRandomNumber( File.ReadLine(Program.Directory+"\Words.txt",0)))) 'We have not failed, yet, this tracks wrong letters. Fail = 0 'Set the event handlers. we change them when game is over, reset them here. GraphicsWindow.KeyDown = OnPress GraphicsWindow.MouseDown = OnClick 'Populate the first of many arrays. 'pword tells us the which letters to display. I tend to use psudo-random variable names 'you don't like it, change it. Oh and ignore spaces. For i = 1 To Text.GetLength(word) If (Text.GetSubText(word,i,1) = " ")Then pword[i] = 1 Else pword[i] = 0 EndIf EndFor If (Text.GetLength(word) < Array.GetItemCount(pword)) Then For i = Text.GetLength(word) + 1 To Array.GetItemCount(pword) pword[i] = 1 EndFor EndIf DispSound() 'Brush and pen Colors GraphicsWindow.PenColor = "black" GraphicsWindow.BrushColor = "blue" 'Window size GraphicsWindow.Width = 330 GraphicsWindow.Height= 300 'It's Gallows time GraphicsWindow.DrawLine(50,25,125,25) GraphicsWindow.DrawLine(50,25,50,150) GraphicsWindow.DrawLine(25,150,175,150) GraphicsWindow.DrawLine(125,25,125,40) 'XR is our left offset for the letter boxes 'Y1,Y2 are the top offset, and they are back wards, agian suck it up =P XR = 5 Y1 = GraphicsWindow.Height -25 Y2 = GraphicsWindow.Height -50 'draw the boxes with letters on the screen. 'it's 1-13 because i like to multitask, and it makes sense For i = 1 to 13 'just a rectangle GraphicsWindow.DrawRectangle(xr,Y1,20,20) GraphicsWindow.DrawRectangle(xr,Y2,20,20) 'For those of you who don't know 65 is the code for "A" and 66 is "B" etc 'we only use upper case, since thats what the keyboard keys are read as GraphicsWindow.DrawText(XR+5, y2+3, Text.GetCharacter(64+i)) GraphicsWindow.DrawText(XR+5, y1+3, Text.GetCharacter(77+i)) 'these should be self explanitory, sets the x,y for each letter lx[Text.GetCharacter(64+i)] = XR lx[Text.GetCharacter(77+i)] = XR ly[Text.GetCharacter(64+i)] = Y2 ly[Text.GetCharacter(77+i)] = Y1 ' lb[] is for deciding if a key has been 'pressed before seemed good place for init the array. lb[Text.GetCharacter(64+i)] = 0 lb[Text.GetCharacter(77+i)] = 0 'get the left offset ready for the next loop. XR = XR + 25 EndFor 'Display the word for the first time. DisplayWord() EndSub 'display a the word or phrase. Sub DisplayWord 'this function gets called alot. so clean up. disp = "" 'crawl the word. Show what has been entered. For i = 1 To Text.GetLength(word) If(pword[i] = 1)Then disp = disp + Text.GetSubText(word,i,1) else disp = disp + "#" EndIf EndFor 'Erase what we have then write it agian. GraphicsWindow.BrushColor = "white" GraphicsWindow.PenColor = "white" GraphicsWindow.FillRectangle(0,GraphicsWindow.height-100,200,40) GraphicsWindow.BrushColor = "green" GraphicsWindow.DrawText(30, GraphicsWindow.Height-100, disp) TextWindow.WriteLine(pword) EndSub 'this is was a pain in the ass. just throwing it out there. sub OnPress 'var to shorted the lines. lk = GraphicsWindow.LastKey DoLetter() EndSub Sub OnClick lk = 0 x = GraphicsWindow.MouseX y = GraphicsWindow.MouseY If ((x > 225 And x < 315) And (y > 200 And y < 225)) Then If (MuteSound) Then MuteSound = "False" Else MuteSound = "True EndIf DispSound() EndIf For i = 1 to 26 If( x > lx[Text.GetCharacter(64+i)] And x < (lx[Text.GetCharacter(64+i)] +20)) Then If( y > ly[Text.GetCharacter(64+i)] And y < (ly[Text.GetCharacter(64+i)] +20)) Then lk = Text.GetCharacter(64+i) DoLetter() EndIf EndIf EndFor EndSub Sub DoLetter If (lb[lk] = 0) Then 'oh my, it's a letter that hasn't been pressed lb[lk] = 1 'so we don't care later. 'fill in the box. do it now. GraphicsWindow.BrushColor = "blue" GraphicsWindow.FillRectangle ( lx[lk],ly[lk],20,20) 'Is the letter in the word? If(Text.IsSubText(word, lk)) Then 'crawl the word letter by letter. For i = 1 to Text.GetLength(word) 'is this letter the key that was pressed? If(Text.GetSubText(word,i,1) = lk) Then pword[i] = 1 'let it be seen from now on. EndIf EndFor 'we are done with the key now. Display it. and throw a few debug stuff. DisplayWord() If(MuteSound = "False") Then Sound.PlayChimes() EndIf Else 'You failed in your task, your penalty is. If(MuteSound = "False") Then Sound.PlayClick() EndIf DoFail() EndIf EndIf 'Win Condition!!! If(Array.ContainsValue(pword,0) <> "True") then GraphicsWindow.BrushColor = "GREEN" GraphicsWindow.FontSize = 64 GraphicsWindow.DrawText(20,20, "YOU WIN") GraphicsWindow.FontSize = 12 GraphicsWindow.DrawText(175,20,"press anykey to continue") GraphicsWindow.KeyDown = Nothing GraphicsWindow.MouseDown = Nothing EndIf lk = 0 EndSub Sub DoFail Fail = Fail + 1 GraphicsWindow.PenColor = "Tan" If(Fail = 1)Then GraphicsWindow.DrawEllipse(115,40,20,20) ElseIf (Fail = 2) Then GraphicsWindow.DrawLine(125,60, 125, 100) ElseIf(Fail = 3) Then GraphicsWindow.DrawLine(125,70, 110, 85) ElseIf(Fail = 4) Then GraphicsWindow.DrawLine(125,70, 140, 85) ElseIf(Fail = 5) Then GraphicsWindow.DrawLine(125,100, 110, 115) ElseIf(Fail = 6) Then GraphicsWindow.KeyDown = Nothing GraphicsWindow.MouseDown = Nothing GraphicsWindow.DrawLine(125,100, 140, 115) GraphicsWindow.BrushColor = "RED" GraphicsWindow.FontSize = 64 GraphicsWindow.DrawText(20,20, "YOU FAIL") GraphicsWindow.FontSize = 12 GraphicsWindow.DrawText(175,20,"press anykey to continue") GraphicsWindow.BrushColor = "white" GraphicsWindow.PenColor = "white" GraphicsWindow.FillRectangle(0,GraphicsWindow.height-100,200,40) GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(30, GraphicsWindow.Height-100, word) EndIf EndSub Sub DispSound If(MuteSound) Then GraphicsWindow.BrushColor = "green" Else GraphicsWindow.BrushColor = "White" EndIf GraphicsWindow.PenColor = "Black" GraphicsWindow.FillRectangle( 225, 200, 90, 25) GraphicsWindow.DrawRectangle( 225, 200, 90, 25) GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(235,204,"Mute Sound") EndSub Sub Nothing InitialSetup() EndSub End>BZN186.sb< Start>BZR072.sb< '----------------------------------------------------------------------------------------------------------- '--------------------------Armored Assault--------------------------------------------------------------- '--------------------------Developed By ---------------------------------------------------------------- '--------------------------Sean Sullivan----------------------------------------------------------------- '===========Copyright DOSMANN INC.================================= '-----------------------Started Jan, 2014---------------------------------------------------------------- '------------------------------------------------------------------------------------------------------------ '------------------------------------------------------------------------------------------------------------ GraphicsWindow.Width = 800 GraphicsWindow.Height = 600 GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "Armored Assault" GraphicsWindow.DrawResizedImage(Program.Directory + "/background_picture.jpg",0,0,GraphicsWindow.Width,GraphicsWindow.Height) LDUtilities.Icon = Program.Directory + "/Icon.ico" GraphicsWindow.BrushColor = "Black" Cboard = Shapes.AddImage(Program.Directory + "/Controls.jpg") Shapes.Move(Cboard,2000,150) Shapes.SetOpacity(Cboard,75) ' The following line could be harmful and has been automatically commented. ' Username = LDEncryption.AESDecrypt(File.ReadLine(Program.Directory + "/Settings.txt",1),"TankWars") TankWeapon = LDNetwork.GetGameData("TankWarsWeapons") GraphicsWindow.FontSize = 15 BStartServer = Controls.AddButton("Start Server",330,250) BJoinServer = Controls.AddButton("Join Server",330,300) BChange = Controls.AddButton("Change Username",330,350) BWeapon = Controls.AddButton("Weapon",330,400) BControl = Controls.AddButton("Controls",330,450) Bback = Controls.AddButton("Back",650,1000) LDShapes.SetImage(BJoinServer,Program.Directory + "/button.jpg") LDShapes.BrushColour(BJoinServer,"Black") LDShapes.SetImage(BStartServer,Program.Directory + "/button1.jpg") LDShapes.BrushColour(BStartServer,"Black") LDShapes.SetImage(BChange,Program.Directory + "/button2.jpg") LDShapes.BrushColour(BChange,"Black") LDShapes.SetImage(BWeapon,Program.Directory + "/button3.jpg") LDShapes.BrushColour(BWeapon,"Black") LDShapes.SetImage(BControl,Program.Directory + "/button5.jpg") LDShapes.BrushColour(BControl,"Black") LDShapes.SetImage(Bback,Program.Directory + "/button4.jpg") LDShapes.BrushColour(Bback,"Black") GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 30 GraphicsWindow.DrawText(335,200,Username) GraphicsWindow.BrushColor = "Black" 'Shapes.Move(Shapes.AddText("JOIN SERVER"),330,200) Controls.ButtonClicked = OnButtonClicked Sub OnButtonClicked If Controls.LastClickedButton = BStartServer Then LDProcess.Start(Program.Directory + "/SERVER.exe","") Program.End() ElseIf Controls.LastClickedButton = BChange Then LDProcess.Start(Program.Directory + "/Username.exe","") Program.End() ElseIf Controls.LastClickedButton = BWeapon Then Animateout() GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 15 Seperationx = 250 Seperationy = 175 For t = 1 to 3 For i1 = 1 to 3 If t > 1 Then i = ((t * 3) - 3) + i1 Else i = i1 EndIf If i <= TankWeapon[1]["NumOfWeapons"] Then Offsetx = (i1 * Seperationx) - Seperationx Offsety = (t * Seperationy) - Seperationy If HasAdded <> "True" Then Weapon[i] = Shapes.AddImage(Program.Directory + "/weapons/WeaponSelect.bmp") Shapes.Move(Weapon[i],1000,25 + Offsety) 'OK what i'm trying to accomplish is something like a weapon store. but I can't make it look right. check this out. Shapes.SetOpacity(Weapon[i],70) GraphicsWindow.BrushColor = "Black" BUse[i] = Controls.AddButton("Use",2000,120 + Offsety) GraphicsWindow.BrushColor = "White" Text[i][1] = Shapes.AddText(TankWeapon[i]["Name"]) Text[i][2] = Shapes.AddText("Damage: " + TankWeapon[i]["Damage"]) Text[i][3] = Shapes.AddText("Rate of Fire: " + TankWeapon[i]["ROF"]) Text[i][4] = Shapes.AddText("Velocity: " + TankWeapon[i]["Velocity"]) Text[i][5] = Shapes.AddText("Homing: " + TankWeapon[i]["Homeing"]) Icon[i] = Shapes.AddImage(Program.Directory + "/" + TankWeapon[i]["Icon"]) Shapes.Move(Text[i][1],2000,35 + Offsety) Shapes.Move(Text[i][2],2000,60 + Offsety) Shapes.Move(Text[i][3],2000,75 + Offsety) Shapes.Move(Text[i][4],2000,90 + Offsety) Shapes.Move(Text[i][5],2000,110 + Offsety) Shapes.Move(Icon[i],2000,38 + Offsety) EndIf Shapes.Animate(Weapon[i],25 + Offsetx,25 + Offsety,1000) Shapes.Animate(Text[i][1],90 + Offsetx,35 + Offsety,1000) Shapes.Animate(Text[i][2],35 + Offsetx,60 + Offsety,1000) Shapes.Animate(Text[i][3],35 + Offsetx,75 + Offsety,1000) Shapes.Animate(Text[i][4],35 + Offsetx,90 + Offsety,1000) Shapes.Animate(Text[i][5],35 + Offsetx,105 + Offsety,1000) Shapes.Animate(Icon[i],45 + Offsetx,38 + Offsety,1000) Shapes.Animate(BUse[i],200 + Offsetx,120 + Offsety,1000) EndIf EndFor EndFor HasAdded = "True" Shapes.Animate(Bback,650,550,1000) '650 '550 ElseIf Controls.LastClickedButton = Bback Then For t = 1 to 3 For i1 = 1 to 3 If t > 1 Then i = ((t * 3) - 3) + i1 Else i = i1 EndIf If i <= TankWeapon[1]["NumOfWeapons"] Then Offsetx = (i1 * Seperationx) - Seperationx Offsety = (t * Seperationy) - Seperationy Shapes.Animate(Weapon[i],1000,25 + Offsety,1000) Shapes.Animate(Text[i][1],1000,35 + Offsety,1000) Shapes.Animate(Text[i][2],1000,60 + Offsety,1000) Shapes.Animate(Text[i][3],1000,75 + Offsety,1000) Shapes.Animate(Text[i][4],1000,90 + Offsety,1000) Shapes.Animate(Text[i][5],1000,105 + Offsety,1000) Shapes.Animate(Icon[i],1000,38 + Offsety,1000) Shapes.Animate(BUse[i],1000,120 + Offsety,1000) EndIf EndFor EndFor AnimateIn() ElseIf Controls.LastClickedButton = BJoinServer Then LDProcess.Start(Program.Directory + "/CLIENT.exe","") Program.End() ElseIf Controls.LastClickedButton = BControl Then AnimateOut() Shapes.Animate(Bback,650,550,1000) Shapes.Animate(Cboard,100,150,1000) EndIf For u = 1 To TankWeapon[1]["NumOfWeapons"] If Controls.LastClickedButton = BUse[u] Then Var = LDNetwork.GetGameData("TankWars" + Username) Pass = Var["password"] LDNetwork.SetGameData("TankWars" + Username,"weapon=" + u + ";password=" + Pass) GraphicsWindow.ShowMessage("Weapon Selected","") EndIf EndFor EndSub Sub AnimateIn Shapes.Animate(Bback,650,1000,1000) Shapes.Animate(BStartServer,330,250,1250) Shapes.Animate(BJoinServer,330,300,1500) Shapes.Animate(BChange,330,350,1750) Shapes.Animate(BWeapon,330,400,2000) Shapes.Animate(BControl,330,450,2250) Shapes.Animate(Cboard,2000,150,2000) EndSub Sub AnimateOut Shapes.Animate(BStartServer,2000,250,2000) Shapes.Animate(BJoinServer,2000,300,2000) Shapes.Animate(BChange,2000,350,2000) Shapes.Animate(BWeapon,2000,400,2000) Shapes.Animate(BControl,2000,450,2000) EndSub End>BZR072.sb< Start>BZV866.sb< a1="OOOOOOOOOOOOOOOOOOOOOOO!O O!O OOOOOOOOOOOOOOOOOOO O!O O O O!O O OOOOOOOOOOOOOOO O O!O O O O O O!O O O OOOOOOOOOOO O O O!O O O O O O O!O O O O OOOOOOOOOOO O O!O O O O O O O!O O O O O OOOOOOOOOOO O!O O O O O O O O!O O O O O O OOOOOOO O O!O O O O O O O O O O!O O O O O O O OOO O O O!O O O O O O O O O O!O O O O O O O O OOO O!O O O O O O O O!O OOOOO O OOOOO O OOOOO!O O O O!OOOOOOOOOOOOOOOOO O!O a2="OOOOOOOOOOOOOOOOOOOOOO!O O!O OOOOOOOOOOOOOOOOOO O!O O O O!O O OOOOOOOOOOOOOO O O!O O O O O O!O O O OOOOOOOOOO O O O!O O O O O O O!O O O O OOOOOOOOOO O O!O O O O O O O!O O O O O OOOOOOOOOO O!O O O O O O O O!O O O O O O OOOOOO O O!O O O O O O O O O O!O O O O O O O OO O O O!O O O O O O O O O O O!O O O O O O O O OO O O!O O O O O O O O O!O OOOOO O OOOOO O OO O!O O O O!OOOOOOOOOOOOOOOOO O!O a3="OOOOOOOOOOOOOOOOOOOOOOO!O O!O OOOOOOOOOOOOOOOOOOO O!O O O O!O O OOOOOOOOOOOOOOO O O!O O O O O O!O O O OOOOOOOOOOO O O O!O O O O O O O!O O O O OOOOOOOOOOO O O!O O O O O O O!O O O O O OOOOOOOOOOO O!O O O O O O O O!O O O O O O OOOOOOO O O!O O O O O O O O O O!O O O O O O O OOO O O O!O O O O O O O O O O O!O O O O O O OOO O O!O OOOOO O OOOOO O O !O O O OOOOO!OOOOOOOOOOOOOOOOO O! O! O aa=LDText.Split(a1 "!") aq=LDText.Split(a2 "!") qa=LDText.Split(a3 "!") GraphicsWindow.Title="Easter Labyrinth GraphicsWindow.BackgroundColor="tan GraphicsWindow.BrushColor="darkred GraphicsWindow.Height=777 GraphicsWindow.DrawImage(ImageList.LoadImage("e:\oww.png") 218 330) For y=11 To 32 For x=1 To 31 If Text.GetSubText(aa[y-10] x 1)="O" Then GraphicsWindow.FillRectangle(x*11 y*11 11 11) GraphicsWindow.FillRectangle(121+(43-y)*11 (x+10)*11 11 11) EndIf If Text.GetSubText(aq[y-10] x 1)="O" Then GraphicsWindow.FillRectangle(132+(32-x)*11 231+(43-y)*11 11 11) EndIf If Text.GetSubText(qa[y-10] x 1)="O" Then GraphicsWindow.FillRectangle((y)*11-110 242+(32-x)*11 11 11) EndIf If Text.GetSubText(qa[y] x 1)="W" Then GraphicsWindow.BrushColor="tan GraphicsWindow.FillRectangle((y)*11-110 242+(32-x)*11 11 11) EndIf EndFor EndFor End>BZV866.sb< Start>BZW070-0.sb< GraphicsWindow.Title = "Zodiac 1-8" wrap = "True gw = 1670 gh = 800 LDUtilities.ShowErrors ="false LDUtilities.ShowNoShapeErrors ="false GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "#000055 star=0 qi=1 'GraphicsWindow.MouseMove=moom main() Sub main Shapes_Init() scale = 1 angle = 0 zii=200 Shapes_Add() InitStars()'----------------fishes num = Array.GetItemCount(star) index = Array.GetAllIndices(star) offsetX = 0 offsetY = 0 GetMinMax() offsetX = -xMin + 50 offsetY = -yMin + 90 DrawGrids() sdrw() qi=2 Shapes_Initcc()'-------------capricorn scale = 1.2 angle = 0 Shapes_Add() star=0 InitStarscc() sdrw() qi=3'-----------------------aquarius Shapes_Initaq() scale = 1.2 angle = 0 Shapes_Add() star=0 InitStarsaq() sdrw() qi=4'----------------------aries Shapes_Initary() scale = 1 angle = 0 Shapes_Add() star=0 InitStarsary() sdrw() qi=5'------------------------cancer shpcnc() scale = 1 angle = 0 Shapes_Add() star=0 initscnc () sdrw() qi=6'-----------------taurus Shapes_Init_tau () scale = 1 angle = 0 zii=1 Shapes_Add() star=0 InitStars_tau () sdrw() qi=7'-----------------gemini Shapes_Initgmm () scale = 1 angle = 0 zii=1 Shapes_Add() star=0 InitStarsgm() sdrw() qi=8'-----------------leo Shapes_InitLn () scale = 1.05 angle = 0 zii=1 Shapes_Add() star=0 InitStarsLn () sdrw() LDFastShapes.Update () ds=95 For s= 1 to 10 dooff () Program.Delay (333) endfor LDEvents.MouseWheel=wll inn=0 EndSub Sub sdrw GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DarkGray nume = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) For i = 1 To nume e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y ly=Shapes.AddLine(x1, y1, x2, y2) ldShapes.ZIndex (ly,999) lyn[qi][i]=LDFastShapes.ShapeIndex (ly) EndFor LDFastShapes.Update () num = Array.GetItemCount(star) index = Array.GetAllIndices(star) GraphicsWindow.BrushColor = "White" For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() mag = star[index[i]]["Mag"] d = 20 / mag ell = Shapes.AddEllipse(d, d) ldShapes.ZIndex (ell,1000) el[qi][i]=LDFastShapes.ShapeIndex (ell) ldfastShapes.Move(el[qi][i], x - d / 2, y - d / 2) EndFor EndSub Sub moom 'GraphicsWindow.Title="Zodiac scroll GraphicsWindow.Title=GraphicsWindow.MouseX +" , "+GraphicsWindow.MouseY EndSub Sub wll If inn=0 then inn=1 ds=LDEvents.LastMouseWheelDelta *25 off=off+ds 'GraphicsWindow.Title=off dooff() inn=0 endif EndSub sub dooff For qi=1 To 8 For i = 1 To Array.GetItemCount (el[qi]) LDFastShapes.Move (el[qi][i],LDFastShapes.GetLeft (el[qi][i])+ds, LDFastShapes.GetTop (el[qi][i])) EndFor For i = 1 To Array.GetItemCount (ffs[qi]) LDFastShapes.Move (ffs[qi][i],LDFastShapes.GetLeft (ffs[qi][i])+ds, LDFastShapes.GetTop (ffs[qi][i])) EndFor For i = 1 To Array.GetItemCount (lyn[qi]) LDFastShapes.Move (lyn[qi][i],LDFastShapes.GetLeft (lyn[qi][i])+ds, LDFastShapes.GetTop (lyn[qi][i])) EndFor EndFor LDFastShapes.Update () For i=1 to Array.GetItemCount (txx) Shapes.Move (txx[i],shapes.GetLeft (txx[i])+ds, Shapes.GetTop (txx[i])) EndFor For i=1 to Array.GetItemCount (ltx) Shapes.Move (ltx[i], Shapes.GetLeft (ltx[i])+ds,1) EndFor EndSub Sub GetMinMax For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() ra1 = Text.GetSubText(ra, 1, 2) If wrap And 12 < ra1 Then ra1 = ra1 - 24 EndIf If i = 1 Then raMin = ra1 decMin = Text.GetSubText(dec, 1, 3) raMax = ra1 decMax = Text.GetSubText(dec, 1, 3) xMin = x yMin = y xMax = x yMax = y Else raMin = Math.Min(ra1, raMin) decMin = Math.Min(Text.GetSubText(dec, 1, 3), decMin) raMax = Math.Max(ra1, raMax) decMax = Math.Max(Text.GetSubText(dec, 1, 3), decMax) xMin = Math.Min(x, xMin) yMin = Math.Min(y, yMin) xMax = Math.Max(x, xMax) yMax = Math.Max(y, yMax) EndIf EndFor decMin = Math.Floor(decMin / 10) * 10 raMax = raMax + 1 decMax = decMax + 1 EndSub Sub InitStarsLn ' Initialize stars in Leo star["Regulus"] = "ra=10 08 22.46;dec=+11 58 01.9;mag=1.36;fd=32;" star["γ1 Leo"] = "ra=10 19 58.16;dec=+19 50 30.7;mag=2.01;fd=41;" star["Denebola"] = "ra=11 49 03.88;dec=+14 34 20.4;mag=2.14;fd=94;" star["δ Leo"] = "ra=11 14 06.41;dec=+20 31 26.5;mag=2.56;fd=68;" star["ε Leo"] = "ra=09 45 51.10;dec=+23 46 27.4;mag=2.97;fd=17;" star["θ Leo"] = "ra=11 14 14.44;dec=+15 25 47.1;mag=3.33;fd=70;" star["ζ Leo"] = "ra=10 16 41.40;dec=+23 25 02.4;mag=3.43;fd=36;" star["η Leo"] = "ra=10 07 19.95;dec=+16 45 45.6;mag=3.48;fd=30;" star["ο Leo A"] = "ra=09 41 09.12;dec=+09 53 32.6;mag=3.52;fd=14;" star["ο Leo B"] = "ra=09 41 13.40;dec=+09 54 35.0;mag=3.70;fd=14;" star["γ2 Leo"] = "ra=10 19 58.60;dec=+19 50 26.0;mag=3.80;fd=41;" star["ρ Leo"] = "ra=10 32 48.68;dec=+09 18 23.7;mag=3.84;fd=47;" star["μ Leo"] = "ra=09 52 45.96;dec=+26 00 25.5;mag=3.88;fd=24;" star["ι Leo"] = "ra=11 23 55.37;dec=+10 31 46.9;mag=4.00;fd=78;" star["σ Leo"] = "ra=11 21 08.25;dec=+06 01 45.7;mag=4.05;fd=77;" star["54 Leo"] = "ra=10 55 36.85;dec=+24 44 59.1;mag=4.30;fd=54;" star["υ Leo"] = "ra=11 36 56.93;dec=-00 49 25.9;mag=4.30;fd=91;" star["λ Leo"] = "ra=09 31 43.24;dec=+22 58 05.0;mag=4.32;fd=4;" star["31 Leo"] = "ra=10 07 54.32;dec=+09 59 51.6;mag=4.39;fd=31;" star["60 Leo"] = "ra=11 02 19.78;dec=+20 10 47.1;mag=4.42;fd=60;" star["φ Leo"] = "ra=11 16 39.76;dec=-03 39 05.5;mag=4.45;fd=74;" star["κ Leo"] = "ra=09 24 39.28;dec=+26 10 56.8;mag=4.47;fd=1;" star["93 Leo"] = "ra=11 47 59.23;dec=+20 13 08.2;mag=4.50;fd=93;" star["72 Leo"] = "ra=11 15 12.24;dec=+23 05 43.9;mag=4.56;fd=72;" star["χ Leo"] = "ra=11 05 01.23;dec=+07 20 10.0;mag=4.62;fd=63;" star["π Leo"] = "ra=10 00 12.82;dec=+08 02 39.4;mag=4.68;fd=29;" star["61 Leo"] = "ra=11 01 49.67;dec=-02 29 04.2;mag=4.73;fd=61;" star["87 Leo"] = "ra=11 30 18.88;dec=-03 00 12.5;mag=4.77;fd=87;" star["40 Leo"] = "ra=10 19 44.31;dec=+19 28 17.2;mag=4.78;fd=40;" star["58 Leo"] = "ra=11 00 33.64;dec=+03 37 03.1;mag=4.84;fd=58;" star["τ Leo"] = "ra=11 27 56.23;dec=+02 51 22.6;mag=4.95;fd=84;" star["59 Leo"] = "ra=11 00 44.83;dec=+06 06 05.4;mag=4.98;fd=59;" star["ξ Leo"] = "ra=09 31 56.79;dec=+11 18 00.1;mag=4.99;fd=5;" star["10 Leo"] = "ra=09 37 12.71;dec=+06 50 08.8;mag=5.00;fd=10;" star["6 Leo"] = "ra=09 31 57.58;dec=+09 42 56.9;mag=5.07;fd=6;" star["48 Leo"] = "ra=10 34 48.07;dec=+06 57 13.0;mag=5.07;fd=48;" star["75 Leo"] = "ra=11 17 17.37;dec=+02 00 39.3;mag=5.18;fd=75;" star["ν Leo"] = "ra=09 58 13.39;dec=+12 26 41.4;mag=5.26;fd=27;" star["92 Leo"] = "ra=11 40 47.11;dec=+21 21 10.2;mag=5.26;fd=92;" star["22 Leo"] = "ra=09 51 53.02;dec=+24 23 44.9;mag=5.29;fd=22;" star["73 Leo"] = "ra=11 15 51.90;dec=+13 18 27.3;mag=5.31;fd=73;" star["53 Leo"] = "ra=10 49 15.43;dec=+10 32 42.9;mag=5.32;fd=53;" star["ψ Leo"] = "ra=09 43 43.90;dec=+14 01 18.1;mag=5.36;fd=16;" star["79 Leo"] = "ra=11 24 02.34;dec=+01 24 27.9;mag=5.39;fd=79;" star["ω Leo"] = "ra=09 28 27.38;dec=+09 03 24.4;mag=5.40;fd=2;" star["69 Leo"] = "ra=11 13 45.58;dec=-00 04 10.2;mag=5.40;fd=69;" star["37 Leo"] = "ra=10 16 40.75;dec=+13 43 42.1;mag=5.42;fd=37;" star["46 Leo"] = "ra=10 32 11.80;dec=+14 08 14.0;mag=5.43;fd=46;" star["HD 94402"] = "ra=10 53 43.76;dec=-02 07 45.3;mag=5.45;" star["52 Leo"] = "ra=10 46 25.35;dec=+14 11 41.3;mag=5.49;fd=52;" star["51 Leo"] = "ra=10 46 24.49;dec=+18 53 29.8;mag=5.50;fd=51;" star["65 Leo"] = "ra=11 06 54.43;dec=+01 57 20.6;mag=5.52;fd=65;" star["95 Leo"] = "ra=11 55 40.53;dec=+15 38 48.5;mag=5.53;fd=95;" star["86 Leo"] = "ra=11 30 29.08;dec=+18 24 35.1;mag=5.54;fd=86;" star["81 Leo"] = "ra=11 25 36.46;dec=+16 27 23.6;mag=5.58;fd=81;" star["44 Leo"] = "ra=10 25 15.19;dec=+08 47 05.8;mag=5.61;fd=44;" star["15 Leo"] = "ra=09 43 33.27;dec=+29 58 29.0;mag=5.64;fd=15;" star["18 Leo"] = "ra=09 46 23.34;dec=+11 48 36.0;mag=5.67;fd=18;" star["49 Leo"] = "ra=10 35 02.19;dec=+08 39 01.6;mag=5.67;fd=49;" star["EO Leo"] = "ra=10 02 48.96;dec=+21 56 57.4;mag=5.68;" star["67 Leo"] = "ra=11 08 49.08;dec=+24 39 30.4;mag=5.70;fd=67;" star["3 Leo"] = "ra=09 28 29.19;dec=+08 11 18.1;mag=5.72;fd=3;" star["8 Leo"] = "ra=09 37 02.59;dec=+16 26 16.7;mag=5.73;fd=8;" star["85 Leo"] = "ra=11 29 41.86;dec=+15 24 48.2;mag=5.74;fd=85;" star["89 Leo"] = "ra=11 34 22.06;dec=+03 03 37.5;mag=5.76;fd=89;" star["36 G. Leo"] = "ra=11 14 01.81;dec=+08 03 39.4;mag=5.79;" star["5 G. Leo"] = "ra=09 46 10.04;dec=+06 42 31.0;mag=5.80;" star["39 Leo"] = "ra=10 17 14.80;dec=+23 06 23.2;mag=5.81;fd=39;" star["10 Sex"] = "ra=09 56 26.03;dec=+08 55 59.2;mag=5.85;fd=(10);" star["DR Leo"] = "ra=09 41 35.11;dec=+31 16 40.2;mag=5.90;" star["76 Leo"] = "ra=11 18 54.98;dec=+01 39 01.9;mag=5.90;fd=76;" star["55 Leo"] = "ra=10 55 42.34;dec=+00 44 13.0;mag=5.91;fd=55;" star["56 Leo"] = "ra=10 56 01.48;dec=+06 11 07.4;mag=5.91;fd=56;" star["35 Leo"] = "ra=10 16 32.42;dec=+23 30 10.8;mag=5.95;fd=35;" star["62 Leo"] = "ra=11 03 36.63;dec=-00 00 03.0;mag=5.95;fd=62;" star["90 Leo"] = "ra=11 34 42.50;dec=+16 47 48.9;mag=5.95;fd=90;" star["45 Leo"] = "ra=10 27 38.99;dec=+09 45 44.7;mag=6.01;fd=45;" star["R Leo"] = "ra=09 47 33.50;dec=+11 25 44.0;mag=6.02;" star["11 Sex"] = "ra=09 58 07.62;dec=+08 18 50.6;mag=6.05;fd=(11);" star["50 G. Leo"] = "ra=11 23 17.97;dec=+00 07 55.4;mag=6.05;" star["43 Leo"] = "ra=10 23 00.46;dec=+06 32 34.4;mag=6.06;fd=43;" star["20 Leo"] = "ra=09 49 50.12;dec=+21 10 46.0;mag=6.10;fd=20;" star["20 G. Leo"] = "ra=10 53 25.04;dec=-02 15 18.0;mag=6.12;" star["30 G. Leo"] = "ra=11 03 14.55;dec=-00 45 07.4;mag=6.12;" star["42 Leo"] = "ra=10 21 50.32;dec=+14 58 32.9;mag=6.16;fd=42;" star["59 G. Leo"] = "ra=11 27 53.73;dec=-01 41 59.8;mag=6.23;" star["13 Leo"] = "ra=09 41 38.50;dec=+25 54 46.6;mag=6.26;fd=13;" star["HD 97658"] = "ra=11 14 33s;dec=+25 42 37″;mag=6.27;" star["88 Leo"] = "ra=11 31 45.14;dec=+14 21 53.9;mag=6.27;fd=88;" star["54 Leo"] = "ra=10 55 37.30;dec=+24 44 56.0;mag=6.30;fd=54;" star["19 G. Leo"] = "ra=10 52 36.10;dec=-00 12 05.7;mag=6.31;" star["7 Leo"] = "ra=09 35 52.91;dec=+14 22 46.5;mag=6.32;fd=7;" star["80 Leo"] = "ra=11 25 50.10;dec=+03 51 36.7;mag=6.35;fd=80;" star["18 G. Leo"] = "ra=10 52 13.69;dec=+01 01 29.9;mag=6.37;" star["37 Sex"] = "ra=10 46 05.68;dec=+06 22 23.8;mag=6.38;fd=(37);" star["6 LMi"] = "ra=09 23 31.85;dec=+25 10 58.2;mag=6.41;fd=(6);" star["34 Leo"] = "ra=10 11 38.19;dec=+13 21 18.7;mag=6.43;fd=34;" star["67 G. Leo"] = "ra=11 34 58.93;dec=-04 21 40.2;mag=6.43;" star["19 Leo"] = "ra=09 47 25.99;dec=+11 34 05.4;mag=6.44;fd=19;" star["23 Leo"] = "ra=09 51 01.97;dec=+13 03 58.5;mag=6.45;fd=23;" star["HD 100655"] = "ra=11 35 03.79;dec=+20 26 29.6;mag=6.45;" star["HN Leo"] = "ra=09 58 26.12;dec=+27 45 32.6;mag=6.48;" star["64 Leo"] = "ra=11 07 39.72;dec=+23 19 25.5;mag=6.48;fd=64;" star["83 Leo A"] = "ra=11 26 45.75;dec=+03 00 45.6;mag=6.49;fd=83;" star["18 LMi"] = "ra=09 56 31.36;dec=+32 23 04.6;mag=6.55;fd=(18);" star["9 Leo"] = "ra=09 37 49.96;dec=+24 40 13.1;mag=6.61;fd=9;" star["11 Leo"] = "ra=09 38 01.31;dec=+14 20 50.8;mag=6.63;fd=11;" star["57 Leo"] = "ra=10 56 10.53;dec=+00 25 58.6;mag=6.65;fd=57;" star["52 LMi"] = "ra=11 07 04.91;dec=+25 32 13.8;mag=6.86;fd=(52);" edge = "1=μ Leo-κ Leo;2=κ Leo-λ Leo;3=λ Leo-ε Leo;4=ε Leo-μ Leo;5=μ Leo-ζ Leo;" edge = edge + "6=ζ Leo-γ1 Leo;7=γ1 Leo-60 Leo;8=60 Leo-δ Leo;9=δ Leo-Denebola;" edge = edge + "10=Denebola-θ Leo;11=θ Leo-δ Leo;12=θ Leo-ι Leo;13=ι Leo-σ Leo;" edge = edge + "14=θ Leo-η Leo;15=η Leo-Regulus;16=Regulus-ρ Leo;17=ρ Leo-ο Leo A;" edge = edge + "18=η Leo-γ1 Leo;" EndSub Sub Shapes_InitLn shX = -1500 ' x offset shY = 80 ' y offset shape = "" shape[1] = "func=ell;x=346;y=92;width=28;height=61;angle=21;bc=#6E4021;pw=0;" shape[2] = "func=tri;x=332;y=140;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=204;bc=#6E4021;pw=0;" shape[3] = "func=ell;x=56;y=84;width=135;height=117;bc=#B48637;pw=0;" shape[4] = "func=rect;x=388;y=58;width=46;height=31;angle=7;bc=#B48637;pw=0;" shape[5] = "func=rect;x=377;y=102;width=47;height=20;angle=16;bc=#B48637;pw=0;" shape[6] = "func=rect;x=265;y=160;width=75;height=53;angle=344;bc=#916C2C;pw=0;" shape[7] = "func=ell;x=167;y=94;width=169;height=101;bc=#B48637;pw=0;" shape[8] = "func=rect;x=275;y=184;width=143;height=29;angle=354;bc=#916C2C;pw=0;" shape[9] = "func=rect;x=255;y=211;width=143;height=29;angle=354;bc=#B48637;pw=0;" shape[10] = "func=rect;x=249;y=170;width=75;height=53;angle=344;bc=#B48637;pw=0;" shape[11] = "func=rect;x=400;y=189;width=53;height=31;angle=36;bc=#916C2C;pw=0;" shape[12] = "func=rect;x=379;y=216;width=53;height=31;angle=36;bc=#B48637;pw=0;" shape[13] = "func=rect;x=122;y=310;width=53;height=33;angle=21;bc=#916C2C;pw=0;" shape[14] = "func=rect;x=101;y=220;width=103;height=32;angle=324;bc=#916C2C;pw=0;" shape[15] = "func=rect;x=74;y=280;width=100;height=30;angle=66;bc=#916C2C;pw=0;" shape[16] = "func=rect;x=122;y=324;width=53;height=33;angle=21;bc=#B48637;pw=0;" shape[17] = "func=rect;x=61;y=279;width=100;height=30;angle=66;bc=#B48637;pw=0;" shape[18] = "func=rect;x=132;y=168;width=67;height=71;angle=324;bc=#916C2C;pw=0;" shape[19] = "func=rect;x=88;y=218;width=103;height=32;angle=324;bc=#B48637;pw=0;" shape[20] = "func=rect;x=94;y=154;width=67;height=71;angle=324;bc=#B48637;pw=0;" shape[21] = "func=rect;x=142;y=90;width=96;height=88;angle=359;bc=#B48637;pw=0;" shape[22] = "func=tri;x=419;y=61;x1=9;y1=0;x2=0;y2=12;x3=19;y3=12;angle=279;bc=#816027;pw=0;" shape[23] = "func=ell;x=280;y=50;width=35;height=68;angle=17;bc=#94572D;pw=0;" shape[24] = "func=ell;x=229;y=76;width=61;height=28;angle=348;bc=#94572D;pw=0;" shape[25] = "func=ell;x=326;y=62;width=25;height=43;angle=355;bc=#94572D;pw=0;" shape[26] = "func=ell;x=308;y=11;width=35;height=54;angle=32;bc=#94572D;pw=0;" shape[27] = "func=ell;x=380;y=10;width=35;height=35;bc=#94572D;pw=0;" shape[28] = "func=ell;x=309;y=26;width=43;height=30;angle=28;bc=#B48637;pw=0;" shape[29] = "func=ell;x=325;y=20;width=92;height=94;bc=#B48637;pw=0;" shape[30] = "func=ell;x=389;y=88;width=39;height=18;angle=5;bc=#000000;pw=0;" shape[31] = "func=tri;x=421;y=85;x1=4;y1=0;x2=0;y2=17;x3=9;y3=17;angle=180;bc=#B48637;pw=0;" shape[32] = "func=tri;x=414;y=94;x1=4;y1=0;x2=0;y2=17;x3=9;y3=17;bc=#B48637;pw=0;" shape[33] = "func=tri;x=405;y=85;x1=4;y1=0;x2=0;y2=17;x3=9;y3=17;angle=180;bc=#B48637;pw=0;" shape[34] = "func=tri;x=397;y=92;x1=5;y1=0;x2=0;y2=19;x3=10;y3=19;bc=#B48637;pw=0;" shape[35] = "func=tri;x=390;y=43;x1=7;y1=0;x2=0;y2=18;x3=14;y3=18;angle=304;bc=#000000;pw=0;" shape[36] = "func=ell;x=365;y=1;width=39;height=22;bc=#94572D;pw=0;" shape[37] = "func=ell;x=336;y=0;width=43;height=38;bc=#94572D;pw=0;" shape[38] = "func=ell;x=302;y=54;width=41;height=70;bc=#94572D;pw=0;" shape[39] = "func=ell;x=323;y=84;width=28;height=61;angle=355;bc=#94572D;pw=0;" shape[40] = "func=ell;x=325;y=27;width=29;height=44;angle=21;bc=#94572D;pw=0;" shape[41] = "func=tri;x=374;y=17;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=193;bc=#94572D;pw=0;" shape[42] = "func=tri;x=348;y=32;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=165;bc=#94572D;pw=0;" shape[43] = "func=tri;x=338;y=58;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=156;bc=#94572D;pw=0;" shape[44] = "func=tri;x=326;y=132;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=190;bc=#94572D;pw=0;" shape[45] = "func=tri;x=308;y=111;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=190;bc=#94572D;pw=0;" shape[46] = "func=tri;x=289;y=100;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=190;bc=#94572D;pw=0;" shape[47] = "func=tri;x=262;y=89;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=215;bc=#94572D;pw=0;" shape[48] = "func=tri;x=220;y=81;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=257;bc=#94572D;pw=0;" shape[49] = "func=ell;x=14.97;y=166.34;width=12.13;height=12.13;bc=#916C2C;pw=0;" shape[50] = "func=ell;x=15.02;y=160.89;width=12.26;height=12.26;bc=#926C2C;pw=0;" shape[51] = "func=ell;x=15.18;y=155.65;width=12.4;height=12.4;bc=#926D2C;pw=0;" shape[52] = "func=ell;x=15.43;y=150.59;width=12.53;height=12.53;bc=#936D2C;pw=0;" shape[53] = "func=ell;x=15.8;y=145.71;width=12.66;height=12.66;bc=#936E2C;pw=0;" shape[54] = "func=ell;x=16.3;y=140.99;width=12.8;height=12.8;bc=#946E2D;pw=0;" shape[55] = "func=ell;x=16.92;y=136.41;width=12.93;height=12.93;bc=#956F2D;pw=0;" shape[56] = "func=ell;x=17.69;y=131.97;width=13.06;height=13.06;bc=#956F2D;pw=0;" shape[57] = "func=ell;x=18.62;y=127.66;width=13.2;height=13.2;bc=#966F2D;pw=0;" shape[58] = "func=ell;x=19.7;y=123.45;width=13.33;height=13.33;bc=#96702D;pw=0;" shape[59] = "func=ell;x=20.96;y=119.35;width=13.46;height=13.46;bc=#97702E;pw=0;" shape[60] = "func=ell;x=22.4;y=115.32;width=13.6;height=13.6;bc=#98712E;pw=0;" shape[61] = "func=ell;x=24.04;y=111.37;width=13.73;height=13.73;bc=#98712E;pw=0;" shape[62] = "func=ell;x=25.87;y=107.48;width=13.86;height=13.86;bc=#99722E;pw=0;" shape[63] = "func=ell;x=27.92;y=103.64;width=14;height=14;bc=#99722E;pw=0;" shape[64] = "func=ell;x=30.18;y=99.82;width=14.13;height=14.13;bc=#9A722E;pw=0;" shape[65] = "func=ell;x=32.68;y=96.03;width=14.26;height=14.26;bc=#9A732F;pw=0;" shape[66] = "func=ell;x=35.42;y=92.25;width=14.4;height=14.4;bc=#9B732F;pw=0;" shape[67] = "func=ell;x=38.41;y=88.47;width=14.53;height=14.53;bc=#9C742F;pw=0;" shape[68] = "func=ell;x=41.66;y=84.66;width=14.66;height=14.66;bc=#9C742F;pw=0;" shape[69] = "func=ell;x=45.82;y=80.25;width=14.8;height=14.8;bc=#9D752F;pw=0;" shape[70] = "func=ell;x=48.87;y=75.89;width=14.93;height=14.93;bc=#9D7530;pw=0;" shape[71] = "func=ell;x=50.86;y=71.64;width=15.06;height=15.06;bc=#9E7530;pw=0;" shape[72] = "func=ell;x=51.86;y=67.58;width=15.2;height=15.2;bc=#9F7630;pw=0;" shape[73] = "func=ell;x=51.92;y=63.77;width=15.33;height=15.33;bc=#9F7630;pw=0;" shape[74] = "func=ell;x=51.11;y=60.27;width=15.46;height=15.46;bc=#A07730;pw=0;" shape[75] = "func=ell;x=49.47;y=57.15;width=15.6;height=15.6;bc=#A07730;pw=0;" shape[76] = "func=ell;x=47.08;y=54.48;width=15.73;height=15.73;bc=#A17831;pw=0;" shape[77] = "func=ell;x=43.98;y=52.32;width=15.86;height=15.86;bc=#A17831;pw=0;" shape[78] = "func=ell;x=40.25;y=50.75;width=16;height=16;bc=#A27931;pw=0;" shape[79] = "func=ell;x=35.92;y=49.81;width=16.13;height=16.13;bc=#A37931;pw=0;" shape[80] = "func=ell;x=31.07;y=49.59;width=16.26;height=16.26;bc=#A37931;pw=0;" shape[81] = "func=ell;x=25.75;y=50.14;width=16.4;height=16.4;bc=#A47A32;pw=0;" shape[82] = "func=ell;x=20.02;y=51.54;width=16.53;height=16.53;bc=#A47A32;pw=0;" shape[83] = "func=ell;x=13.94;y=53.85;width=16.66;height=16.66;bc=#A57B32;pw=0;" shape[84] = "func=ell;x=7.57;y=57.13;width=16.8;height=16.8;bc=#A67B32;pw=0;" shape[85] = "func=ell;x=0.97;y=61.45;width=16.93;height=16.93;bc=#A67C32;pw=0;" shape[86] = "func=ell;x=-5.82;y=66.88;width=17.06;height=17.06;bc=#A77C32;pw=0;" shape[87] = "func=ell;x=-12.71;y=73.49;width=17.2;height=17.2;bc=#A77C33;pw=0;" shape[88] = "func=ell;x=-19.67;y=81.33;width=17.33;height=17.33;bc=#A87D33;pw=0;" shape[89] = "func=ell;x=-23.18;y=86.57;width=17.46;height=17.46;bc=#A87D33;pw=0;" shape[90] = "func=ell;x=-25.81;y=91.89;width=17.6;height=17.6;bc=#A97E33;pw=0;" shape[91] = "func=ell;x=-27.56;y=97.18;width=17.73;height=17.73;bc=#AA7E33;pw=0;" shape[92] = "func=ell;x=-28.47;y=102.38;width=17.86;height=17.86;bc=#AA7F34;pw=0;" shape[93] = "func=ell;x=-28.55;y=107.4;width=18;height=18;bc=#AB7F34;pw=0;" shape[94] = "func=ell;x=-27.84;y=112.16;width=18.13;height=18.13;bc=#AB7F34;pw=0;" shape[95] = "func=ell;x=-26.35;y=116.57;width=18.26;height=18.26;bc=#AC8034;pw=0;" shape[96] = "func=ell;x=-24.11;y=120.56;width=18.4;height=18.4;bc=#AD8034;pw=0;" shape[97] = "func=ell;x=-21.14;y=124.03;width=18.53;height=18.53;bc=#AD8134;pw=0;" shape[98] = "func=ell;x=-17.46;y=126.91;width=18.66;height=18.66;bc=#AE8135;pw=0;" shape[99] = "func=ell;x=-13.11;y=129.12;width=18.8;height=18.8;bc=#AE8235;pw=0;" shape[100] = "func=ell;x=-8.09;y=130.57;width=18.93;height=18.93;bc=#AF8235;pw=0;" shape[101] = "func=ell;x=-2.43;y=131.18;width=19.06;height=19.06;bc=#AF8235;pw=0;" shape[102] = "func=ell;x=3.83;y=130.87;width=19.2;height=19.2;bc=#B08335;pw=0;" shape[103] = "func=ell;x=10.69;y=129.55;width=19.33;height=19.33;bc=#B18336;pw=0;" shape[104] = "func=ell;x=18.11;y=127.14;width=19.46;height=19.46;bc=#B18436;pw=0;" shape[105] = "func=ell;x=26.07;y=123.57;width=19.6;height=19.6;bc=#B28436;pw=0;" shape[106] = "func=ell;x=34.56;y=118.74;width=19.73;height=19.73;bc=#B28536;pw=0;" shape[107] = "func=ell;x=43.54;y=112.58;width=19.86;height=19.86;bc=#B38536;pw=0;" shape[108] = "func=ell;x=53;y=105;width=20;height=20;bc=#B48637;pw=0;" shape[109] = "func=ell;x=422;y=241;width=18;height=27;angle=342;bc=#B48637;pw=0;" shape[110] = "func=ell;x=410;y=245;width=17;height=27;angle=344;bc=#B48637;pw=0;" shape[111] = "func=ell;x=445;y=207;width=19;height=24;angle=334;bc=#916C2C;pw=0;" shape[112] = "func=ell;x=443;y=214;width=18;height=27;angle=342;bc=#916C2C;pw=0;" shape[113] = "func=ell;x=435;y=220;width=17;height=27;angle=344;bc=#916C2C;pw=0;" shape[114] = "func=ell;x=425;y=234;width=19;height=24;angle=334;bc=#B48637;pw=0;" shape[115] = "func=ell;x=172;y=318;width=18;height=27;angle=319;bc=#916C2C;pw=0;" shape[116] = "func=ell;x=170;y=332;width=18;height=27;angle=342;bc=#916C2C;pw=0;" shape[117] = "func=ell;x=167;y=327;width=19;height=30;angle=305;bc=#B48637;pw=0;" shape[118] = "func=ell;x=171;y=341;width=18;height=27;angle=319;bc=#B48637;pw=0;" shape[119] = "func=ell;x=160;y=346;width=18;height=27;angle=319;bc=#B48637;pw=0;" shape[120] = "func=ell;x=3;y=173;width=26;height=49;angle=12;bc=#94572D;pw=0;" shape[121] = "func=tri;x=8;y=206;x1=8;y1=0;x2=0;y2=26;x3=17;y3=26;angle=190;bc=#94572D;pw=0;" shape[122] = "func=tri;x=0;y=199;x1=6;y1=0;x2=0;y2=25;x3=12;y3=25;angle=197;bc=#94572D;pw=0;" shape[123] = "func=tri;x=2;y=206;x1=8;y1=0;x2=0;y2=33;x3=16;y3=33;angle=193;bc=#94572D;pw=0;" shape[124] = "func=tri;x=346;y=136;x1=7;y1=0;x2=0;y2=31;x3=15;y3=31;angle=197;bc=#6E4021;pw=0;" EndSub Sub InitStars star[99] = "name=η Psc;ra=01 31 28.99;dec=+15 20 45.0;mag=3.62;" star[6] = "name=γ Psc;ra=23 17 09.49;dec=+03 16 56.1;mag=3.70;" star[28] = "name=ω Psc;ra=23 59 18.60;dec=+06 51 48.9;mag=4.03;" star[17] = "name=ι Psc;ra=23 39 56.82;dec=+05 37 38.5;mag=4.13;" star[110] = "name=ο Psc;ra=01 45 23.59;dec=+09 09 27.5;mag=4.26;" star[71] = "name=ε Psc;ra=01 02 56.66;dec=+07 53 24.3;mag=4.27;" star[10] = "name=θ Psc;ra=23 27 58.17;dec=+06 22 44.8;mag=4.27;" star[113] = "name=α Psc A;ra=02 02 02.80;dec=+02 45 49.5;mag=4.33;" star[30] = "name=30 Psc;ra=00 01 57.59;dec=−06 00 50.3;mag=4.37;" star[63] = "name=δ Psc;ra=00 48 40.90;dec=+07 35 06.7;mag=4.44;" star[106] = "name=ν Psc;ra=01 41 25.91;dec=+05 29 15.4;mag=4.45;" star[4] = "name=β Psc;ra=23 03 52.61;dec=+03 49 12.3;mag=4.48;" star[18] = "name=λ Psc;ra=23 42 02.88;dec=+01 46 49.5;mag=4.49;" star[83] = "name=τ Psc;ra=01 11 39.59;dec=+30 05 23.0;mag=4.51;" star[33] = "name=33 Psc;ra=00 05 20.15;dec=−05 42 28.2;mag=4.61;" star[111] = "name=ξ Psc;ra=01 53 33.34;dec=+03 11 14.9;mag=4.61;" star[84] = "name=χ Psc;ra=01 11 27.19;dec=+21 02 04.8;mag=4.66;" star[85] = "name=φ Psc;ra=01 13 44.94;dec=+24 35 01.6;mag=4.67;" star[90] = "name=υ Psc;ra=01 19 27.98;dec=+27 15 50.7;mag=4.74;" star[98] = "name=μ Psc;ra=01 30 10.94;dec=+06 08 38.2;mag=4.84;" star[27] = "name=27 Psc;ra=23 58 40.41;dec=−03 33 20.9;mag=4.88;" star[8] = "name=κ Psc;ra=23 26 55.91;dec=+01 15 21.0;mag=4.95;" star[19] = "name=19 Psc;ra=23 46 23.54;dec=+03 29 12.7;mag=4.95;" star[47] = "name=47 Psc;ra=00 28 02.84;dec=+17 53 35.1;mag=5.01;" star[7] = "name=7 Psc;ra=23 20 20.54;dec=+05 22 53.2;mag=5.05;" star[64] = "name=64 Psc;ra=00 48 58.71;dec=+16 56 28.1;mag=5.07;" star[29] = "name=29 Psc;ra=00 01 49.44;dec=−03 01 38.9;mag=5.13;" star[89] = "name=89 Psc;ra=01 17 47.98;dec=+03 36 52.3;mag=5.13;" star[82] = "name=82 Psc;ra=01 11 06.77;dec=+31 25 29.2;mag=5.15;" star[86] = "name=ζ Psc A;ra=01 13 43.80;dec=+07 34 31.8;mag=5.21;" star[113] = "name=α Psc B;ra=02 02 02.80;dec=+02 45 49.0;mag=5.23;" star[91] = "name=91 Psc;ra=01 21 07.35;dec=+28 44 18.2;mag=5.23;" star[107] = "name=107 Psc;ra=01 42 29.95;dec=+20 16 12.5;mag=5.24;" star[74] = "name=ψ¹ Psc;ra=01 05 40.93;dec=+21 28 23.6;mag=5.33;" star[93] = "name=ρ Psc;ra=01 26 15.28;dec=+19 10 20.4;mag=5.35;" star[55] = "name=55 Psc;ra=00 39 55.55;dec=+21 26 18.8;mag=5.36;" star[57] = "name=57 Psc;ra=00 46 32.98;dec=+15 28 32.2;mag=5.36;" star[41] = "name=41 Psc;ra=00 20 35.86;dec=+08 11 24.9;mag=5.38;" star[52] = "name=52 Psc;ra=00 32 35.40;dec=+20 17 40.0;mag=5.38;" star[5] = "name=5 Psc;ra=23 08 40.84;dec=+02 07 39.4;mag=5.42;" star[2] = "name=2 Psc;ra=22 59 27.40;dec=+00 57 47.1;mag=5.43;" star[68] = "name=68 Psc;ra=00 57 50.15;dec=+28 59 32.0;mag=5.44;" star[20] = "name=20 Psc;ra=23 47 56.49;dec=−02 45 41.8;mag=5.49;" star[69] = "name=σ Psc;ra=01 02 49.09;dec=+31 48 15.6;mag=5.50;" star[94] = "name=94 Psc;ra=01 26 41.65;dec=+19 14 26.0;mag=5.50;" star[58] = "name=58 Psc;ra=00 47 01.43;dec=+11 58 26.2;mag=5.51;" star[80] = "name=80 Psc;ra=01 08 22.34;dec=+05 39 00.8;mag=5.51;" star[34] = "name=34 Psc;ra=00 10 02.18;dec=+11 08 44.9;mag=5.54;" star[102] = "name=π Psc;ra=01 37 05.96;dec=+12 08 29.4;mag=5.54;" star[74] = "name=ψ¹ Psc;ra=01 05 41.68;dec=+21 27 55.7;mag=5.55;" star[79] = "name=ψ² Psc;ra=01 07 57.11;dec=+20 44 21.6;mag=5.56;" star[81] = "name=ψ³ Psc;ra=01 09 49.20;dec=+19 39 30.2;mag=5.57;" star[22] = "name=22 Psc;ra=23 51 57.83;dec=+02 55 49.5;mag=5.59;" star[72] = "name=72 Psc;ra=01 05 05.35;dec=+14 56 45.6;mag=5.64;" star[16] = "name=16 Psc;ra=23 36 23.35;dec=+02 06 07.5;mag=5.68;" star[51] = "name=51 Psc;ra=00 32 23.75;dec=+06 57 19.6;mag=5.69;" star[32] = "name=32 Psc;ra=00 02 29.76;dec=+08 29 08.1;mag=5.70;" star[44] = "name=44 Psc;ra=00 25 24.22;dec=+01 56 23.0;mag=5.77;" star[21] = "name=21 Psc;ra=23 49 27.48;dec=+01 04 34.3;mag=5.77;" star[66] = "name=66 Psc;ra=00 54 35.22;dec=+19 11 18.4;mag=5.80;" star[54] = "name=54 Psc;ra=00 39 22.09;dec=+21 15 04.9;mag=5.88;" star[53] = "name=53 Psc;ra=00 36 47.31;dec=+15 13 54.3;mag=5.89;" star[112] = "name=112 Psc;ra=02 00 09.02;dec=+03 05 51.5;mag=5.89;" star[14] = "name=14 Psc;ra=23 34 08.95;dec=−01 14 51.1;mag=5.91;" star[62] = "name=62 Psc;ra=00 48 17.34;dec=+07 17 59.7;mag=5.92;" star[24] = "name=24 Psc;ra=23 52 55.52;dec=−03 09 19.4;mag=5.93;" star[87] = "name=87 Psc;ra=01 14 07.65;dec=+16 08 00.8;mag=5.97;" star[60] = "name=60 Psc;ra=00 47 23.62;dec=+06 44 27.5;mag=5.98;" star[105] = "name=105 Psc;ra=01 39 40.77;dec=+16 24 21.2;mag=5.98;" star[97] = "name=97 Psc;ra=01 29 52.83;dec=+18 21 20.4;mag=6.01;" star[35] = "name=35 Psc;ra=00 14 58.78;dec=+08 49 15.7;mag=6.02;" star[73] = "name=73 Psc;ra=01 04 52.62;dec=+05 39 22.7;mag=6.03;" star[88] = "name=88 Psc;ra=01 14 42.40;dec=+06 59 42.7;mag=6.04;" star[48] = "name=48 Psc;ra=00 28 12.69;dec=+16 26 42.4;mag=6.05;" star[67] = "name=67 Psc;ra=00 55 58.52;dec=+27 12 33.7;mag=6.08;" star[59] = "name=59 Psc;ra=00 47 13.56;dec=+19 34 43.3;mag=6.11;" star[1] = "name=1 Psc;ra=22 54 59.47;dec=+01 03 53.6;mag=6.11;" star[36] = "name=36 Psc;ra=00 16 34.06;dec=+08 14 24.7;mag=6.12;" star[75] = "name=75 Psc;ra=01 06 33.62;dec=+12 57 21.5;mag=6.14;" star[3] = "name=3 Psc;ra=23 00 37.88;dec=+00 11 09.0;mag=6.22;" star[26] = "name=26 Psc;ra=23 55 07.78;dec=+07 04 15.7;mag=6.22;" star[78] = "name=78 Psc;ra=01 08 01.20;dec=+32 00 43.9;mag=6.23;" star[101] = "name=101 Psc;ra=01 35 46.44;dec=+14 39 41.2;mag=6.23;" star[42] = "name=42 Psc;ra=00 22 25.45;dec=+13 28 56.8;mag=6.25;" star[9] = "name=9 Psc;ra=23 27 14.77;dec=+01 07 21.7;mag=6.26;" star[109] = "name=109 Psc;ra=01 44 55.85;dec=+20 05 00.3;mag=6.27;" star[76] = "name=76 Psc;ra=01 06 11.20;dec=+32 10 53.6;mag=6.28;" star[25] = "name=25 Psc;ra=23 53 04.75;dec=+02 05 26.3;mag=6.29;" star[31] = "name=31 Psc;ra=00 02 24.17;dec=+08 57 24.6;mag=6.33;" star[77] = "name=77 Psc A;ra=01 05 49.22;dec=+04 54 31.2;mag=6.35;" star[13] = "name=13 Psc;ra=23 31 57.56;dec=−01 05 09.3;mag=6.39;" star[46] = "name=46 Psc;ra=00 27 58.48;dec=+19 30 50.7;mag=6.40;" star[86] = "name=ζ Psc B;ra=01 13 45.17;dec=+07 34 42.2;mag=6.44;" star[15] = "name=15 Psc;ra=23 35 28.61;dec=+01 18 47.5;mag=6.47;" star[43] = "name=43 Psc;ra=00 24 38.15;dec=+14 18 55.9;mag=6.48;" star[61] = "name=61 Psc;ra=00 47 54.73;dec=+20 55 31.1;mag=6.51;" star[40] = "name=40 Psc;ra=00 19 56.28;dec=+16 15 03.2;mag=6.60;" star[38] = "name=38 Psc;ra=00 17 24.50;dec=+08 52 34.8;mag=6.66;" star[104] = "name=104 Psc;ra=01 39 15.39;dec=+14 17 08.3;mag=6.74;" star[45] = "name=45 Psc;ra=00 25 41.89;dec=+07 41 28.4;mag=6.77;" star[65] = "name=65 Psc;ra=00 49 53.11;dec=+27 42 37.1;mag=7.0;" star[95] = "name=95 Psc;ra=01 27 39.81;dec=+05 21 11.2;mag=7.01;" star[65] = "name=65 Psc;ra=00 49 53.20;dec=+27 42 37.0;mag=7.1;" star[77] = "name=77 Psc B;ra=01 05 51.42;dec=+04 54 35.0;mag=7.26;" star[100] = "name=100 Psc;ra=01 34 51.61;dec=+12 33 31.2;mag=7.28;" edge = "1=69-83;2=83-90;3=90-85;4=85-74;5=74-84;6=84-99;7=99-110;" edge = edge + "8=110-113;9=113-106;10=106-71;11=71-63;12=63-28;" edge = edge + "13=28-10;14=10-6;15=6-8;16=8-18;" EndSub Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.FontSize = 12 y1 = 0 ww=1 y2 = GraphicsWindow.Height For ra = 0 To 23 RADec2XY() ltx[ww]=Shapes.AddLine(x, y1, x, y2) LDShapes.ZIndex (ltx[ww],2222) raTxt = ra If wrap And raTxt < 0 Then raTxt = raTxt + 24 EndIf txx[ww] = Shapes.AddText(raTxt + "h") Shapes.Move(txx[ww], x, 5) ww=ww+1 EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -40 To 40 Step 10 If dec > 0 Then dec = Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() lii=Shapes.AddLine(x1, y, x2, y) LDShapes.ZIndex (lii,2222) txt = Shapes.AddText(dec) Shapes.Move(txt, x1, y) EndFor EndSub Sub RADec2XY ' param ra - right ascension ' param dec - declination ' return x, y x = Text.GetSubText(ra, 1, 2) If wrap And 12 < x Then x = x - 24 EndIf x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = offsetX - (x - raMin) * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y = offsetY - y * 3600 / 360 EndSub Sub Shapes_Init shX = 41 ' x offset shY = 110 ' y offset shape = "" shape[1] = "func=ell;x=76;y=10;width=63;height=119;angle=23;bc=#2F559D;pw=0;" shape[2] = "func=tri;x=70;y=94;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=25;bc=#2F559D;pw=0;" shape[3] = "func=tri;x=108;y=0;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=199;bc=#000055;pw=0;" shape[4] = "func=ell;x=118;y=34;width=20;height=21;bc=#000055;pw=0;" shape[5] = "func=ell;x=74;y=40;width=12;height=32;angle=58;bc=#2F559D;pw=0;" shape[6] = "func=ell;x=121;y=72;width=15;height=40;angle=17;bc=#2F559D;pw=0;" shape[7] = "func=ell;x=342;y=195;width=63;height=119;angle=106;bc=#2F559D;pw=0;" shape[8] = "func=tri;x=304;y=210;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=105;bc=#2F559D;pw=0;" shape[9] = "func=tri;x=401;y=258;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=295;bc=#000055;pw=0;" shape[10] = "func=ell;x=397;y=243;width=20;height=21;bc=#000055;pw=0;" shape[11] = "func=ell;x=367;y=203;width=15;height=40;angle=112;bc=#2F559D;pw=0;" shape[12] = "func=ell;x=361;y=271;width=12;height=32;angle=58;bc=#2F559D;pw=0;" shape[13] = "func=line;x=43;y=130;x1=39;y1=0;x2=0;y2=72;pc=#2F559D;pw=8;" shape[14] = "func=line;x=0;y=201;x1=0;y1=74;x2=44;y2=0;pc=#2F559D;pw=8;" shape[15] = "func=line;x=2;y=238;x1=0;y1=35;x2=42;y2=0;pc=#2F559D;pw=8;" shape[16] = "func=line;x=41;y=242;x1=18;y1=31;x2=0;y2=0;pc=#2F559D;pw=8;" shape[17] = "func=line;x=56;y=271;x1=0;y1=1;x2=30;y2=0;pc=#2F559D;pw=8;" shape[18] = "func=line;x=82;y=232;x1=0;y1=38;x2=1;y2=0;pc=#2F559D;pw=8;" shape[19] = "func=line;x=83;y=230;x1=0;y1=6;x2=65;y2=0;pc=#2F559D;pw=8;" shape[20] = "func=line;x=143;y=230;x1=0;y1=0;x2=79;y2=7;pc=#2F559D;pw=8;" shape[21] = "func=line;x=217;y=234;x1=0;y1=2;x2=98;y2=0;pc=#2F559D;pw=8;" EndSub Sub Shapes_Add j=1 Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shpp = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shpp = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shpp = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shpp = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) EndIf LDShapes.ZIndex (shpp,zii) zii=zii+1 x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y ffs[qi][j]=LDFastShapes.ShapeIndex(shpp) ldfastShapes.Move(ffs[qi][j], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then ldfastShapes.Rotate(ffs[qi][j], shp["angle"]) EndIf 'shape[i] = shpp j=j+1 EndFor LDFastShapes.Update () shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight For i = 1 To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Move Stack.PushValue("local", i) s = scale shX = x shY = y For i = 1 To Array.GetItemCount(shape) shp = shape[i] _x = shp["rx"] _y = shp["ry"] Shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub InitStarsaq ' Initialize stars in Aquarius star[22] = "name=β Aqr;ra=21 31 33.52;dec=-05 34 16.2;mag=2.90;" star[34] = "name=α Aqr;ra=22 05 47.03;dec=-00 19 11.4;mag=2.95;" star[76] = "name=δ Aqr;ra=22 54 39.04;dec=-15 49 14.7;mag=3.27;" star[55] = "name=ζ1 Aqr;ra=22 28 49.80;dec=-00 01 12.2;mag=3.65;" star[88] = "name=88 Aqr;ra=23 09 26.76;dec=-21 10 20.9;mag=3.68;" star[73] = "name=λ Aqr;ra=22 52 36.86;dec=-07 34 46.8;mag=3.73;" star[2] = "name=ε Aqr;ra=20 47 40.53;dec=-09 29 44.5;mag=3.78;" star[48] = "name=γ Aqr;ra=22 21 39.30;dec=-01 23 14.5;mag=3.86;" star[98] = "name=98 Aqr;ra=23 22 58.30;dec=-20 06 01.2;mag=3.96;" star[62] = "name=η Aqr;ra=22 35 21.33;dec=-00 07 02.5;mag=4.04;" star[71] = "name=τ2 Aqr;ra=22 49 35.51;dec=-13 35 33.1;mag=4.05;" star[43] = "name=θ Aqr;ra=22 16 49.97;dec=-07 46 59.7;mag=4.17;" star[90] = "name=φ Aqr;ra=23 14 19.33;dec=-06 02 54.7;mag=4.22;" star[91] = "name=ψ1 Aqr;ra=23 15 53.28;dec=-09 05 15.7;mag=4.24;" star[33] = "name=ι Aqr;ra=22 06 26.21;dec=-13 52 10.3;mag=4.29;" star[99] = "name=99 Aqr;ra=23 26 02.82;dec=-20 38 30.7;mag=4.38;" star[93] = "name=ψ2 Aqr;ra=23 17 54.20;dec=-09 10 57.0;mag=4.41;" star[55] = "name=ζ2 Aqr;ra=22 28 50.10;dec=-00 01 12.0;mag=4.42;" star[3] = "name=3 Aqr;ra=20 47 44.24;dec=-05 01 39.4;mag=4.43;" star[86] = "name=86 Aqr;ra=23 06 40.81;dec=-23 44 35.2;mag=4.48;" star[105] = "name=ω2 Aqr;ra=23 42 43.28;dec=-14 32 41.1;mag=4.49;" star[13] = "name=ν Aqr;ra=21 09 35.59;dec=-11 22 18.0;mag=4.50;" star[23] = "name=ξ Aqr;ra=21 37 45.04;dec=-07 51 14.9;mag=4.68;" star[66] = "name=66 Aqr;ra=22 43 35.25;dec=-18 49 49.1;mag=4.68;" star[101] = "name=101 Aqr;ra=23 33 16.63;dec=-20 54 52.3;mag=4.70;" star[89] = "name=89 Aqr;ra=23 09 54.88;dec=-22 27 27.3;mag=4.71;" star[6] = "name=μ Aqr;ra=20 52 39.21;dec=-08 58 59.7;mag=4.73;" star[31] = "name=ο Aqr;ra=22 03 18.83;dec=-02 09 19.2;mag=4.74;" star[52] = "name=π Aqr;ra=22 25 16.61;dec=+01 22 38.6;mag=4.80;" star[57] = "name=σ Aqr;ra=22 30 38.82;dec=-10 40 40.4;mag=4.82;" star[104] = "name=104 Aqr A;ra=23 41 45.80;dec=-17 48 59.5;mag=4.82;" star[92] = "name=χ Aqr;ra=23 16 50.95;dec=-07 43 35.3;mag=4.93;" star[102] = "name=ω1 Aqr;ra=23 39 47.04;dec=-14 13 19.4;mag=4.97;" star[95] = "name=ψ3 Aqr;ra=23 18 57.65;dec=-09 36 38.6;mag=4.99;" star[63] = "name=κ Aqr;ra=22 37 45.42;dec=-04 13 39.9;mag=5.04;" star[25] = "name=25 Aqr;ra=21 39 33.28;dec=+02 14 37.5;mag=5.10;" star[47] = "name=47 Aqr;ra=22 21 35.58;dec=-21 35 52.9;mag=5.12;" star[1] = "name=1 Aqr;ra=20 39 24.83;dec=+00 29 11.4;mag=5.15;" star[108] = "name=108 Aqr;ra=23 51 21.32;dec=-18 54 33.0;mag=5.17;" star[94] = "name=94 Aqr B;ra=23 19 06.37;dec=-13 27 17.0;mag=5.19;" star[97] = "name=97 Aqr;ra=23 22 39.10;dec=-15 02 21.8;mag=5.19;" star[94] = "name=94 Aqr A;ra=23 19 06.51;dec=-13 27 30.4;mag=5.20;" star[59] = "name=υ Aqr;ra=22 34 41.50;dec=-20 42 28.3;mag=5.21;" star[68] = "name=68 Aqr;ra=22 47 33.19;dec=-19 36 46.3;mag=5.24;" star[106] = "name=106 Aqr;ra=23 44 12.06;dec=-18 16 36.9;mag=5.24;" star[107] = "name=107 Aqr;ra=23 46 00.84;dec=-18 40 42.1;mag=5.28;" star[32] = "name=32 Aqr;ra=22 04 47.43;dec=-00 54 22.5;mag=5.29;" star[41] = "name=41 Aqr;ra=22 14 18.02;dec=-21 04 28.9;mag=5.33;" star[42] = "name=42 Aqr;ra=22 16 48.04;dec=-12 49 53.2;mag=5.34;" star[46] = "name=ρ Aqr;ra=22 20 11.91;dec=-07 49 16.0;mag=5.35;" star[103] = "name=103 Aqr;ra=23 41 34.51;dec=-18 01 36.8;mag=5.36;" star[38] = "name=38 Aqr;ra=22 10 37.46;dec=-11 33 53.9;mag=5.43;" star[83] = "name=83 Aqr;ra=23 05 09.71;dec=-07 41 37.7;mag=5.44;" star[18] = "name=18 Aqr;ra=21 24 11.44;dec=-12 52 41.3;mag=5.48;" star[21] = "name=21 Aqr;ra=21 25 16.96;dec=-03 33 23.7;mag=5.48;" star[7] = "name=7 Aqr;ra=20 56 54.03;dec=-09 41 51.1;mag=5.49;" star[12] = "name=12 Aqr B;ra=21 04 04.58;dec=-05 49 24.2;mag=7.31;" star[49] = "name=49 Aqr;ra=22 23 30.79;dec=-24 45 45.6;mag=5.53;" star[77] = "name=77 Aqr;ra=22 54 45.60;dec=-16 16 18.3;mag=5.53;" star[5] = "name=5 Aqr;ra=20 52 08.69;dec=-05 30 25.4;mag=5.55;" star[30] = "name=30 Aqr;ra=22 03 16.43;dec=-06 31 20.7;mag=5.55;" star[53] = "name=53 Aqr B;ra=22 26 34.15;dec=-16 44 31.7;mag=5.55;" star[96] = "name=96 Aqr;ra=23 19 23.86;dec=-05 07 27.5;mag=5.56;" star[28] = "name=28 Aqr;ra=22 01 05.01;dec=+00 36 17.1;mag=5.60;" star[26] = "name=26 Aqr;ra=21 42 10.12;dec=+01 17 07.0;mag=5.66;" star[69] = "name=τ1 Aqr;ra=22 47 42.75;dec=-14 03 23.1;mag=5.68;" star[19] = "name=19 Aqr;ra=21 25 13.02;dec=-09 44 53.3;mag=5.71;" star[44] = "name=44 Aqr;ra=22 17 06.50;dec=-05 23 14.0;mag=5.75;" star[50] = "name=50 Aqr;ra=22 24 27.03;dec=-13 31 45.9;mag=5.76;" star[51] = "name=51 Aqr;ra=22 24 06.87;dec=-04 50 13.2;mag=5.79;" star[35] = "name=35 Aqr;ra=22 08 58.99;dec=-18 31 10.5;mag=5.80;" star[74] = "name=74 Aqr;ra=22 53 28.69;dec=-11 36 59.5;mag=5.80;" star[15] = "name=15 Aqr;ra=21 18 11.07;dec=-04 31 10.2;mag=5.83;" star[16] = "name=16 Aqr;ra=21 21 04.33;dec=-04 33 36.5;mag=5.87;" star[60] = "name=60 Aqr;ra=22 34 02.89;dec=-01 34 27.0;mag=5.88;" star[12] = "name=12 Aqr A;ra=21 04 04.74;dec=-05 49 23.0;mag=5.89;" star[45] = "name=45 Aqr;ra=22 19 00.70;dec=-13 18 17.9;mag=5.96;" star[4] = "name=4 Aqr;ra=20 51 25.69;dec=-05 37 35.9;mag=5.99;" star[17] = "name=17 Aqr;ra=21 22 56.27;dec=-09 19 09.4;mag=5.99;" star[39] = "name=39 Aqr;ra=22 12 25.74;dec=-14 11 37.8;mag=6.04;" star[82] = "name=82 Aqr;ra=23 02 32.56;dec=-06 34 26.1;mag=6.18;" star[70] = "name=70 Aqr;ra=22 48 30.19;dec=-10 33 19.8;mag=6.19;" star[78] = "name=78 Aqr;ra=22 54 34.13;dec=-07 12 16.3;mag=6.20;" star[11] = "name=11 Aqr;ra=21 00 33.81;dec=-04 43 47.7;mag=6.21;" star[81] = "name=81 Aqr;ra=23 01 23.65;dec=-07 03 40.1;mag=6.23;" star[100] = "name=100 Aqr;ra=23 31 42.04;dec=-21 22 10.0;mag=6.24;" star[53] = "name=53 Aqr A;ra=22 26 34.40;dec=-16 44 33.0;mag=6.35;" star[56] = "name=56 Aqr;ra=22 30 17.33;dec=-14 35 08.3;mag=6.36;" star[20] = "name=20 Aqr;ra=21 24 51.68;dec=-03 23 53.6;mag=6.38;" star[29] = "name=29 Aqr;ra=22 02 26.25;dec=-16 57 53.4;mag=6.39;" star[58] = "name=58 Aqr;ra=22 31 41.28;dec=-10 54 19.7;mag=6.39;" star[61] = "name=61 Aqr;ra=22 35 48.82;dec=-17 27 37.1;mag=6.39;" star[67] = "name=67 Aqr;ra=22 43 14.25;dec=-06 57 46.5;mag=6.40;" star[14] = "name=14 Aqr;ra=21 16 17.78;dec=-09 12 52.8;mag=6.45;" star[114] = "name=HD 210277;ra=22 09 29.87;dec=-07 32 55.2;mag=6.63;" star[37] = "name=37 Aqr;ra=22 10 31.74;dec=-10 49 13.7;mag=6.64;" star[24] = "name=24 Aqr;ra=21 39 31.39;dec=-00 03 04.1;mag=6.66;" star[104] = "name=104 Aqr B;ra=23 41 46.39;dec=-17 47 00.5;mag=8.52;" edge = "1=2-6;2=6-22;3=22-34;4=22-33;5=33-43;6=34-43;7=43-57;" edge = edge + "8=57-71;9=71-76;10=34-48;11=48-55;12=55-62;" edge = edge + "13=62-73;14=73-88;15=62-90;16=90-91;17=91-102;" edge = edge + "18=102-98;19=98-104;" EndSub Sub Shapes_Initaq shX = 384 ' x offset shY = 315 ' y offset shape = "" shape[1] = "func=ell;x=92;y=62;width=56;height=31;angle=30;bc=#204040;pw=0;" shape[2] = "func=ell;x=106;y=0;width=73;height=86;angle=32;bc=#204040;pw=0;" shape[3] = "func=ell;x=101;y=72;width=37;height=14;angle=28;bc=#102020;pw=0;" shape[4] = "func=tri;x=63;y=39;x1=31;y1=0;x2=0;y2=155;x3=63;y3=155;angle=38;bc=#204040;pw=0;" shape[5] = "func=ell;x=37;y=173;width=36;height=100;angle=10;bc=#204040;pw=0;" shape[6] = "func=ell;x=12;y=155;width=34;height=118;angle=17;bc=#204040;pw=0;" shape[7] = "func=ell;x=0;y=151;width=28;height=90;angle=24;bc=#204040;pw=0;" shape[8] = "func=ell;x=238;y=26;width=55;height=71;angle=28;bc=#204040;pw=0;" shape[9] = "func=rect;x=234;y=78;width=22;height=34;angle=32;bc=#204040;pw=0;" shape[10] = "func=rect;x=179;y=95;width=87;height=81;angle=31;bc=#204040;pw=0;" shape[11] = "func=rect;x=256;y=144;width=67;height=22;angle=53;bc=#204040;pw=0;" shape[12] = "func=rect;x=299;y=165;width=65;height=19;angle=348;bc=#204040;pw=0;" shape[13] = "func=rect;x=144;y=94;width=74;height=22;angle=334;bc=#204040;pw=0;" shape[14] = "func=rect;x=137;y=62;width=18;height=69;angle=358;bc=#204040;pw=0;" shape[15] = "func=rect;x=153;y=160;width=89;height=54;angle=19;bc=#204040;pw=0;" shape[16] = "func=rect;x=99;y=186;width=75;height=30;angle=341;bc=#204040;pw=0;" shape[17] = "func=rect;x=130;y=220;width=96;height=31;angle=328;bc=#204040;pw=0;" shape[18] = "func=ell;x=80;y=199;width=35;height=34;bc=#204040;pw=0;" shape[19] = "func=ell;x=117;y=247;width=35;height=39;bc=#204040;pw=0;" shape[20] = "func=rect;x=128;y=274;width=28;height=56;angle=345;bc=#204040;pw=0;" shape[21] = "func=rect;x=80;y=217;width=27;height=74;bc=#204040;pw=0;" shape[22] = "func=ell;x=248;y=49;width=14;height=14;bc=#102020;pw=0;" shape[23] = "func=ell;x=268;y=60;width=14;height=14;bc=#102020;pw=0;" shape[24] = "func=ell;x=258;y=17;width=21;height=22;bc=#204040;pw=0;" shape[25] = "func=ell;x=274;y=19;width=21;height=22;bc=#204040;pw=0;" shape[26] = "func=ell;x=285;y=32;width=21;height=22;bc=#204040;pw=0;" shape[27] = "func=ell;x=289;y=49;width=21;height=22;bc=#204040;pw=0;" shape[28] = "func=ell;x=241;y=21;width=21;height=22;bc=#204040;pw=0;" shape[29] = "func=ell;x=280;y=65;width=21;height=22;bc=#204040;pw=0;" shape[30] = "func=ell;x=229;y=35;width=21;height=22;bc=#204040;pw=0;" shape[31] = "func=ell;x=359;y=148;width=32;height=31;bc=#204040;pw=0;" shape[32] = "func=ell;x=357;y=155;width=13;height=73;angle=6;bc=#204040;pw=0;" shape[33] = "func=ell;x=385;y=162;width=14;height=78;angle=345;bc=#204040;pw=0;" shape[34] = "func=tri;x=58;y=270;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=265;bc=#204040;pw=0;" shape[35] = "func=tri;x=116;y=308;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=261;bc=#204040;pw=0;" EndSub Sub InitStarscc ' Initialize stars in Capricornus star[49] = "name=δ Cap;ra=21 47 02.29;dec=-16 07 35.6;mag=2.85;" star[9] = "name=β1 Cap;ra=20 21 00.65;dec=-14 46 53.0;mag=3.05;" star[6] = "name=α2 Cap;ra=20 18 03.22;dec=-12 32 41.5;mag=3.58;" star[40] = "name=γ Cap;ra=21 40 05.34;dec=-16 39 44.1;mag=3.69;" star[34] = "name=ζ Cap;ra=21 26 40.03;dec=-22 24 41.0;mag=3.77;" star[23] = "name=θ Cap;ra=21 05 56.78;dec=-17 13 57.8;mag=4.08;" star[18] = "name=ω Cap;ra=20 51 49.30;dec=-26 55 08.9;mag=4.12;" star[16] = "name=ψ Cap;ra=20 46 05.77;dec=-25 16 13.9;mag=4.13;" star[32] = "name=ι Cap;ra=21 22 14.78;dec=-16 50 04.4;mag=4.27;" star[5] = "name=α1 Cap;ra=20 17 38.86;dec=-12 30 29.6;mag=4.30;" star[24] = "name=24 Cap;ra=21 07 07.69;dec=-25 00 20.7;mag=4.49;" star[36] = "name=36 Cap;ra=21 28 43.32;dec=-21 48 25.8;mag=4.50;" star[39] = "name=ε Cap;ra=21 37 04.82;dec=-19 27 57.6;mag=4.51;" star[43] = "name=κ Cap;ra=21 42 39.42;dec=-18 51 58.7;mag=4.72;" star[8] = "name=ν Cap;ra=20 20 39.81;dec=-12 45 32.6;mag=4.77;" star[11] = "name=ρ Cap;ra=20 28 51.62;dec=-17 48 49.2;mag=4.77;" star[22] = "name=η Cap;ra=21 04 24.32;dec=-19 51 17.8;mag=4.82;" star[51] = "name=μ Cap;ra=21 53 17.58;dec=-13 33 06.5;mag=5.07;" star[10] = "name=π Cap;ra=20 27 19.20;dec=-18 12 42.1;mag=5.08;" star[46] = "name=46 Cap;ra=21 45 00.25;dec=-09 04 56.7;mag=5.10;" star[15] = "name=υ Cap;ra=20 40 02.96;dec=-18 08 19.0;mag=5.15;" star[42] = "name=42 Cap;ra=21 41 32.93;dec=-14 02 48.7;mag=5.16;" star[28] = "name=φ Cap;ra=21 15 37.89;dec=-20 39 06.1;mag=5.17;" star[14] = "name=τ2 Cap;ra=20 39 16.32;dec=-14 57 17.0;mag=5.24;" star[41] = "name=41 Cap;ra=21 42 00.64;dec=-23 15 45.5;mag=5.24;" star[7] = "name=σ Cap;ra=20 19 23.60;dec=-19 07 06.6;mag=5.28;" star[25] = "name=χ Cap;ra=21 08 33.61;dec=-21 11 36.7;mag=5.30;" star[29] = "name=29 Cap;ra=21 15 44.83;dec=-15 10 17.4;mag=5.31;" star[33] = "name=33 Cap;ra=21 24 09.60;dec=-20 51 05.6;mag=5.38;" star[30] = "name=30 Cap;ra=21 17 57.28;dec=-17 59 06.5;mag=5.40;" star[48] = "name=λ Cap;ra=21 46 32.08;dec=-11 21 57.4;mag=5.57;" star[37] = "name=37 Cap;ra=21 34 51.07;dec=-20 05 03.8;mag=5.70;" star[19] = "name=19 Cap;ra=20 54 47.85;dec=-17 55 22.3;mag=5.78;" star[35] = "name=35 Cap;ra=21 27 14.83;dec=-21 11 46.1;mag=5.78;" star[2] = "name=ξ2 Cap;ra=20 12 25.76;dec=-12 37 01.3;mag=5.84;" star[4] = "name=4 Cap;ra=20 18 01.38;dec=-21 48 35.6;mag=5.86;" star[44] = "name=44 Cap;ra=21 43 04.40;dec=-14 23 59.1;mag=5.88;" star[17] = "name=17 Cap;ra=20 46 09.97;dec=-21 30 50.4;mag=5.91;" star[12] = "name=ο Cap A;ra=20 29 53.89;dec=-18 34 58.7;mag=5.94;" star[45] = "name=45 Cap;ra=21 44 00.98;dec=-14 44 57.8;mag=5.96;" star[47] = "name=47 Cap;ra=21 46 16.26;dec=-09 16 33.4;mag=6.00;" star[21] = "name=21 Cap;ra=21 00 51.78;dec=-17 31 51.1;mag=6.07;" star[27] = "name=27 Cap;ra=21 09 32.93;dec=-20 33 22.8;mag=6.25;" star[20] = "name=20 Cap;ra=20 59 36.13;dec=-19 02 06.8;mag=6.26;" star[3] = "name=3 Cap;ra=20 16 22.80;dec=-12 20 13.5;mag=6.30;" star[1] = "name=ξ1 Cap;ra=20 11 57.90;dec=-12 23 32.5;mag=6.34;" star[12] = "name=ο Cap B;ra=20 29 52.58;dec=-18 35 10.2;mag=6.74;" star[13] = "name=τ1 Cap;ra=20 37 21.16;dec=-15 08 50.0;mag=6.76;" star[50] = "name=50 Cap;ra=21 46 42.09;dec=-11 41 52.2;mag=7.01;" star[31] = "name=31 Cap;ra=21 18 15.64;dec=-17 27 44.2;mag=7.07;" edge = "1=6-9;2=9-16;3=16-18;4=18-34;5=34-49;6=49-40;7=40-32;" edge = edge + "8=32-23;9=23-9;" EndSub Sub Shapes_Initcc shX = 640 ' x offset shY = 441 ' y offset shape = "" shape[1] = "func=rect;x=191;y=68;width=44;height=86;bc=#83809C;pw=0;" shape[2] = "func=tri;x=179;y=6;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=339;bc=#83809C;pw=0;" shape[3] = "func=tri;x=207;y=0;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=343;bc=#83809C;pw=0;" shape[4] = "func=line;x=171;y=144;x1=26;y1=46;x2=0;y2=0;pc=#83809C;pw=16;" shape[5] = "func=line;x=193;y=188;x1=0;y1=0;x2=58;y2=24;pc=#83809C;pw=16;" shape[6] = "func=line;x=149;y=145;x1=21;y1=68;x2=0;y2=0;pc=#83809C;pw=16;" shape[7] = "func=line;x=102;y=200;x1=64;y1=6;x2=0;y2=0;pc=#83809C;pw=16;" shape[8] = "func=ell;x=1;y=82;width=97;height=99;bc=#83809C;pw=0;" shape[9] = "func=ell;x=59;y=72;width=144;height=87;angle=351;bc=#83809C;pw=0;" shape[10] = "func=tri;x=0;y=54;x1=39;y1=0;x2=0;y2=73;x3=79;y3=73;angle=173;bc=#83809C;pc=#000055;pw=4;" shape[11] = "func=ell;x=35;y=123;width=15;height=16;bc=#191970;pw=0;" shape[12] = "func=ell;x=210;y=93;width=15;height=16;bc=#191970;pw=0;" shape[13] = "func=tri;x=155;y=63;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=206;bc=#83809C;pw=0;" shape[14] = "func=tri;x=223;y=67;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=164;bc=#83809C;pw=0;" shape[15] = "func=line;x=208;y=141;x1=0;y1=0;x2=8;y2=18;pc=#191970;pw=4;" shape[16] = "func=tri;x=192;y=151;x1=6;y1=0;x2=0;y2=38;x3=13;y3=38;angle=181;bc=#83809C;pw=0;" shape[17] = "func=tri;x=29;y=91;x1=24;y1=0;x2=0;y2=47;x3=48;y3=47;angle=172;bc=#83809C;pw=0;" shape[18] = "func=line;x=211;y=101;x1=0;y1=0;x2=12;y2=0;pc=#191970;pw=4;" EndSub Sub InitStarsary star[13] = "name=α Ari;ra=02 07 10.29;dec=+23 27 46.0;mag=2.01;" star[6] = "name=β Ari;ra=01 54 38.35;dec=+20 48 29.9;mag=2.64;" star[41] = "name=41 Ari;ra=02 49 58.99;dec=+27 15 38.8;mag=3.61;" star[57] = "name=δ Ari;ra=03 11 37.67;dec=+19 43 36.1;mag=4.35;" star[39] = "name=39 Ari;ra=02 47 54.44;dec=+29 14 50.7;mag=4.52;" star[5] = "name=γ2 Ari;ra=01 53 31.80;dec=+19 17 45.0;mag=4.62;" star[35] = "name=35 Ari;ra=02 43 27.11;dec=+27 42 25.8;mag=4.65;" star[5] = "name=γ1 Ari;ra=01 53 31.77;dec=+19 17 38.7;mag=4.70;" star[9] = "name=λ Ari;ra=01 57 55.78;dec=+23 35 45.9;mag=4.79;" star[58] = "name=ζ Ari;ra=03 14 54.11;dec=+21 02 40.7;mag=4.87;" star[14] = "name=14 Ari;ra=02 09 25.29;dec=+25 56 23.9;mag=4.98;" star[12] = "name=κ Ari;ra=02 06 33.91;dec=+22 38 54.3;mag=5.03;" star[8] = "name=ι Ari;ra=01 57 21.03;dec=+17 49 03.3;mag=5.09;" star[63] = "name=τ2 Ari;ra=03 22 45.27;dec=+20 44 31.6;mag=5.10;" star[38] = "name=38 Ari;ra=02 44 57.51;dec=+12 26 45.5;mag=5.18;" star[48] = "name=ε Ari A;ra=02 59 12.70;dec=+21 20 25.0;mag=5.2;" star[17] = "name=η Ari;ra=02 12 47.98;dec=+21 12 39.5;mag=5.23;" star[42] = "name=π Ari;ra=02 49 17.56;dec=+17 27 51.6;mag=5.26;" star[61] = "name=τ1 Ari;ra=03 21 13.61;dec=+21 08 49.7;mag=5.27;" star[33] = "name=33 Ari;ra=02 40 41.03;dec=+27 03 39.6;mag=5.30;" star[32] = "name=ν Ari;ra=02 38 49.00;dec=+21 57 41.2;mag=5.45;" star[52] = "name=52 Ari A;ra=03 05 26.69;dec=+25 15 18.7;mag=5.45;" star[24] = "name=ξ Ari;ra=02 24 49.04;dec=+10 36 38.2;mag=5.48;" star[48] = "name=ε Ari B;ra=02 59 12.73;dec=+21 20 25.6;mag=5.5;" star[64] = "name=64 Ari;ra=03 24 18.46;dec=+24 43 27.1;mag=5.50;" star[43] = "name=σ Ari;ra=02 51 29.57;dec=+15 04 55.7;mag=5.52;" star[62] = "name=62 Ari;ra=03 22 11.89;dec=+27 36 27.3;mag=5.55;" star[21] = "name=21 Ari;ra=02 15 42.83;dec=+25 02 35.7;mag=5.57;" star[22] = "name=θ Ari;ra=02 18 07.55;dec=+19 54 04.2;mag=5.58;" star[46] = "name=ρ3 Ari;ra=02 56 25.98;dec=+18 01 25.1;mag=5.58;" star[10] = "name=10 Ari;ra=02 03 39.26;dec=+25 56 07.6;mag=5.64;" star[31] = "name=31 Ari;ra=02 36 37.75;dec=+12 26 52.2;mag=5.64;" star[15] = "name=15 Ari;ra=02 10 37.54;dec=+19 30 01.5;mag=5.68;" star[19] = "name=19 Ari;ra=02 13 03.25;dec=+15 16 47.7;mag=5.72;" star[34] = "name=μ Ari;ra=02 42 21.92;dec=+20 00 41.7;mag=5.74;" star[55] = "name=55 Ari;ra=03 09 36.73;dec=+29 04 37.6;mag=5.74;" star[7] = "name=7 Ari;ra=01 55 51.03;dec=+23 34 38.4;mag=5.76;" star[45] = "name=ρ2 Ari;ra=02 55 48.50;dec=+18 19 54.0;mag=5.76;" star[37] = "name=ο Ari;ra=02 44 32.97;dec=+15 18 42.8;mag=5.78;" star[56] = "name=56 Ari;ra=03 12 14.24;dec=+27 15 25.2;mag=5.78;" star[20] = "name=20 Ari;ra=02 15 45.94;dec=+25 46 59.2;mag=5.79;" star[47] = "name=47 Ari;ra=02 58 05.08;dec=+20 40 07.7;mag=5.80;" star[1] = "name=1 Ari A;ra=01 50 08.58;dec=+22 16 31.3;mag=5.83;" star[40] = "name=40 Ari;ra=02 48 32.06;dec=+18 17 01.9;mag=5.83;" star[4] = "name=4 Ari;ra=01 48 10.90;dec=+16 57 20.3;mag=5.86;" star[(16)] = "name=HR 830;ra=02 48 45.87;dec=+25 11 17.1;mag=5.89;" star[1] = "name=1 Ari B;ra=01 50 08.50;dec=+22 16 33.0;mag=5.90;" star[49] = "name=49 Ari;ra=03 01 54.15;dec=+26 27 44.4;mag=5.91;" star[59] = "name=59 Ari;ra=03 19 55.81;dec=+27 04 16.7;mag=5.91;" star[(54)] = "name=54 Cet;ra=01 50 52.01;dec=+11 02 36.4;mag=5.93;" star[29] = "name=29 Ari;ra=02 32 54.15;dec=+15 02 04.1;mag=6.00;" star[11] = "name=11 Ari;ra=02 06 49.22;dec=+25 42 16.5;mag=6.01;" star[16] = "name=16 Ari;ra=02 11 12.06;dec=+25 56 13.0;mag=6.01;" star[66] = "name=66 Ari;ra=03 28 26.57;dec=+22 48 15.4;mag=6.03;" star[65] = "name=65 Ari;ra=03 24 26.11;dec=+20 48 12.6;mag=6.07;" star[53] = "name=53 Ari;ra=03 07 25.69;dec=+17 52 47.9;mag=6.13;" star[26] = "name=26 Ari;ra=02 30 38.37;dec=+19 51 19.4;mag=6.14;" star[60] = "name=60 Ari;ra=03 20 25.57;dec=+25 39 46.7;mag=6.14;" star[27] = "name=27 Ari;ra=02 30 54.38;dec=+17 42 14.6;mag=6.21;" star[54] = "name=54 Ari;ra=03 08 21.09;dec=+18 47 42.3;mag=6.25;" star[(85)] = "name=85 Cet;ra=02 42 28.95;dec=+10 44 30.4;mag=6.32;" star[36] = "name=36 Ari;ra=02 44 19.09;dec=+17 45 50.5;mag=6.46;" star[30] = "name=30 Ari A;ra=02 37 00.44;dec=+24 38 50.1;mag=6.48;" star[51] = "name=51 Ari;ra=03 02 25.87;dec=+26 36 34.7;mag=6.62;" star[52] = "name=52 Ari B;ra=03 05 26.70;dec=+25 15 19.0;mag=7.00;" star[44] = "name=ρ1 Ari;ra=02 54 55.17;dec=+17 44 05.3;mag=7.01;" star[30] = "name=30 Ari B;ra=02 36 57.64;dec=+24 38 53.1;mag=7.09;" edge = "1=5-6;2=6-13;3=13-32;4=32-57;" EndSub Sub Shapes_Initary shX = -200 ' x offset shY = 133 ' y offset shape = "" shape[1] = "func=ell;x=62;y=33;width=99;height=97;bc=#5E5E5E;pw=0;" shape[2] = "func=ell;x=0;y=59;width=67;height=37;angle=348;bc=#5E5E5E;pw=0;" shape[3] = "func=ell;x=45;y=80;width=2;height=0;bc=#5E5E5E;pw=0;" shape[4] = "func=ell;x=222;y=0;width=47;height=48;bc=#000000;pc=#5E5E5E;pw=16;" shape[5] = "func=ell;x=186;y=58;width=99;height=97;bc=#5E5E5E;pw=0;" shape[6] = "func=rect;x=107;y=44;width=127;height=98;angle=11;bc=#5E5E5E;pw=0;" shape[7] = "func=rect;x=68;y=139;width=103;height=17;angle=28;bc=#5E5E5E;pw=0;" shape[8] = "func=rect;x=196;y=147;width=70;height=16;angle=27;bc=#5E5E5E;pw=0;" shape[9] = "func=rect;x=192;y=164;width=70;height=16;angle=356;bc=#5E5E5E;pw=0;" shape[10] = "func=rect;x=218;y=141;width=70;height=16;angle=9;bc=#5E5E5E;pw=0;" shape[11] = "func=rect;x=238;y=172;width=70;height=16;angle=292;bc=#5E5E5E;pw=0;" shape[12] = "func=ell;x=218;y=36;width=37;height=54;angle=34;bc=#5E5E5E;pc=#000000;pw=4;" shape[13] = "func=ell;x=229;y=11;width=78;height=78;bc=#5E5E5E;pw=0;" shape[14] = "func=ell;x=255;y=51;width=20;height=20;bc=#000000;pw=0;" shape[15] = "func=line;x=218;y=71;x1=0;y1=4;x2=11;y2=0;pc=#000000;pw=4;" shape[16] = "func=tri;x=238;y=76;x1=40;y1=0;x2=0;y2=25;x3=80;y3=25;angle=288;bc=#5E5E5E;pw=0;" shape[17] = "func=ell;x=287;y=27;width=47;height=48;bc=#000000;pc=#5E5E5E;pw=16;" shape[18] = "func=line;x=284;y=49;x1=0;y1=0;x2=26;y2=9;pc=#000000;pw=4;" shape[19] = "func=line;x=284;y=49;x1=18;y1=32;x2=0;y2=0;pc=#000000;pw=4;" shape[20] = "func=tri;x=165;y=161;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" shape[21] = "func=tri;x=162;y=168;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" shape[22] = "func=tri;x=252;y=205;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=210;bc=#5E5E5E;pw=0;" shape[23] = "func=tri;x=246;y=203;x1=7;y1=0;x2=0;y2=27;x3=15;y3=27;angle=214;bc=#5E5E5E;pw=0;" shape[24] = "func=tri;x=179;y=160;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0;" shape[25] = "func=tri;x=182;y=153;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0;" shape[26] = "func=rect;x=97;y=127;width=103;height=17;angle=12;bc=#5E5E5E;pw=0;" shape[27] = "func=tri;x=196;y=140;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" EndSub Sub initscnc star[17] = "name=β Cnc;ra=08 16 30.95;dec=+09 11 08.4;mag=3.53;" star[47] = "name=δ Cnc;ra=08 44 41.11;dec=+18 09 17.5;mag=3.94;" star[48] = "name=ι Cnc A;ra=08 46 41.83;dec=+28 45 36.0;mag=4.03;" star[65] = "name=α Cnc;ra=08 58 29.20;dec=+11 51 28.0;mag=4.26;" star[43] = "name=γ Cnc;ra=08 43 17.21;dec=+21 28 06.9;mag=4.66;" star[16] = "name=ζ Cnc;ra=08 12 12.71;dec=+17 38 53.3;mag=4.67;" star[8] = "name=8 Cnc;ra=08 05 04.51;dec=+13 07 06.1;mag=5.14;" star[18] = "name=χ Cnc;ra=08 20 03.87;dec=+27 13 07.0;mag=5.14;" star[77] = "name=ξ Cnc;ra=09 09 21.53;dec=+22 02 43.6;mag=5.16;" star[62] = "name=ο1 Cnc;ra=08 57 14.91;dec=+15 19 21.8;mag=5.22;" star[58] = "name=ρ2 Cnc;ra=08 55 39.69;dec=+27 55 39.2;mag=5.23;" star[64] = "name=σ3 Cnc;ra=08 59 32.68;dec=+32 25 07.1;mag=5.23;" star[76] = "name=κ Cnc;ra=09 07 44.82;dec=+10 40 05.6;mag=5.23;" star[10] = "name=μ2 Cnc;ra=08 07 45.84;dec=+21 34 55.1;mag=5.30;" star[31] = "name=θ Cnc;ra=08 31 35.77;dec=+18 05 40.4;mag=5.33;" star[33] = "name=η Cnc;ra=08 32 42.52;dec=+20 26 28.6;mag=5.33;" star[82] = "name=82 Cnc;ra=09 15 13.88;dec=+14 56 29.5;mag=5.36;" star[57] = "name=57 Cnc;ra=08 54 14.70;dec=+30 34 45.0;mag=5.40;" star[72] = "name=τ Cnc;ra=09 08 00.07;dec=+29 39 15.2;mag=5.42;" star[60] = "name=60 Cnc;ra=08 55 55.56;dec=+11 37 33.8;mag=5.44;" star[59] = "name=σ2 Cnc;ra=08 56 56.63;dec=+32 54 38.1;mag=5.44;" star[69] = "name=ν Cnc;ra=09 02 44.27;dec=+24 27 10.6;mag=5.45;" star[27] = "name=27 Cnc;ra=08 26 43.95;dec=+12 39 17.5;mag=5.56;" star[22] = "name=φ1 Cnc;ra=08 26 27.73;dec=+27 53 37.9;mag=5.58;" star[3] = "name=3 Cnc;ra=08 00 47.31;dec=+17 18 31.4;mag=5.60;" star[15] = "name=15 Cnc;ra=08 13 08.87;dec=+29 39 23.7;mag=5.62;" star[45] = "name=45 Cnc;ra=08 43 12.34;dec=+12 40 51.1;mag=5.62;" star[49] = "name=49 Cnc;ra=08 44 45.04;dec=+10 04 54.2;mag=5.63;" star[51] = "name=σ1 Cnc;ra=08 52 34.62;dec=+32 28 26.8;mag=5.67;" star[63] = "name=ο2 Cnc;ra=08 57 35.16;dec=+15 34 52.4;mag=5.68;" star[30] = "name=υ1 Cnc;ra=08 31 30.57;dec=+24 04 52.4;mag=5.71;" star[14] = "name=ψ2 Cnc;ra=08 10 27.23;dec=+25 30 29.4;mag=5.73;" star[1] = "name=1 Cnc;ra=07 56 59.47;dec=+15 47 25.4;mag=5.80;" star[2] = "name=ω1 Cnc;ra=08 00 55.87;dec=+25 23 34.2;mag=5.87;" star[50] = "name=50 Cnc;ra=08 46 56.06;dec=+12 06 36.3;mag=5.89;" star[66] = "name=66 Cnc;ra=09 01 24.13;dec=+32 15 08.3;mag=5.89;" star[19] = "name=λ Cnc;ra=08 20 32.15;dec=+24 01 20.5;mag=5.92;" star[36] = "name=36 Cnc;ra=08 37 05.79;dec=+09 39 20.1;mag=5.92;" star[20] = "name=20 Cnc;ra=08 23 21.87;dec=+18 19 56.2;mag=5.94;" star[29] = "name=29 Cnc;ra=08 28 37.35;dec=+14 12 39.1;mag=5.94;" star[75] = "name=75 Cnc;ra=09 08 47.42;dec=+26 37 48.0;mag=5.95;" star[(1)] = "name=1 LMi;ra=08 38 19.00;dec=+32 48 07.3;mag=5.96;" star[55] = "name=55 Cnc;ra=08 52 36.13;dec=+28 19 53.0;mag=5.96;" star[9] = "name=μ1 Cnc;ra=08 06 18.40;dec=+22 38 07.8;mag=5.97;" star[5] = "name=5 Cnc;ra=08 01 30.29;dec=+16 27 19.2;mag=5.99;" star[79] = "name=79 Cnc;ra=09 10 20.86;dec=+21 59 47.1;mag=6.04;" star[28] = "name=28 Cnc;ra=08 28 36.80;dec=+24 08 42.2;mag=6.05;" star[67] = "name=67 Cnc;ra=09 01 48.88;dec=+27 54 10.0;mag=6.07;" star[21] = "name=21 Cnc;ra=08 23 55.21;dec=+10 37 55.6;mag=6.11;" star[25] = "name=25 Cnc;ra=08 25 49.99;dec=+17 02 47.9;mag=6.11;" star[46] = "name=46 Cnc;ra=08 45 21.42;dec=+30 41 51.9;mag=6.12;" star[23] = "name=φ2 Cnc A;ra=08 26 47.08;dec=+26 56 07.7;mag=6.14;" star[23] = "name=φ2 Cnc B;ra=08 26 47.00;dec=+26 56 07.0;mag=6.19;" star[(4)] = "name=4 LMi;ra=08 40 18.31;dec=+31 56 31.1;mag=6.21;" star[12] = "name=12 Cnc;ra=08 08 42.44;dec=+13 38 27.4;mag=6.25;" star[53] = "name=53 Cnc;ra=08 52 28.60;dec=+28 15 33.0;mag=6.25;" star[61] = "name=61 Cnc;ra=08 57 58.63;dec=+30 14 01.5;mag=6.25;" star[41] = "name=ε Cnc;ra=08 40 27.03;dec=+19 32 41.4;mag=6.29;" star[4] = "name=4 Cnc;ra=08 01 43.77;dec=+25 05 22.0;mag=6.32;" star[32] = "name=υ2 Cnc;ra=08 33 00.14;dec=+24 05 05.7;mag=6.35;" star[54] = "name=54 Cnc;ra=08 51 01.53;dec=+15 21 01.7;mag=6.36;" star[39] = "name=39 Cnc;ra=08 40 06.44;dec=+20 00 28.1;mag=6.39;" star[13] = "name=ψ1 Cnc;ra=08 10 13.12;dec=+25 50 40.4;mag=6.44;" star[34] = "name=34 Cnc;ra=08 32 39.87;dec=+10 03 57.7;mag=6.48;" star[81] = "name=81 Cnc;ra=09 12 17.87;dec=+14 59 43.6;mag=6.49;" star[24] = "name=24 Cnc A;ra=08 26 39.82;dec=+24 32 03.7;mag=6.51;" star[37] = "name=37 Cnc;ra=08 38 05.19;dec=+09 34 28.7;mag=6.54;" star[35] = "name=35 Cnc;ra=08 35 19.47;dec=+19 35 24.3;mag=6.55;" star[40] = "name=40 Cnc;ra=08 40 11.47;dec=+19 58 16.2;mag=6.61;" star[83] = "name=83 Cnc;ra=09 18 58.91;dec=+17 42 20.4;mag=6.61;" star[38] = "name=38 Cnc;ra=08 39 42.68;dec=+19 46 42.5;mag=6.66;" star[70] = "name=70 Cnc;ra=09 04 09.87;dec=+27 53 53.9;mag=6.67;" star[(2)] = "name=2 LMi;ra=08 39 31.87;dec=+32 30 56.2;mag=6.69;" star[(3)] = "name=3 LMi;ra=08 39 56.35;dec=+32 43 38.2;mag=6.71;" star[42] = "name=42 Cnc;ra=08 40 43.23;dec=+19 43 09.6;mag=6.83;" star[7] = "name=7 Cnc;ra=08 03 50.48;dec=+22 04 14.9;mag=6.84;" star[80] = "name=80 Cnc;ra=09 11 56.93;dec=+18 02 39.0;mag=6.87;" star[78] = "name=78 Cnc;ra=09 09 02.31;dec=+17 28 10.7;mag=7.18;" star[52] = "name=52 Cnc;ra=08 51 10.83;dec=+15 59 57.8;mag=7.38;" star[24] = "name=24 Cnc B;ra=08 26 40.10;dec=+24 32 07.0;mag=7.81;" star[44] = "name=44 Cnc;ra=08 43 08.36;dec=+18 09 02.0;mag=8.03;" star[71] = "name=71 Cnc;ra=09 05 45.52;dec=+17 23 24.5;mag=8.10;" edge = "1=48-43;2=43-47;3=47-65;4=47-17;" EndSub Sub shpcnc shX = -1040 ' x offset shY = 77 ' y offset shape = "" shape[1] = "func=ell;x=60;y=44;width=126;height=181;bc=#661F1F;pc=#000055;pw=2;" shape[2] = "func=ell;x=54;y=99;width=21;height=21;bc=#661F1F;pc=#000055;pw=2;" shape[3] = "func=ell;x=56;y=145;width=21;height=21;bc=#661F1F;pc=#000055;pw=2;" shape[4] = "func=rect;x=73;y=22;width=27;height=23;angle=12;bc=#661F1F;pc=#000055;pw=2;" shape[5] = "func=rect;x=96;y=30;width=24;height=22;angle=21;bc=#661F1F;pc=#000055;pw=2;" shape[6] = "func=rect;x=49;y=209;width=29;height=22;bc=#661F1F;pc=#000055;pw=2;" shape[7] = "func=rect;x=70;y=207;width=24;height=19;angle=327;bc=#661F1F;pc=#000055;pw=2;" shape[8] = "func=tri;x=107;y=15;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=332;bc=#661F1F;pc=#000055;pw=2;" shape[9] = "func=tri;x=131;y=12;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=338;bc=#661F1F;pc=#000055;pw=2;" shape[10] = "func=tri;x=152;y=21;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=346;bc=#661F1F;pc=#000055;pw=2;" shape[11] = "func=tri;x=170;y=34;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[12] = "func=tri;x=103;y=218;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[13] = "func=tri;x=127;y=217;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[14] = "func=tri;x=142;y=219;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[15] = "func=tri;x=161;y=206;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[16] = "func=tri;x=49;y=102;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=290;bc=#661F1F;pc=#000055;pw=2;" shape[17] = "func=tri;x=49;y=122;x1=7;y1=0;x2=0;y2=36;x3=14;y3=36;angle=264;bc=#661F1F;pc=#000055;pw=2;" shape[18] = "func=rect;x=127;y=77;width=14;height=33;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[19] = "func=rect;x=141;y=74;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[20] = "func=rect;x=158;y=84;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[21] = "func=rect;x=169;y=96;width=14;height=33;angle=10;bc=#661F1F;pc=#000055;pw=2;" shape[22] = "func=rect;x=122;y=161;width=14;height=33;angle=7;bc=#661F1F;pc=#000055;pw=2;" shape[23] = "func=rect;x=136;y=162;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[24] = "func=rect;x=153;y=160;width=14;height=33;angle=352;bc=#661F1F;pc=#000055;pw=2;" shape[25] = "func=rect;x=167;y=150;width=14;height=33;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[26] = "func=rect;x=120;y=48;width=14;height=33;angle=338;bc=#661F1F;pc=#000055;pw=2;" shape[27] = "func=rect;x=139;y=46;width=14;height=33;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[28] = "func=rect;x=158;y=55;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[29] = "func=rect;x=173;y=67;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[30] = "func=rect;x=117;y=191;width=14;height=33;angle=12;bc=#661F1F;pc=#000055;pw=2;" shape[31] = "func=rect;x=136;y=194;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[32] = "func=rect;x=154;y=192;width=14;height=33;angle=7;bc=#661F1F;pc=#000055;pw=2;" shape[33] = "func=rect;x=170;y=181;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[34] = "func=ell;x=70;y=99;width=114;height=68;bc=#661F1F;pc=#000055;pw=2;" shape[35] = "func=ell;x=14;y=0;width=50;height=102;angle=45;bc=#661F1F;pc=#000055;pw=2;" shape[36] = "func=ell;x=0;y=132;width=49;height=105;angle=342;bc=#661F1F;pc=#000055;pw=2;" shape[37] = "func=tri;x=16;y=34;x1=18;y1=0;x2=0;y2=66;x3=36;y3=66;angle=30;bc=#000055;pw=0;" shape[38] = "func=tri;x=13;y=130;x1=11;y1=0;x2=0;y2=73;x3=23;y3=73;angle=168;bc=#000055;pw=0;" shape[39] = "func=ell;x=54;y=99;width=21;height=21;bc=#33000000;pc=#000055;pw=2;" shape[40] = "func=ell;x=56;y=145;width=21;height=21;bc=#33000000;pc=#000055;pw=2;" EndSub End>BZW070-0.sb< Start>BZW070.sb< GraphicsWindow.Title = "Zodiac 1-7" wrap = "True gw = 1670 gh = 800 LDUtilities.ShowErrors ="false LDUtilities.ShowNoShapeErrors ="false GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.BackgroundColor = "#000055 star=0 qi=1 'GraphicsWindow.MouseMove=moom main() Sub main Shapes_Init() scale = 1 angle = 0 zii=200 Shapes_Add() InitStars()'----------------fishes num = Array.GetItemCount(star) index = Array.GetAllIndices(star) offsetX = 0 offsetY = 0 GetMinMax() offsetX = -xMin + 50 offsetY = -yMin + 90 DrawGrids() sdrw() qi=2 Shapes_Initcc()'-------------capricorn scale = 1.2 angle = 0 Shapes_Add() star=0 InitStarscc() sdrw() qi=3'-----------------------aquarius Shapes_Initaq() scale = 1.2 angle = 0 Shapes_Add() star=0 InitStarsaq() sdrw() qi=4'----------------------aries Shapes_Initary() scale = 1 angle = 0 Shapes_Add() star=0 InitStarsary() sdrw() qi=5'------------------------cancer shpcnc() scale = 1 angle = 0 Shapes_Add() star=0 initscnc () sdrw() qi=6'-----------------taurus Shapes_Init_tau () scale = 1 angle = 0 zii=1 Shapes_Add() star=0 InitStars_tau () sdrw() qi=7'-----------------gemini Shapes_Initgmm () scale = 1 angle = 0 zii=1 Shapes_Add() star=0 InitStarsgm() sdrw() LDFastShapes.Update () ds=95 For s= 1 to 10 dooff () Program.Delay (333) endfor LDEvents.MouseWheel=wll inn=0 EndSub Sub sdrw GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DarkGray nume = Array.GetItemCount(edge) index = Array.GetAllIndices(edge) For i = 1 To nume e = edge[index[i]] m = Text.GetIndexOf(e, "-") ra = star[Text.GetSubText(e, 1, m - 1)]["RA"] dec = star[Text.GetSubText(e, 1, m - 1)]["Dec"] RADec2XY() x1 = x y1 = y ra = star[Text.GetSubTextToEnd(e, m + 1)]["RA"] dec = star[Text.GetSubTextToEnd(e, m + 1)]["Dec"] RADec2XY() x2 = x y2 = y ly=Shapes.AddLine(x1, y1, x2, y2) ldShapes.ZIndex (ly,999) lyn[qi][i]=LDFastShapes.ShapeIndex (ly) EndFor LDFastShapes.Update () num = Array.GetItemCount(star) index = Array.GetAllIndices(star) GraphicsWindow.BrushColor = "White" For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() mag = star[index[i]]["Mag"] d = 20 / mag ell = Shapes.AddEllipse(d, d) ldShapes.ZIndex (ell,1000) el[qi][i]=LDFastShapes.ShapeIndex (ell) ldfastShapes.Move(el[qi][i], x - d / 2, y - d / 2) EndFor EndSub Sub moom 'GraphicsWindow.Title="Zodiac scroll GraphicsWindow.Title=GraphicsWindow.MouseX +" , "+GraphicsWindow.MouseY EndSub Sub wll If inn=0 then inn=1 ds=LDEvents.LastMouseWheelDelta *25 off=off+ds 'GraphicsWindow.Title=off dooff() inn=0 endif EndSub sub dooff For qi=1 To 7 For i = 1 To Array.GetItemCount (el[qi]) LDFastShapes.Move (el[qi][i],LDFastShapes.GetLeft (el[qi][i])+ds, LDFastShapes.GetTop (el[qi][i])) EndFor For i = 1 To Array.GetItemCount (ffs[qi]) LDFastShapes.Move (ffs[qi][i],LDFastShapes.GetLeft (ffs[qi][i])+ds, LDFastShapes.GetTop (ffs[qi][i])) EndFor For i = 1 To Array.GetItemCount (lyn[qi]) LDFastShapes.Move (lyn[qi][i],LDFastShapes.GetLeft (lyn[qi][i])+ds, LDFastShapes.GetTop (lyn[qi][i])) EndFor EndFor LDFastShapes.Update () For i=1 to Array.GetItemCount (txx) Shapes.Move (txx[i],shapes.GetLeft (txx[i])+ds, Shapes.GetTop (txx[i])) EndFor For i=1 to Array.GetItemCount (ltx) Shapes.Move (ltx[i], Shapes.GetLeft (ltx[i])+ds,1) EndFor EndSub Sub GetMinMax For i = 1 To num ra = star[index[i]]["RA"] dec = star[index[i]]["Dec"] RADec2XY() ra1 = Text.GetSubText(ra, 1, 2) If wrap And 12 < ra1 Then ra1 = ra1 - 24 EndIf If i = 1 Then raMin = ra1 decMin = Text.GetSubText(dec, 1, 3) raMax = ra1 decMax = Text.GetSubText(dec, 1, 3) xMin = x yMin = y xMax = x yMax = y Else raMin = Math.Min(ra1, raMin) decMin = Math.Min(Text.GetSubText(dec, 1, 3), decMin) raMax = Math.Max(ra1, raMax) decMax = Math.Max(Text.GetSubText(dec, 1, 3), decMax) xMin = Math.Min(x, xMin) yMin = Math.Min(y, yMin) xMax = Math.Max(x, xMax) yMax = Math.Max(y, yMax) EndIf EndFor decMin = Math.Floor(decMin / 10) * 10 raMax = raMax + 1 decMax = decMax + 1 EndSub Sub InitStars star[99] = "name=η Psc;ra=01 31 28.99;dec=+15 20 45.0;mag=3.62;" star[6] = "name=γ Psc;ra=23 17 09.49;dec=+03 16 56.1;mag=3.70;" star[28] = "name=ω Psc;ra=23 59 18.60;dec=+06 51 48.9;mag=4.03;" star[17] = "name=ι Psc;ra=23 39 56.82;dec=+05 37 38.5;mag=4.13;" star[110] = "name=ο Psc;ra=01 45 23.59;dec=+09 09 27.5;mag=4.26;" star[71] = "name=ε Psc;ra=01 02 56.66;dec=+07 53 24.3;mag=4.27;" star[10] = "name=θ Psc;ra=23 27 58.17;dec=+06 22 44.8;mag=4.27;" star[113] = "name=α Psc A;ra=02 02 02.80;dec=+02 45 49.5;mag=4.33;" star[30] = "name=30 Psc;ra=00 01 57.59;dec=−06 00 50.3;mag=4.37;" star[63] = "name=δ Psc;ra=00 48 40.90;dec=+07 35 06.7;mag=4.44;" star[106] = "name=ν Psc;ra=01 41 25.91;dec=+05 29 15.4;mag=4.45;" star[4] = "name=β Psc;ra=23 03 52.61;dec=+03 49 12.3;mag=4.48;" star[18] = "name=λ Psc;ra=23 42 02.88;dec=+01 46 49.5;mag=4.49;" star[83] = "name=τ Psc;ra=01 11 39.59;dec=+30 05 23.0;mag=4.51;" star[33] = "name=33 Psc;ra=00 05 20.15;dec=−05 42 28.2;mag=4.61;" star[111] = "name=ξ Psc;ra=01 53 33.34;dec=+03 11 14.9;mag=4.61;" star[84] = "name=χ Psc;ra=01 11 27.19;dec=+21 02 04.8;mag=4.66;" star[85] = "name=φ Psc;ra=01 13 44.94;dec=+24 35 01.6;mag=4.67;" star[90] = "name=υ Psc;ra=01 19 27.98;dec=+27 15 50.7;mag=4.74;" star[98] = "name=μ Psc;ra=01 30 10.94;dec=+06 08 38.2;mag=4.84;" star[27] = "name=27 Psc;ra=23 58 40.41;dec=−03 33 20.9;mag=4.88;" star[8] = "name=κ Psc;ra=23 26 55.91;dec=+01 15 21.0;mag=4.95;" star[19] = "name=19 Psc;ra=23 46 23.54;dec=+03 29 12.7;mag=4.95;" star[47] = "name=47 Psc;ra=00 28 02.84;dec=+17 53 35.1;mag=5.01;" star[7] = "name=7 Psc;ra=23 20 20.54;dec=+05 22 53.2;mag=5.05;" star[64] = "name=64 Psc;ra=00 48 58.71;dec=+16 56 28.1;mag=5.07;" star[29] = "name=29 Psc;ra=00 01 49.44;dec=−03 01 38.9;mag=5.13;" star[89] = "name=89 Psc;ra=01 17 47.98;dec=+03 36 52.3;mag=5.13;" star[82] = "name=82 Psc;ra=01 11 06.77;dec=+31 25 29.2;mag=5.15;" star[86] = "name=ζ Psc A;ra=01 13 43.80;dec=+07 34 31.8;mag=5.21;" star[113] = "name=α Psc B;ra=02 02 02.80;dec=+02 45 49.0;mag=5.23;" star[91] = "name=91 Psc;ra=01 21 07.35;dec=+28 44 18.2;mag=5.23;" star[107] = "name=107 Psc;ra=01 42 29.95;dec=+20 16 12.5;mag=5.24;" star[74] = "name=ψ¹ Psc;ra=01 05 40.93;dec=+21 28 23.6;mag=5.33;" star[93] = "name=ρ Psc;ra=01 26 15.28;dec=+19 10 20.4;mag=5.35;" star[55] = "name=55 Psc;ra=00 39 55.55;dec=+21 26 18.8;mag=5.36;" star[57] = "name=57 Psc;ra=00 46 32.98;dec=+15 28 32.2;mag=5.36;" star[41] = "name=41 Psc;ra=00 20 35.86;dec=+08 11 24.9;mag=5.38;" star[52] = "name=52 Psc;ra=00 32 35.40;dec=+20 17 40.0;mag=5.38;" star[5] = "name=5 Psc;ra=23 08 40.84;dec=+02 07 39.4;mag=5.42;" star[2] = "name=2 Psc;ra=22 59 27.40;dec=+00 57 47.1;mag=5.43;" star[68] = "name=68 Psc;ra=00 57 50.15;dec=+28 59 32.0;mag=5.44;" star[20] = "name=20 Psc;ra=23 47 56.49;dec=−02 45 41.8;mag=5.49;" star[69] = "name=σ Psc;ra=01 02 49.09;dec=+31 48 15.6;mag=5.50;" star[94] = "name=94 Psc;ra=01 26 41.65;dec=+19 14 26.0;mag=5.50;" star[58] = "name=58 Psc;ra=00 47 01.43;dec=+11 58 26.2;mag=5.51;" star[80] = "name=80 Psc;ra=01 08 22.34;dec=+05 39 00.8;mag=5.51;" star[34] = "name=34 Psc;ra=00 10 02.18;dec=+11 08 44.9;mag=5.54;" star[102] = "name=π Psc;ra=01 37 05.96;dec=+12 08 29.4;mag=5.54;" star[74] = "name=ψ¹ Psc;ra=01 05 41.68;dec=+21 27 55.7;mag=5.55;" star[79] = "name=ψ² Psc;ra=01 07 57.11;dec=+20 44 21.6;mag=5.56;" star[81] = "name=ψ³ Psc;ra=01 09 49.20;dec=+19 39 30.2;mag=5.57;" star[22] = "name=22 Psc;ra=23 51 57.83;dec=+02 55 49.5;mag=5.59;" star[72] = "name=72 Psc;ra=01 05 05.35;dec=+14 56 45.6;mag=5.64;" star[16] = "name=16 Psc;ra=23 36 23.35;dec=+02 06 07.5;mag=5.68;" star[51] = "name=51 Psc;ra=00 32 23.75;dec=+06 57 19.6;mag=5.69;" star[32] = "name=32 Psc;ra=00 02 29.76;dec=+08 29 08.1;mag=5.70;" star[44] = "name=44 Psc;ra=00 25 24.22;dec=+01 56 23.0;mag=5.77;" star[21] = "name=21 Psc;ra=23 49 27.48;dec=+01 04 34.3;mag=5.77;" star[66] = "name=66 Psc;ra=00 54 35.22;dec=+19 11 18.4;mag=5.80;" star[54] = "name=54 Psc;ra=00 39 22.09;dec=+21 15 04.9;mag=5.88;" star[53] = "name=53 Psc;ra=00 36 47.31;dec=+15 13 54.3;mag=5.89;" star[112] = "name=112 Psc;ra=02 00 09.02;dec=+03 05 51.5;mag=5.89;" star[14] = "name=14 Psc;ra=23 34 08.95;dec=−01 14 51.1;mag=5.91;" star[62] = "name=62 Psc;ra=00 48 17.34;dec=+07 17 59.7;mag=5.92;" star[24] = "name=24 Psc;ra=23 52 55.52;dec=−03 09 19.4;mag=5.93;" star[87] = "name=87 Psc;ra=01 14 07.65;dec=+16 08 00.8;mag=5.97;" star[60] = "name=60 Psc;ra=00 47 23.62;dec=+06 44 27.5;mag=5.98;" star[105] = "name=105 Psc;ra=01 39 40.77;dec=+16 24 21.2;mag=5.98;" star[97] = "name=97 Psc;ra=01 29 52.83;dec=+18 21 20.4;mag=6.01;" star[35] = "name=35 Psc;ra=00 14 58.78;dec=+08 49 15.7;mag=6.02;" star[73] = "name=73 Psc;ra=01 04 52.62;dec=+05 39 22.7;mag=6.03;" star[88] = "name=88 Psc;ra=01 14 42.40;dec=+06 59 42.7;mag=6.04;" star[48] = "name=48 Psc;ra=00 28 12.69;dec=+16 26 42.4;mag=6.05;" star[67] = "name=67 Psc;ra=00 55 58.52;dec=+27 12 33.7;mag=6.08;" star[59] = "name=59 Psc;ra=00 47 13.56;dec=+19 34 43.3;mag=6.11;" star[1] = "name=1 Psc;ra=22 54 59.47;dec=+01 03 53.6;mag=6.11;" star[36] = "name=36 Psc;ra=00 16 34.06;dec=+08 14 24.7;mag=6.12;" star[75] = "name=75 Psc;ra=01 06 33.62;dec=+12 57 21.5;mag=6.14;" star[3] = "name=3 Psc;ra=23 00 37.88;dec=+00 11 09.0;mag=6.22;" star[26] = "name=26 Psc;ra=23 55 07.78;dec=+07 04 15.7;mag=6.22;" star[78] = "name=78 Psc;ra=01 08 01.20;dec=+32 00 43.9;mag=6.23;" star[101] = "name=101 Psc;ra=01 35 46.44;dec=+14 39 41.2;mag=6.23;" star[42] = "name=42 Psc;ra=00 22 25.45;dec=+13 28 56.8;mag=6.25;" star[9] = "name=9 Psc;ra=23 27 14.77;dec=+01 07 21.7;mag=6.26;" star[109] = "name=109 Psc;ra=01 44 55.85;dec=+20 05 00.3;mag=6.27;" star[76] = "name=76 Psc;ra=01 06 11.20;dec=+32 10 53.6;mag=6.28;" star[25] = "name=25 Psc;ra=23 53 04.75;dec=+02 05 26.3;mag=6.29;" star[31] = "name=31 Psc;ra=00 02 24.17;dec=+08 57 24.6;mag=6.33;" star[77] = "name=77 Psc A;ra=01 05 49.22;dec=+04 54 31.2;mag=6.35;" star[13] = "name=13 Psc;ra=23 31 57.56;dec=−01 05 09.3;mag=6.39;" star[46] = "name=46 Psc;ra=00 27 58.48;dec=+19 30 50.7;mag=6.40;" star[86] = "name=ζ Psc B;ra=01 13 45.17;dec=+07 34 42.2;mag=6.44;" star[15] = "name=15 Psc;ra=23 35 28.61;dec=+01 18 47.5;mag=6.47;" star[43] = "name=43 Psc;ra=00 24 38.15;dec=+14 18 55.9;mag=6.48;" star[61] = "name=61 Psc;ra=00 47 54.73;dec=+20 55 31.1;mag=6.51;" star[40] = "name=40 Psc;ra=00 19 56.28;dec=+16 15 03.2;mag=6.60;" star[38] = "name=38 Psc;ra=00 17 24.50;dec=+08 52 34.8;mag=6.66;" star[104] = "name=104 Psc;ra=01 39 15.39;dec=+14 17 08.3;mag=6.74;" star[45] = "name=45 Psc;ra=00 25 41.89;dec=+07 41 28.4;mag=6.77;" star[65] = "name=65 Psc;ra=00 49 53.11;dec=+27 42 37.1;mag=7.0;" star[95] = "name=95 Psc;ra=01 27 39.81;dec=+05 21 11.2;mag=7.01;" star[65] = "name=65 Psc;ra=00 49 53.20;dec=+27 42 37.0;mag=7.1;" star[77] = "name=77 Psc B;ra=01 05 51.42;dec=+04 54 35.0;mag=7.26;" star[100] = "name=100 Psc;ra=01 34 51.61;dec=+12 33 31.2;mag=7.28;" edge = "1=69-83;2=83-90;3=90-85;4=85-74;5=74-84;6=84-99;7=99-110;" edge = edge + "8=110-113;9=113-106;10=106-71;11=71-63;12=63-28;" edge = edge + "13=28-10;14=10-6;15=6-8;16=8-18;" EndSub Sub DrawGrids GraphicsWindow.PenWidth = 1 GraphicsWindow.PenColor = "DimGray" GraphicsWindow.BrushColor = "DimGray" GraphicsWindow.FontSize = 12 y1 = 0 ww=1 y2 = GraphicsWindow.Height For ra = 0 To 23 RADec2XY() ltx[ww]=Shapes.AddLine(x, y1, x, y2) LDShapes.ZIndex (ltx[ww],2222) raTxt = ra If wrap And raTxt < 0 Then raTxt = raTxt + 24 EndIf txx[ww] = Shapes.AddText(raTxt + "h") Shapes.Move(txx[ww], x, 5) ww=ww+1 EndFor x1 = 0 x2 = GraphicsWindow.Width For dec = -40 To 40 Step 10 If dec > 0 Then dec = Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() lii=Shapes.AddLine(x1, y, x2, y) LDShapes.ZIndex (lii,2222) txt = Shapes.AddText(dec) Shapes.Move(txt, x1, y) EndFor EndSub Sub RADec2XY ' param ra - right ascension ' param dec - declination ' return x, y x = Text.GetSubText(ra, 1, 2) If wrap And 12 < x Then x = x - 24 EndIf x = x + Text.GetSubText(ra, 4, 2) / 60 x = x + Text.GetSubText(ra, 7, 5) / 3600 x = offsetX - (x - raMin) * 3600 / 24 y = Text.GetSubText(dec, 2, 2) y = y + Text.GetSubText(dec, 5, 2) / 60 y = y + Text.GetSubText(dec, 8, 5) / 3600 y = y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y = offsetY - y * 3600 / 360 EndSub Sub Shapes_Init shX = 41 ' x offset shY = 110 ' y offset shape = "" shape[1] = "func=ell;x=76;y=10;width=63;height=119;angle=23;bc=#2F559D;pw=0;" shape[2] = "func=tri;x=70;y=94;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=25;bc=#2F559D;pw=0;" shape[3] = "func=tri;x=108;y=0;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=199;bc=#000055;pw=0;" shape[4] = "func=ell;x=118;y=34;width=20;height=21;bc=#000055;pw=0;" shape[5] = "func=ell;x=74;y=40;width=12;height=32;angle=58;bc=#2F559D;pw=0;" shape[6] = "func=ell;x=121;y=72;width=15;height=40;angle=17;bc=#2F559D;pw=0;" shape[7] = "func=ell;x=342;y=195;width=63;height=119;angle=106;bc=#2F559D;pw=0;" shape[8] = "func=tri;x=304;y=210;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=105;bc=#2F559D;pw=0;" shape[9] = "func=tri;x=401;y=258;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=295;bc=#000055;pw=0;" shape[10] = "func=ell;x=397;y=243;width=20;height=21;bc=#000055;pw=0;" shape[11] = "func=ell;x=367;y=203;width=15;height=40;angle=112;bc=#2F559D;pw=0;" shape[12] = "func=ell;x=361;y=271;width=12;height=32;angle=58;bc=#2F559D;pw=0;" shape[13] = "func=line;x=43;y=130;x1=39;y1=0;x2=0;y2=72;pc=#2F559D;pw=8;" shape[14] = "func=line;x=0;y=201;x1=0;y1=74;x2=44;y2=0;pc=#2F559D;pw=8;" shape[15] = "func=line;x=2;y=238;x1=0;y1=35;x2=42;y2=0;pc=#2F559D;pw=8;" shape[16] = "func=line;x=41;y=242;x1=18;y1=31;x2=0;y2=0;pc=#2F559D;pw=8;" shape[17] = "func=line;x=56;y=271;x1=0;y1=1;x2=30;y2=0;pc=#2F559D;pw=8;" shape[18] = "func=line;x=82;y=232;x1=0;y1=38;x2=1;y2=0;pc=#2F559D;pw=8;" shape[19] = "func=line;x=83;y=230;x1=0;y1=6;x2=65;y2=0;pc=#2F559D;pw=8;" shape[20] = "func=line;x=143;y=230;x1=0;y1=0;x2=79;y2=7;pc=#2F559D;pw=8;" shape[21] = "func=line;x=217;y=234;x1=0;y1=2;x2=98;y2=0;pc=#2F559D;pw=8;" EndSub Sub Shapes_Add j=1 Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s = scale For i = 1 To Array.GetItemCount(shape) shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf If shp["func"] = "rect" Then shpp = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "ell" Then shpp = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) ElseIf shp["func"] = "tri" Then shpp = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shpp = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) EndIf LDShapes.ZIndex (shpp,zii) zii=zii+1 x = shp["x"] y = shp["y"] shp["rx"] = x shp["ry"] = y ffs[qi][j]=LDFastShapes.ShapeIndex(shpp) ldfastShapes.Move(ffs[qi][j], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then ldfastShapes.Rotate(ffs[qi][j], shp["angle"]) EndIf 'shape[i] = shpp j=j+1 EndFor LDFastShapes.Update () shAngle = 0 y = Stack.PopValue("local") x = Stack.PopValue("local") i = Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight For i = 1 To Array.GetItemCount(shape) shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Move Stack.PushValue("local", i) s = scale shX = x shY = y For i = 1 To Array.GetItemCount(shape) shp = shape[i] _x = shp["rx"] _y = shp["ry"] Shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub InitStarsaq ' Initialize stars in Aquarius star[22] = "name=β Aqr;ra=21 31 33.52;dec=-05 34 16.2;mag=2.90;" star[34] = "name=α Aqr;ra=22 05 47.03;dec=-00 19 11.4;mag=2.95;" star[76] = "name=δ Aqr;ra=22 54 39.04;dec=-15 49 14.7;mag=3.27;" star[55] = "name=ζ1 Aqr;ra=22 28 49.80;dec=-00 01 12.2;mag=3.65;" star[88] = "name=88 Aqr;ra=23 09 26.76;dec=-21 10 20.9;mag=3.68;" star[73] = "name=λ Aqr;ra=22 52 36.86;dec=-07 34 46.8;mag=3.73;" star[2] = "name=ε Aqr;ra=20 47 40.53;dec=-09 29 44.5;mag=3.78;" star[48] = "name=γ Aqr;ra=22 21 39.30;dec=-01 23 14.5;mag=3.86;" star[98] = "name=98 Aqr;ra=23 22 58.30;dec=-20 06 01.2;mag=3.96;" star[62] = "name=η Aqr;ra=22 35 21.33;dec=-00 07 02.5;mag=4.04;" star[71] = "name=τ2 Aqr;ra=22 49 35.51;dec=-13 35 33.1;mag=4.05;" star[43] = "name=θ Aqr;ra=22 16 49.97;dec=-07 46 59.7;mag=4.17;" star[90] = "name=φ Aqr;ra=23 14 19.33;dec=-06 02 54.7;mag=4.22;" star[91] = "name=ψ1 Aqr;ra=23 15 53.28;dec=-09 05 15.7;mag=4.24;" star[33] = "name=ι Aqr;ra=22 06 26.21;dec=-13 52 10.3;mag=4.29;" star[99] = "name=99 Aqr;ra=23 26 02.82;dec=-20 38 30.7;mag=4.38;" star[93] = "name=ψ2 Aqr;ra=23 17 54.20;dec=-09 10 57.0;mag=4.41;" star[55] = "name=ζ2 Aqr;ra=22 28 50.10;dec=-00 01 12.0;mag=4.42;" star[3] = "name=3 Aqr;ra=20 47 44.24;dec=-05 01 39.4;mag=4.43;" star[86] = "name=86 Aqr;ra=23 06 40.81;dec=-23 44 35.2;mag=4.48;" star[105] = "name=ω2 Aqr;ra=23 42 43.28;dec=-14 32 41.1;mag=4.49;" star[13] = "name=ν Aqr;ra=21 09 35.59;dec=-11 22 18.0;mag=4.50;" star[23] = "name=ξ Aqr;ra=21 37 45.04;dec=-07 51 14.9;mag=4.68;" star[66] = "name=66 Aqr;ra=22 43 35.25;dec=-18 49 49.1;mag=4.68;" star[101] = "name=101 Aqr;ra=23 33 16.63;dec=-20 54 52.3;mag=4.70;" star[89] = "name=89 Aqr;ra=23 09 54.88;dec=-22 27 27.3;mag=4.71;" star[6] = "name=μ Aqr;ra=20 52 39.21;dec=-08 58 59.7;mag=4.73;" star[31] = "name=ο Aqr;ra=22 03 18.83;dec=-02 09 19.2;mag=4.74;" star[52] = "name=π Aqr;ra=22 25 16.61;dec=+01 22 38.6;mag=4.80;" star[57] = "name=σ Aqr;ra=22 30 38.82;dec=-10 40 40.4;mag=4.82;" star[104] = "name=104 Aqr A;ra=23 41 45.80;dec=-17 48 59.5;mag=4.82;" star[92] = "name=χ Aqr;ra=23 16 50.95;dec=-07 43 35.3;mag=4.93;" star[102] = "name=ω1 Aqr;ra=23 39 47.04;dec=-14 13 19.4;mag=4.97;" star[95] = "name=ψ3 Aqr;ra=23 18 57.65;dec=-09 36 38.6;mag=4.99;" star[63] = "name=κ Aqr;ra=22 37 45.42;dec=-04 13 39.9;mag=5.04;" star[25] = "name=25 Aqr;ra=21 39 33.28;dec=+02 14 37.5;mag=5.10;" star[47] = "name=47 Aqr;ra=22 21 35.58;dec=-21 35 52.9;mag=5.12;" star[1] = "name=1 Aqr;ra=20 39 24.83;dec=+00 29 11.4;mag=5.15;" star[108] = "name=108 Aqr;ra=23 51 21.32;dec=-18 54 33.0;mag=5.17;" star[94] = "name=94 Aqr B;ra=23 19 06.37;dec=-13 27 17.0;mag=5.19;" star[97] = "name=97 Aqr;ra=23 22 39.10;dec=-15 02 21.8;mag=5.19;" star[94] = "name=94 Aqr A;ra=23 19 06.51;dec=-13 27 30.4;mag=5.20;" star[59] = "name=υ Aqr;ra=22 34 41.50;dec=-20 42 28.3;mag=5.21;" star[68] = "name=68 Aqr;ra=22 47 33.19;dec=-19 36 46.3;mag=5.24;" star[106] = "name=106 Aqr;ra=23 44 12.06;dec=-18 16 36.9;mag=5.24;" star[107] = "name=107 Aqr;ra=23 46 00.84;dec=-18 40 42.1;mag=5.28;" star[32] = "name=32 Aqr;ra=22 04 47.43;dec=-00 54 22.5;mag=5.29;" star[41] = "name=41 Aqr;ra=22 14 18.02;dec=-21 04 28.9;mag=5.33;" star[42] = "name=42 Aqr;ra=22 16 48.04;dec=-12 49 53.2;mag=5.34;" star[46] = "name=ρ Aqr;ra=22 20 11.91;dec=-07 49 16.0;mag=5.35;" star[103] = "name=103 Aqr;ra=23 41 34.51;dec=-18 01 36.8;mag=5.36;" star[38] = "name=38 Aqr;ra=22 10 37.46;dec=-11 33 53.9;mag=5.43;" star[83] = "name=83 Aqr;ra=23 05 09.71;dec=-07 41 37.7;mag=5.44;" star[18] = "name=18 Aqr;ra=21 24 11.44;dec=-12 52 41.3;mag=5.48;" star[21] = "name=21 Aqr;ra=21 25 16.96;dec=-03 33 23.7;mag=5.48;" star[7] = "name=7 Aqr;ra=20 56 54.03;dec=-09 41 51.1;mag=5.49;" star[12] = "name=12 Aqr B;ra=21 04 04.58;dec=-05 49 24.2;mag=7.31;" star[49] = "name=49 Aqr;ra=22 23 30.79;dec=-24 45 45.6;mag=5.53;" star[77] = "name=77 Aqr;ra=22 54 45.60;dec=-16 16 18.3;mag=5.53;" star[5] = "name=5 Aqr;ra=20 52 08.69;dec=-05 30 25.4;mag=5.55;" star[30] = "name=30 Aqr;ra=22 03 16.43;dec=-06 31 20.7;mag=5.55;" star[53] = "name=53 Aqr B;ra=22 26 34.15;dec=-16 44 31.7;mag=5.55;" star[96] = "name=96 Aqr;ra=23 19 23.86;dec=-05 07 27.5;mag=5.56;" star[28] = "name=28 Aqr;ra=22 01 05.01;dec=+00 36 17.1;mag=5.60;" star[26] = "name=26 Aqr;ra=21 42 10.12;dec=+01 17 07.0;mag=5.66;" star[69] = "name=τ1 Aqr;ra=22 47 42.75;dec=-14 03 23.1;mag=5.68;" star[19] = "name=19 Aqr;ra=21 25 13.02;dec=-09 44 53.3;mag=5.71;" star[44] = "name=44 Aqr;ra=22 17 06.50;dec=-05 23 14.0;mag=5.75;" star[50] = "name=50 Aqr;ra=22 24 27.03;dec=-13 31 45.9;mag=5.76;" star[51] = "name=51 Aqr;ra=22 24 06.87;dec=-04 50 13.2;mag=5.79;" star[35] = "name=35 Aqr;ra=22 08 58.99;dec=-18 31 10.5;mag=5.80;" star[74] = "name=74 Aqr;ra=22 53 28.69;dec=-11 36 59.5;mag=5.80;" star[15] = "name=15 Aqr;ra=21 18 11.07;dec=-04 31 10.2;mag=5.83;" star[16] = "name=16 Aqr;ra=21 21 04.33;dec=-04 33 36.5;mag=5.87;" star[60] = "name=60 Aqr;ra=22 34 02.89;dec=-01 34 27.0;mag=5.88;" star[12] = "name=12 Aqr A;ra=21 04 04.74;dec=-05 49 23.0;mag=5.89;" star[45] = "name=45 Aqr;ra=22 19 00.70;dec=-13 18 17.9;mag=5.96;" star[4] = "name=4 Aqr;ra=20 51 25.69;dec=-05 37 35.9;mag=5.99;" star[17] = "name=17 Aqr;ra=21 22 56.27;dec=-09 19 09.4;mag=5.99;" star[39] = "name=39 Aqr;ra=22 12 25.74;dec=-14 11 37.8;mag=6.04;" star[82] = "name=82 Aqr;ra=23 02 32.56;dec=-06 34 26.1;mag=6.18;" star[70] = "name=70 Aqr;ra=22 48 30.19;dec=-10 33 19.8;mag=6.19;" star[78] = "name=78 Aqr;ra=22 54 34.13;dec=-07 12 16.3;mag=6.20;" star[11] = "name=11 Aqr;ra=21 00 33.81;dec=-04 43 47.7;mag=6.21;" star[81] = "name=81 Aqr;ra=23 01 23.65;dec=-07 03 40.1;mag=6.23;" star[100] = "name=100 Aqr;ra=23 31 42.04;dec=-21 22 10.0;mag=6.24;" star[53] = "name=53 Aqr A;ra=22 26 34.40;dec=-16 44 33.0;mag=6.35;" star[56] = "name=56 Aqr;ra=22 30 17.33;dec=-14 35 08.3;mag=6.36;" star[20] = "name=20 Aqr;ra=21 24 51.68;dec=-03 23 53.6;mag=6.38;" star[29] = "name=29 Aqr;ra=22 02 26.25;dec=-16 57 53.4;mag=6.39;" star[58] = "name=58 Aqr;ra=22 31 41.28;dec=-10 54 19.7;mag=6.39;" star[61] = "name=61 Aqr;ra=22 35 48.82;dec=-17 27 37.1;mag=6.39;" star[67] = "name=67 Aqr;ra=22 43 14.25;dec=-06 57 46.5;mag=6.40;" star[14] = "name=14 Aqr;ra=21 16 17.78;dec=-09 12 52.8;mag=6.45;" star[114] = "name=HD 210277;ra=22 09 29.87;dec=-07 32 55.2;mag=6.63;" star[37] = "name=37 Aqr;ra=22 10 31.74;dec=-10 49 13.7;mag=6.64;" star[24] = "name=24 Aqr;ra=21 39 31.39;dec=-00 03 04.1;mag=6.66;" star[104] = "name=104 Aqr B;ra=23 41 46.39;dec=-17 47 00.5;mag=8.52;" edge = "1=2-6;2=6-22;3=22-34;4=22-33;5=33-43;6=34-43;7=43-57;" edge = edge + "8=57-71;9=71-76;10=34-48;11=48-55;12=55-62;" edge = edge + "13=62-73;14=73-88;15=62-90;16=90-91;17=91-102;" edge = edge + "18=102-98;19=98-104;" EndSub Sub Shapes_Initaq shX = 384 ' x offset shY = 315 ' y offset shape = "" shape[1] = "func=ell;x=92;y=62;width=56;height=31;angle=30;bc=#204040;pw=0;" shape[2] = "func=ell;x=106;y=0;width=73;height=86;angle=32;bc=#204040;pw=0;" shape[3] = "func=ell;x=101;y=72;width=37;height=14;angle=28;bc=#102020;pw=0;" shape[4] = "func=tri;x=63;y=39;x1=31;y1=0;x2=0;y2=155;x3=63;y3=155;angle=38;bc=#204040;pw=0;" shape[5] = "func=ell;x=37;y=173;width=36;height=100;angle=10;bc=#204040;pw=0;" shape[6] = "func=ell;x=12;y=155;width=34;height=118;angle=17;bc=#204040;pw=0;" shape[7] = "func=ell;x=0;y=151;width=28;height=90;angle=24;bc=#204040;pw=0;" shape[8] = "func=ell;x=238;y=26;width=55;height=71;angle=28;bc=#204040;pw=0;" shape[9] = "func=rect;x=234;y=78;width=22;height=34;angle=32;bc=#204040;pw=0;" shape[10] = "func=rect;x=179;y=95;width=87;height=81;angle=31;bc=#204040;pw=0;" shape[11] = "func=rect;x=256;y=144;width=67;height=22;angle=53;bc=#204040;pw=0;" shape[12] = "func=rect;x=299;y=165;width=65;height=19;angle=348;bc=#204040;pw=0;" shape[13] = "func=rect;x=144;y=94;width=74;height=22;angle=334;bc=#204040;pw=0;" shape[14] = "func=rect;x=137;y=62;width=18;height=69;angle=358;bc=#204040;pw=0;" shape[15] = "func=rect;x=153;y=160;width=89;height=54;angle=19;bc=#204040;pw=0;" shape[16] = "func=rect;x=99;y=186;width=75;height=30;angle=341;bc=#204040;pw=0;" shape[17] = "func=rect;x=130;y=220;width=96;height=31;angle=328;bc=#204040;pw=0;" shape[18] = "func=ell;x=80;y=199;width=35;height=34;bc=#204040;pw=0;" shape[19] = "func=ell;x=117;y=247;width=35;height=39;bc=#204040;pw=0;" shape[20] = "func=rect;x=128;y=274;width=28;height=56;angle=345;bc=#204040;pw=0;" shape[21] = "func=rect;x=80;y=217;width=27;height=74;bc=#204040;pw=0;" shape[22] = "func=ell;x=248;y=49;width=14;height=14;bc=#102020;pw=0;" shape[23] = "func=ell;x=268;y=60;width=14;height=14;bc=#102020;pw=0;" shape[24] = "func=ell;x=258;y=17;width=21;height=22;bc=#204040;pw=0;" shape[25] = "func=ell;x=274;y=19;width=21;height=22;bc=#204040;pw=0;" shape[26] = "func=ell;x=285;y=32;width=21;height=22;bc=#204040;pw=0;" shape[27] = "func=ell;x=289;y=49;width=21;height=22;bc=#204040;pw=0;" shape[28] = "func=ell;x=241;y=21;width=21;height=22;bc=#204040;pw=0;" shape[29] = "func=ell;x=280;y=65;width=21;height=22;bc=#204040;pw=0;" shape[30] = "func=ell;x=229;y=35;width=21;height=22;bc=#204040;pw=0;" shape[31] = "func=ell;x=359;y=148;width=32;height=31;bc=#204040;pw=0;" shape[32] = "func=ell;x=357;y=155;width=13;height=73;angle=6;bc=#204040;pw=0;" shape[33] = "func=ell;x=385;y=162;width=14;height=78;angle=345;bc=#204040;pw=0;" shape[34] = "func=tri;x=58;y=270;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=265;bc=#204040;pw=0;" shape[35] = "func=tri;x=116;y=308;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=261;bc=#204040;pw=0;" EndSub Sub InitStarscc ' Initialize stars in Capricornus star[49] = "name=δ Cap;ra=21 47 02.29;dec=-16 07 35.6;mag=2.85;" star[9] = "name=β1 Cap;ra=20 21 00.65;dec=-14 46 53.0;mag=3.05;" star[6] = "name=α2 Cap;ra=20 18 03.22;dec=-12 32 41.5;mag=3.58;" star[40] = "name=γ Cap;ra=21 40 05.34;dec=-16 39 44.1;mag=3.69;" star[34] = "name=ζ Cap;ra=21 26 40.03;dec=-22 24 41.0;mag=3.77;" star[23] = "name=θ Cap;ra=21 05 56.78;dec=-17 13 57.8;mag=4.08;" star[18] = "name=ω Cap;ra=20 51 49.30;dec=-26 55 08.9;mag=4.12;" star[16] = "name=ψ Cap;ra=20 46 05.77;dec=-25 16 13.9;mag=4.13;" star[32] = "name=ι Cap;ra=21 22 14.78;dec=-16 50 04.4;mag=4.27;" star[5] = "name=α1 Cap;ra=20 17 38.86;dec=-12 30 29.6;mag=4.30;" star[24] = "name=24 Cap;ra=21 07 07.69;dec=-25 00 20.7;mag=4.49;" star[36] = "name=36 Cap;ra=21 28 43.32;dec=-21 48 25.8;mag=4.50;" star[39] = "name=ε Cap;ra=21 37 04.82;dec=-19 27 57.6;mag=4.51;" star[43] = "name=κ Cap;ra=21 42 39.42;dec=-18 51 58.7;mag=4.72;" star[8] = "name=ν Cap;ra=20 20 39.81;dec=-12 45 32.6;mag=4.77;" star[11] = "name=ρ Cap;ra=20 28 51.62;dec=-17 48 49.2;mag=4.77;" star[22] = "name=η Cap;ra=21 04 24.32;dec=-19 51 17.8;mag=4.82;" star[51] = "name=μ Cap;ra=21 53 17.58;dec=-13 33 06.5;mag=5.07;" star[10] = "name=π Cap;ra=20 27 19.20;dec=-18 12 42.1;mag=5.08;" star[46] = "name=46 Cap;ra=21 45 00.25;dec=-09 04 56.7;mag=5.10;" star[15] = "name=υ Cap;ra=20 40 02.96;dec=-18 08 19.0;mag=5.15;" star[42] = "name=42 Cap;ra=21 41 32.93;dec=-14 02 48.7;mag=5.16;" star[28] = "name=φ Cap;ra=21 15 37.89;dec=-20 39 06.1;mag=5.17;" star[14] = "name=τ2 Cap;ra=20 39 16.32;dec=-14 57 17.0;mag=5.24;" star[41] = "name=41 Cap;ra=21 42 00.64;dec=-23 15 45.5;mag=5.24;" star[7] = "name=σ Cap;ra=20 19 23.60;dec=-19 07 06.6;mag=5.28;" star[25] = "name=χ Cap;ra=21 08 33.61;dec=-21 11 36.7;mag=5.30;" star[29] = "name=29 Cap;ra=21 15 44.83;dec=-15 10 17.4;mag=5.31;" star[33] = "name=33 Cap;ra=21 24 09.60;dec=-20 51 05.6;mag=5.38;" star[30] = "name=30 Cap;ra=21 17 57.28;dec=-17 59 06.5;mag=5.40;" star[48] = "name=λ Cap;ra=21 46 32.08;dec=-11 21 57.4;mag=5.57;" star[37] = "name=37 Cap;ra=21 34 51.07;dec=-20 05 03.8;mag=5.70;" star[19] = "name=19 Cap;ra=20 54 47.85;dec=-17 55 22.3;mag=5.78;" star[35] = "name=35 Cap;ra=21 27 14.83;dec=-21 11 46.1;mag=5.78;" star[2] = "name=ξ2 Cap;ra=20 12 25.76;dec=-12 37 01.3;mag=5.84;" star[4] = "name=4 Cap;ra=20 18 01.38;dec=-21 48 35.6;mag=5.86;" star[44] = "name=44 Cap;ra=21 43 04.40;dec=-14 23 59.1;mag=5.88;" star[17] = "name=17 Cap;ra=20 46 09.97;dec=-21 30 50.4;mag=5.91;" star[12] = "name=ο Cap A;ra=20 29 53.89;dec=-18 34 58.7;mag=5.94;" star[45] = "name=45 Cap;ra=21 44 00.98;dec=-14 44 57.8;mag=5.96;" star[47] = "name=47 Cap;ra=21 46 16.26;dec=-09 16 33.4;mag=6.00;" star[21] = "name=21 Cap;ra=21 00 51.78;dec=-17 31 51.1;mag=6.07;" star[27] = "name=27 Cap;ra=21 09 32.93;dec=-20 33 22.8;mag=6.25;" star[20] = "name=20 Cap;ra=20 59 36.13;dec=-19 02 06.8;mag=6.26;" star[3] = "name=3 Cap;ra=20 16 22.80;dec=-12 20 13.5;mag=6.30;" star[1] = "name=ξ1 Cap;ra=20 11 57.90;dec=-12 23 32.5;mag=6.34;" star[12] = "name=ο Cap B;ra=20 29 52.58;dec=-18 35 10.2;mag=6.74;" star[13] = "name=τ1 Cap;ra=20 37 21.16;dec=-15 08 50.0;mag=6.76;" star[50] = "name=50 Cap;ra=21 46 42.09;dec=-11 41 52.2;mag=7.01;" star[31] = "name=31 Cap;ra=21 18 15.64;dec=-17 27 44.2;mag=7.07;" edge = "1=6-9;2=9-16;3=16-18;4=18-34;5=34-49;6=49-40;7=40-32;" edge = edge + "8=32-23;9=23-9;" EndSub Sub Shapes_Initcc shX = 640 ' x offset shY = 441 ' y offset shape = "" shape[1] = "func=rect;x=191;y=68;width=44;height=86;bc=#83809C;pw=0;" shape[2] = "func=tri;x=179;y=6;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=339;bc=#83809C;pw=0;" shape[3] = "func=tri;x=207;y=0;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=343;bc=#83809C;pw=0;" shape[4] = "func=line;x=171;y=144;x1=26;y1=46;x2=0;y2=0;pc=#83809C;pw=16;" shape[5] = "func=line;x=193;y=188;x1=0;y1=0;x2=58;y2=24;pc=#83809C;pw=16;" shape[6] = "func=line;x=149;y=145;x1=21;y1=68;x2=0;y2=0;pc=#83809C;pw=16;" shape[7] = "func=line;x=102;y=200;x1=64;y1=6;x2=0;y2=0;pc=#83809C;pw=16;" shape[8] = "func=ell;x=1;y=82;width=97;height=99;bc=#83809C;pw=0;" shape[9] = "func=ell;x=59;y=72;width=144;height=87;angle=351;bc=#83809C;pw=0;" shape[10] = "func=tri;x=0;y=54;x1=39;y1=0;x2=0;y2=73;x3=79;y3=73;angle=173;bc=#83809C;pc=#000055;pw=4;" shape[11] = "func=ell;x=35;y=123;width=15;height=16;bc=#191970;pw=0;" shape[12] = "func=ell;x=210;y=93;width=15;height=16;bc=#191970;pw=0;" shape[13] = "func=tri;x=155;y=63;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=206;bc=#83809C;pw=0;" shape[14] = "func=tri;x=223;y=67;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=164;bc=#83809C;pw=0;" shape[15] = "func=line;x=208;y=141;x1=0;y1=0;x2=8;y2=18;pc=#191970;pw=4;" shape[16] = "func=tri;x=192;y=151;x1=6;y1=0;x2=0;y2=38;x3=13;y3=38;angle=181;bc=#83809C;pw=0;" shape[17] = "func=tri;x=29;y=91;x1=24;y1=0;x2=0;y2=47;x3=48;y3=47;angle=172;bc=#83809C;pw=0;" shape[18] = "func=line;x=211;y=101;x1=0;y1=0;x2=12;y2=0;pc=#191970;pw=4;" EndSub Sub InitStarsary star[13] = "name=α Ari;ra=02 07 10.29;dec=+23 27 46.0;mag=2.01;" star[6] = "name=β Ari;ra=01 54 38.35;dec=+20 48 29.9;mag=2.64;" star[41] = "name=41 Ari;ra=02 49 58.99;dec=+27 15 38.8;mag=3.61;" star[57] = "name=δ Ari;ra=03 11 37.67;dec=+19 43 36.1;mag=4.35;" star[39] = "name=39 Ari;ra=02 47 54.44;dec=+29 14 50.7;mag=4.52;" star[5] = "name=γ2 Ari;ra=01 53 31.80;dec=+19 17 45.0;mag=4.62;" star[35] = "name=35 Ari;ra=02 43 27.11;dec=+27 42 25.8;mag=4.65;" star[5] = "name=γ1 Ari;ra=01 53 31.77;dec=+19 17 38.7;mag=4.70;" star[9] = "name=λ Ari;ra=01 57 55.78;dec=+23 35 45.9;mag=4.79;" star[58] = "name=ζ Ari;ra=03 14 54.11;dec=+21 02 40.7;mag=4.87;" star[14] = "name=14 Ari;ra=02 09 25.29;dec=+25 56 23.9;mag=4.98;" star[12] = "name=κ Ari;ra=02 06 33.91;dec=+22 38 54.3;mag=5.03;" star[8] = "name=ι Ari;ra=01 57 21.03;dec=+17 49 03.3;mag=5.09;" star[63] = "name=τ2 Ari;ra=03 22 45.27;dec=+20 44 31.6;mag=5.10;" star[38] = "name=38 Ari;ra=02 44 57.51;dec=+12 26 45.5;mag=5.18;" star[48] = "name=ε Ari A;ra=02 59 12.70;dec=+21 20 25.0;mag=5.2;" star[17] = "name=η Ari;ra=02 12 47.98;dec=+21 12 39.5;mag=5.23;" star[42] = "name=π Ari;ra=02 49 17.56;dec=+17 27 51.6;mag=5.26;" star[61] = "name=τ1 Ari;ra=03 21 13.61;dec=+21 08 49.7;mag=5.27;" star[33] = "name=33 Ari;ra=02 40 41.03;dec=+27 03 39.6;mag=5.30;" star[32] = "name=ν Ari;ra=02 38 49.00;dec=+21 57 41.2;mag=5.45;" star[52] = "name=52 Ari A;ra=03 05 26.69;dec=+25 15 18.7;mag=5.45;" star[24] = "name=ξ Ari;ra=02 24 49.04;dec=+10 36 38.2;mag=5.48;" star[48] = "name=ε Ari B;ra=02 59 12.73;dec=+21 20 25.6;mag=5.5;" star[64] = "name=64 Ari;ra=03 24 18.46;dec=+24 43 27.1;mag=5.50;" star[43] = "name=σ Ari;ra=02 51 29.57;dec=+15 04 55.7;mag=5.52;" star[62] = "name=62 Ari;ra=03 22 11.89;dec=+27 36 27.3;mag=5.55;" star[21] = "name=21 Ari;ra=02 15 42.83;dec=+25 02 35.7;mag=5.57;" star[22] = "name=θ Ari;ra=02 18 07.55;dec=+19 54 04.2;mag=5.58;" star[46] = "name=ρ3 Ari;ra=02 56 25.98;dec=+18 01 25.1;mag=5.58;" star[10] = "name=10 Ari;ra=02 03 39.26;dec=+25 56 07.6;mag=5.64;" star[31] = "name=31 Ari;ra=02 36 37.75;dec=+12 26 52.2;mag=5.64;" star[15] = "name=15 Ari;ra=02 10 37.54;dec=+19 30 01.5;mag=5.68;" star[19] = "name=19 Ari;ra=02 13 03.25;dec=+15 16 47.7;mag=5.72;" star[34] = "name=μ Ari;ra=02 42 21.92;dec=+20 00 41.7;mag=5.74;" star[55] = "name=55 Ari;ra=03 09 36.73;dec=+29 04 37.6;mag=5.74;" star[7] = "name=7 Ari;ra=01 55 51.03;dec=+23 34 38.4;mag=5.76;" star[45] = "name=ρ2 Ari;ra=02 55 48.50;dec=+18 19 54.0;mag=5.76;" star[37] = "name=ο Ari;ra=02 44 32.97;dec=+15 18 42.8;mag=5.78;" star[56] = "name=56 Ari;ra=03 12 14.24;dec=+27 15 25.2;mag=5.78;" star[20] = "name=20 Ari;ra=02 15 45.94;dec=+25 46 59.2;mag=5.79;" star[47] = "name=47 Ari;ra=02 58 05.08;dec=+20 40 07.7;mag=5.80;" star[1] = "name=1 Ari A;ra=01 50 08.58;dec=+22 16 31.3;mag=5.83;" star[40] = "name=40 Ari;ra=02 48 32.06;dec=+18 17 01.9;mag=5.83;" star[4] = "name=4 Ari;ra=01 48 10.90;dec=+16 57 20.3;mag=5.86;" star[(16)] = "name=HR 830;ra=02 48 45.87;dec=+25 11 17.1;mag=5.89;" star[1] = "name=1 Ari B;ra=01 50 08.50;dec=+22 16 33.0;mag=5.90;" star[49] = "name=49 Ari;ra=03 01 54.15;dec=+26 27 44.4;mag=5.91;" star[59] = "name=59 Ari;ra=03 19 55.81;dec=+27 04 16.7;mag=5.91;" star[(54)] = "name=54 Cet;ra=01 50 52.01;dec=+11 02 36.4;mag=5.93;" star[29] = "name=29 Ari;ra=02 32 54.15;dec=+15 02 04.1;mag=6.00;" star[11] = "name=11 Ari;ra=02 06 49.22;dec=+25 42 16.5;mag=6.01;" star[16] = "name=16 Ari;ra=02 11 12.06;dec=+25 56 13.0;mag=6.01;" star[66] = "name=66 Ari;ra=03 28 26.57;dec=+22 48 15.4;mag=6.03;" star[65] = "name=65 Ari;ra=03 24 26.11;dec=+20 48 12.6;mag=6.07;" star[53] = "name=53 Ari;ra=03 07 25.69;dec=+17 52 47.9;mag=6.13;" star[26] = "name=26 Ari;ra=02 30 38.37;dec=+19 51 19.4;mag=6.14;" star[60] = "name=60 Ari;ra=03 20 25.57;dec=+25 39 46.7;mag=6.14;" star[27] = "name=27 Ari;ra=02 30 54.38;dec=+17 42 14.6;mag=6.21;" star[54] = "name=54 Ari;ra=03 08 21.09;dec=+18 47 42.3;mag=6.25;" star[(85)] = "name=85 Cet;ra=02 42 28.95;dec=+10 44 30.4;mag=6.32;" star[36] = "name=36 Ari;ra=02 44 19.09;dec=+17 45 50.5;mag=6.46;" star[30] = "name=30 Ari A;ra=02 37 00.44;dec=+24 38 50.1;mag=6.48;" star[51] = "name=51 Ari;ra=03 02 25.87;dec=+26 36 34.7;mag=6.62;" star[52] = "name=52 Ari B;ra=03 05 26.70;dec=+25 15 19.0;mag=7.00;" star[44] = "name=ρ1 Ari;ra=02 54 55.17;dec=+17 44 05.3;mag=7.01;" star[30] = "name=30 Ari B;ra=02 36 57.64;dec=+24 38 53.1;mag=7.09;" edge = "1=5-6;2=6-13;3=13-32;4=32-57;" EndSub Sub Shapes_Initary shX = -200 ' x offset shY = 133 ' y offset shape = "" shape[1] = "func=ell;x=62;y=33;width=99;height=97;bc=#5E5E5E;pw=0;" shape[2] = "func=ell;x=0;y=59;width=67;height=37;angle=348;bc=#5E5E5E;pw=0;" shape[3] = "func=ell;x=45;y=80;width=2;height=0;bc=#5E5E5E;pw=0;" shape[4] = "func=ell;x=222;y=0;width=47;height=48;bc=#000000;pc=#5E5E5E;pw=16;" shape[5] = "func=ell;x=186;y=58;width=99;height=97;bc=#5E5E5E;pw=0;" shape[6] = "func=rect;x=107;y=44;width=127;height=98;angle=11;bc=#5E5E5E;pw=0;" shape[7] = "func=rect;x=68;y=139;width=103;height=17;angle=28;bc=#5E5E5E;pw=0;" shape[8] = "func=rect;x=196;y=147;width=70;height=16;angle=27;bc=#5E5E5E;pw=0;" shape[9] = "func=rect;x=192;y=164;width=70;height=16;angle=356;bc=#5E5E5E;pw=0;" shape[10] = "func=rect;x=218;y=141;width=70;height=16;angle=9;bc=#5E5E5E;pw=0;" shape[11] = "func=rect;x=238;y=172;width=70;height=16;angle=292;bc=#5E5E5E;pw=0;" shape[12] = "func=ell;x=218;y=36;width=37;height=54;angle=34;bc=#5E5E5E;pc=#000000;pw=4;" shape[13] = "func=ell;x=229;y=11;width=78;height=78;bc=#5E5E5E;pw=0;" shape[14] = "func=ell;x=255;y=51;width=20;height=20;bc=#000000;pw=0;" shape[15] = "func=line;x=218;y=71;x1=0;y1=4;x2=11;y2=0;pc=#000000;pw=4;" shape[16] = "func=tri;x=238;y=76;x1=40;y1=0;x2=0;y2=25;x3=80;y3=25;angle=288;bc=#5E5E5E;pw=0;" shape[17] = "func=ell;x=287;y=27;width=47;height=48;bc=#000000;pc=#5E5E5E;pw=16;" shape[18] = "func=line;x=284;y=49;x1=0;y1=0;x2=26;y2=9;pc=#000000;pw=4;" shape[19] = "func=line;x=284;y=49;x1=18;y1=32;x2=0;y2=0;pc=#000000;pw=4;" shape[20] = "func=tri;x=165;y=161;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" shape[21] = "func=tri;x=162;y=168;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" shape[22] = "func=tri;x=252;y=205;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=210;bc=#5E5E5E;pw=0;" shape[23] = "func=tri;x=246;y=203;x1=7;y1=0;x2=0;y2=27;x3=15;y3=27;angle=214;bc=#5E5E5E;pw=0;" shape[24] = "func=tri;x=179;y=160;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0;" shape[25] = "func=tri;x=182;y=153;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0;" shape[26] = "func=rect;x=97;y=127;width=103;height=17;angle=12;bc=#5E5E5E;pw=0;" shape[27] = "func=tri;x=196;y=140;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0;" EndSub Sub initscnc star[17] = "name=β Cnc;ra=08 16 30.95;dec=+09 11 08.4;mag=3.53;" star[47] = "name=δ Cnc;ra=08 44 41.11;dec=+18 09 17.5;mag=3.94;" star[48] = "name=ι Cnc A;ra=08 46 41.83;dec=+28 45 36.0;mag=4.03;" star[65] = "name=α Cnc;ra=08 58 29.20;dec=+11 51 28.0;mag=4.26;" star[43] = "name=γ Cnc;ra=08 43 17.21;dec=+21 28 06.9;mag=4.66;" star[16] = "name=ζ Cnc;ra=08 12 12.71;dec=+17 38 53.3;mag=4.67;" star[8] = "name=8 Cnc;ra=08 05 04.51;dec=+13 07 06.1;mag=5.14;" star[18] = "name=χ Cnc;ra=08 20 03.87;dec=+27 13 07.0;mag=5.14;" star[77] = "name=ξ Cnc;ra=09 09 21.53;dec=+22 02 43.6;mag=5.16;" star[62] = "name=ο1 Cnc;ra=08 57 14.91;dec=+15 19 21.8;mag=5.22;" star[58] = "name=ρ2 Cnc;ra=08 55 39.69;dec=+27 55 39.2;mag=5.23;" star[64] = "name=σ3 Cnc;ra=08 59 32.68;dec=+32 25 07.1;mag=5.23;" star[76] = "name=κ Cnc;ra=09 07 44.82;dec=+10 40 05.6;mag=5.23;" star[10] = "name=μ2 Cnc;ra=08 07 45.84;dec=+21 34 55.1;mag=5.30;" star[31] = "name=θ Cnc;ra=08 31 35.77;dec=+18 05 40.4;mag=5.33;" star[33] = "name=η Cnc;ra=08 32 42.52;dec=+20 26 28.6;mag=5.33;" star[82] = "name=82 Cnc;ra=09 15 13.88;dec=+14 56 29.5;mag=5.36;" star[57] = "name=57 Cnc;ra=08 54 14.70;dec=+30 34 45.0;mag=5.40;" star[72] = "name=τ Cnc;ra=09 08 00.07;dec=+29 39 15.2;mag=5.42;" star[60] = "name=60 Cnc;ra=08 55 55.56;dec=+11 37 33.8;mag=5.44;" star[59] = "name=σ2 Cnc;ra=08 56 56.63;dec=+32 54 38.1;mag=5.44;" star[69] = "name=ν Cnc;ra=09 02 44.27;dec=+24 27 10.6;mag=5.45;" star[27] = "name=27 Cnc;ra=08 26 43.95;dec=+12 39 17.5;mag=5.56;" star[22] = "name=φ1 Cnc;ra=08 26 27.73;dec=+27 53 37.9;mag=5.58;" star[3] = "name=3 Cnc;ra=08 00 47.31;dec=+17 18 31.4;mag=5.60;" star[15] = "name=15 Cnc;ra=08 13 08.87;dec=+29 39 23.7;mag=5.62;" star[45] = "name=45 Cnc;ra=08 43 12.34;dec=+12 40 51.1;mag=5.62;" star[49] = "name=49 Cnc;ra=08 44 45.04;dec=+10 04 54.2;mag=5.63;" star[51] = "name=σ1 Cnc;ra=08 52 34.62;dec=+32 28 26.8;mag=5.67;" star[63] = "name=ο2 Cnc;ra=08 57 35.16;dec=+15 34 52.4;mag=5.68;" star[30] = "name=υ1 Cnc;ra=08 31 30.57;dec=+24 04 52.4;mag=5.71;" star[14] = "name=ψ2 Cnc;ra=08 10 27.23;dec=+25 30 29.4;mag=5.73;" star[1] = "name=1 Cnc;ra=07 56 59.47;dec=+15 47 25.4;mag=5.80;" star[2] = "name=ω1 Cnc;ra=08 00 55.87;dec=+25 23 34.2;mag=5.87;" star[50] = "name=50 Cnc;ra=08 46 56.06;dec=+12 06 36.3;mag=5.89;" star[66] = "name=66 Cnc;ra=09 01 24.13;dec=+32 15 08.3;mag=5.89;" star[19] = "name=λ Cnc;ra=08 20 32.15;dec=+24 01 20.5;mag=5.92;" star[36] = "name=36 Cnc;ra=08 37 05.79;dec=+09 39 20.1;mag=5.92;" star[20] = "name=20 Cnc;ra=08 23 21.87;dec=+18 19 56.2;mag=5.94;" star[29] = "name=29 Cnc;ra=08 28 37.35;dec=+14 12 39.1;mag=5.94;" star[75] = "name=75 Cnc;ra=09 08 47.42;dec=+26 37 48.0;mag=5.95;" star[(1)] = "name=1 LMi;ra=08 38 19.00;dec=+32 48 07.3;mag=5.96;" star[55] = "name=55 Cnc;ra=08 52 36.13;dec=+28 19 53.0;mag=5.96;" star[9] = "name=μ1 Cnc;ra=08 06 18.40;dec=+22 38 07.8;mag=5.97;" star[5] = "name=5 Cnc;ra=08 01 30.29;dec=+16 27 19.2;mag=5.99;" star[79] = "name=79 Cnc;ra=09 10 20.86;dec=+21 59 47.1;mag=6.04;" star[28] = "name=28 Cnc;ra=08 28 36.80;dec=+24 08 42.2;mag=6.05;" star[67] = "name=67 Cnc;ra=09 01 48.88;dec=+27 54 10.0;mag=6.07;" star[21] = "name=21 Cnc;ra=08 23 55.21;dec=+10 37 55.6;mag=6.11;" star[25] = "name=25 Cnc;ra=08 25 49.99;dec=+17 02 47.9;mag=6.11;" star[46] = "name=46 Cnc;ra=08 45 21.42;dec=+30 41 51.9;mag=6.12;" star[23] = "name=φ2 Cnc A;ra=08 26 47.08;dec=+26 56 07.7;mag=6.14;" star[23] = "name=φ2 Cnc B;ra=08 26 47.00;dec=+26 56 07.0;mag=6.19;" star[(4)] = "name=4 LMi;ra=08 40 18.31;dec=+31 56 31.1;mag=6.21;" star[12] = "name=12 Cnc;ra=08 08 42.44;dec=+13 38 27.4;mag=6.25;" star[53] = "name=53 Cnc;ra=08 52 28.60;dec=+28 15 33.0;mag=6.25;" star[61] = "name=61 Cnc;ra=08 57 58.63;dec=+30 14 01.5;mag=6.25;" star[41] = "name=ε Cnc;ra=08 40 27.03;dec=+19 32 41.4;mag=6.29;" star[4] = "name=4 Cnc;ra=08 01 43.77;dec=+25 05 22.0;mag=6.32;" star[32] = "name=υ2 Cnc;ra=08 33 00.14;dec=+24 05 05.7;mag=6.35;" star[54] = "name=54 Cnc;ra=08 51 01.53;dec=+15 21 01.7;mag=6.36;" star[39] = "name=39 Cnc;ra=08 40 06.44;dec=+20 00 28.1;mag=6.39;" star[13] = "name=ψ1 Cnc;ra=08 10 13.12;dec=+25 50 40.4;mag=6.44;" star[34] = "name=34 Cnc;ra=08 32 39.87;dec=+10 03 57.7;mag=6.48;" star[81] = "name=81 Cnc;ra=09 12 17.87;dec=+14 59 43.6;mag=6.49;" star[24] = "name=24 Cnc A;ra=08 26 39.82;dec=+24 32 03.7;mag=6.51;" star[37] = "name=37 Cnc;ra=08 38 05.19;dec=+09 34 28.7;mag=6.54;" star[35] = "name=35 Cnc;ra=08 35 19.47;dec=+19 35 24.3;mag=6.55;" star[40] = "name=40 Cnc;ra=08 40 11.47;dec=+19 58 16.2;mag=6.61;" star[83] = "name=83 Cnc;ra=09 18 58.91;dec=+17 42 20.4;mag=6.61;" star[38] = "name=38 Cnc;ra=08 39 42.68;dec=+19 46 42.5;mag=6.66;" star[70] = "name=70 Cnc;ra=09 04 09.87;dec=+27 53 53.9;mag=6.67;" star[(2)] = "name=2 LMi;ra=08 39 31.87;dec=+32 30 56.2;mag=6.69;" star[(3)] = "name=3 LMi;ra=08 39 56.35;dec=+32 43 38.2;mag=6.71;" star[42] = "name=42 Cnc;ra=08 40 43.23;dec=+19 43 09.6;mag=6.83;" star[7] = "name=7 Cnc;ra=08 03 50.48;dec=+22 04 14.9;mag=6.84;" star[80] = "name=80 Cnc;ra=09 11 56.93;dec=+18 02 39.0;mag=6.87;" star[78] = "name=78 Cnc;ra=09 09 02.31;dec=+17 28 10.7;mag=7.18;" star[52] = "name=52 Cnc;ra=08 51 10.83;dec=+15 59 57.8;mag=7.38;" star[24] = "name=24 Cnc B;ra=08 26 40.10;dec=+24 32 07.0;mag=7.81;" star[44] = "name=44 Cnc;ra=08 43 08.36;dec=+18 09 02.0;mag=8.03;" star[71] = "name=71 Cnc;ra=09 05 45.52;dec=+17 23 24.5;mag=8.10;" edge = "1=48-43;2=43-47;3=47-65;4=47-17;" EndSub Sub shpcnc shX = -1040 ' x offset shY = 77 ' y offset shape = "" shape[1] = "func=ell;x=60;y=44;width=126;height=181;bc=#661F1F;pc=#000055;pw=2;" shape[2] = "func=ell;x=54;y=99;width=21;height=21;bc=#661F1F;pc=#000055;pw=2;" shape[3] = "func=ell;x=56;y=145;width=21;height=21;bc=#661F1F;pc=#000055;pw=2;" shape[4] = "func=rect;x=73;y=22;width=27;height=23;angle=12;bc=#661F1F;pc=#000055;pw=2;" shape[5] = "func=rect;x=96;y=30;width=24;height=22;angle=21;bc=#661F1F;pc=#000055;pw=2;" shape[6] = "func=rect;x=49;y=209;width=29;height=22;bc=#661F1F;pc=#000055;pw=2;" shape[7] = "func=rect;x=70;y=207;width=24;height=19;angle=327;bc=#661F1F;pc=#000055;pw=2;" shape[8] = "func=tri;x=107;y=15;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=332;bc=#661F1F;pc=#000055;pw=2;" shape[9] = "func=tri;x=131;y=12;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=338;bc=#661F1F;pc=#000055;pw=2;" shape[10] = "func=tri;x=152;y=21;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=346;bc=#661F1F;pc=#000055;pw=2;" shape[11] = "func=tri;x=170;y=34;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[12] = "func=tri;x=103;y=218;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[13] = "func=tri;x=127;y=217;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[14] = "func=tri;x=142;y=219;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[15] = "func=tri;x=161;y=206;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2;" shape[16] = "func=tri;x=49;y=102;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=290;bc=#661F1F;pc=#000055;pw=2;" shape[17] = "func=tri;x=49;y=122;x1=7;y1=0;x2=0;y2=36;x3=14;y3=36;angle=264;bc=#661F1F;pc=#000055;pw=2;" shape[18] = "func=rect;x=127;y=77;width=14;height=33;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[19] = "func=rect;x=141;y=74;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[20] = "func=rect;x=158;y=84;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[21] = "func=rect;x=169;y=96;width=14;height=33;angle=10;bc=#661F1F;pc=#000055;pw=2;" shape[22] = "func=rect;x=122;y=161;width=14;height=33;angle=7;bc=#661F1F;pc=#000055;pw=2;" shape[23] = "func=rect;x=136;y=162;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[24] = "func=rect;x=153;y=160;width=14;height=33;angle=352;bc=#661F1F;pc=#000055;pw=2;" shape[25] = "func=rect;x=167;y=150;width=14;height=33;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[26] = "func=rect;x=120;y=48;width=14;height=33;angle=338;bc=#661F1F;pc=#000055;pw=2;" shape[27] = "func=rect;x=139;y=46;width=14;height=33;angle=351;bc=#661F1F;pc=#000055;pw=2;" shape[28] = "func=rect;x=158;y=55;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[29] = "func=rect;x=173;y=67;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[30] = "func=rect;x=117;y=191;width=14;height=33;angle=12;bc=#661F1F;pc=#000055;pw=2;" shape[31] = "func=rect;x=136;y=194;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[32] = "func=rect;x=154;y=192;width=14;height=33;angle=7;bc=#661F1F;pc=#000055;pw=2;" shape[33] = "func=rect;x=170;y=181;width=14;height=33;bc=#661F1F;pc=#000055;pw=2;" shape[34] = "func=ell;x=70;y=99;width=114;height=68;bc=#661F1F;pc=#000055;pw=2;" shape[35] = "func=ell;x=14;y=0;width=50;height=102;angle=45;bc=#661F1F;pc=#000055;pw=2;" shape[36] = "func=ell;x=0;y=132;width=49;height=105;angle=342;bc=#661F1F;pc=#000055;pw=2;" shape[37] = "func=tri;x=16;y=34;x1=18;y1=0;x2=0;y2=66;x3=36;y3=66;angle=30;bc=#000055;pw=0;" shape[38] = "func=tri;x=13;y=130;x1=11;y1=0;x2=0;y2=73;x3=23;y3=73;angle=168;bc=#000055;pw=0;" shape[39] = "func=ell;x=54;y=99;width=21;height=21;bc=#33000000;pc=#000055;pw=2;" shape[40] = "func=ell;x=56;y=145;width=21;height=21;bc=#33000000;pc=#000055;pw=2;" EndSub Sub InitStarsgm ' Initialize stars in Gemini star[78] = "name=Pollux;ra=07 45 19.36;dec=+28 01 34.7;mag=1.16;" star[66] = "name=Castor A;ra=07 34 36.00;dec=+31 53 19.1;mag=1.90;" star[24] = "name=γ Gem;ra=06 37 42.70;dec=+16 23 57.9;mag=1.93;" star[13] = "name=μ Gem;ra=06 22 57.59;dec=+22 30 49.9;mag=2.87;" star[27] = "name=ε Gem;ra=06 43 55.93;dec=+25 07 52.2;mag=3.06;" star[7] = "name=η Gem;ra=06 14 52.70;dec=+22 30 24.6;mag=3.31;" star[31] = "name=ξ Gem;ra=06 45 17.43;dec=+12 53 45.8;mag=3.35;" star[55] = "name=δ Gem;ra=07 20 07.39;dec=+21 58 56.4;mag=3.50;" star[77] = "name=κ Gem;ra=07 44 26.87;dec=+24 23 53.3;mag=3.57;" star[54] = "name=λ Gem;ra=07 18 05.61;dec=+16 32 25.7;mag=3.58;" star[34] = "name=θ Gem;ra=06 52 47.34;dec=+33 57 40.9;mag=3.60;" star[60] = "name=ι Gem;ra=07 25 43.68;dec=+27 47 53.8;mag=3.78;" star[43] = "name=ζ Gem;ra=07 04 06.54;dec=+20 34 13.1;mag=4.01;" star[69] = "name=υ Gem;ra=07 35 55.37;dec=+26 53 45.6;mag=4.06;" star[18] = "name=ν Gem A;ra=06 28 57.79;dec=+20 12 43.8;mag=4.13;" star[1] = "name=1 Gem;ra=06 04 07.22;dec=+23 15 49.1;mag=4.16;" star[62] = "name=ρ Gem;ra=07 29 06.61;dec=+31 47 02.7;mag=4.16;" star[75] = "name=σ Gem;ra=07 43 18.69;dec=+28 53 02.7;mag=4.23;" star[46] = "name=τ Gem;ra=07 11 08.39;dec=+30 14 43.0;mag=4.41;" star[30] = "name=30 Gem;ra=06 43 59.29;dec=+13 13 41.3;mag=4.49;" star[38] = "name=38 Gem;ra=06 54 38.59;dec=+13 10 40.9;mag=4.71;" star[71] = "name=ο Gem;ra=07 39 09.96;dec=+34 35 04.7;mag=4.89;" star[81] = "name=81 Gem;ra=07 46 07.49;dec=+18 30 36.6;mag=4.89;" star[83] = "name=φ Gem;ra=07 53 29.84;dec=+26 45 57.1;mag=4.97;" star[65] = "name=65 Gem;ra=07 29 48.78;dec=+27 54 58.3;mag=5.01;" star[57] = "name=57 Gem;ra=07 23 28.55;dec=+25 03 02.2;mag=5.04;" star[74] = "name=74 Gem;ra=07 39 28.59;dec=+17 40 28.3;mag=5.04;" star[51] = "name=51 Gem;ra=07 13 22.27;dec=+16 09 32.6;mag=5.07;" star[64] = "name=64 Gem;ra=07 29 20.46;dec=+28 07 06.3;mag=5.07;" star[56] = "name=56 Gem;ra=07 21 56.90;dec=+20 26 37.4;mag=5.09;" star[80] = "name=π Gem;ra=07 47 30.34;dec=+33 24 56.8;mag=5.14;" star[26] = "name=26 Gem;ra=06 42 24.32;dec=+17 38 43.9;mag=5.20;" star[42] = "name=ω Gem;ra=07 02 24.78;dec=+24 12 55.6;mag=5.20;" star[63] = "name=63 Gem;ra=07 27 44.39;dec=+21 26 44.0;mag=5.20;" star[68] = "name=68 Gem;ra=07 33 36.50;dec=+15 49 36.1;mag=5.27;" star[36] = "name=36 Gem;ra=06 51 33.05;dec=+21 45 40.4;mag=5.28;" star[76] = "name=76 Gem;ra=07 44 06.92;dec=+25 47 03.2;mag=5.30;" star[85] = "name=85 Gem;ra=07 55 39.90;dec=+19 53 02.6;mag=5.38;" star[28] = "name=28 Gem;ra=06 44 45.46;dec=+28 58 15.6;mag=5.42;" star[45] = "name=45 Gem;ra=07 08 22.04;dec=+15 55 51.3;mag=5.47;" star[70] = "name=70 Gem;ra=07 38 32.84;dec=+35 02 54.5;mag=5.58;" star[35] = "name=35 Gem;ra=06 50 25.50;dec=+13 24 47.5;mag=5.68;" star[41] = "name=41 Gem;ra=07 00 15.82;dec=+16 04 44.4;mag=5.73;" star[37] = "name=37 Gem;ra=06 55 18.69;dec=+25 22 32.3;mag=5.73;" star[3] = "name=3 Gem;ra=06 09 43.99;dec=+23 06 48.5;mag=5.75;" star[47] = "name=47 Gem;ra=07 11 23.08;dec=+26 51 24.0;mag=5.75;" star[53] = "name=53 Gem;ra=07 15 57.18;dec=+27 53 50.7;mag=5.75;" star[59] = "name=59 Gem;ra=07 24 33.44;dec=+27 38 16.1;mag=5.77;" star[5] = "name=5 Gem;ra=06 11 32.31;dec=+24 25 13.4;mag=5.83;" star[52] = "name=52 Gem;ra=07 14 41.94;dec=+24 53 06.7;mag=5.84;" star[48] = "name=48 Gem;ra=07 12 26.39;dec=+24 07 43.3;mag=5.85;" star[33] = "name=33 Gem;ra=06 49 49.85;dec=+16 12 10.5;mag=5.85;" star[61] = "name=61 Gem;ra=07 26 56.33;dec=+20 15 27.3;mag=5.94;" star[44] = "name=44 Gem;ra=07 05 18.37;dec=+22 38 14.9;mag=6.00;" star[8] = "name=8 Gem;ra=06 16 19.05;dec=+23 58 12.2;mag=6.09;" star[58] = "name=58 Gem;ra=07 23 28.15;dec=+22 56 43.6;mag=6.17;" star[82] = "name=82 Gem;ra=07 48 33.65;dec=+23 08 27.5;mag=6.18;" star[39] = "name=39 Gem;ra=06 58 47.52;dec=+26 04 51.1;mag=6.20;" star[16] = "name=16 Gem;ra=06 27 56.69;dec=+20 29 46.6;mag=6.22;" star[9] = "name=9 Gem;ra=06 16 58.71;dec=+23 44 27.3;mag=6.24;" star[20] = "name=20 Gem;ra=06 32 18.52;dec=+17 47 03.4;mag=6.26;" star[141] = "name=141 Tau;ra=06 01 41.63;dec=+22 24 03.8;mag=6.36;" star[19] = "name=19 Gem;ra=06 31 37.44;dec=+15 54 12.7;mag=6.38;" star[40] = "name=40 Gem;ra=06 59 27.94;dec=+25 54 51.1;mag=6.40;" star[25] = "name=25 Gem;ra=06 41 20.90;dec=+28 11 47.9;mag=6.45;" star[50] = "name=50 Gem;ra=07 12 49.08;dec=+27 13 30.2;mag=6.46;" star[32] = "name=32 Gem;ra=06 45 54.20;dec=+12 41 36.8;mag=6.47;" star[6] = "name=6 Gem;ra=06 12 19.10;dec=+22 54 30.7;mag=6.51;" star[79] = "name=79 Gem;ra=07 45 09.34;dec=+20 18 57.8;mag=6.53;" star[15] = "name=15 Gem A;ra=06 27 46.58;dec=+20 47 22.6;mag=6.54;" star[10] = "name=10 Gem;ra=06 18 54.43;dec=+23 36 11.9;mag=6.58;" star[2] = "name=2 Gem;ra=06 06 48.66;dec=+23 38 19.0;mag=6.67;" star[23] = "name=23 Gem;ra=06 36 02.12;dec=+16 47 49.5;mag=6.73;" star[4] = "name=4 Gem;ra=06 10 29.94;dec=+22 59 52.4;mag=6.88;" star[11] = "name=11 Gem;ra=06 19 19.30;dec=+23 28 09.9;mag=6.91;" star[12] = "name=12 Gem;ra=06 19 22.52;dec=+23 16 28.2;mag=6.95;" star[49] = "name=49 Gem;ra=07 12 49.38;dec=+25 44 55.3;mag=7.05;" star[18] = "name=ν Gem B;ra=06 28 53.70;dec=+20 14 20.0;mag=8.00;" star[15] = "name=15 Gem B;ra=06 27 45.94;dec=+20 46 59.6;mag=8.59;" edge = "1=66-46;2=46-27;3=27-13;4=13-7;5=66-78;6=78-55;7=55-43;" edge = edge + "8=43-24;" EndSub Sub Shapes_Initgmm shX = -840 ' x offset shY = -11 ' y offset shape = "" shape[1] = "func=ell;x=34;y=69;width=54;height=52;bc=#A4825B;pw=0;" shape[2] = "func=ell;x=0;y=117;width=54;height=52;bc=#A4825B;pw=0;" shape[3] = "func=ell;x=30;y=144;width=41;height=61;angle=33;bc=#A4825B;pw=0;" shape[4] = "func=rect;x=109;y=201;width=44;height=21;bc=#A4825B;pw=0;" shape[5] = "func=rect;x=91;y=224;width=44;height=21;angle=4;bc=#A4825B;pw=0;" shape[6] = "func=rect;x=138;y=221;width=67;height=20;angle=43;bc=#A4825B;pw=0;" shape[7] = "func=rect;x=118;y=244;width=67;height=20;angle=43;bc=#A4825B;pw=0;" shape[8] = "func=rect;x=141;y=164;width=61;height=23;angle=335;bc=#A4825B;pw=0;" shape[9] = "func=rect;x=172;y=143;width=44;height=21;angle=335;bc=#A4825B;pw=0;" shape[10] = "func=rect;x=196;y=156;width=67;height=20;angle=43;bc=#A4825B;pw=0;" shape[11] = "func=rect;x=177;y=180;width=67;height=20;angle=57;bc=#A4825B;pw=0;" shape[12] = "func=ell;x=245;y=179;width=41;height=16;angle=333;bc=#A4825B;pw=0;" shape[13] = "func=ell;x=218;y=210;width=41;height=16;angle=349;bc=#A4825B;pw=0;" shape[14] = "func=ell;x=187;y=246;width=41;height=16;angle=349;bc=#A4825B;pw=0;" shape[15] = "func=ell;x=161;y=269;width=41;height=20;angle=7;bc=#A4825B;pw=0;" shape[16] = "func=rect;x=77;y=121;width=101;height=50;angle=39;bc=#A4825B;pw=0;" shape[17] = "func=rect;x=34;y=169;width=85;height=53;angle=38;bc=#A4825B;pw=0;" shape[18] = "func=rect;x=106;y=86;width=53;height=22;angle=348;bc=#A4825B;pw=0;" shape[19] = "func=rect;x=148;y=69;width=51;height=20;angle=325;bc=#A4825B;pw=0;" shape[20] = "func=tri;x=133;y=0;x1=11;y1=0;x2=0;y2=42;x3=23;y3=42;angle=305;bc=#624E37;pw=0;" shape[21] = "func=line;x=156;y=28;x1=0;y1=0;x2=89;y2=60;pc=#624E37;pw=4;" shape[22] = "func=tri;x=230;y=74;x1=12;y1=0;x2=0;y2=20;x3=24;y3=20;angle=307;bc=#624E37;pw=0;" shape[23] = "func=rect;x=248;y=84;width=25;height=28;angle=304;bc=#624E37;pw=0;" shape[24] = "func=tri;x=252;y=94;x1=15;y1=0;x2=0;y2=18;x3=30;y3=18;angle=307;bc=#000000;pw=0;" shape[25] = "func=rect;x=91;y=174;width=51;height=19;angle=358;bc=#A4825B;pc=#000000;pw=2;" shape[26] = "func=ell;x=130;y=169;width=29;height=25;bc=#A4825B;pw=0;" shape[27] = "func=rect;x=32;y=189;width=20;height=48;angle=350;bc=#A4825B;pw=0;" shape[28] = "func=rect;x=36;y=222;width=46;height=18;bc=#A4825B;pw=0;" shape[29] = "func=rect;x=64;y=241;width=9;height=0;bc=#A4825B;pw=0;" shape[30] = "func=rect;x=55;y=136;width=44;height=20;angle=324;bc=#A4825B;pw=0;" shape[31] = "func=rect;x=62;y=151;width=56;height=22;angle=74;bc=#A4825B;pc=#000000;pw=2;" shape[32] = "func=ell;x=86;y=169;width=23;height=23;angle=347;bc=#A4825B;pw=0;" shape[33] = "func=ell;x=77;y=87;width=42;height=63;angle=44;bc=#A4825B;pw=0;" shape[34] = "func=ell;x=73;y=221;width=27;height=23;angle=13;bc=#A4825B;pw=0;" shape[35] = "func=ell;x=103;y=116;width=61;height=64;angle=316;bc=#624E37;pw=0;" shape[36] = "func=ell;x=111;y=128;width=40;height=34;angle=313;bc=#A4825B;pw=0;" shape[37] = "func=rect;x=104;y=120;width=25;height=23;angle=315;bc=#A4825B;pw=0;" shape[38] = "func=ell;x=93;y=117;width=19;height=30;angle=318;bc=#624E37;pw=0;" shape[39] = "func=ell;x=108;y=102;width=19;height=30;angle=318;bc=#624E37;pw=0;" shape[40] = "func=line;x=118;y=134;x1=0;y1=0;x2=29;y2=27;pc=#624E37;pw=2;" shape[41] = "func=line;x=111;y=135;x1=0;y1=0;x2=29;y2=29;pc=#624E37;pw=2;" shape[42] = "func=line;x=121;y=128;x1=0;y1=0;x2=28;y2=27;pc=#624E37;pw=2;" shape[43] = "func=ell;x=89;y=119;width=15;height=29;angle=340;bc=#A4825B;pw=0;" shape[44] = "func=ell;x=113;y=95;width=15;height=29;angle=291;bc=#A4825B;pw=0;" shape[45] = "func=ell;x=184;y=40;width=26;height=33;angle=352;bc=#A4825B;pw=0;" shape[46] = "func=rect;x=107;y=130;width=22;height=9;angle=313;bc=#624E37;pw=0;" shape[47] = "func=rect;x=131;y=152;width=22;height=9;angle=315;bc=#624E37;pw=0;" shape[48] = "func=tri;x=126;y=106;x1=6;y1=0;x2=0;y2=10;x3=12;y3=10;angle=294;bc=#000000;pw=0;" shape[49] = "func=ell;x=68;y=74;width=26;height=19;angle=39;bc=#A4825B;pw=0;" shape[50] = "func=ell;x=2;y=152;width=26;height=19;angle=231;bc=#A4825B;pw=0;" shape[51] = "func=ell;x=60;y=84;width=13;height=13;bc=#000000;pw=0;" shape[52] = "func=ell;x=48;y=99;width=13;height=13;bc=#000000;pw=0;" shape[53] = "func=ell;x=32;y=122;width=13;height=13;bc=#000000;pw=0;" shape[54] = "func=ell;x=20;y=137;width=13;height=13;bc=#000000;pw=0;" EndSub Sub Shapes_Init_tau shX = -500 ' x offset shY = 64 ' y offset shape = "" shape[1] = "func=ell;x=75;y=49;width=86;height=134;angle=24;bc=#000055;pc=#66411F;pw=16;" shape[2] = "func=rect;x=56;y=71;width=67;height=57;angle=24;bc=#000055;pw=0;" shape[3] = "func=ell;x=71;y=29;width=52;height=53;bc=#66411F;pw=0;" shape[4] = "func=ell;x=34;y=105;width=52;height=53;bc=#66411F;pw=0;" shape[5] = "func=ell;x=58;y=0;width=70;height=68;bc=#000055;pw=0;" shape[6] = "func=ell;x=0;y=107;width=73;height=75;bc=#000055;pw=0;" shape[7] = "func=ell;x=240;y=111;width=148;height=154;bc=#66411F;pw=0;" shape[8] = "func=rect;x=213;y=213;width=104;height=37;angle=334;bc=#66411F;pw=0;" shape[9] = "func=rect;x=202;y=265;width=105;height=29;angle=33;bc=#66411F;pw=0;" shape[10] = "func=rect;x=148;y=190;width=104;height=37;angle=358;bc=#66411F;pw=0;" shape[11] = "func=rect;x=113;y=245;width=105;height=29;angle=76;bc=#66411F;pw=0;" shape[12] = "func=ell;x=132;y=187;width=48;height=46;bc=#66411F;pw=0;" shape[13] = "func=ell;x=194;y=228;width=48;height=46;bc=#66411F;pw=0;" shape[14] = "func=ell;x=200;y=119;width=3;height=1;bc=#66411F;pw=0;" shape[15] = "func=rect;x=199;y=78;width=178;height=88;angle=351;bc=#66411F;pw=0;" shape[16] = "func=ell;x=117;y=83;width=105;height=120;angle=34;bc=#66411F;pc=#000055;pw=4;" shape[17] = "func=ell;x=183;y=123;width=23;height=24;bc=#000055;pw=0;" shape[18] = "func=ell;x=171;y=50;width=23;height=54;angle=42;bc=#66411F;pw=0;" shape[19] = "func=ell;x=108;y=163;width=23;height=54;angle=20;bc=#66411F;pw=0;" shape[20] = "func=ell;x=166;y=150;width=85;height=67;angle=315;bc=#66411F;pc=#000055;pw=4;" shape[21] = "func=ell;x=217;y=173;width=12;height=15;bc=#000055;pw=0;" shape[22] = "func=ell;x=193;y=197;width=11;height=16;angle=260;bc=#000055;pw=0;" shape[23] = "func=ell;x=179;y=136;width=30;height=68;angle=46;bc=#66411F;pw=0;" shape[24] = "func=tri;x=135;y=311;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=270;bc=#66411F;pw=0;" shape[25] = "func=tri;x=157;y=306;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=69;bc=#66411F;pw=0;" shape[26] = "func=tri;x=260;y=311;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=233;bc=#66411F;pw=0;" shape[27] = "func=tri;x=272;y=293;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=32;bc=#66411F;pw=0;" shape[28] = "func=ell;x=321;y=44;width=73;height=67;bc=#000055;pw=0;" shape[29] = "func=ell;x=329;y=104;width=73;height=67;bc=#000055;pw=0;" shape[30] = "func=ell;x=325;y=155;width=74;height=70;bc=#000055;pw=0;" shape[31] = "func=ell;x=325;y=211;width=74;height=70;bc=#000055;pw=0;" EndSub Sub InitStars_tau star[87] = "name=Aldebaran;ra=04 35 55.20;dec=+16 30 35.1;mag=0.87;" star[112] = "name=β Tau;ra=05 26 17.50;dec=+28 36 28.3;mag=1.65;" star[25] = "name=Alcyone A;ra=03 47 29.06;dec=+24 06 18.9;mag=2.85;" star[123] = "name=ζ Tau;ra=05 37 38.68;dec=+21 08 33.3;mag=2.97;" star[78] = "name=θ2 Tau;ra=04 28 39.67;dec=+15 52 15.4;mag=3.40;" star[35] = "name=λ Tau;ra=04 00 40.82;dec=+12 29 25.4;mag=3.41;" star[74] = "name=ε Tau;ra=04 28 36.93;dec=+19 10 49.9;mag=3.53;" star[1] = "name=ο Tau;ra=03 24 48.84;dec=+09 01 44.6;mag=3.61;" star[27] = "name=Atlas A;ra=03 49 09.73;dec=+24 03 12.7;mag=3.62;" star[54] = "name=γ Tau;ra=04 19 47.53;dec=+15 37 39.7;mag=3.65;" star[17] = "name=Electra;ra=03 44 52.52;dec=+24 06 48.4;mag=3.72;" star[2] = "name=ξ Tau;ra=03 27 10.12;dec=+09 43 58.0;mag=3.73;" star[61] = "name=δ1 Tau;ra=04 22 56.03;dec=+17 32 33.3;mag=3.77;" star[77] = "name=θ1 Tau;ra=04 28 34.43;dec=+15 57 44.0;mag=3.84;" star[20] = "name=Maia;ra=03 45 49.59;dec=+24 22 04.3;mag=3.87;" star[38] = "name=ν Tau;ra=04 03 09.38;dec=+05 59 21.5;mag=3.91;" star[5] = "name=5 Tau;ra=03 30 52.37;dec=+12 56 12.1;mag=4.14;" star[23] = "name=Merope;ra=03 46 19.56;dec=+23 56 54.5;mag=4.14;" star[65] = "name=κ1 Tau;ra=04 25 22.10;dec=+22 17 38.3;mag=4.21;" star[88] = "name=88 Tau;ra=04 35 39.23;dec=+10 09 39.3;mag=4.25;" star[49] = "name=μ Tau;ra=04 15 32.05;dec=+08 53 32.7;mag=4.27;" star[90] = "name=90 Tau;ra=04 38 09.40;dec=+12 30 39.1;mag=4.27;" star[94] = "name=τ Tau;ra=04 42 14.70;dec=+22 57 25.1;mag=4.27;" star[69] = "name=υ Tau;ra=04 26 18.39;dec=+22 48 49.3;mag=4.28;" star[10] = "name=10 Tau;ra=03 36 52.52;dec=+00 24 10.2;mag=4.29;" star[19] = "name=Taygeta;ra=03 45 12.48;dec=+24 28 02.6;mag=4.30;" star[68] = "name=68 Tau;ra=04 25 29.32;dec=+17 55 40.8;mag=4.30;" star[119] = "name=119 Tau;ra=05 32 12.75;dec=+18 35 39.3;mag=4.32;" star[37] = "name=37 Tau;ra=04 04 41.66;dec=+22 04 55.4;mag=4.36;" star[71] = "name=71 Tau;ra=04 26 20.67;dec=+15 37 06.0;mag=4.48;" star[136] = "name=136 Tau;ra=05 53 19.64;dec=+27 36 44.2;mag=4.56;" star[102] = "name=ι Tau;ra=05 03 05.70;dec=+21 35 24.2;mag=4.62;" star[86] = "name=ρ Tau;ra=04 33 50.86;dec=+14 50 40.2;mag=4.65;" star[92] = "name=σ2 Tau;ra=04 39 16.45;dec=+15 55 04.9;mag=4.67;" star[73] = "name=π Tau;ra=04 26 36.38;dec=+14 42 49.9;mag=4.69;" star[64] = "name=64 Tau;ra=04 24 05.69;dec=+17 26 39.2;mag=4.80;" star[139] = "name=139 Tau;ra=05 57 59.66;dec=+25 57 14.1;mag=4.81;" star[47] = "name=47 Tau;ra=04 13 56.39;dec=+09 15 50.0;mag=4.84;" star[126] = "name=126 Tau;ra=05 41 17.72;dec=+16 32 03.1;mag=4.84;" star[114] = "name=114 Tau;ra=05 27 38.08;dec=+21 56 13.1;mag=4.88;" star[132] = "name=132 Tau;ra=05 49 00.96;dec=+24 34 03.2;mag=4.88;" star[134] = "name=134 Tau;ra=05 49 32.94;dec=+12 39 04.9;mag=4.89;" star[104] = "name=104 Tau;ra=05 07 26.68;dec=+18 38 42.0;mag=4.91;" star[50] = "name=ω2 Tau;ra=04 17 15.69;dec=+20 34 43.5;mag=4.93;" star[75] = "name=75 Tau;ra=04 28 26.37;dec=+16 21 34.7;mag=4.96;" star[109] = "name=109 Tau;ra=05 19 16.59;dec=+22 05 48.1;mag=4.96;" star[52] = "name=φ Tau;ra=04 20 21.23;dec=+27 21 03.4;mag=4.97;" star[111] = "name=111 Tau;ra=05 24 25.31;dec=+17 23 00.8;mag=5.00;" star[79] = "name=79 Tau;ra=04 28 50.10;dec=+13 02 51.5;mag=5.02;" star[28] = "name=Pleione;ra=03 49 11.20;dec=+24 08 12.6;mag=5.05;" star[30] = "name=30 Tau;ra=03 48 16.25;dec=+11 08 36.1;mag=5.08;" star[91] = "name=σ1 Tau;ra=04 39 09.20;dec=+15 48 00.1;mag=5.08;" star[97] = "name=97 Tau;ra=04 51 22.41;dec=+18 50 23.8;mag=5.08;" star[66] = "name=66 Tau;ra=04 23 51.84;dec=+09 27 39.5;mag=5.10;" star[4] = "name=4 Tau;ra=03 30 24.48;dec=+11 20 11.3;mag=5.14;" star[41] = "name=41 Tau;ra=04 06 36.40;dec=+27 36 00.1;mag=5.18;" star[125] = "name=125 Tau;ra=05 39 44.19;dec=+25 53 49.7;mag=5.18;" star[42] = "name=ψ Tau;ra=04 07 00.52;dec=+29 00 04.6;mag=5.21;" star[58] = "name=58 Tau;ra=04 20 36.24;dec=+15 05 43.8;mag=5.26;" star[67] = "name=κ2 Tau;ra=04 25 24.94;dec=+22 12 00.4;mag=5.27;" star[106] = "name=l Tau;ra=05 07 48.43;dec=+20 25 06.4;mag=5.28;" star[133] = "name=133 Tau;ra=05 47 42.90;dec=+13 53 58.7;mag=5.28;" star[46] = "name=46 Tau;ra=04 13 33.11;dec=+07 42 57.7;mag=5.29;" star[40] = "name=40 Tau;ra=04 03 44.60;dec=+05 26 08.3;mag=5.32;" star[29] = "name=29 Tau;ra=03 45 40.43;dec=+06 03 00.1;mag=5.34;" star[56] = "name=56 Tau;ra=04 19 36.69;dec=+21 46 24.9;mag=5.34;" star[121] = "name=121 Tau;ra=05 35 27.12;dec=+24 02 22.7;mag=5.37;" star[59] = "name=χ Tau;ra=04 22 34.93;dec=+25 37 45.7;mag=5.38;" star[44] = "name=44 Tau;ra=04 10 49.88;dec=+26 28 51.7;mag=5.39;" star[83] = "name=83 Tau;ra=04 30 37.30;dec=+13 43 28.0;mag=5.40;" star[115] = "name=115 Tau;ra=05 27 10.09;dec=+17 57 44.2;mag=5.40;" star[16] = "name=Celaeno;ra=03 44 48.20;dec=+24 17 22.5;mag=5.45;" star[93] = "name=93 Tau;ra=04 40 03.42;dec=+12 11 51.5;mag=5.45;" star[36] = "name=36 Tau;ra=04 04 21.67;dec=+24 06 21.7;mag=5.46;" star[81] = "name=81 Tau;ra=04 30 38.83;dec=+15 41 31.0;mag=5.47;" star[118] = "name=118 Tau;ra=05 29 16.49;dec=+25 09 01.1;mag=5.47;" star[130] = "name=130 Tau;ra=05 47 26.20;dec=+17 43 44.9;mag=5.47;" star[53] = "name=53 Tau;ra=04 19 26.08;dec=+21 08 32.7;mag=5.50;" star[103] = "name=103 Tau;ra=05 08 06.62;dec=+24 15 54.7;mag=5.50;" star[43] = "name=ω1 Tau;ra=04 09 09.90;dec=+19 36 33.5;mag=5.51;" star[116] = "name=116 Tau;ra=05 27 45.61;dec=+15 52 26.8;mag=5.52;" star[72] = "name=72 Tau;ra=04 27 17.45;dec=+22 59 46.9;mag=5.53;" star[(44)] = "name=44 Eri;ra=04 28 32.11;dec=+01 22 51.1;mag=5.53;" star[122] = "name=122 Tau;ra=05 37 03.71;dec=+17 02 25.5;mag=5.53;" star[135] = "name=135 Tau;ra=05 50 28.90;dec=+14 18 20.5;mag=5.54;" star[12] = "name=12 Tau;ra=03 39 51.14;dec=+03 03 24.6;mag=5.55;" star[57] = "name=57 Tau;ra=04 19 57.63;dec=+14 02 06.9;mag=5.58;" star[80] = "name=80 Tau;ra=04 30 08.53;dec=+15 38 16.4;mag=5.58;" star[137] = "name=137 Tau;ra=05 52 22.30;dec=+14 10 18.5;mag=5.60;" star[32] = "name=32 Tau;ra=03 56 52.03;dec=+22 28 41.7;mag=5.62;" star[51] = "name=51 Tau;ra=04 18 23.14;dec=+21 34 45.8;mag=5.64;" star[63] = "name=63 Tau;ra=04 23 25.00;dec=+16 46 38.4;mag=5.64;" star[18] = "name=18 Tau;ra=03 45 09.73;dec=+24 50 21.7;mag=5.66;" star[31] = "name=31 Tau;ra=03 52 00.22;dec=+06 32 05.7;mag=5.66;" star[120] = "name=120 Tau;ra=05 33 31.63;dec=+18 32 24.8;mag=5.67;" star[13] = "name=13 Tau;ra=03 42 18.94;dec=+19 42 01.0;mag=5.68;" star[45] = "name=45 Tau;ra=04 11 20.20;dec=+05 31 22.9;mag=5.71;" star[60] = "name=60 Tau;ra=04 22 03.45;dec=+14 04 38.1;mag=5.72;" star[131] = "name=131 Tau;ra=05 47 13.15;dec=+14 29 18.3;mag=5.72;" star[6] = "name=6 Tau;ra=03 32 35.93;dec=+09 22 24.8;mag=5.76;" star[21] = "name=Sterope I;ra=03 45 54.46;dec=+24 33 16.6;mag=5.76;" star[117] = "name=117 Tau;ra=05 28 01.60;dec=+17 14 21.3;mag=5.77;" star[89] = "name=89 Tau;ra=04 38 09.38;dec=+16 02 00.2;mag=5.78;" star[99] = "name=99 Tau;ra=04 57 48.65;dec=+23 56 54.9;mag=5.79;" star[98] = "name=98 Tau;ra=04 58 09.38;dec=+25 03 01.9;mag=5.79;" star[105] = "name=105 Tau;ra=05 07 55.43;dec=+21 42 17.4;mag=5.84;" star[39] = "name=39 Tau;ra=04 05 20.15;dec=+22 00 33.2;mag=5.90;" star[76] = "name=76 Tau;ra=04 28 23.34;dec=+14 44 27.7;mag=5.90;" star[7] = "name=7 Tau;ra=03 34 26.62;dec=+24 27 52.1;mag=5.95;" star[129] = "name=129 Tau;ra=05 46 45.49;dec=+15 49 21.0;mag=6.00;" star[85] = "name=85 Tau;ra=04 31 51.69;dec=+15 51 05.9;mag=6.01;" star[33] = "name=33 Tau;ra=03 57 03.80;dec=+23 10 32.1;mag=6.05;" star[96] = "name=96 Tau;ra=04 49 44.08;dec=+15 54 15.3;mag=6.09;" star[110] = "name=110 Tau;ra=05 23 37.72;dec=+16 41 57.7;mag=6.09;" star[11] = "name=11 Tau;ra=03 40 46.30;dec=+25 19 46.3;mag=6.11;" star[14] = "name=14 Tau;ra=03 43 47.14;dec=+19 39 54.6;mag=6.13;" star[95] = "name=95 Tau;ra=04 43 13.75;dec=+24 05 20.3;mag=6.18;" star[113] = "name=113 Tau;ra=05 26 05.72;dec=+16 42 00.6;mag=6.23;" star[108] = "name=108 Tau;ra=05 15 27.66;dec=+22 17 05.5;mag=6.26;" star[24] = "name=24 Tau;ra=03 47 20.90;dec=+24 06 58.0;mag=6.28;" star[84] = "name=84 Tau;ra=04 31 07.16;dec=+15 06 18.6;mag=6.28;" star[48] = "name=48 Tau;ra=04 15 46.21;dec=+15 24 02.7;mag=6.31;" star[62] = "name=62 Tau;ra=04 23 59.76;dec=+24 18 03.7;mag=6.34;" star[22] = "name=Sterope II;ra=03 46 02.89;dec=+24 31 40.8;mag=6.43;" star[70] = "name=70 Tau;ra=04 25 37.25;dec=+15 56 27.9;mag=6.44;" star[26] = "name=26 Tau;ra=03 48 56.91;dec=+23 51 26.2;mag=6.47;" star[9] = "name=9 Tau;ra=03 36 58.03;dec=+23 12 40.0;mag=6.72;" star[101] = "name=101 Tau;ra=04 59 44.27;dec=+15 55 00.5;mag=6.75;" star[55] = "name=55 Tau;ra=04 19 54.78;dec=+16 31 21.6;mag=6.85;" edge = "1=112-74;2=74-68;3=68-54;4=123-87;5=87-78;6=78-54;7=54-49;" edge = edge + "8=54-35;9=25-35;10=35-2;" EndSub End>BZW070.sb< Start>BZW527.sb< ' verison retouché litdev ' program: CLG849 ' PROGRAM : args=0 p=0 GraphicsWindow.title="super LITDEV -TRYHEST TREE" sub tree ' :size p=p+1 size[p]=args[1] 'TextWindow.WriteLine(size[p]) ' data ok if size[p] < 5 then dd=size tmov() dd=size tmov() else dd= size[p]/3 tmov() tang=tang- 30 ldcall.Function ("tree", size[p]*2/3 ) ' GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(175,1,1) p=p-1 tang=tang+ 30 ' TextWindow.WriteLine(tang) ' data ok dd=size[p]/6 tmov() tang=tang+ 25 ldcall.Function ("tree", size[p]/2) ' GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(1,175,1) p=p-1 tang=tang - 25 dd= size[p]/3 tmov() tang=tang+ 25 ldcall.Function ("tree", size[p]/2 ) COL=GraphicsWindow.GetColorFromRGB(1,Math.GetRandomNumber(200)+100,1) GraphicsWindow.PenColor = COL p=p-1 tang=tang - 25 dd=size[p]/6 tmov() dd=-size[p] tmov() EndIf EndSub GraphicsWindow.left=10 GraphicsWindow.top=10 GraphicsWindow.Width =1500 GraphicsWindow.Height=800 GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(90,150,90) GraphicsWindow.PenWidth =1 tx=600 ty=600 tang=-20 ldcall.Function ("tree" , 330) tx=600 ty=600 tang=20 ldcall.Function ("tree" , 330) tx=600 ty=600 tang=40 ldcall.Function ("tree", 300) Sub tmov 'mm=LDMath.Convert2Cartesian(tx ty dd tang-90) mm[1] = tx+dd*Math.Cos((tang-90)*Math.Pi/180) mm[2] = ty+dd*Math.Sin((tang-90)*Math.Pi/180) 'TextWindow.WriteLine("FROM "+tx+" : "+ty) 'TextWindow.WriteLine("TO "+mm[1]+" : "+mm[2]) GraphicsWindow.DrawLine (tx ty mm[1] mm[2]) tx=mm[1] ty=mm[2] 'Program.Delay(1000) EndSub End>BZW527.sb< Start>BZX012.sb< 'Robin Andrews 'Divisors challenge ' divisors="" divisorsIndex=1 ' input: TextWindow.Writeline("Please input a positive non-zero whole number: ") TextWindow.WriteLine("") number = TextWindow.ReadNumber() remainder = Math.Remainder(number, 1) if (remainder<>0 Or number = 0) Then TextWindow.WriteLine("") Goto input EndIf For i = 1 To number test = Math.Remainder(number, i) If (test = 0) Then divisors[divisorsIndex] = i divisorsIndex = divisorsIndex + 1 EndIf EndFor ' TextWindow.WriteLine("") TextWindow.WriteLine("The divisors of " + number + " are: ") TextWindow.WriteLine("") divisorsLength = Array.GetItemCount(divisors) For m = 1 To (divisorsLength-1) TextWindow.Write(divisors[m] + ", ") EndFor TextWindow.Write(divisors[divisorsLength] + ".") TextWindow.WriteLine("") TextWindow.WriteLine("") End>BZX012.sb<