Ñò VHc@s¾ddkTddkZdaetƒadZetadZda d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „ZeegZd„Zd„Zd„ZeƒdS(iÿÿÿÿ(t*Nii–icCs~xwtdtƒD]f}ttd|tƒtt|tƒƒitƒtt|tdƒt|ttƒƒitƒqWdS(Nii(tranget BOARDSIZEtLinetPointtPPSt WINDOWSIZEtdrawtwin(ti((s TicTacToe5.pytdrawGrids0cCs%tt|tdt|tdƒS(scoordinates of center of squarei(RR(trowtcol((s TicTacToe5.pyt rectCenterscCstt|tt|tƒS(s'coordinates of top left of inset X or O(RRtINSET(R R ((s TicTacToe5.pyt rectUpperLeftscCs%tt|dtt|dtƒS(s+coordinates of bottom right of inset X or Oi(RRR(R R ((s TicTacToe5.pytrectLowerRight scCs!tt|dtt|tƒS(s(coordinates of top right of inset X or Oi(RRR(R R ((s TicTacToe5.pytrectUpperRight$scCs!tt|tt|dtƒS(s*coordinates of bottom left of inset X or Oi(RRR(R R ((s TicTacToe5.pyt rectLowerLeft(scCsTtt||ƒt||ƒƒitƒtt||ƒt||ƒƒitƒdS(sDraw an X in the given squareN(RRRRRRR(R R ((s TicTacToe5.pytdrawX.s(cCs+tt||ƒtdtƒitƒdS(sDraw an O in the given squareiN(tCircleR RRRR(R R ((s TicTacToe5.pytdrawO3scCs|tS(sFFind out row or colum number that corresponds to this pixel coordinate(R(t pixelCoord((s TicTacToe5.pyt boardCoord:scCsLg}x?tD]7}g}xtD]}|dg7}q W||g7}q W|S(s#Initialize the state of each squareiÿÿÿÿ(t BOARDRANGE(t squareStateR tinnertj((s TicTacToe5.pytinitSquareState?scCstdƒ}|djo&t|ƒattƒattantdttƒat ƒa t ƒd}x‘|ttjoti ƒ}t |iƒƒt |iƒƒ}}t ||djo5t|d||ƒ|dt ||<|d}qjqjWtidƒtiƒdS( Ns&Enter board size (Press Enter for 3): tsTicTacToe version 5iiÿÿÿÿiii(t raw_inputtevalRRRRRtGraphWinRRRR tgetMouseRtgetYtgetXtdrawListttimetsleeptclose(tuserSizet turnCountt clickPointR R ((s TicTacToe5.pytmainJs&      % (t zellegraphicsR%RRRRRRtNoneRR R RRRRRRR$RRR+(((s TicTacToe5.pyts(