Skip to content

Instantly share code, notes, and snippets.

@carcigenicate
Last active August 4, 2017 20:01
Show Gist options
  • Save carcigenicate/5bfa5afbd21c5b65d3bd6284df0f1eb8 to your computer and use it in GitHub Desktop.
Save carcigenicate/5bfa5afbd21c5b65d3bd6284df0f1eb8 to your computer and use it in GitHub Desktop.
Swedish Othello Debug
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.
@AurumFerrum
Copy link

no there should be none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment