Last active
August 4, 2017 20:01
-
-
Save carcigenicate/5bfa5afbd21c5b65d3bd6284df0f1eb8 to your computer and use it in GitHub Desktop.
Swedish Othello Debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def datornsDrag(self,datorBricka,fåLegalaDrag,fåDatorBräde,görDittDrag,räknaPoäng): | |
möjligaDrag = self.fåLegalaDrag(self.bräde,datorBricka) | |
högstaPoäng = -1 | |
for x, y in möjligaDrag: | |
datorBräde = self.fåDatorBräde(self.bräde) | |
print(self.bräde) | |
self.görDittDrag(datorBräde, datorBricka, x, y) | |
print(self.bräde) | |
print("Done test for" + str(x) + " " + str(y)) | |
poäng = self.räknaPoäng(datorBräde)[datorBricka] | |
if poäng > högstaPoäng: | |
bästaDrag= [x, y] | |
högstaPoäng = poäng | |
return bästaDrag | |
Running this shows: | |
[[' ', ' ', ' ', ' '], [' ', 'S', 'V', ' '], [' ', 'V', 'S', ' '], [' ', ' ', ' ', ' ']] | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'S', ' '], [' ', ' ', ' ', ' ']] | |
Done test for0 1 | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'S', ' '], [' ', ' ', ' ', ' ']] | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'S', ' '], [' ', ' ', ' ', ' ']] | |
Done test for1 0 | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'S', ' '], [' ', ' ', ' ', ' ']] | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'V', 'V'], [' ', ' ', ' ', ' ']] | |
Done test for2 3 | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'V', 'V'], [' ', ' ', ' ', ' ']] | |
[[' ', 'V', ' ', ' '], [' ', 'V', 'V', ' '], [' ', 'V', 'V', 'V'], [' ', ' ', ' ', ' ']] | |
Each set of 2 rows is a before and after. Note the "after" row is different from the "before" row. |
Ya. So the original is being modified. Why, I can't say. Your copy board function must be broken. I'm going to go lie down though :/ Good luck.
Is there a difference between self.brade
and brade
?
no there should be none
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Whell, whilst using the
print bräde
in the maincode after and beforegörDittDrag
did not show any difference