3 ½©5YÏ ã@sŠddlZddlZdaetƒadZetadZda dd„Z dd„Z d d „Z d d „Z d d„Zdd„Zdd„Zdd„Zdd„Zdd„ZeƒdS)éNéé–écCslxftdtƒD]X}tjtjd|tƒtjt|tƒƒjtƒtjtj|tdƒtj|ttƒƒjtƒq WdS)z&Draw the horizontal and vertical linesérN) ÚrangeÚ BOARDSIZEÚzgÚLineÚPointÚPPSÚ WINDOWSIZEÚdrawÚwin)Úi©rú./TicTacToe3.pyÚdrawGrids*rcCs$tjt|tdt|tdƒS)zcoordinates of center of squareé)rr r )ÚrowÚcolrrrÚ rectCentersrcCstjt|tt|tƒS)z'coordinates of top left of inset X or O)rr r ÚINSET)rrrrrÚ rectUpperLeftsrcCs$tjt|dtt|dtƒS)z+coordinates of bottom right of inset X or Or)rr r r)rrrrrÚrectLowerRightsrcCs tjt|dtt|tƒS)z(coordinates of top right of inset X or Or)rr r r)rrrrrÚrectUpperRight"srcCs tjt|tt|dtƒS)z*coordinates of bottom left of inset X or Or)rr r r)rrrrrÚ rectLowerLeft&srcCs@tjt||ƒt||ƒƒjtƒtjt||ƒt||ƒƒjtƒdS)zDraw an X in the given squareN)rr rrr rrr)rrrrrÚdrawX,srcCs$tjt||ƒtdtƒjtƒdS)zDraw an O in the given squarerN)rZCirclerr rr r)rrrrrÚdrawO1srcCsFx@tD]8}x2tD]*}||ddkr0t||ƒqt||ƒqWqWdS)z)Fill the board with alternating Xs and OsrrN)Ú BOARDRANGErr)rrrrrÚ fillBoard5s    rcCsVtdƒ}|dkr(t|ƒattƒattatjdttƒa t ƒt ƒt j ƒt j ƒdS)Nz&Enter board size (Press Enter for 3): ÚzTicTacToe version 3)ÚinputÚintrrrr r rZGraphWinrrrZgetMouseÚclose)ZuserSizerrrÚmain>sr$)Z zellegraphicsrÚtimerrrr r rrrrrrrrrrrr$rrrrÚs$