3 ½©5Yô ã@s‚ddlZddlZdaetƒadZetadZda dd„Z dd„Z d d „Z d d „Z d d„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ú./TicTacToe2.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ÚdrawO1srcCsdtdƒ}|dkr(t|ƒattƒattatjdttƒa t ƒt ddƒt ddƒt j ƒt jƒdS)Nz&Enter board size (Press Enter for 3): ÚzTicTacToe version 2rrr)ÚinputÚintrrÚ BOARDRANGEr r rZGraphWinrrrrZgetMouseÚclose)ZuserSizerrrÚmain5s  r#)Z zellegraphicsrÚtimerrr!r r rrrrrrrrrrr#rrrrÚs"