package Ġcom . j sc isco . lom Ċ Ċ import Ġcom . j sc isco . lom . builders . Entity Factory Ċ import Ġcom . j sc isco . lom . configuration . Game Configuration Ċ import Ġcom . j sc isco . lom . d ungeon . D ungeon Builder Ċ import Ġcom . j sc isco . lom . d ungeon . Game Context Ċ import Ġcom . j sc isco . lom . d ungeon . state . Player Turn State Ċ import Ġcom . j sc isco . lom . d ungeon . state . State Ċ import Ġcom . j sc isco . lom . d ungeon . str ategies . Generic D ungeon Strategy Ċ import Ġcom . j sc isco . lom . events . Quit Game Event Ċ import Ġcom . j sc isco . lom . extensions . add At Empty Position Ċ import Ġcom . j sc isco . lom . view . D ungeon View Ċ import Ġorg . hex works . cob alt . events . api . subscribe Ċ import Ġorg . hex works . cob alt . logging . api . Logger Ċ import Ġorg . hex works . cob alt . logging . api . LoggerFactory Ċ import Ġorg . hex works . z ir con . api . Swing Applications Ċ import Ġorg . hex works . z ir con . api . data . impl . Size 3 D Ċ import Ġorg . hex works . z ir con . api . extensions . handle Keyboard Events Ċ import Ġorg . hex works . z ir con . api . u ie vent . Keyboard EventType Ċ import Ġorg . hex works . z ir con . api . u ie vent . Processed Ċ import Ġorg . hex works . z ir con . internal . Z ir con Ċ import Ġjava . util .* Ċ Ċ fun Ġmain ( args : ĠArray < String >) Ġ{ ĊĠĠĠ ĠSystem . setProperty (" session . id ", ĠUUID . randomUUID (). toString ()) ĊĊĠĠĠ Ġval Ġlogger : ĠLogger Ġ= ĠLoggerFactory . getLogger (" com . j sc isco . lom . Main ") ĊĊĠĠĠ Ġval Ġapplication Ġ= ĠSw ing Applications . start Application ( Game Configuration . build AppConfig ()) Ċ // ĠĠĠ Ġapplication . dock ( Start View ()) ĊĠĠĠ Ġval Ġd ungeon Size Ġ= ĠSize 3 D . create ( Game Configuration . WINDOW _ WIDTH , ĠGame Configuration . WINDOW _ HEIGHT , Ġ 1 ) ĊĠĠĠ Ġval Ġvisible Size Ġ= ĠSize 3 D . create ( Game Configuration . VISIBLE _ D UN GE ON _ WIDTH , ĠGame Configuration . VISIBLE _ D UN GE ON _ HEIGHT , Ġ 1 ) ĊĊĠĠĠ Ġval Ġd ungeon Ġ= ĠD ungeon Builder ( d ungeon Size , Ġstrategy Ġ= ĠGeneric D ungeon Strategy ( d ungeon Size )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ( visible Size , Ġd ungeon Size ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. also Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . add At Empty Position ( Entity Factory . new Player ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . update Camera () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġdv Ġ= ĠD ungeon View ( d ungeon ) ĊĠĠĠ Ġapplication . dock ( dv ) ĊĊĠĠĠ Ġval Ġstates Ġ= Ġmutable ListOf < State >( Player Turn State ( d ungeon )) ĊĊĠĠĠ ĠZ ir con . event Bus . subscribe < Quit Game Event > Ġ{ ĊĠĠĠĠĠĠĠ ĠSystem . exit ( 0 ) ĊĠĠĠ Ġ} Ċ Ċ // ĠĠĠ ĠZ ir con . event Bus . subscribe < Start Player Turn > Ġ{ Ċ // ĠĠĠĠĠĠĠ ĠZ ir con . event Bus . publish ( Push State Event ( Player Turn State ( d ungeon ))) Ċ // ĠĠĠ Ġ} Ċ Ċ // ĠĠĠ ĠZ ir con . event Bus . subscribe < Pop State Event > Ġ{ Ċ // ĠĠĠĠĠĠĠ Ġlogger . info (" Pop ping Ġstate Ġ${ states . last () }") Ċ // ĠĠĠĠĠĠĠ Ġstates . remove At ( states . last Index ) Ċ // ĠĠĠĠĠĠĠ Ġlogger . info (" Current Ġstate Ġis Ġnow Ġ${ states . last () }") Ċ // ĠĠĠ Ġ} Ċ Ċ // ĠĠĠ ĠZ ir con . event Bus . subscribe < Push State Event > Ġ{ Ċ // ĠĠĠĠĠĠĠ Ġstates . add ( it . state ) Ċ // ĠĠĠĠĠĠĠ Ġlogger . info ( states . last (). toString ()) Ċ // ĠĠĠ Ġ} Ċ Ċ // ĠĠĠ ĠZ ir con . event Bus . subscribe < Open Inventory Dialog > Ġ{ Ċ // ĠĠĠĠĠĠĠ Ġdv . screen . open Modal ( Inventory Dialog ( it . d ungeon , Ġit . player , Ġdv . screen )) Ċ // ĠĠĠ Ġ} Ċ // Ċ // ĠĠĠ ĠZ ir con . event Bus . subscribe < Open Equipment Dialog > Ġ{ Ċ // ĠĠĠĠĠĠĠ Ġdv . screen . open Modal ( Equipment Dialog ( it . player , Ġdv . screen )) Ċ // ĠĠĠ Ġ} ĊĊĠĠĠ Ġdv . screen . handle Keyboard Events ( Keyboard EventType . KEY _ PRES SED ) Ġ{ Ġevent , Ġ_ Ġ-> ĊĠĠĠĠĠĠĠ Ġstates . last (). handle Input ( Game Context ( d ungeon , Ġdv . screen , Ġevent )) ĊĠĠĠĠĠĠĠ ĠPro cessed ĊĠĠĠ Ġ} Ċ Ċ // ĠĠĠ Ġwhile Ġ( true ) Ġ{ Ċ //// ĠĠĠĠĠĠĠ Ġstates . last ()?. update () Ċ // ĠĠĠ Ġ} Ċ } Ċ