MCPcopy Create free account
hub / github.com/ActiveState/code / myMax

Function myMax

recipes/Python/275150_Py_Tic_Tac_Toe/recipe-275150.py:234–256  ·  view source on GitHub ↗
(what,bsize,type,arr)

Source from the content-addressed store, hash-verified

232 return retVal
233
234def myMax(what,bsize,type,arr):
235 global playerToken,myToken,gameOver,winArr,rowArr,colArr,digArr,vals,s1,s2,s3,s4,s5,s6,s7,s8,s9
236
237 max = -1
238 maxIndex = -1
239 if type != "dig" :
240 i = 0
241 while i < bsize :
242 if arr[i] > max :
243 max = arr[i]
244 maxIndex = i
245 i = i + 1
246 if type == "dig" :
247 i = 0
248 while i < 2 :
249 if arr[i] > max :
250 max = arr[i]
251 maxIndex = i
252 i = i + 1
253 if what == 0 :
254 return maxIndex
255 else:
256 return max
257
258def playerWin():
259 global bsize,playerToken,myToken,gameOver,winArr,rowArr,colArr,digArr,vals,s1,s2,s3,s4,s5,s6,s7,s8,s9

Callers 1

moveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected