package Ġcom . van zo consult ing . t ict act oe . ui Ċ Ċ import Ġcom . van zo consult ing . domain . Board Ċ import Ġcom . van zo consult ing . t ict act oe . di . Activity Scoped Ċ import Ġcom . van zo consult ing . t ict act oe . dispatcher . Dispatcher Provider Ċ import Ġcom . van zo consult ing . t ict act oe . ui . Board Contract . View Ċ import Ġcom . van zo consult ing . use case . Delete Board Ċ import Ġcom . van zo consult ing . use case . Get Board Ċ import Ġcom . van zo consult ing . use case . Save Board Ċ import Ġkotlinx . coroutines . Global Scope Ċ import Ġkotlinx . coroutines . launch Ċ import Ġkotlinx . coroutines . with Context Ċ import Ġjavax . inject . Inject Ċ Ċ @ Activity Scoped Ċ class ĠBoard Presenter Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġget Board : ĠGet Board , ĊĠĠĠ Ġprivate Ġval Ġsave Board : ĠSave Board , ĊĠĠĠ Ġprivate Ġval Ġdelete Board : ĠDelete Board , ĊĠĠĠ Ġprivate Ġval Ġdispatcher Provider : ĠDispatcher Provider Ċ ): ĠBoard Contract . Presenter Ġ{ ĊĊĠĠĠ Ġoverride Ġvar Ġview : ĠView ? Ġ= Ġnull ĊĊĠĠĠ Ġoverride Ġfun Ġload Board () Ġ= ĠGlobal Scope . launch ( dispatcher Provider . main ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġboard Ġ= Ġwith Context ( dispatcher Provider . io ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Board () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġview ?. reset () ĊĠĠĠĠĠĠĠ Ġview ?. render Board ( board Ġ?: ĠBoard ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġmake Move ( board : ĠBoard , Ġindex : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġboard . mark ( index ). take If Ġ{ Ġit Ġ!= Ġboard Ġ} Ġ? . let Ġ{ Ġupdated Board Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview ?. render Board ( updated Board ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġupdated Board . winner ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġview ?. show Winner ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( updated Board . is Draw ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġview ?. show Draw () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠGlobal Scope . launch ( dispatcher Provider . io ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( updated Board . is Complete ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdelete Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsave Board ( updated Board ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }