package Ġcom . planes _ multi player . android Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . widget . Button Ċ Ċ class ĠGame Controls Adapter ( private Ġval Ġm _ Context : ĠContext ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġm _ Cur Stage Ġ= ĠGame Stages . Board Editing ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Plane Round : ĠPlan es Round Interface ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Game Board s : ĠGame Board s Adapter ĊĠĠĠ Ġprivate Ġvar Ġm _ Tablet Ġ= Ġfalse ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Planes Layout : ĠPlan es Vertical Layout ĊĊĠĠĠ Ġ// Board ĠEdit ing ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Rotate Button : ĠButton ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Left Button : ĠButton ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Right Button : ĠButton ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Up Button : ĠButton ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Down Button : ĠButton ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Done Button : ĠButton ĊĊĠĠĠ Ġ// Game ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Stats Title : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Hits TextView : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Mis ses TextView : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Dead TextView : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Moves TextView : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Hits Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Mis ses Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Dead Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Moves Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ View Computer Board Button 1 : ĠTwo Line Text Button With State ĊĊĠĠĠ Ġ// Start ĠNew ĠGame ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Winner TextView : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Start New Round : ĠTwo Line Text Button ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Computer W ins : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Player W ins : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Draw s : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Computer W ins Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Player W ins Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ Draw s Label : ĠCo lo ured Surface With Text ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġm _ View Computer Board Button 2 : ĠTwo Line Text Button With State ĊĊĠĠĠ Ġfun Ġset Board Editing Controls ( up Button : ĠButton , Ġdown Button : ĠButton , Ġleft Button : ĠButton , Ġright Button : ĠButton , Ġdone Button : ĠButton , Ġrotate Button : ĠButton ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Up Button Ġ= Ġup Button ĊĠĠĠĠĠĠĠ Ġm _ Down Button Ġ= Ġdown Button ĊĠĠĠĠĠĠĠ Ġm _ Left Button Ġ= Ġleft Button ĊĠĠĠĠĠĠĠ Ġm _ Right Button Ġ= Ġright Button ĊĠĠĠĠĠĠĠ Ġm _ Done Button Ġ= Ġdone Button ĊĠĠĠĠĠĠĠ Ġm _ Rotate Button Ġ= Ġrotate Button ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Left Button . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Left Button . setOnClickListener Ġ{ Ġm _ Game Board s . move Plane Up () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Right Button . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Right Button . setOnClickListener Ġ{ Ġm _ Game Board s . move Plane Down () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Up Button . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Up Button . setOnClickListener Ġ{ Ġm _ Game Board s . move Plane Left () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Down Button . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Down Button . setOnClickListener Ġ{ Ġm _ Game Board s . move Plane Right () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Rotate Button . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Rotate Button . setOnClickListener Ġ{ Ġm _ Game Board s . rotate Plane () Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Done Button . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Done Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Game Stage () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Game Stage () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Game Stage () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Plane Round . done Clicked () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Game Controls ( stats Title : ĠCo lo ured Surface With Text , Ġview Computer Board Button 1 : ĠTwo Line Text Button With State , Ġmoves Label : ĠCo lo ured Surface With Text , Ġmoves Count : ĠCo lo ured Surface With Text , Ġmis ses Label : ĠCo lo ured Surface With Text , Ġmis ses Count : ĠCo lo ured Surface With Text , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġhits Label : ĠCo lo ured Surface With Text , Ġhits Count : ĠCo lo ured Surface With Text , Ġde ads Label : ĠCo lo ured Surface With Text , Ġdead Count : ĠCo lo ured Surface With Text ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Stats Title Ġ= Ġstats Title ĊĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 1 Ġ= Ġview Computer Board Button 1 ĊĠĠĠĠĠĠĠ Ġm _ Moves Label Ġ= Ġmoves Label ĊĠĠĠĠĠĠĠ Ġm _ Moves TextView Ġ= Ġmoves Count ĊĠĠĠĠĠĠĠ Ġm _ Mis ses Label Ġ= Ġmis ses Label ĊĠĠĠĠĠĠĠ Ġm _ Mis ses TextView Ġ= Ġmis ses Count ĊĠĠĠĠĠĠĠ Ġm _ Hits Label Ġ= Ġhits Label ĊĠĠĠĠĠĠĠ Ġm _ Hits TextView Ġ= Ġhits Count ĊĠĠĠĠĠĠĠ Ġm _ Dead Label Ġ= Ġde ads Label ĊĠĠĠĠĠĠĠ Ġm _ Dead TextView Ġ= Ġdead Count ĊĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 1 . setState (" player ", Ġm _ Context . resources . getString ( R . string . view _ player _ board 2 )) ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ View Computer Board Button 1 . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 1 . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( m _ View Computer Board Button 1 . currentState Name Ġ=== Ġ" computer ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Computer Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 1 . setState (" player ", Ġm _ Context . resources . getString ( R . string . view _ player _ board 2 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmis ses Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Mis ses () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġhits Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Hits () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdead Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Dead () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmoves Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Moves () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Mis ses TextView . setText ( Integer . toString ( mis ses )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Hits TextView . setText ( Integer . toString ( hits )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Dead TextView . setText ( Integer . toString ( dead )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Moves TextView . setText ( Integer . toString ( moves )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Stats Title . setText ( m _ Context . resources . getString ( R . string . computer _ stats )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Computer Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġif Ġ( m _ View Computer Board Button 1 . currentState Name Ġ=== Ġ" player ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Player Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 1 . setState (" computer ", Ġm _ Context . resources . getString ( R . string . view _ computer _ board 2 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmis ses Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Mis ses () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġhits Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Hits () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdead Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Dead () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmoves Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Moves () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Mis ses TextView . setText ( Integer . toString ( mis ses )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Hits TextView . setText ( Integer . toString ( hits )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Dead TextView . setText ( Integer . toString ( dead )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Moves TextView . setText ( Integer . toString ( moves )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Stats Title . setText ( m _ Context . resources . getString ( R . string . player _ stats )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Player Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Start New Game Controls ( view Computer Board Button 2 : ĠTwo Line Text Button With State , Ġstart New Game Button : ĠTwo Line Text Button , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcomputer W ins Label : ĠCo lo ured Surface With Text , Ġcomputer W ins Count : ĠCo lo ured Surface With Text , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġplayer W ins Label : ĠCo lo ured Surface With Text , Ġplayer W ins Count : ĠCo lo ured Surface With Text , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdraw s Label : ĠCo lo ured Surface With Text , Ġdraw s Count : ĠCo lo ured Surface With Text , Ġw innerText : ĠCo lo ured Surface With Text ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 Ġ= Ġview Computer Board Button 2 ĊĠĠĠĠĠĠĠ Ġm _ Start New Round Ġ= Ġstart New Game Button ĊĠĠĠĠĠĠĠ Ġm _ Computer W ins Label Ġ= Ġcomputer W ins Label ĊĠĠĠĠĠĠĠ Ġm _ Computer W ins Ġ= Ġcomputer W ins Count ĊĠĠĠĠĠĠĠ Ġm _ Player W ins Label Ġ= Ġplayer W ins Label ĊĠĠĠĠĠĠĠ Ġm _ Player W ins Ġ= Ġplayer W ins Count ĊĠĠĠĠĠĠĠ Ġm _ Winner TextView Ġ= Ġw innerText ĊĠĠĠĠĠĠĠ Ġm _ Draw s Ġ= Ġdraw s Count ĊĠĠĠĠĠĠĠ Ġm _ Draw s Label Ġ= Ġdraw s Label ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ Start New Round . isInitialized Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Start New Round . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Plane Round . init Round () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Board Editing Stage () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Board Editing Stage () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Board Editing Stage () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 . setState (" player ", Ġm _ Context . resources . getString ( R . string . view _ player _ board 2 )) ĊĠĠĠĠĠĠĠ Ġif Ġ( this :: m _ View Computer Board Button 2 . isInitialized ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( m _ View Computer Board Button 2 . currentState Name Ġ=== Ġ" computer ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Computer Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Computer Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 . setState (" player ", Ġm _ Context . resources . getString ( R . string . view _ player _ board 2 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġif Ġ( m _ View Computer Board Button 2 . currentState Name Ġ=== Ġ" player ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Player Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Player Board () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 . setState (" computer ", Ġm _ Context . resources . getString ( R . string . view _ computer _ board 2 )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset New Round Stage () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomputer _ wins Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer W ins () ĊĠĠĠĠĠĠĠ Ġval Ġplayer _ wins Ġ= Ġm _ Plane Round . player Guess _ Stat No Player W ins () ĊĠĠĠĠĠĠĠ Ġval Ġdraw s Ġ= Ġm _ Plane Round . player Guess _ Stat No Draw s () ĊĠĠĠĠĠĠĠ Ġm _ Player W ins . setText ( Integer . toString ( player _ wins )) ĊĠĠĠĠĠĠĠ Ġm _ Computer W ins . setText ( Integer . toString ( computer _ wins )) ĊĠĠĠĠĠĠĠ Ġm _ Draw s . setText ( Integer . toString ( draw s )) ĊĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 . setState (" player ", Ġm _ Context . resources . getString ( R . string . view _ player _ board 2 )) ĊĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Computer Board () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Game Stage () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ(! m _ Tablet ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Game Board s . set Computer Board () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 1 . setState (" player ", Ġm _ Context . resources . getString ( R . string . view _ player _ board 2 )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Stats Title . setText ( m _ Context . resources . getString ( R . string . computer _ stats )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġupdate Stats ( true ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Board Editing Stage () Ġ{} ĊĠĠĠ Ġfun Ġupdate Stats ( is Computer : ĠBoolean ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ// on Ġthe Ġcomputer Ġboard Ġshow Ġthe Ġcomputer Ġstats Ġand ĊĠĠĠĠĠĠĠ Ġ// such Ġthat Ġthe Ġplayer Ġknows Ġhow Ġfar Ġthe Ġcomputer Ġis ĊĠĠĠĠĠĠĠ Ġif Ġ( is Computer ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmis ses Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Mis ses () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġhits Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Hits () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdead Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Dead () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmoves Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer Moves () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Mis ses TextView . setText ( Integer . toString ( mis ses )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Hits TextView . setText ( Integer . toString ( hits )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Dead TextView . setText ( Integer . toString ( dead )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Moves TextView . setText ( Integer . toString ( moves )) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmis ses Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Mis ses () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġhits Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Hits () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdead Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Dead () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmoves Ġ= Ġm _ Plane Round . player Guess _ Stat No Player Moves () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Mis ses TextView . setText ( Integer . toString ( mis ses )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Hits TextView . setText ( Integer . toString ( hits )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Dead TextView . setText ( Integer . toString ( dead )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġm _ Moves TextView . setText ( Integer . toString ( moves )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġround End s ( is Computer Winner : ĠBoolean , Ġis Draw : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Planes Layout . set Computer Board () ĊĠĠĠĠĠĠĠ Ġm _ Planes Layout . set New Round Stage () ĊĠĠĠĠĠĠĠ Ġif Ġ( is Computer Winner ) Ġm _ Winner TextView . setText ( m _ Context . resources . getText ( R . string . computer _ winner ). toString ()) Ġelse Ġm _ Winner TextView . setText ( m _ Context . resources . getText ( R . string . player _ winner ). toString ()) ĊĠĠĠĠĠĠĠ Ġif Ġ( is Draw ) Ġm _ Winner TextView . setText ( m _ Context . resources . getText ( R . string . draw _ result ). toString ()) ĊĠĠĠĠĠĠĠ Ġval Ġcomputer _ wins Ġ= Ġm _ Plane Round . player Guess _ Stat No Computer W ins () ĊĠĠĠĠĠĠĠ Ġval Ġplayer _ wins Ġ= Ġm _ Plane Round . player Guess _ Stat No Player W ins () ĊĠĠĠĠĠĠĠ Ġval Ġdraw s Ġ= Ġm _ Plane Round . player Guess _ Stat No Draw s () ĊĠĠĠĠĠĠĠ Ġm _ Player W ins . setText ( Integer . toString ( player _ wins )) ĊĠĠĠĠĠĠĠ Ġm _ Computer W ins . setText ( Integer . toString ( computer _ wins )) ĊĠĠĠĠĠĠĠ Ġm _ Draw s . setText ( Integer . toString ( draw s )) ĊĠĠĠĠĠĠĠ Ġm _ View Computer Board Button 2 . setState (" player ", Ġm _ Context . resources . getText ( R . string . view _ player _ board 2 ). toString ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Done Enabled ( enabled : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Done Button . isEnabled Ġ= Ġenabled ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Game Settings ( plane Round : ĠPlan es Round Interface , Ġis Tablet : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Plane Round Ġ= Ġplane Round ĊĠĠĠĠĠĠĠ Ġm _ Tablet Ġ= Ġis Tablet ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Game Board s ( game Board s : ĠGame Board s Adapter ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Game Board s Ġ= Ġgame Board s ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Planes Layout ( planes Layout : ĠPlan es Vertical Layout ) Ġ{ ĊĠĠĠĠĠĠĠ Ġm _ Planes Layout Ġ= Ġplanes Layout ĊĠĠĠ Ġ} Ċ }