C
C#2w ago
yummy_bee

Othello game invalid move

i have written an othello game but everytime i click a tile it says invalid move: {8,8} even if i dont click tile 8,8 and i dont know what is wrong. https://github.com/waal22el/Othello2
GitHub
GitHub - waal22el/Othello2
Contribute to waal22el/Othello2 development by creating an account on GitHub.
5 Replies
Sehra
Sehra2w ago
in GameGrid.xaml.cs on like 41, the row,col is captured via a closure, you want to make a copy of them first and use the copy instead
var rowCopy = row;
var colCopy = col;
cell.MouseLeftButtonDown += (s, e) => OnTileClicked(rowCopy, colCopy);
var rowCopy = row;
var colCopy = col;
cell.MouseLeftButtonDown += (s, e) => OnTileClicked(rowCopy, colCopy);
yummy_bee
yummy_beeOP2w ago
ohh okay i see
yummy_bee
yummy_beeOP2w ago
hmm now i get this when i pressed something
No description
Sehra
Sehra2w ago
well, you have the stack trace so you can figure out where it's called from and why player is null
yummy_bee
yummy_beeOP7d ago
okay i have fixed those problems but when i run it player 2 never get their turn its only player 1 that gets to play

Did you find this page helpful?