//Contructors public BanCo(MainWindow frm, Grid grd) { Option = new Option(); OWin = new _5O_Win(); row = column = 12; currPlayer = Player.None; end = Player.None; frmParent = frm; grdBanCo = grd; board = new Player[row, column]; ResetBoard(); eBoard = new LuongGiaBanCo(this); hv = new HinhVuong(); CreateHV(); grdBanCo.Children.Add(hv); grdBanCo.MouseDown += new System.Windows.Input.MouseButtonEventHandler(grdBanCo_MouseDown); }
//Bắt đầu lại trò chơi mới public void PlayAgain() { OWin = new _5O_Win(); grdBanCo.Children.Clear(); grdBanCo.Children.Add(hv); ResetBoard(); this.DrawGomokuBoard(); if (this.Option.WhoPlayWith == Player.Com) { if (end == Player.None) { currPlayer = Player.Com; } if (currPlayer == Player.Com && this.Option.WhoPlayWith == Player.Com) { DiNgauNhien(); } } else { if (end == Player.None) { if (currPlayer == Player.Human) { currPlayer = Player.Com; } else if (currPlayer == Player.Com) { currPlayer = Player.Human; } } } end = Player.None; }