package Ġmagic mar bles . api . field Ċ Ċ import Ġcom . github . m ichael bull . result . Result ĊĊ Ċ interface ĠField Ġ{ ĊĠĠĠ Ġval Ġfield : ĠList < List < Mar ble ? >> ĊĠĠĠ Ġval Ġwidth : ĠInt ĊĠĠĠ Ġval Ġheight : ĠInt ĊĊĠĠĠ Ġfun Ġcheck Bounds ( column : ĠInt , Ġrow : ĠInt ) Ġ= Ġcolumn Ġin Ġ 0 Ġuntil Ġwidth Ġ&& Ġrow Ġin Ġ 0 Ġuntil Ġheight ĊĠĠĠ Ġfun Ġmoves Possible (): ĠBoolean ĊĊĠĠĠ Ġfun Ġmar ble Count () Ġ= Ġfield ĊĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . count Ġ{ Ġmar ble Ġ-> Ġmar ble Ġ!= Ġnull Ġ} Ġ} ĊĠĠĠĠĠĠĠ Ġ. sum () ĊĊĠĠĠ Ġfun Ġget Connected Mar bles ( column : ĠInt , Ġrow : ĠInt ): ĠResult < List < Pair < Int , ĠInt >>, ĠField Exception > ĊĊĠĠĠ Ġoperator Ġfun Ġget ( column : ĠInt , Ġrow : ĠInt ): ĠMar ble ? Ġ= Ġfield . get OrNull ( column )?. get OrNull ( row ) Ċ }