Grid Printing Code for Python
Github link : Click here
Note: The code is open-source but it highly advised to acknowledge this Web page or the github link whenever using this code in your project.
The main aim of this is to allow for easy access to a 2d grid with x,y coordinates. It can be used to create a chess board, Maze or just anything you could think of with a grid.
The basic output look as follows:
The variables defined are:
The function in it are:
For customization :
- Change the variable x,y to alter the board size
- Insert values in the _coords lists to get a particular pattern in a certain cell
- If you want to change the default cell filling then simply go to the end of print_board() function and under the heading default change the empty_cell function to any desired functions.
I hope this code will help you sometime in future or it gave you an idea to make a better version of it (then don't forgot to share it to me via commenting it down).
Github link of the whole code: Click here
For any queries or suggestions comment below.
Comments
Post a Comment
For any queries or suggestions
Comment Here