Advertisement
c0d3dsk1lls

play_checkers CodedSkills.net

Aug 7th, 2022 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.75 KB | None | 0 0
  1.  
  2. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  3. ##=======================================================================================================================================================================================##
  4. ##----------------------CODEDSKILLS.NET--------------------------------------------------------------------------------------------------------------------------------------------------##
  5. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  6. #--------------------------#-------------#
  7. import pygame as pg                      #
  8. from modules import statics as st        #
  9. from modules.statics import *            #
  10. from modules.checker_board import *      #
  11. from modules.checker import *            #
  12. #----------------------------------------#
  13. #----------------------------------------#-------------------------------------------------
  14. #STATIC VARIABLES FOR THIS FILE -------------------#
  15. fps = 120   #--------------------------------------#
  16. WIN = pg.display.set_mode((st.width, st.height))   #
  17. pg.display.set_caption("CodedSkills.net: _._._Checkers_._._")                 #
  18. #--------------------------------------------------#
  19. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  20. #---------------------------------------------------------------
  21. # GET ROW AND COLUMN FOR MOUSE  #-------------------------------
  22. def get_row_col_mouse(pos): #---#
  23.     x, y = pos #---------#--#
  24.     row = y // sq_size   #
  25.     col = x // sq_size   #
  26.     return row, col      #
  27. #------------------------#
  28. #------------------------#------------------+-------------------------------------+------------+------------------------+
  29. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  30. # MAIN FUNCTION  ------------#
  31. if __name__ == "__main__":   #
  32. #----------------------------#
  33. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  34. #------------------------#------------------+--------------------------+----------------------+------------------------------------+
  35.     # REPRESENTS THE GAME --------#
  36.     run = True       #------------#
  37. #---------------------------------#
  38. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  39.     # CERTAIN CLOCK VALUE DEFAULT, VARIES FROM PC TO PC   #
  40.     clock = pg.time.Clock()  #----------------------------#
  41. #----------------------------#
  42.     # create board ----------#----------------------------------------------------+------------------+----------------------------------------------+
  43.     board = checker_board()  #
  44.     game =  checker(WIN)  #--#
  45. #------------------------#
  46.     # MAIN LOOP ----------------#---------+-----+
  47.     while run: #----------------#
  48.         clock.tick(fps) #-------#----------------+----------+
  49. #-------------------------------#--#
  50.         if board.winner() != None: #
  51.             print(board.winner())  #
  52. #----------------------------------#
  53. #----------------------------------#--------+----------------#---------+----------------------+------------------------------------+
  54.         # CHECK IF EVENTS ARE RUNNING OR NOT ----------------#
  55.         for event in pg.event.get(): #-----------------------#
  56.             if event.type == pg.QUIT: #----------------------#
  57.                 run = False  #-------------------------------#
  58.             if event.type == pg.MOUSEBUTTONDOWN: #-----------#
  59.                 pos = pg.mouse.get_pos() #-------------------#
  60.                 row, col = get_row_col_mouse(pos) #----------#
  61.                 game.selectrc(row, col) #--------------------#
  62.                 # piece = board.get_piece(row, col)  --------#
  63.                 # board.move(piece, 4, 3)  ------------------#
  64. #++++++++++++++++++++++++++#---------------------------------#
  65.         game.update()      #
  66.     pg.quit()              #
  67. #++++++++++++++++++++++++++#
  68. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  69. ##=================================================================================================================================================##
  70. ##-------------------------------------------------------------------------------------------------------------------------------------------------##
  71. ##                                                                                                                                                 ##
  72. ##                                                                                        ##   //                                                  ##
  73. ##----+-#########\   ########  -+#######\\-- +##########   #######\\        /#######\\    ##  //     ######---+-##      ##       /#######\\        ##
  74. ##      ##-          ##|--|##    ##-     ##   ##           ##-     ##      ||-----        ## //        ##       ##----+-##      ||-----         +--##
  75. ##      ##           ##|  |##  -+##    +--##  #######      ##       ##  -- \\#######\\    ## \\        ##       ##      ##------\\#######\\-------+##
  76. ##      ##-        +-##|--|##    ##-     ##   ##           ##-     ##         ------||    ##  \\       ##       ##      ##         ------||--------##
  77. ##      #########/   ########  -#######//-  -+##########   #######//       \\######//     ##   \\    ######---+-#####   #####   \\######//------+--##
  78. ##                                                                                                                                                 ##
  79. ##                                                          https://CodedSkills.net                                                                ##
  80. ##-------------------------------------------------------------------------------------------------------------------------------------------------##
  81. ##=================================================================================================================================================##
  82. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  83.  
  84.  
  85. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  86. ##=======================================================================================================================================================================================##
  87. ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
  88. ##                                                                                                                                                                                       ##
  89. ##           ###       #######\    #######\       #######       ########     ##  ##     ########     ########       #######     ########       ####        ##         /#######\\         ##
  90. ##          #-##            //          //        \   //    =      ##        ##  ##        ##        ##|--|##       ##  //         ##         //  \\       ##        ||-                 ##
  91. ##            ##          ##\\        ##\\           //            ##        ##  ##        ##        ##|  |##       ###\\          ##        //====\\      ##        \\#######\\         ##
  92. ##            ##            //          //          //             ##        ##  ##        ##        ##|--|##       ##  \\         ##       //      \\     ##                 ||         ##
  93. ##       ##########   ########--  ########--       //       =      ##         ####         ##        ########       ##   \\     ########   //        \\    #######   \\######//          ##
  94. ##                                                                                                                                                                                       ##
  95. ##                                                                         https://1337tutorials.net                                                                                     ##
  96. ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
  97. ##=======================================================================================================================================================================================##
  98. ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement