This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| multiDimnArray = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]) | |
| # Dimensions: 2 | |
| # Shape: (2, 4) | |
| # -------------- SELECTING: -------------- | |
| multiDimnArray[0, 1] # Second element from first array | |
| # >>> 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| array_of_ones = np.ones(10, dtype=np.uint8) | |
| # [1 1 1 1 1 1 1 1 1 1] | |
| # Dimensions: 1 | |
| # Shape: (10,) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 600, 400 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) | |
| # GLOBAL VARS, Using a Dictionary. | |
| _VARS = {'surf': False} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 600, 400 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) | |
| PADDING = PADTOPBOTTOM, PADLEFTRIGHT = 60, 60 | |
| # VARS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 600, 400 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) | |
| PADDING = PADTOPBOTTOM, PADLEFTRIGHT = 60, 60 | |
| # VARS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 600, 400 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) | |
| # VARS: | |
| _VARS = {'surf': False} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 600, 400 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) | |
| # VARS: | |
| _VARS = {'surf': False} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 800, 600 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) | |
| # NOTE WE MOVED ALL GRID CONSTANTS HERE FOR CONVENIENCE: | |
| _VARS = {'surf': False, 'gridWH': 400, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| # CREATE AN EMPTY (zeros) list of lists: | |
| MAP = np.zeros((6, 6), dtype=int) | |
| print(MAP) | |
| print(MAP.shape) | |
| print(MAP.shape[0]) # ROWS | |
| print(MAP.shape[1]) # COLUMNS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import pygame | |
| from pygame.locals import KEYDOWN, K_q | |
| import numpy as np | |
| # CONSTANTS: | |
| SCREENSIZE = WIDTH, HEIGHT = 800, 600 | |
| BLACK = (0, 0, 0) | |
| GREY = (160, 160, 160) |