public bool ComputerMove() { algh.graf = new MinMax.WeightedGraph(nOfRows, computer); algh.FillNode(_fields, currentGamer, algh.graf.Graph, algh.graf.numberOfLevels);///! PositionTag position = algh.FindBestMove(algh.graf.Graph); Fields.Field fieldToSign = _fields[position.row, position.column]; fieldToSign._pattern = computer; if (computer == Pattern.Circle) { fieldToSign.graphicButton.Background = (Brush)Application.Current.Resources["CircleImage"];/// To mozna przeniesc do windowconf i tam przy zmianie obrazu gracza zmieniac tez to } else { fieldToSign.graphicButton.Background = (Brush)Application.Current.Resources["CrossImage"]; } int status = isTheEnd(position); if (status == 1) { GamerXWon(currentGamer); return(false); } else if (status == 0) { Draw(); return(false); } else { return(true); } }
public void gaming(Button button) { int status; PositionTag position = (PositionTag)button.Tag; Fields.Field fieldToSign = _fields[position.row, position.column]; if (fieldToSign._pattern == Pattern.None) { if (currentGamer == Pattern.Cross) { fieldToSign.graphicButton.Background = (Brush)Application.Current.Resources["CrossImage"]; } else { fieldToSign.graphicButton.Background = (Brush)Application.Current.Resources["CircleImage"]; } fieldToSign._pattern = currentGamer; status = isTheEnd(position); if (status == 1) { GamerXWon(currentGamer); return; } else if (status == 0) { Draw(); return; } else { Patternchange(); } if (currentGamer == computer) { if (ComputerMove() == false) { return; } else { Patternchange(); } } } }///polimorfizm gamer gamer cross