/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 0 - 2 0 2 1 , ĠNull Non ame Ċ Ġ* ĠKotlin Ġconverted Ġand Ġmodified Ġby ĠV en om = N hel v Ċ Ġ* ĠAll Ġrights Ġreserved . Ċ Ġ* Ċ Ġ* ĠRedistribution Ġand Ġuse Ġin Ġsource Ġand Ġbinary Ġforms , Ġwith Ġor Ġwithout Ċ Ġ* Ġmodification , Ġare Ġpermitted Ġprovided Ġthat Ġthe Ġfollowing Ġconditions Ġare Ġmet : Ċ Ġ* ĠĠĠĠ Ġ* ĠRedistributions Ġof Ġsource Ġcode Ġmust Ġretain Ġthe Ġabove Ġcopyright Ċ Ġ* ĠĠĠĠĠĠ Ġnotice , Ġthis Ġlist Ġof Ġconditions Ġand Ġthe Ġfollowing Ġdisclaimer . Ċ Ġ* ĠĠĠĠ Ġ* ĠRedistributions Ġin Ġbinary Ġform Ġmust Ġreproduce Ġthe Ġabove Ġcopyright Ċ Ġ* ĠĠĠĠĠĠ Ġnotice , Ġthis Ġlist Ġof Ġconditions Ġand Ġthe Ġfollowing Ġdisclaimer Ġin Ġthe Ċ Ġ* ĠĠĠĠĠĠ Ġdocumentation Ġand / or Ġother Ġmaterials Ġprovided Ġwith Ġthe Ġdistribution . Ċ Ġ* ĠĠĠĠ Ġ* ĠNeither Ġthe Ġname Ġof ĠNull Non ame Ġnor Ġthe Ġnames Ġof Ġits Ċ Ġ* ĠĠĠĠĠĠ Ġcontributors Ġmay Ġbe Ġused Ġto Ġendorse Ġor Ġpromote Ġproducts Ġderived Ġfrom Ċ Ġ* ĠĠĠĠĠĠ Ġthis Ġsoftware Ġwithout Ġspecific Ġprior Ġwritten Ġpermission . Ċ Ġ* Ċ Ġ* ĠTHIS ĠSOFTWARE ĠIS ĠPROVIDED ĠBY ĠTHE ĠCOPYRIGHT ĠHOLDERS ĠAND ĠCONTRIBUTORS Ġ" AS ĠIS " Ċ Ġ* ĠAND ĠANY ĠEXPRESS ĠOR ĠIMPLIED ĠWARRANTIES , ĠINCLUDING , ĠBUT ĠNOT ĠLIMITED ĠTO , ĠTHE Ċ Ġ* ĠIMPLIED ĠWARRANTIES ĠOF ĠMERCHANTABILITY ĠAND ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE Ċ Ġ* ĠARE ĠDISCLAIMED . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE ĠCOPYRIGHT ĠOWNER ĠOR ĠCONTRIBUTORS ĠBE Ċ Ġ* ĠLIABLE ĠFOR ĠANY ĠDIRECT , ĠINDIRECT , ĠINCIDENTAL , ĠSPECIAL , ĠEXEMPLARY , ĠOR Ċ Ġ* ĠCONSEQUENTIAL ĠDAMAGES Ġ( INCLUDING , ĠBUT ĠNOT ĠLIMITED ĠTO , ĠPROCUREMENT ĠOF Ċ Ġ* ĠSUBSTITUTE ĠGOODS ĠOR ĠSERVICES ; ĠLOSS ĠOF ĠUSE , ĠDATA , ĠOR ĠPROFITS ; ĠOR ĠBUSINESS Ċ Ġ* ĠINTERRUPTION ) ĠHOWEVER ĠCAUSED ĠAND ĠON ĠANY ĠTHEORY ĠOF ĠLIABILITY , ĠWHETHER ĠIN Ċ Ġ* ĠCONTRACT , ĠSTRICT ĠLIABILITY , ĠOR ĠTORT Ġ( INCLUDING ĠNEGLIGENCE ĠOR ĠOTHERWISE ) Ċ Ġ* ĠARISING ĠIN ĠANY ĠWAY ĠOUT ĠOF ĠTHE ĠUSE ĠOF ĠTHIS ĠSOFTWARE , ĠEVEN ĠIF ĠADVISED ĠOF ĠTHE Ċ Ġ* ĠPOSSIBILITY ĠOF ĠSUCH ĠDAMAGE . Ċ Ġ*/ Ċ package Ġmu . nu . null po . game . subsystem . mode Ċ Ċ import Ġmu . nu . null po . game . component . B GM Status . B GM Ċ import Ġmu . nu . null po . game . component . Block Ċ import Ġmu . nu . null po . game . component . Controller Ċ import Ġmu . nu . null po . game . component . Piece Ċ import Ġmu . nu . null po . game . event . Event Receiver . COLOR Ċ import Ġmu . nu . null po . game . event . Event Receiver . FONT Ċ import Ġmu . nu . null po . game . play . Game Engine Ċ import Ġmu . nu . null po . gui . common . Base Font Ċ import Ġmu . nu . null po . util . Custom Properties Ċ import Ġmu . nu . null po . util . General Util Ċ import Ġmu . nu . null po . util . General Util . to Time Str Ċ import Ġnet . ome gab oshi . null pom ino . game . subsystem . random izer . N int endo Random izer Ċ Ċ /** ĠRET RO ĠCLASS IC Ġmode Ġ( Based Ġfrom ĠN ES , ĠOriginal Ġfrom ĠNull po UE Ġbuild Ġ 0 1 0 2 1 0 Ġby ĠZ ir cean ) Ġ*/ Ċ class ĠRet ro Classic : Abstract Mode () Ġ{ ĊĊ ĉ /** ĠAmount Ġof Ġpoints Ġyou Ġjust Ġget Ġfrom Ġline Ġclears Ġ*/ Ċ ĉ private Ġvar Ġlast score Ġ= Ġ 0 ĊĊ ĉ /** ĠE lapsed Ġtime Ġfrom Ġlast Ġline Ġclear Ġ( last score Ġis Ġdisplayed Ġto Ġscreen Ċĉ Ġ* Ġuntil Ġthis Ġreaches Ġto Ġ 1 2 0 ) Ġ*/ Ċ ĉ private Ġvar Ġsc get time Ġ= Ġ 0 ĊĊ ĉ /** ĠSelected Ġgame Ġtype Ġ*/ Ċ ĉ private Ġvar Ġgame type Ġ= Ġ 0 ĊĊ ĉ /** ĠSelected ĠSpeed ĠDiff iculty Ġ*/ Ċ ĉ private Ġvar Ġspeed type Ġ= Ġ 0 ĊĊ ĉ /** ĠSelected Ġstarting Ġlevel Ġ*/ Ċ ĉ private Ġvar Ġstart level Ġ= Ġ 0 ĊĊ ĉ /** ĠSelected Ġgarbage Ġheight Ġ*/ Ċ ĉ private Ġvar Ġstart height Ġ= Ġ 0 ĊĊ ĉ /** ĠUsed Ġfor Ġsoft Ġdrop Ġscoring Ġ*/ Ċ ĉ private Ġvar Ġs of td rops core Ġ= Ġ 0 ĊĊ ĉ /** ĠUsed Ġfor Ġhard Ġdrop Ġscoring Ġ*/ Ċ ĉ private Ġvar Ġhar dd rops core Ġ= Ġ 0 ĊĊ ĉ /** ĠNext Ġlevel Ġlines Ġ*/ Ċ ĉ private Ġvar Ġle v ell ines Ġ= Ġ 0 ĊĊ ĉ /** ĠBig Ġmode Ġon / off Ġ*/ Ċ ĉ private Ġvar Ġbig Ġ= Ġfalse ĊĊ ĉ /** ĠMax Ġinterval Ġof ĠI - piece Ġ*/ Ċ ĉ private Ġvar Ġdro ught Ġ= Ġ 0 Ċ ĉ private Ġval Ġdro ught s : Mutable List < Int > Ġ= Ġmutable ListOf () ĊĊ ĉ /** ĠYour Ġplace Ġon Ġleader board Ġ(- 1 : Ġout Ġof Ġrank ) Ġ*/ Ċ ĉ private Ġvar Ġranking Rank Ġ= Ġ 0 ĊĊ ĉ /** ĠScore Ġrecords Ġ*/ Ċ ĉ private Ġvar Ġranking Score : Array < IntArray > Ġ= ĠArray ( RAN K ING _ TYPE ) Ġ{ IntArray ( RAN K ING _ MAX )} ĊĊ ĉ /** ĠLine Ġrecords Ġ*/ Ċ ĉ private Ġvar Ġranking Lines : Array < IntArray > Ġ= ĠArray ( RAN K ING _ TYPE ) Ġ{ IntArray ( RAN K ING _ MAX )} ĊĊ ĉ /** ĠLevel Ġrecords Ġ*/ Ċ ĉ private Ġvar Ġranking Level : Array < IntArray > Ġ= ĠArray ( RAN K ING _ TYPE ) Ġ{ IntArray ( RAN K ING _ MAX )} ĊĊ ĉ /** ĠTime Ġrecords ĠRe aches ĠScore ĠMax - out Ġ 9 9 9 9 9 9 Ġ*/ Ċ ĉ private Ġvar Ġmax S cored Time : Int ? Ġ= Ġnull ĊĊ ĉ /** ĠReturns Ġthe Ġname Ġof Ġthis Ġmode Ġ*/ Ċ ĉ override Ġval Ġname Ġ= Ġ" Ret ro ĠClass ic Ġ. N " ĊĊ ĉ override Ġval Ġgame Intensity Ġ= Ġ- 1 ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġbe Ġcalled Ġwhen Ġthe Ġgame Ġent ers Ġthe Ġmain Ġgame Ċĉ Ġ* Ġscreen . Ġ*/ Ċ ĉ override Ġfun Ġplayer Init ( engine : Game Engine , Ġplayer ID : Int ) Ġ{ Ċĉ ĉ super . player Init ( engine , Ġplayer ID ) Ċĉ ĉ last score Ġ= Ġ 0 Ċĉ ĉ sc get time Ġ= Ġ 0 Ċĉ ĉ sof td rops core Ġ= Ġ 0 Ċĉ ĉ har dd rops core Ġ= Ġ 0 Ċĉ ĉ lev ell ines Ġ= Ġ 0 Ċĉ ĉ dro ught Ġ= Ġ 0 Ċĉ ĉ dro ught s . removeAll Ġ{ true } ĊĊĉ ĉ ranking Rank Ġ= Ġ- 1 Ċĉ ĉ ranking Score Ġ= ĠArray ( RAN K ING _ TYPE ) Ġ{ IntArray ( RAN K ING _ MAX )} Ċĉ ĉ ranking Lines Ġ= ĠArray ( RAN K ING _ TYPE ) Ġ{ IntArray ( RAN K ING _ MAX )} Ċĉ ĉ ranking Level Ġ= ĠArray ( RAN K ING _ TYPE ) Ġ{ IntArray ( RAN K ING _ MAX )} ĊĊĉ ĉ engine . run Ġ{ Ċĉĉ ĉ tw ist Enable Ġ= Ġfalse Ċĉĉ ĉ b 2 b Enable Ġ= Ġfalse Ċĉĉ ĉ split b 2 b Ġ= Ġfalse Ċĉĉ ĉ combo Type Ġ= ĠGame Engine . COM BO _ TYPE _ DISABLE Ċĉĉ ĉ b igh alf Ġ= Ġfalse Ċĉĉ ĉ big move Ġ= Ġfalse Ċĉĉ ĉ speed . are Ġ= Ġ 1 0 Ċĉĉ ĉ speed . are Line Ġ= Ġ 2 0 Ċĉĉ ĉ speed . line Delay Ġ= Ġ 2 0 Ċĉĉ ĉ ow Min D AS Ġ= Ġ- 1 Ċĉĉ ĉ ow Max D AS Ġ= Ġ- 1 Ċĉĉ ĉ ow SD Sp d Ġ= Ġ 1 Ċĉĉ ĉ rule Opt . next Display Ġ= Ġ 1 Ċĉĉ ĉ rule Opt . har dd rop Enable Ġ= Ġfalse ĊĊĉĉ ĉ ow Skin Ġ= Ġif ( speed type == 2 != start level >= 1 0 ) Ġ 8 Ġelse Ġ 9 Ċĉĉ ĉ ow Delay Cancel Ġ= Ġ 0 Ċĉ ĉ } Ċĉ ĉ if (! owner . replay Mode ) Ġ{ Ċĉĉ ĉ load Setting ( owner . mode Config ) Ċĉĉ ĉ load Ranking ( owner . record Prop , Ġengine . rule Opt . str Rule Name ) Ċĉ ĉ } Ġelse Ġload Setting ( owner . replay Prop ) ĊĊĉ ĉ engine . owner . background Status . bg Ġ= Ġstart level Ċĉ ĉ if ( engine . owner . background Status . bg > 1 9 ) Ġengine . owner . background Status . bg Ġ= Ġ 1 9 Ċĉ ĉ lev ell ines Ġ= Ġmin Of (( start level + 1 )* 1 0 , Ġmax Of ( 1 0 0 , Ġ( start level - 5 )* 1 0 )) Ċĉ ĉ engine . frame color Ġ= ĠGame Engine . FRAME _ SK IN _ GB Ċ ĉ } ĊĊ ĉ /** ĠSet Ġthe Ġgravity Ġspeed Ċĉ Ġ* Ġ@ param Ġengine ĠGame Engine Ġobject Ċĉ Ġ*/ Ċ ĉ private Ġfun Ġset Speed ( engine : Game Engine ) Ġ{ Ċĉ ĉ var Ġlv Ġ= Ġengine . statistics . level ĊĊĉ ĉ engine . ow Skin Ġ= Ġif ( speed type == 2 != lv >= 1 0 ) Ġ 8 Ġelse Ġ 9 Ċĉ ĉ if ( speed type > 0 ) Ġ{ Ċĉĉ ĉ lv Ġ= Ġmax Of ( 0 , Ġmin Of ( lv , Ġtable Denom inator Hard . size - 1 )) ĊĊĉĉ ĉ engine . speed . gravity Ġ= Ġif ( speed type > 1 ) Ġ 6 0 0 0 0 Ġelse Ġ 5 0 0 0 7 Ċĉĉ ĉ engine . speed . denom inator Ġ= Ġtable Denom inator Hard [ lv ]* 6 0 0 0 0 Ċĉĉ ĉ engine . speed . das Ġ= Ġ 1 2 Ċĉĉ ĉ engine . ow ARR Ġ= Ġ 4 Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ lv Ġ= Ġmax Of ( 0 , Ġmin Of ( lv , Ġtable Denom inator . size - 1 )) ĊĊĉĉ ĉ engine . speed . gravity Ġ= Ġ 6 0 1 Ċĉĉ ĉ engine . speed . denom inator Ġ= Ġtable Denom inator [ lv ]* 6 0 0 Ċĉĉ ĉ engine . speed . das Ġ= Ġ 1 6 Ċĉĉ ĉ engine . ow ARR Ġ= Ġ 6 Ċĉ ĉ } Ċĉ ĉ engine . speed . lock Delay Ġ= Ġengine . speed . denom inator / engine . speed . gravity ĊĊ ĉ } ĊĊ ĉ /** ĠMain Ġroutine Ġfor Ġgame Ġsetup Ġscreen Ġ*/ Ċ ĉ override Ġfun Ġon Setting ( engine : Game Engine , Ġplayer ID : Int ): Boolean Ġ{ Ċĉ ĉ // ĠMenu Ċĉ ĉ if (! engine . owner . replay Mode ) Ġ{ Ċĉĉ ĉ // ĠConfiguration Ġchanges Ċĉĉ ĉ val Ġchange Ġ= Ġupdate Cursor ( engine , Ġ 4 ) ĊĊĉĉ ĉ if ( change != 0 ) Ġ{ Ċĉĉĉ ĉ engine . play SE (" change ") ĊĊĉĉĉ ĉ when ( menu Cursor ) Ġ{ Ċĉĉĉĉĉ 0 Ġ-> Ġ{ Ċĉĉĉĉĉ ĉ game type Ġ+= Ġchange Ċĉĉĉĉĉ ĉ if ( game type < 0 ) Ġgame type Ġ= ĠGAME TYPE _ MAX - 1 Ċĉĉĉĉĉ ĉ if ( game type > GAME TYPE _ MAX - 1 ) Ġgame type Ġ= Ġ 0 Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ 1 Ġ-> Ġ{ Ċĉĉĉĉĉ ĉ speed type Ġ+= Ġchange Ċĉĉĉĉĉ ĉ if ( speed type < 0 ) Ġspeed type Ġ= ĠSPE ED _ MAX - 1 Ċĉĉĉĉĉ ĉ if ( speed type > SPEED _ MAX - 1 ) Ġspeed type Ġ= Ġ 0 Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ 2 Ġ-> Ġ{ Ċĉĉĉĉĉ ĉ start level Ġ+= Ġchange Ċĉĉĉĉĉ ĉ if ( start level < 0 ) Ġstart level Ġ= Ġ 1 9 Ċĉĉĉĉĉ ĉ if ( start level > 1 9 ) Ġstart level Ġ= Ġ 0 Ċĉĉĉĉĉ ĉ engine . owner . background Status . bg Ġ= Ġstart level Ċĉĉĉĉĉ ĉ lev ell ines Ġ= Ġmin Of (( start level + 1 )* 1 0 , Ġmax Of ( 1 0 0 , Ġ( start level - 5 )* 1 0 )) Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ 3 Ġ-> Ġ{ Ċĉĉĉĉĉ ĉ start height Ġ+= Ġchange Ċĉĉĉĉĉ ĉ if ( start height < 0 ) Ġstart height Ġ= Ġ 5 Ċĉĉĉĉĉ ĉ if ( start height > 5 ) Ġstart height Ġ= Ġ 0 Ċĉĉĉĉ ĉ } Ċĉĉĉĉĉ 4 Ġ-> Ġbig Ġ= Ġ! big Ċĉĉĉ ĉ } Ċĉĉ ĉ } ĊĊĉĉ ĉ // ĠCheck Ġfor ĠA Ġbutton , Ġwhen Ġpressed Ġthis Ġwill Ġbegin Ġthe Ġgame Ċĉĉ ĉ if ( engine . ctrl . is Push ( Controller . BUTTON _ A ) && menu Time >= 5 ) Ġ{ Ċĉĉĉ ĉ engine . play SE (" dec ide ") Ċĉĉĉ ĉ save Setting ( owner . mode Config ) Ċĉĉĉ ĉ owner . save Mode Config () Ċĉĉĉ ĉ return Ġfalse Ċĉĉ ĉ } ĊĊĉĉ ĉ // ĠCheck Ġfor ĠB Ġbutton , Ġwhen Ġpressed Ġthis Ġwill Ġshutdown Ġthe Ġgame Ġengine . Ċĉĉ ĉ if ( engine . ctrl . is Push ( Controller . BUTTON _ B )) Ġengine . quit flag Ġ= Ġtrue ĊĊĉĉ ĉ menu Time ++ Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ menu Time ++ Ċĉĉ ĉ menu Cursor Ġ= Ġ- 1 ĊĊĉĉ ĉ return Ġmenu Time < 6 0 Ċĉ ĉ } ĊĊĉ ĉ return Ġtrue Ċ ĉ } ĊĊ ĉ /** ĠR enders Ġgame Ġsetup Ġscreen Ġ*/ Ċ ĉ override Ġfun Ġrender Setting ( engine : Game Engine , Ġplayer ID : Int ) Ġ{ Ċĉ ĉ draw Menu ( engine , Ġplayer ID , Ġreceiver , Ġ 0 , ĠCOLOR . BLUE , Ġ 0 , Ġ" GAME ĠTYPE " Ġto ĠGAME TYPE _ NAME [ game type ], Ċĉĉ ĉ " DIFF IC UL TY " Ġto ĠSpeed Level . values ()[ speed type ]. show Name , Ċĉĉ ĉ " Level " Ġto ĠLE VEL _ NAME [ start level ], Ġ" HEIGHT " Ġto Ġstart height , Ġ" BIG " Ġto Ġbig ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Ready ( engine : Game Engine , Ġplayer ID : Int ): Boolean Ġ{ Ċĉ ĉ if ( engine . stat c [ 0 ]== 0 ) Ġ{ Ċĉĉ ĉ engine . run Ġ{ Ċĉĉĉ ĉ random izer Ġ= ĠN int endo Random izer () Ċĉĉĉ ĉ rule Opt . run Ġ{ Ċĉĉĉĉ ĉ rotate Initial Ġ= Ġfalse Ċĉĉĉĉ ĉ lock reset Move Ġ= Ġfalse Ċĉĉĉĉ ĉ sof td rop Lock Ġ= Ġtrue Ċĉĉĉĉ ĉ sof td rop Multiply Native Speed Ġ= Ġfalse Ċĉĉĉĉ ĉ sof td rop Gravity Speed Limit Ġ= Ġfalse Ċĉĉĉĉ ĉ hold Enable Ġ= Ġfalse Ċĉĉĉĉ ĉ das In ARE Ġ= Ġfalse Ċĉĉĉĉ ĉ das In Ready Ġ= Ġfalse Ċĉĉĉĉ ĉ das Charge On Blocked Move Ġ= Ġtrue Ċĉĉĉĉ ĉ das Store Charge On Neutral Ġ= Ġtrue Ċĉĉĉĉ ĉ das Redirect In Delay Ġ= Ġtrue Ċĉĉĉ ĉ } Ċĉĉ ĉ } ĊĊĊĉĉ ĉ engine . create Field IfNeeded () Ċĉĉ ĉ fill G arbage ( engine , Ġstart height ) Ċĉ ĉ } Ċĉ ĉ return Ġfalse Ċ ĉ } ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġbe Ġcalled Ġbefore Ġthe Ġgame Ġactually Ġbegins Ġ( after Ċĉ Ġ* ĠReady & Go Ġscreen Ġdis appe ars ) Ġ*/ Ċ ĉ override Ġfun Ġstart Game ( engine : Game Engine , Ġplayer ID : Int ) Ġ{ Ċĉ ĉ engine . statistics . level Ġ= Ġstart level Ċĉ ĉ engine . statistics . level Disp Add Ġ= Ġ 1 Ċĉ ĉ engine . big Ġ= Ġbig ĊĊĉ ĉ owner . bg m Status . bg m Ġ= ĠBG M . Ret ro N (( game type + start level )% 3 ) Ċĉ ĉ set Speed ( engine ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Move ( engine : Game Engine , Ġplayer ID : Int ): Boolean Ġ{ Ċĉ ĉ // Ġ æĸ° è¦ı ãĥĶ ãĥ¼ãĤ¹ åĩº çı¾ æĻĤ Ċĉ ĉ if ( engine . ending == 0 && engine . stat c [ 0 ]== 0 && ! engine . hold Disable ) Ċĉĉ ĉ if ( engine . run Ġ{ getNext Object Copy ( next Piece Count )} ?. type != Piece . Shape . I ) Ġdro ught ++ Ċĉĉ ĉ else Ġ{ Ċĉĉĉ ĉ if ( dro ught > 7 ) Ġdro ught s Ġ+= Ġdro ught Ċĉĉĉ ĉ dro ught Ġ= Ġ 0 Ċĉĉ ĉ } ĊĊĉ ĉ return Ġfalse Ċ ĉ } ĊĊ ĉ /** ĠR enders ĠH UD Ġ( leader board Ġor Ġgame Ġstatistics ) Ġ*/ Ċ ĉ override Ġfun Ġrender Last ( engine : Game Engine , Ġplayer ID : Int ) Ġ{ Ċĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 0 , Ġ" RET RO ĠCLASS IC ", ĠCOLOR . GREEN ) Ċĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 1 , Ġ" (${ SPEED _ NAME [ speed type ]} Ġ${ GAME TYPE _ NAME [ game type ]}) ", ĠCOLOR . GREEN ) ĊĊĉ ĉ if ( engine . stat == Game Engine . Status . SETTING || engine . stat == Game Engine . Status . RESULT && ! owner . replay Mode ) Ġ{ Ċĉĉ ĉ if (! owner . replay Mode && ! big && engine . ai == null ) Ġ{ Ċĉĉĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 3 , Ġ 3 , Ġ" SCORE ĠĠĠ ĠLINE ĠLV .", ĠCOLOR . BLUE ) ĊĊĉĉĉ ĉ for ( i Ġin Ġ 0 Ġuntil ĠR ANK ING _ MAX ) Ġ{ Ċĉĉĉĉ ĉ receiver . draw Score Grade ( engine , Ġplayer ID , Ġ 0 , Ġ 4 + i , ĠString . format ("% 2 d ", Ġi + 1 ), Ċĉĉĉĉĉ ĉ if ( ranking Rank == i ) ĠCOLOR . R AIN BO W Ġelse ĠCOLOR . YELLOW ) Ċĉĉĉĉ ĉ receiver . draw Score Num ( engine , Ġplayer ID , Ġ 3 , Ġ 4 + i , ĠGeneral Util . caps Integer ( ranking Score [ game type ][ i ], Ġ 6 ), Ġi == ranking Rank ) Ċĉĉĉĉ ĉ receiver . draw Score Num ( engine , Ġplayer ID , Ġ 1 2 , Ġ 4 + i , ĠGeneral Util . caps Integer ( ranking Lines [ game type ][ i ], Ġ 3 ), Ċĉĉĉĉĉ ĉ i == ranking Rank ) Ċĉĉĉĉ ĉ receiver . draw Score ( engine , Ġplayer ID , Ġ 1 7 , Ġ 4 + i , ĠLE VEL _ NAME [ ranking Level [ game type ][ i ]], Ċĉĉĉĉĉ ĉ font Ġ= Ġif ( ranking Level [ game type ][ i ]< 3 0 ) ĠF ONT . NUM Ġelse ĠF ONT . NORMAL , Ġflag Ġ= Ġi == ranking Rank ) Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 3 , Ġ" SCORE ${ if ( last score > 0 ) Ġ"( +$ last score )" Ġelse Ġ"" }", ĠCOLOR . BLUE ) Ċĉĉ ĉ receiver . draw Score ( engine , Ġplayer ID , Ġ 0 , Ġ 4 , ĠGeneral Util . caps Integer ( engine . statistics . score , Ġ 6 ), Ċĉĉĉ ĉ font Ġ= Ġif ( engine . statistics . score <= 9 9 9 9 9 9 ) ĠF ONT . NUM Ġelse ĠF ONT . NORMAL , Ġscale Ġ= Ġ 2 f ) ĊĊĉĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 6 , Ġ" LINE ", ĠCOLOR . BLUE ) Ċĉĉ ĉ receiver . draw Score ( engine , Ġplayer ID , Ġ 0 , Ġ 7 , Ġwhen ( game type ) Ġ{ Ċĉĉĉ ĉ GAME TYPE _ TYPE _ B Ġ-> ĠString . format (" -% 2 d ", Ġmax Of ( 2 5 - engine . statistics . lines , Ġ 0 )) Ċĉĉĉ ĉ else Ġ-> ĠGeneral Util . caps Integer ( engine . statistics . lines , Ġ 3 ) Ċĉĉ ĉ }, Ġif ( game type != GAME TYPE _ TYPE _ B && engine . statistics . lines < 9 9 9 ) ĠF ONT . NUM Ġelse ĠF ONT . NORMAL , Ġscale Ġ= Ġ 2 f ) ĊĊĉĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 9 , Ġ" Level ", ĠCOLOR . BLUE ) Ċĉĉ ĉ receiver . draw Score ( engine , Ġplayer ID , Ġ 0 , Ġ 1 0 , ĠLE VEL _ NAME [ engine . statistics . level ], Ċĉĉĉ ĉ if ( engine . statistics . level < 3 0 ) ĠF ONT . NUM Ġelse ĠF ONT . NORMAL , Ġscale Ġ= Ġ 2 f ) ĊĊĉĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 1 2 , Ġ" Time ", ĠCOLOR . BLUE ) Ċĉĉ ĉ receiver . draw Score Num ( engine , Ġplayer ID , Ġ 0 , Ġ 1 3 , Ġengine . statistics . time . to Time Str , Ġ 2 f ) ĊĊĉĉ ĉ receiver . draw Score Font ( engine , Ġplayer ID , Ġ 0 , Ġ 1 6 , Ġ" I - Piece ĠD ro ught ", ĠCOLOR . BLUE ) Ċĉĉ ĉ receiver . draw Score Num ( engine , Ġplayer ID , Ġ 0 , Ġ 1 7 , Ġ"$ dro ught Ġ/ Ġ${ max Of ( dro ught , Ġdro ught s . max OrNull () Ġ?: Ġ 0 )} ", Ġ 2 f ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġbe Ġcalled Ġwhen Ġthe Ġgame Ġtimer Ġupdates Ġ*/ Ċ ĉ override Ġfun Ġon Last ( engine : Game Engine , Ġplayer ID : Int ) Ġ{ Ċĉ ĉ sc get time ++ Ċ ĉ } ĊĊ ĉ /** ĠCalculates Ġline - clear Ġscore Ċĉ Ġ* Ġ( This Ġfunction Ġwill Ġbe Ġcalled Ġeven Ġif Ġno Ġlines Ġare Ġcleared ) Ġ*/ Ċ ĉ override Ġfun Ġcalc Score ( engine : Game Engine , Ġplayer ID : Int , Ġlines : Int ): Int Ġ{ Ċĉ ĉ sof td rops core Ġ/= Ġ 2 Ċĉ ĉ engine . statistics . score SD Ġ+= Ġs of td rops core Ċĉ ĉ sof td rops core Ġ= Ġ 0 ĊĊĉ ĉ engine . statistics . score HD Ġ+= Ġhar dd rops core Ċĉ ĉ har dd rops core Ġ= Ġ 0 ĊĊĉ ĉ // ĠLine Ġclear Ġscore Ċĉ ĉ var Ġpts Ġ= Ġ 0 Ċĉ ĉ // ĠLevel Ġup Ċĉ ĉ when Ġ{ Ċĉĉ ĉ lines == 1 Ġ-> Ġpts Ġ+= Ġ 4 0 *( engine . statistics . level + 1 ) Ġ// ĠSingle Ċĉĉ ĉ lines == 2 Ġ-> Ġpts Ġ+= Ġ 1 0 0 *( engine . statistics . level + 1 ) Ġ// ĠDouble Ċĉĉ ĉ lines == 3 Ġ-> Ġpts Ġ+= Ġ 3 0 0 *( engine . statistics . level + 1 ) Ġ// ĠTrip le Ċĉĉ ĉ lines >= 4 Ġ-> Ġpts Ġ+= Ġ 1 2 0 0 *( engine . statistics . level + 1 ) Ġ// ĠQu adr uple Ċĉ ĉ } ĊĊĉ ĉ // ĠB - TYPE Ġgame Ġcompleted Ċĉ ĉ if ( game type == GAME TYPE _ TYPE _ B && engine . statistics . lines >= 2 5 ) Ġ{ Ċĉĉ ĉ pts Ġ+= Ġ( engine . statistics . level + start height )* 1 0 0 0 Ċĉĉ ĉ engine . ending Ġ= Ġ 1 Ċĉĉ ĉ engine . game Ended () Ċĉ ĉ } ĊĊĉ ĉ // ĠAdd Ġscore Ġto Ġtotal Ċĉ ĉ if ( pts > 0 ) Ġ{ Ċĉĉ ĉ last score Ġ= Ġpts Ċĉĉ ĉ sc get time Ġ= Ġ 0 Ċĉĉ ĉ engine . statistics . score Line Ġ+= Ġpts Ċĉ ĉ } ĊĊĉ ĉ if ( game type != GAME TYPE _ AR RANGE && engine . statistics . score > 9 9 9 9 9 9 && max S cored Time == null ) Ġ{ Ċĉĉ ĉ max S cored Time Ġ= Ġengine . statistics . time Ċĉĉ ĉ engine . play SE (" appl ause 5 ") Ċĉ ĉ } ĊĊĉ ĉ // ĠUpdate Ġmeter Ċĉ ĉ if ( game type == GAME TYPE _ TYPE _ B ) Ġ{ Ċĉĉ ĉ engine . meter Value Ġ= Ġmin Of ( engine . statistics . lines , Ġ 2 5 )* receiver . get Meter Max ( engine )/ 2 5 Ċĉĉ ĉ engine . meter Color Ġ= Ġwhen Ġ{ Ċĉĉĉ ĉ engine . statistics . lines >= 2 0 Ġ-> ĠGame Engine . METER _ COLOR _ RED Ċĉĉĉ ĉ engine . statistics . lines >= 1 5 Ġ-> ĠGame Engine . METER _ COLOR _ OR ANGE Ċĉĉĉ ĉ engine . statistics . lines >= 1 0 Ġ-> ĠGame Engine . METER _ COLOR _ YELLOW Ċĉĉĉ ĉ else Ġ-> ĠGame Engine . METER _ COLOR _ GREEN Ċĉĉ ĉ } ĊĊĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ engine . meter Value Ġ= Ġengine . statistics . lines % 1 0 * receiver . get Meter Max ( engine )/ 9 Ċĉĉ ĉ engine . meter Color Ġ= ĠGame Engine . METER _ COLOR _ GREEN Ċĉĉ ĉ if ( engine . statistics . lines % 1 0 >= 2 ) Ġengine . meter Color Ġ= ĠGame Engine . METER _ COLOR _ YELLOW Ċĉĉ ĉ if ( engine . statistics . lines % 1 0 >= 5 ) Ġengine . meter Color Ġ= ĠGame Engine . METER _ COLOR _ OR ANGE Ċĉĉ ĉ if ( engine . statistics . lines % 1 0 >= 8 ) Ġengine . meter Color Ġ= ĠGame Engine . METER _ COLOR _ RED Ċĉ ĉ } ĊĊĉ ĉ if ( game type != GAME TYPE _ TYPE _ B && engine . statistics . lines >= lev ell ines ) Ġ{ Ċĉĉ ĉ // ĠLevel Ġup Ċĉĉ ĉ engine . statistics . level ++ ĊĊĉĉ ĉ lev ell ines Ġ+= Ġ 1 0 ĊĊĉĉ ĉ // engine . frame color Ġ= Ġengine . statistics . level Ċĉĉ ĉ if ( engine . statistics . level > 2 5 5 ) Ġ{ Ċĉĉĉ ĉ engine . statistics . level Ġ= Ġ 0 Ċĉĉ ĉ } ĊĊĉĉ ĉ owner . background Status . fade sw Ġ= Ġtrue Ċĉĉ ĉ owner . background Status . fade count Ġ= Ġ 0 ĊĊĉĉ ĉ owner . background Status . fade bg Ġ= Ġmax Of ( 0 , Ġmin Of ( 1 9 , Ġengine . statistics . level )) ĊĊĉĉ ĉ set Speed ( engine ) Ċĉĉ ĉ engine . play SE (" level up ") Ċĉ ĉ } Ċĉ ĉ return Ġpts Ċ ĉ } ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġbe Ġcalled Ġwhen Ġsoft - drop Ġis Ġused Ġ*/ Ċ ĉ override Ġfun Ġafter Soft Drop Fall ( engine : Game Engine , Ġplayer ID : Int , Ġfall : Int ) Ġ{ Ċĉ ĉ sof td rops core Ġ+= Ġfall Ċ ĉ } ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġbe Ġcalled Ġwhen Ġhard - drop Ġis Ġused Ġ*/ Ċ ĉ override Ġfun Ġafter Hard Drop Fall ( engine : Game Engine , Ġplayer ID : Int , Ġfall : Int ) Ġ{ Ċĉ ĉ har dd rops core Ġ+= Ġfall Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Game Over ( engine : Game Engine , Ġplayer ID : Int ): Boolean Ġ{ Ċĉ ĉ if ( engine . stat c [ 0 ]== 0 ) Ġ{ Ċĉĉ ĉ if ( dro ught > 7 ) Ġdro ught s Ġ+= Ġdro ught Ċĉĉ ĉ dro ught Ġ= Ġ 0 Ċĉ ĉ } Ċĉ ĉ return Ġfalse Ċ ĉ } ĊĊ ĉ /* Ġ çµĲæŀľ çĶ» éĿ¢ ãģ® åĩ¦çĲĨ Ġ*/ Ċ ĉ override Ġfun Ġon Result ( engine : Game Engine , Ġplayer ID : Int ): Boolean Ġ{ Ċĉ ĉ if ( engine . ctrl . is Menu Repeat Key ( Controller . BUTTON _ UP )) Ġ{ Ċĉĉ ĉ engine . stat c [ 1 ] -- Ċĉĉ ĉ if ( engine . stat c [ 1 ]< 0 ) Ġengine . stat c [ 1 ] Ġ= Ġ 2 Ċĉĉ ĉ engine . play SE (" change ") Ċĉ ĉ } Ċĉ ĉ if ( engine . ctrl . is Menu Repeat Key ( Controller . BUTTON _ DOWN )) Ġ{ Ċĉĉ ĉ engine . stat c [ 1 ] ++ Ċĉĉ ĉ if ( engine . stat c [ 1 ]> 2 ) Ġengine . stat c [ 1 ] Ġ= Ġ 0 Ċĉĉ ĉ engine . play SE (" change ") Ċĉ ĉ } ĊĊĉ ĉ return Ġfalse Ċ ĉ } ĊĊ ĉ /** ĠR enders Ġgame Ġresult Ġscreen Ġ*/ Ċ ĉ override Ġfun Ġrender Result ( engine : Game Engine , Ġplayer ID : Int ) Ġ{ Ċĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 0 , Ġ"${ Base Font . UP _ S }${ Base Font . DOWN _ S } ĠPAGE ${ engine . stat c [ 1 ]+ 1 }/ 2 ", ĠCOLOR . OR ANGE ) Ċĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 1 , Ġ" PLAY ĠDATA ", ĠCOLOR . OR ANGE ) ĊĊĉ ĉ if ( engine . stat c [ 1 ]== 0 ) Ġ{ Ċĉĉ ĉ draw Result Stats ( engine , Ġplayer ID , Ġreceiver , Ġ 3 , ĠCOLOR . BLUE , ĠStat istic . SCORE , ĠStat istic . LINES ) Ċĉĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 7 , Ġ" Level ", ĠCOLOR . BLUE ) Ċĉĉ ĉ val Ġstr Level Ġ= ĠString . format ("% 1 0 s ", ĠLE VEL _ NAME [ engine . statistics . level ]) Ċĉĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 8 , Ġstr Level ) Ċĉĉ ĉ draw Result Stats ( engine , Ġplayer ID , Ġreceiver , Ġ 9 , ĠCOLOR . BLUE , ĠStat istic . SPL ) Ċĉĉ ĉ draw Result Rank ( engine , Ġplayer ID , Ġreceiver , Ġ 1 5 , ĠCOLOR . BLUE , Ġranking Rank ) Ċĉĉ ĉ draw Result ( engine , Ġplayer ID , Ġreceiver , Ġ 1 1 , ĠCOLOR . BLUE , Ġ" QUAD %", ĠString . format ("% 3 d %% ", Ġengine . statistics . run Ġ{ Ċĉĉĉ ĉ total Quadr uple * 1 0 0 / max Of ( 1 , Ġtotal Quadr uple + total Single + total Double + total Triple + total Split Double + total Split Triple ) Ċĉĉ ĉ })) Ċĉ ĉ } Ġelse Ġ{ Ċĉĉ ĉ draw Result Stats ( engine , Ġplayer ID , Ġreceiver , Ġ 3 , ĠCOLOR . BLUE , ĠStat istic . TIME , ĠStat istic . L PM ) Ċĉĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 7 , Ġ" I - D ro ught s ", ĠCOLOR . BLUE ) Ċĉĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 8 , Ġ" Lon gest ", ĠCOLOR . BLUE , Ġ. 8 f ) Ċĉĉ ĉ receiver . draw Menu Num ( engine , Ġplayer ID , Ġ 0 , Ġ 8 , ĠString . format ("% 3 d ", Ġdro ught s . max OrNull () Ġ?: Ġ 0 ), Ġ 2 f ) Ċĉĉ ĉ receiver . draw Menu Font ( engine , Ġplayer ID , Ġ 0 , Ġ 1 0 , Ġ" Average ", ĠCOLOR . BLUE , Ġ. 8 f ) Ċĉĉ ĉ receiver . draw Menu Num ( engine , Ġplayer ID , Ġ 0 , Ġ 1 1 , ĠString . format ("% 3 f ", Ġdro ught s . average ()), Ġ 2 f ) Ċĉĉ ĉ draw Result ( engine , Ġplayer ID , Ġreceiver , Ġ 1 3 , ĠCOLOR . RED , Ġ" Burn outs ", Ċĉĉĉ ĉ String . format ("% 3 d ", Ġengine . statistics . run Ġ{ total Single + total Double + total Split Double + total Triple + total Split Triple })) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġbe Ġcalled Ġwhen Ġthe Ġreplay Ġdata Ġis Ġgoing Ġto Ġbe Ċĉ Ġ* Ġsaved Ġ*/ Ċ ĉ override Ġfun Ġsave Replay ( engine : Game Engine , Ġplayer ID : Int , Ġprop : Custom Properties ) Ġ{ Ċĉ ĉ save Setting ( prop ) ĊĊĉ ĉ // ĠChecks / Updates Ġthe Ġranking Ċĉ ĉ if (! owner . replay Mode && ! big && engine . ai == null ) Ġ{ Ċĉĉ ĉ update Ranking ( engine . statistics . score , Ġengine . statistics . lines , Ġengine . statistics . level , Ċĉĉĉ ĉ game type + speed type * GAME TYPE _ MAX ) ĊĊĉĉ ĉ if ( ranking Rank ! =- 1 ) Ġ{ Ċĉĉĉ ĉ save Ranking ( engine . rule Opt . str Rule Name ) Ċĉĉĉ ĉ owner . save Mode Config () Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ /** ĠLoad Ġthe Ġsettings Ġfrom Ġ[ prop ] Ġ*/ Ċ ĉ override Ġfun Ġload Setting ( prop : Custom Properties ) Ġ{ Ċĉ ĉ game type Ġ= Ġprop . getProperty (" ret rom ar athon . game type ", Ġ 0 ) Ċĉ ĉ speed type Ġ= Ġprop . getProperty (" ret rom ar athon . speed type ", Ġ 0 ) Ċĉ ĉ start level Ġ= Ġprop . getProperty (" ret rom ar athon . start level ", Ġ 0 ) Ċĉ ĉ start height Ġ= Ġprop . getProperty (" ret rom ar athon . start height ", Ġ 0 ) Ċĉ ĉ big Ġ= Ġprop . getProperty (" ret rom ar athon . big ", Ġfalse ) Ċ ĉ } ĊĊ ĉ /** ĠSave Ġthe Ġsettings Ċĉ Ġ* Ġ@ param Ġprop ĠCustom Properties Ċĉ Ġ*/ Ċ ĉ override Ġfun Ġsave Setting ( prop : Custom Properties ) Ġ{ Ċĉ ĉ prop . setProperty (" ret rom ar athon . game type ", Ġgame type ) Ċĉ ĉ prop . setProperty (" ret rom ar athon . speed type ", Ġspeed type ) Ċĉ ĉ prop . setProperty (" ret rom ar athon . start level ", Ġstart level ) Ċĉ ĉ prop . setProperty (" ret rom ar athon . start height ", Ġstart height ) Ċĉ ĉ prop . setProperty (" ret rom ar athon . big ", Ġbig ) Ċ ĉ } ĊĊ ĉ /** ĠLoad Ġthe Ġranking Ċĉ Ġ* Ġ@ param Ġprop ĠCustom Properties Ċĉ Ġ* Ġ@ param Ġrule Name ĠRule Ġname Ċĉ Ġ*/ Ċ ĉ override Ġfun Ġload Ranking ( prop : Custom Properties , Ġrule Name : String ) Ġ{ Ċĉ ĉ for ( i Ġin Ġ 0 Ġuntil ĠR ANK ING _ MAX ) Ċĉĉ ĉ for ( type Ġin Ġ 0 Ġuntil ĠR ANK ING _ TYPE ) Ġ{ Ċĉĉĉ ĉ ranking Score [ type ][ i ] Ġ= Ġprop . getProperty ("$ rule Name .$ type . score .$ i ", Ġ 0 ) Ċĉĉĉ ĉ ranking Lines [ type ][ i ] Ġ= Ġprop . getProperty ("$ rule Name .$ type . lines .$ i ", Ġ 0 ) Ċĉĉĉ ĉ ranking Level [ type ][ i ] Ġ= Ġprop . getProperty ("$ rule Name .$ type . level .$ i ", Ġ 0 ) Ċĉĉ ĉ } Ċ ĉ } ĊĊ ĉ /** ĠSave Ġthe Ġranking Ċĉ Ġ* Ġ@ param Ġrule Name ĠRule Ġname Ċĉ Ġ*/ Ċ ĉ private Ġfun Ġsave Ranking ( rule Name : String ) Ġ{ Ċĉ ĉ super . save Ranking ( rule Name , Ġ( 0 Ġuntil ĠR ANK ING _ TYPE ). flatMap Ġ{ j Ġ-> Ċĉĉ ĉ ( 0 Ġuntil ĠR ANK ING _ MAX ). flatMap Ġ{ i Ġ-> Ċĉĉĉ ĉ listOf ( Ċĉĉĉĉ ĉ "$ rule Name .$ j . score .$ i " Ġto Ġranking Score [ j ][ i ], Ċĉĉĉĉ ĉ "$ rule Name .$ j . lines .$ i " Ġto Ġranking Lines [ j ][ i ], Ċĉĉĉĉ ĉ "$ rule Name .$ j . level .$ i " Ġto Ġranking Level [ j ][ i ]) Ċĉĉ ĉ } Ċĉ ĉ }) Ċ ĉ } ĊĊ ĉ /** ĠUpdate Ġthe Ġranking Ċĉ Ġ* Ġ@ param Ġsc ĠScore Ċĉ Ġ* Ġ@ param Ġli ĠLines Ċĉ Ġ* Ġ@ param Ġlv ĠLevel Ċĉ Ġ* Ġ@ param Ġtype ĠGame Ġtype Ċĉ Ġ*/ Ċ ĉ private Ġfun Ġupdate Ranking ( sc : Int , Ġli : Int , Ġlv : Int , Ġtype : Int ) Ġ{ Ċĉ ĉ ranking Rank Ġ= Ġcheck Ranking ( sc , Ġli , Ġlv , Ġtype ) ĊĊĉ ĉ if ( ranking Rank ! =- 1 ) Ġ{ Ċĉĉ ĉ // ĠShift Ġthe Ġranking Ġdata Ċĉĉ ĉ for ( i Ġin ĠR ANK ING _ MAX - 1 Ġdown To Ġranking Rank + 1 ) Ġ{ Ċĉĉĉ ĉ ranking Score [ type ][ i ] Ġ= Ġranking Score [ type ][ i - 1 ] Ċĉĉĉ ĉ ranking Lines [ type ][ i ] Ġ= Ġranking Lines [ type ][ i - 1 ] Ċĉĉĉ ĉ ranking Level [ type ][ i ] Ġ= Ġranking Level [ type ][ i - 1 ] Ċĉĉ ĉ } ĊĊĉĉ ĉ // ĠInsert Ġa Ġnew Ġdata Ċĉĉ ĉ ranking Score [ type ][ ranking Rank ] Ġ= Ġsc Ċĉĉ ĉ ranking Lines [ type ][ ranking Rank ] Ġ= Ġli Ċĉĉ ĉ ranking Level [ type ][ ranking Rank ] Ġ= Ġlv Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ /** ĠThis Ġfunction Ġwill Ġcheck Ġthe Ġranking Ġand Ġreturns Ġwhich Ġplace Ġyou Ġare . Ċĉ Ġ* Ġ(- 1 : ĠOut Ġof Ġrank ) Ċĉ Ġ* Ġ@ param Ġsc ĠScore Ċĉ Ġ* Ġ@ param Ġli ĠLines Ċĉ Ġ* Ġ@ param Ġlv ĠLevel Ċĉ Ġ* Ġ@ return ĠPlace Ġ( First Ġplace Ġis Ġ 0 . Ġ- 1 Ġis ĠOut Ġof ĠRank ) Ċĉ Ġ*/ Ċ ĉ private Ġfun Ġcheck Ranking ( sc : Int , Ġli : Int , Ġlv : Int , Ġtype : Int ): Int Ġ{ Ċĉ ĉ for ( i Ġin Ġ 0 Ġuntil ĠR ANK ING _ MAX ) Ċĉĉ ĉ if ( sc > ranking Score [ type ][ i ]) Ġreturn Ġi Ċĉĉ ĉ else Ġif ( sc == ranking Score [ type ][ i ] && li > ranking Lines [ type ][ i ]) Ċĉĉĉ ĉ return Ġi Ċĉĉ ĉ else Ġif ( sc == ranking Score [ type ][ i ] && li == ranking Lines [ type ][ i ] && lv < ranking Level [ type ][ i ]) Ġreturn Ġi ĊĊĉ ĉ return Ġ- 1 Ċ ĉ } ĊĊ ĉ /** ĠFill Ġthe Ġplay field Ġwith Ġgarbage Ċĉ Ġ* Ġ@ param Ġengine ĠGame Engine Ċĉ Ġ* Ġ@ param Ġheight ĠG arbage Ġheight Ġlevel Ġnumber Ċĉ Ġ*/ Ċ ĉ private Ġfun Ġfill G arbage ( engine : Game Engine , Ġheight : Int ) Ġ{ Ċĉ ĉ val Ġh Ġ= Ġengine . field . height Ċĉ ĉ val Ġstart Height Ġ= Ġh - 1 Ċĉ ĉ var Ġf : Float Ċĉ ĉ for ( y Ġin Ġstart Height Ġdown To Ġh - table G arbage Height [ height ]) Ċĉĉ ĉ for ( x Ġin Ġ 0 Ġuntil Ġengine . field . width ) Ġ{ Ċĉĉĉ ĉ f Ġ= Ġengine . random . next Float () Ċĉĉĉ ĉ if ( f < 0 . 5 ) Ċĉĉĉĉ ĉ engine . field . set Block ( x , Ġy , ĠBlock (( f * 1 4 ). toInt ()+ 2 , Ġengine . skin , ĠBlock . ATTRIBUTE . VISIBLE , ĠBlock . ATTRIBUTE . G ARB AGE )) Ċĉĉ ĉ } Ċ ĉ } ĊĊ ĉ comp anion Ġobject Ġ{ ĊĊĉ ĉ /** ĠDen om inator Ġtable Ġ( NT SC - U ) Ġ*/ Ċĉ ĉ private Ġval Ġtable Denom inator Ġ= Ġint ArrayOf ( Ċĉĉ ĉ // ĉ 0 ĠĠ 1 ĠĠ 2 ĠĠ 3 ĠĠ 4 ĠĠ 5 ĠĠ 6 ĠĠ 7 ĠĠ 8 ĠĠ 9 ĠĠĠ Ġ+ xx Ċĉĉĉ 4 8 , Ġ 4 3 , Ġ 3 8 , Ġ 3 3 , Ġ 2 8 , Ġ 2 3 , Ġ 1 8 , Ġ 1 3 , Ġ 8 , Ġ 6 , Ġ// Ġ 0 0 Ċĉĉĉ 5 , Ġ 5 , Ġ 5 , Ġ 4 , Ġ 4 , Ġ 4 , Ġ 3 , Ġ 3 , Ġ 3 , Ġ 2 , Ġ// Ġ 1 0 Ċĉĉĉ 2 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 1 Ġ// Ġ 2 0 Ċĉ ĉ ) ĊĊĉ ĉ /** ĠDen om inator Ġtable Ġ( Arrange ) Ġ*/ Ċĉ ĉ private Ġval Ġtable Denom inator Hard Ġ= Ġint ArrayOf ( Ċĉĉ ĉ // ĉ 0 ĠĠ 1 ĠĠ 2 ĠĠ 3 ĠĠ 4 ĠĠ 5 ĠĠ 6 ĠĠ 7 ĠĠ 8 ĠĠ 9 ĠĠĠ Ġ+ xx Ċĉĉĉ 3 6 , Ġ 3 2 , Ġ 2 9 , Ġ 2 5 , Ġ 2 2 , Ġ 1 8 , Ġ 1 5 , Ġ 1 1 , Ġ 7 , Ġ 5 , Ġ// Ġ 0 0 Ċĉĉĉ 4 , Ġ 4 , Ġ 4 , Ġ 3 , Ġ 3 , Ġ 3 , Ġ 2 , Ġ 2 , Ġ 2 , Ġ 1 , Ġ// Ġ 1 0 Ċĉ ĉ ) Ċĉ ĉ /** ĠG arbage Ġheight Ġtable Ġ*/ Ċĉ ĉ private Ġval Ġtable G arbage Period Ġ= Ġint ArrayOf ( 6 , Ġ 5 ) Ċĉ ĉ /** ĠG arbage Ġheight Ġtable Ġ*/ Ċĉ ĉ private Ġval Ġtable G arbage Height Ġ= Ġint ArrayOf ( 0 , Ġ 3 , Ġ 5 , Ġ 8 , Ġ 1 0 , Ġ 1 2 ) ĊĊĉ ĉ /** ĠGame Ġtypes Ġ*/ Ċĉ ĉ private Ġenum Ġclass ĠGame Type ( val Ġshow Name : String ) Ġ{ ĠA (" A - "), ĠB (" B + "), ĠC (" C # ") Ġ} ĊĊĉ ĉ /** ĠNumber Ġof Ġgame Ġtypes Ġ*/ Ċĉ ĉ private Ġval ĠGAME TYPE _ MAX Ġ= ĠGame Type . values (). size ĊĊĉ ĉ /** ĠGame Ġtype Ġname Ġ*/ Ċĉ ĉ private Ġval ĠGAME TYPE _ NAME Ġ= ĠGame Type . values (). map Ġ{ it . show Name } ĊĊĉ ĉ private Ġval ĠGAME TYPE _ TYPE _ A Ġ= ĠGame Type . A . ordinal Ċĉ ĉ private Ġval ĠGAME TYPE _ TYPE _ B Ġ= ĠGame Type . B . ordinal Ċĉ ĉ private Ġval ĠGAME TYPE _ AR RANGE Ġ= ĠGame Type . C . ordinal ĊĊĉ ĉ /** ĠSpeed Ġtypes Ġ*/ Ċĉ ĉ private Ġenum Ġclass ĠSpeed Level ( title : String ? Ġ= Ġnull ) Ġ{ Ċĉĉ ĉ NT SC , ĠPAL , ĠPAL _ RAW (" PAL ĠH ARD "); ĊĊĉĉ ĉ val Ġshow Name : String Ġ= Ġtitle Ġ?: Ġname Ċĉ ĉ } Ċĉ ĉ /** ĠNumber Ġof Ġspeed Ġtypes Ġ*/ Ċĉ ĉ private Ġval ĠSPE ED _ MAX Ġ= ĠSpeed Level . values (). size ĊĊĉ ĉ /** ĠSpeed Ġtype Ġname Ġ*/ Ċĉ ĉ private Ġval ĠSPE ED _ NAME Ġ= ĠSpeed Level . values (). map Ġ{ it . show Name } ĊĊĉ ĉ /** ĠNumber Ġof Ġranking Ġrecords Ġ*/ Ċĉ ĉ private Ġconst Ġval ĠR ANK ING _ MAX Ġ= Ġ 1 3 ĊĊĉ ĉ /** ĠNumber Ġof Ġranking Ġtypes Ġ*/ Ċĉ ĉ private Ġval ĠR ANK ING _ TYPE Ġ= ĠGAME TYPE _ MAX * Speed Level . values (). size ĊĊĉ ĉ /** ĠMaximum - Level Ġname Ġtable Ġ*/ Ċĉ ĉ private Ġval ĠLE VEL _ NAME Ġ= ĠarrayOf ( Ċĉĉ ĉ // ĠĠĠĠ 0 ĠĠĠĠ 1 ĠĠĠĠ 2 ĠĠĠĠ 3 ĠĠĠĠ 4 ĠĠĠĠ 5 ĠĠĠĠ 6 ĠĠĠĠ 7 ĠĠĠĠ 8 ĠĠĠĠ 9 ĠĠĠĠĠ Ġ+ xx Ċĉĉ ĉ " 0 0 ", Ġ" 0 1 ", Ġ" 0 2 ", Ġ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