³ò ®ÂiFcs©ddkTddkZdZeeƒZdZeeZdZeZ d„Z d„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„ZeƒdS(s)Fill the board with alternating Xs and Osiÿÿÿÿ(t*Nii–ic s~xwtdtƒD]f}ttd|tƒtt|tƒƒitƒtt|tdƒt|ttƒƒitƒqWdS(Nii( tranget BOARDSIZEtitLinetPointtPPSt WINDOWSIZEtdrawtwin( RRRRRRRRR ((s TicTacToe3.pysdrawGrids0cs)tt|tdt|tdƒSdS(scoordinates of center of squareiN(RRtcoltrow(R R RR((s TicTacToe3.pys rectCenterscs!tt|tt|tƒSdS(s'coordinates of top left of inset X or ON(RRR tINSETR (R R RRR ((s TicTacToe3.pys rectUpperLeftscs)tt|dtt|dtƒSdS(s+coordinates of bottom right of inset X or OiN(RRR R R (R R RRR ((s TicTacToe3.pysrectLowerRightscs%tt|dtt|tƒSdS(s(coordinates of top right of inset X or OiN(RRR R R (R R RRR ((s TicTacToe3.pysrectUpperRight!scs%tt|tt|dtƒSdS(s*coordinates of bottom left of inset X or OiN(RRR R R (R R RRR ((s TicTacToe3.pys rectLowerLeft%sc sTtt||ƒt||ƒƒitƒtt||ƒt||ƒƒitƒdS(sDraw an X in the given squareN( Rt rectUpperLeftR R trectLowerRightRR t rectLowerLefttrectUpperRight( R R RR RRR RR((s TicTacToe3.pysdrawX+s(cs/tt||ƒtdtƒitƒddS(sDraw an O in the given squareiN(tCirclet rectCenterR R RR RR (R R RRRR RR ((s TicTacToe3.pysdrawO0scsYxRtD]J}xAtD]9}||ddjot||ƒnt||ƒqWqWdS(s)Fill the board with alternating Xs and OsiiN(t BOARDRANGER R tdrawXtdrawO(RR R RR((s TicTacToe3.pys fillBoard4scsztdƒ}|djo&t|ƒattƒattantdttƒa t ƒt ƒt i dƒt iƒdS(Ns&Enter board size (Press Enter for 3): tsTicTacToe version 3i(t raw_inputtuserSizetevalRRRRRtGraphWinR tdrawGridt fillBoardttimetsleeptclose(RRRRRRRRRR RRRRR((s TicTacToe3.pysmain=s     (tgraphicsRRRRRRR tNoneR RRR RRRRRRtmain(R RRRRRRR R!R RRR RRRRRRR"((s TicTacToe3.pyss$