import Ġcom . google . common . base . Charsets Ċ import Ġcom . google . common . io . File Write Mode Ċ import Ġcom . google . common . io . Files Ċ import Ġcom . google . common . primitives . Long s Ċ import Ġcom . google . common . primitives . Short s Ċ import Ġde . planet builder . un official hyp ixel api . data . sky block data . auction s . Auction Related Data Ċ import Ġde . planet builder . un official hyp ixel api . data . sky block data . auction s . Sky Block Auction Ċ import Ġkotlinx . serialization . Serialization Exception Ċ import Ġkotlinx . serialization . encode ToString Ċ import Ġkotlinx . serialization . json . Json Ċ import Ġmanagers . Http Manager Ċ import Ġorg . http 4 k . lens . Path Ċ import Ġjava . io . File Ċ import Ġjava . io . IOException Ċ import Ġjava . nio . ByteBuffer Ċ import Ġjava . util .* Ċ import Ġkotlin . system . measure Time Millis Ċ Ċ val Ġrequesting Path Ġ= ĠPath . of (" request ing ") Ċ val Ġwebsocket s Handler : ĠMutable List <( String ) Ġ-> ĠUnit > Ġ= Ġmutable ListOf () ĊĊĊ Ċ fun Ġmain () Ġ{ ĊĠĠĠ Ġval Ġmanager Ġ= ĠHttp Manager () ĊĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġval Ġws : ĠW s Handler Ġ= Ġwebsocket s ("/ { request ing }" Ġbind Ġ{ Ġws : ĠWeb socket Ġ-> Ġws . send ( Ws Message ( Json . encode ToString ( all Data (" compact - god - pot - data . bin ")) )) }) ĊĠĠĠ Ġval Ġhttp Ġ= Ġ{ _: ĠRequest Ġ-> ĠResponse ( OK ). body (" This Ġis Ġwebsocket s Ġlo l ") Ġ} ĊĠĠĠ ĠPoly Handler ( http , Ġws ). as Server ( Jet ty ( 9 0 0 0 )). start () ĊĊĊĊĠĠĠ Ġprintln (" started Ġon Ġport Ġ 9 0 0 0 ") ĊĊĠĠĠ Ġprintln ( Date ( System . currentTimeMillis ()). toString ()) ĊĊĠĠĠ Ġval Ġtimer Ġ= ĠTimer () ĊĠĠĠ Ġtimer . schedule ( Update God Pot Data (), Ġ 0 , Ġ 6 0 0 0 0 ) ĊĊĠĠĠ Ġwhile Ġ( true ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠThread . sleep ( 2 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠInterruptedException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd Data ToFile (" errors ", Date ( System . currentTimeMillis ()). toString () Ġ+ Ġ"\ n \ n " Ġ+ Ġe . stack Trace ToString () Ġ+ Ġ"\ n \ n \ n \ n \ n ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġ*/ Ċ } Ċ Ċ class ĠUpdate God Pot Data Ġ: ĠTimer Task () Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġrun () Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprintln ("\ n updating ...") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprintln (" Time Ġupdate Ġtook : Ġ${ measure Time Millis Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġauction Listener Ġ= ĠA uction Related Data () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġauction Listener . get Auction s Data () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠSerialization Exception ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd Data ToFile (" errors ", Date ( System . currentTimeMillis ()). toString () Ġ+ Ġ"\ n \ n " Ġ+ Ġe . stack Trace ToString () Ġ+ Ġ"\ n \ n \ n \ n \ n ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġgod Pot Offers Ġ= Ġmutable ListOf < Sky Block Auction >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġdata . auction s . indices ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( data . auction s [ i ]. item _ name Ġ== Ġ" God ĠP otion " Ġ&& Ġdata . auction s [ i ]. bin Ġ&& Ġdata . auction s [ i ]. bids . isEmpty ()) Ġgod Pot Offers . add ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdata . auction s [ i ] ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Offers . sortBy Ġ{ Ġit . starting _ bid Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġvar Ġindex Ġ= Ġgod Pot Offers . size - 1 ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhile Ġ( index Ġ>= Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( god Pot Offers [ index ]. starting _ bid Ġ> Ġgod Pot Offers [ 0 ]. starting _ bid + 5 0 0 0 0 0 ) Ġgod Pot Offers . remove At ( index ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġindex -- ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġprices Ġ= Ġmutable ListOf < Long >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġgod Pot Offers . indices ) Ġprices . add ( god Pot Offers [ i ]. starting _ bid ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbox plot Values Ġ= ĠArray ( 6 ){ 0 . 0 } ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġbox plot Values . indices ) Ġbox plot Values [ i ] Ġ= Ġget Box plot Values ( god Pot Offers )[" q $ i "] !! ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprintln (" total Ġactive Ġoffers Ġunder Ġ${ god Pot Offers [ 0 ]. starting _ bid + 5 0 0 0 0 0 }: Ġ${ god Pot Offers . size }") ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġgod Pot Data Ġ= ĠGod Pot Data ( getActive Offers Between ( god Pot Offers ), Ġprices , Ġbox plot Values , ĠSystem . currentTimeMillis ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwrite Binary File ( god Pot Data , Ġ" data - validity - test . bin ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠJson . encode ToString ( all Data (" data - validity - test . bin ")) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġjava . nio . file . Files . delete ( java . nio . file . Path . of (" data - validity - test . bin ")) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwrite Binary File ( god Pot Data , Ġ" compact - god - pot - data . bin ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġjava . nio . file . Files . delete ( java . nio . file . Path . of (" data - validity - test . bin ")) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}} ms ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprintln ( Date ( System . currentTimeMillis ()). toString ()) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprintln (" Error Ġoccurred .") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Data ToFile (" errors ", Date ( System . currentTimeMillis ()). toString () Ġ+ Ġ"\ n \ n " Ġ+ Ġe . stack Trace ToString () Ġ+ Ġ"\ n \ n \ n \ n \ n ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprintln () ĊĠĠĠ Ġ} Ċ } ĊĊĊ Ċ fun Ġadd Data ToFile ( filePath : ĠString , Ġmessage : ĠString ) Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠ ĠFile ( filePath ). createNew File () ĊĠĠĠĠĠĠĠ ĠFiles . as Char Sink ( File ( filePath ), ĠChar sets . UTF _ 8 , ĠFile Write Mode . APPEND ). write ( message ) ĊĠĠĠ Ġ} Ġcatch Ġ( e : ĠIOException ) Ġ{ ĊĠĠĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun Ġall Data ( filePath : ĠString ) Ġ: ĠArray < God Pot Data Compact > Ġ{ ĊĠĠĠ ĠJson . encode ToString ( read Binary File ( File ( filePath ). length ()/ 5 6 - 1 , ĠfilePath )) ĊĠĠĠ Ġval Ġall Data Ġ= Ġmutable ListOf < God Pot Data Compact >() ĊĠĠĠ Ġfor Ġ( i Ġin Ġ 0 Ġuntil ĠFile ( filePath ). length ()/ 5 6 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġall Data . add ( read Binary File ( i , ĠfilePath )) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġall Data . to Typed Array () Ċ } Ċ Ċ fun Ġread Binary File ( index : ĠLong , ĠfilePath : ĠString ) Ġ: ĠGod Pot Data Compact Ġ{ ĊĠĠĠ Ġval Ġbytes : ĠByteArray Ġ= ĠFiles . as Byte Source ( File ( filePath )). read () ĊĠĠĠ Ġvar Ġi Ġ= Ġ 0 ĊĠĠĠ Ġval Ġactive Offers Between Ġ= ĠArray < Short >( 1 2 ) Ġ{ 0 } ĊĠĠĠ Ġwhile Ġ( i Ġ< Ġ 2 4 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġactive Offers Between [ i / 2 ] Ġ= ĠShort s . from Bytes ( bytes [ index . toInt ()* 5 6 + i ], Ġbytes [ index . toInt ()* 5 6 + i + 1 ]) ĊĠĠĠĠĠĠĠ Ġi += 2 ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġbox plot Values Ġ= ĠArray ( 6 ){ 0 f } ĊĠĠĠ Ġwhile Ġ( i Ġ< Ġ 4 8 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbox plot Values [( i - 2 4 )/ 4 ] Ġ= ĠByteBuffer . wrap ( array Of ( bytes [ index . toInt ()* 5 6 + i ], bytes [ index . toInt ()* 5 6 + i + 1 ], bytes [ index . toInt ()* 5 6 + i + 2 ], bytes [ index . toInt ()* 5 6 + i + 3 ]). toByteArray ()). float ĊĠĠĠĠĠĠĠ Ġi += 4 ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġtimestamp Ġ= ĠLong s . from ByteArray ( bytes . slice ( index . toInt ()* 5 6 + 4 8 Ġuntil Ġindex . toInt ()* 5 6 + 5 6 ). toByteArray ()) ĊĠĠĠ Ġreturn ĠGod Pot Data Compact ( active Offers Between , Ġbox plot Values , Ġtimestamp ) Ċ } Ċ Ċ fun Ġwrite Binary File ( god Pot Data : ĠGod Pot Data , ĠfilePath : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġgod Pot Data Compact Ġ= ĠGod Pot Data Compact ( ĊĠĠĠĠĠĠĠ ĠarrayOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" u 6 0 0 0 0 0 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 6 0 0 0 0 1 u 6 4 9 9 9 8 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 6 4 9 9 9 9 u 6 5 0 0 0 0 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 6 5 0 0 0 1 u 6 8 9 9 9 9 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 6 9 0 0 0 0 u 6 9 8 9 9 8 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 6 9 8 9 9 9 u 7 0 0 0 0 0 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 7 0 0 0 0 1 u 7 4 9 9 9 8 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 7 4 9 9 9 9 u 7 5 0 0 0 0 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 7 5 0 0 0 1 u 7 8 9 9 9 9 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 7 9 0 0 0 0 u 7 9 8 9 9 8 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" 7 9 8 9 9 9 u 8 0 0 0 0 0 "] !!. to Short (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . active Offers Between [" o 8 0 0 0 0 1 "] !!. to Short () ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ ĠarrayOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . box plot Values [ 0 ]. toFloat (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . box plot Values [ 1 ]. toFloat (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . box plot Values [ 2 ]. toFloat (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . box plot Values [ 3 ]. toFloat (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . box plot Values [ 4 ]. toFloat (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgod Pot Data . box plot Values [ 5 ]. toFloat () ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġgod Pot Data . timestamp ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġbytes Ġ= ĠByteBuffer . allocate ( 5 6 ) ĊĠĠĠ Ġfor Ġ( i Ġin Ġgod Pot Data Compact . offer Numbers . indices ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbytes . put Short ( god Pot Data Compact . offer Numbers [ i ]) ĊĠĠĠ Ġ} ĊĠĠĠ Ġfor Ġ( i Ġin Ġgod Pot Data Compact . box plot Values . indices ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbytes . put Float ( god Pot Data Compact . box plot Values [ i ]) ĊĠĠĠ Ġ} ĊĠĠĠ Ġbytes . put Long ( god Pot Data Compact . timestamp ) ĊĠĠĠ Ġval ĠbyteArray Ġ= ĠByteArray ( 5 6 ) ĊĠĠĠ Ġfor Ġ( i Ġin ĠbyteArray . indices ) Ġ{ ĊĠĠĠĠĠĠĠ ĠbyteArray [ i ] Ġ= Ġbytes [ i ] ĊĠĠĠ Ġ} ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠ ĠFile ( filePath ). createNew File () ĊĠĠĠĠĠĠĠ ĠFiles . as Byte Sink ( File ( filePath ), ĠFile Write Mode . APPEND ). write ( byteArray ) ĊĠĠĠ Ġ} Ġcatch Ġ( e : ĠIOException ) Ġ{ ĊĠĠĠĠĠĠĠ Ġadd Data ToFile (" errors ", Date ( System . currentTimeMillis ()). toString () Ġ+ Ġ"\ n \ n " Ġ+ Ġe . stack Trace ToString () Ġ+ Ġ"\ n \ n \ n \ n \ n ") ĊĠĠĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun Ġget Active Offers Between ( offers : ĠMutable List < Sky Block Auction >): ĠHashMap < String , ĠInt > Ġ{ ĊĠĠĠ Ġval Ġactive Offers Between Ġ= ĠHashMap < String , ĠInt >() ĊĠĠĠ Ġactive Offers Between [" u 6 0 0 0 0 0 "] Ġ= Ġvalues Between ( offers , Ġ 0 , Ġ 6 0 0 0 0 0 ) ĊĠĠĠ Ġactive Offers Between [" 6 0 0 0 0 1 u 6 4 9 9 9 8 "] Ġ= Ġvalues Between ( offers , Ġ 6 0 0 0 0 1 , Ġ 6 4 9 9 9 8 ) ĊĠĠĠ Ġactive Offers Between [" 6 4 9 9 9 9 u 6 5 0 0 0 0 "] Ġ= Ġvalues Between ( offers , Ġ 6 4 9 9 9 9 , Ġ 6 5 0 0 0 0 ) ĊĠĠĠ Ġactive Offers Between [" 6 5 0 0 0 1 u 6 8 9 9 9 9 "] Ġ= Ġvalues Between ( offers , Ġ 6 5 0 0 0 1 , Ġ 6 8 9 9 9 9 ) ĊĠĠĠ Ġactive Offers Between [" 6 9 0 0 0 0 u 6 9 8 9 9 8 "] Ġ= Ġvalues Between ( offers , Ġ 6 9 0 0 0 0 , Ġ 6 9 8 9 9 8 ) ĊĠĠĠ Ġactive Offers Between [" 6 9 8 9 9 9 u 7 0 0 0 0 0 "] Ġ= Ġvalues Between ( offers , Ġ 6 9 8 9 9 9 , Ġ 7 0 0 0 0 0 ) ĊĠĠĠ Ġactive Offers Between [" 7 0 0 0 0 1 u 7 4 9 9 9 8 "] Ġ= Ġvalues Between ( offers , Ġ 7 0 0 0 0 1 , Ġ 7 4 9 9 9 8 ) ĊĠĠĠ Ġactive Offers Between [" 7 4 9 9 9 9 u 7 5 0 0 0 0 "] Ġ= Ġvalues Between ( offers , Ġ 7 4 9 9 9 9 , Ġ 7 5 0 0 0 0 ) ĊĠĠĠ Ġactive Offers Between [" 7 5 0 0 0 1 u 7 8 9 9 9 9 "] Ġ= Ġvalues Between ( offers , Ġ 7 5 0 0 0 1 , Ġ 7 8 9 9 9 9 ) ĊĠĠĠ Ġactive Offers Between [" 7 9 0 0 0 0 u 7 9 8 9 9 8 "] Ġ= Ġvalues Between ( offers , Ġ 7 9 0 0 0 0 , Ġ 7 9 8 9 9 8 ) ĊĠĠĠ Ġactive Offers Between [" 7 9 8 9 9 9 u 8 0 0 0 0 0 "] Ġ= Ġvalues Between ( offers , Ġ 7 9 8 9 9 9 , Ġ 8 0 0 0 0 0 ) ĊĠĠĠ Ġactive Offers Between [" o 8 0 0 0 0 1 "] Ġ= Ġvalues Between ( offers , Ġ 7 9 8 9 9 9 , Ġ 1 0 0 0 0 0 0 0 ) ĊĠĠĠ Ġreturn Ġactive Offers Between Ċ } Ċ Ċ fun Ġvalues Between ( auction s : ĠMutable List < Sky Block Auction >, Ġmin : ĠLong , Ġmax : ĠLong ) Ġ: ĠInt Ġ{ ĊĠĠĠ Ġvar Ġvalues Between Ġ= Ġ 0 ĊĠĠĠ Ġfor Ġ( i Ġin Ġauction s . indices ) Ġif Ġ( auction s [ i ]. starting _ bid Ġin Ġmin .. max ) Ġvalues Between ++ ĊĠĠĠ Ġreturn Ġvalues Between Ċ } Ċ Ċ fun Ġget Box plot Values ( offers : ĠMutable List < Sky Block Auction >): ĠHashMap < String , ĠDouble >{ ĊĠĠĠ Ġval Ġret Ġ= ĠHashMap < String , ĠDouble >() ĊĠĠĠ Ġret [" q 0 "] Ġ= Ġoffers [ 0 ]. starting _ bid . toDouble () ĊĠĠĠ Ġret [" q 4 "] Ġ= Ġoffers [ offers . last Index ]. starting _ bid . toDouble () ĊĠĠĠ Ġif Ġ( offers . size Ġ% Ġ 2 Ġ!= Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġret [" q 2 "] Ġ= Ġoffers [( offers . size - 1 )/ 2 ]. starting _ bid . toDouble () ĊĠĠĠĠĠĠĠ Ġif Ġ(( offers . size + 1 )/ 2 Ġ% Ġ 2 Ġ!= Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 1 "] Ġ= Ġoffers [( offers . size - 1 )/ 4 ]. starting _ bid . toDouble () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 3 "] Ġ= Ġoffers [ offers . size - (( offers . size + 3 )/ 4 )]. starting _ bid . toDouble () ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 1 "] Ġ= Ġ( offers [( offers . size + 1 )/ 4 ]. starting _ bid . toDouble () Ġ+ Ġoffers [( offers . size - 3 )/ 4 ]. starting _ bid . toDouble ()) / 2 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 3 "] Ġ= Ġ( offers [ offers . size -( offers . size + 5 )/ 4 ]. starting _ bid . toDouble () Ġ+ Ġoffers [ offers . size -( offers . size + 1 )/ 4 ]. starting _ bid . toDouble ()) / 2 ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġret [" q 2 "] Ġ= Ġ( offers [ offers . size / 2 - 1 ]. starting _ bid . toDouble () Ġ+ Ġoffers [ offers . size / 2 ]. starting _ bid . toDouble ()) / 2 ĊĠĠĠĠĠĠĠ Ġif Ġ( offers . size / 2 Ġ% Ġ 2 Ġ!= Ġ 0 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 1 "] Ġ= Ġoffers [( offers . size - 2 )/ 4 ]. starting _ bid . toDouble () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 3 "] Ġ= Ġoffers [ offers . size - (( offers . size + 2 )/ 4 )]. starting _ bid . toDouble () ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 1 "] Ġ= Ġ( offers [ offers . size / 4 ]. starting _ bid . toDouble () Ġ+ Ġoffers [ offers . size / 4 - 1 ]. starting _ bid . toDouble ()) / 2 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġret [" q 3 "] Ġ= Ġ( offers [ offers . size -( offers . size / 4 + 1 )]. starting _ bid . toDouble () Ġ+ Ġoffers [ offers . size -( offers . size / 4 )]. starting _ bid . toDouble ()) / 2 ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġret [" q 5 "] Ġ= Ġ 0 . 0 ĊĠĠĠ Ġfor Ġ( i Ġin Ġ 0 Ġuntil Ġoffers . size / 1 0 ) Ġ{ ĊĠĠĠĠĠĠĠ Ġret [" q 5 "] Ġ= Ġret [" q 5 "] !!. plus ( offers [ i ]. starting _ bid . toDouble ()) ĊĠĠĠ Ġ} ĊĠĠĠ Ġret [" q 5 "] Ġ= Ġret [" q 5 "] !!. div ( offers . size / 1 0 ) ĊĊĠĠĠ Ġreturn Ġret Ċ }