Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##=======================================================================================================================================================================================##
- ##----------------------CODEDSKILLS.NET--------------------------------------------------------------------------------------------------------------------------------------------------##
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- #--------------------------#-------------#
- import pygame as pg #
- from modules import statics as st #
- from modules.statics import * #
- from modules.checker_board import * #
- from modules.checker import * #
- #----------------------------------------#
- #----------------------------------------#-------------------------------------------------
- #STATIC VARIABLES FOR THIS FILE -------------------#
- fps = 120 #--------------------------------------#
- WIN = pg.display.set_mode((st.width, st.height)) #
- pg.display.set_caption("CodedSkills.net: _._._Checkers_._._") #
- #--------------------------------------------------#
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- #---------------------------------------------------------------
- # GET ROW AND COLUMN FOR MOUSE #-------------------------------
- def get_row_col_mouse(pos): #---#
- x, y = pos #---------#--#
- row = y // sq_size #
- col = x // sq_size #
- return row, col #
- #------------------------#
- #------------------------#------------------+-------------------------------------+------------+------------------------+
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # MAIN FUNCTION ------------#
- if __name__ == "__main__": #
- #----------------------------#
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- #------------------------#------------------+--------------------------+----------------------+------------------------------------+
- # REPRESENTS THE GAME --------#
- run = True #------------#
- #---------------------------------#
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # CERTAIN CLOCK VALUE DEFAULT, VARIES FROM PC TO PC #
- clock = pg.time.Clock() #----------------------------#
- #----------------------------#
- # create board ----------#----------------------------------------------------+------------------+----------------------------------------------+
- board = checker_board() #
- game = checker(WIN) #--#
- #------------------------#
- # MAIN LOOP ----------------#---------+-----+
- while run: #----------------#
- clock.tick(fps) #-------#----------------+----------+
- #-------------------------------#--#
- if board.winner() != None: #
- print(board.winner()) #
- #----------------------------------#
- #----------------------------------#--------+----------------#---------+----------------------+------------------------------------+
- # CHECK IF EVENTS ARE RUNNING OR NOT ----------------#
- for event in pg.event.get(): #-----------------------#
- if event.type == pg.QUIT: #----------------------#
- run = False #-------------------------------#
- if event.type == pg.MOUSEBUTTONDOWN: #-----------#
- pos = pg.mouse.get_pos() #-------------------#
- row, col = get_row_col_mouse(pos) #----------#
- game.selectrc(row, col) #--------------------#
- # piece = board.get_piece(row, col) --------#
- # board.move(piece, 4, 3) ------------------#
- #++++++++++++++++++++++++++#---------------------------------#
- game.update() #
- pg.quit() #
- #++++++++++++++++++++++++++#
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##=================================================================================================================================================##
- ##-------------------------------------------------------------------------------------------------------------------------------------------------##
- ## ##
- ## ## // ##
- ##----+-#########\ ######## -+#######\\-- +########## #######\\ /#######\\ ## // ######---+-## ## /#######\\ ##
- ## ##- ##|--|## ##- ## ## ##- ## ||----- ## // ## ##----+-## ||----- +--##
- ## ## ##| |## -+## +--## ####### ## ## -- \\#######\\ ## \\ ## ## ##------\\#######\\-------+##
- ## ##- +-##|--|## ##- ## ## ##- ## ------|| ## \\ ## ## ## ------||--------##
- ## #########/ ######## -#######//- -+########## #######// \\######// ## \\ ######---+-##### ##### \\######//------+--##
- ## ##
- ## https://CodedSkills.net ##
- ##-------------------------------------------------------------------------------------------------------------------------------------------------##
- ##=================================================================================================================================================##
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
- ##=======================================================================================================================================================================================##
- ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
- ## ##
- ## ### #######\ #######\ ####### ######## ## ## ######## ######## ####### ######## #### ## /#######\\ ##
- ## #-## // // \ // = ## ## ## ## ##|--|## ## // ## // \\ ## ||- ##
- ## ## ##\\ ##\\ // ## ## ## ## ##| |## ###\\ ## //====\\ ## \\#######\\ ##
- ## ## // // // ## ## ## ## ##|--|## ## \\ ## // \\ ## || ##
- ## ########## ########-- ########-- // = ## #### ## ######## ## \\ ######## // \\ ####### \\######// ##
- ## ##
- ## https://1337tutorials.net ##
- ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------##
- ##=======================================================================================================================================================================================##
- ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++##
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement