{"id":58,"date":"2025-11-21T16:24:07","date_gmt":"2025-11-21T16:24:07","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/c_menhart\/?p=58"},"modified":"2025-11-21T16:24:07","modified_gmt":"2025-11-21T16:24:07","slug":"friday-11-21-2025","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/c_menhart\/2025\/11\/21\/friday-11-21-2025\/","title":{"rendered":"friday 11\/21\/2025"},"content":{"rendered":"\n<p>for the main.py i did this <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pygame\nimport sys\nfrom grid import Grid\npygame.init()\ndark_blue = (44, 44, 127)\nscreen = pygame.display.set_mode((300, 600))\npygame.display.set_caption(\"python Tetris\")\n\nclock = pygame.time.Clock()\n\n\ngame_grid = Grid()\n\ngame_grid&#91;0]&#91;0] = 1 \ngame_grid&#91;3]&#91;5] = 4\ngame_grid&#91;17]&#91;8] = 7 \n\ngame_grid.print_grid()\nwhile True:\n    for event in pygame.event.get():\n        if event.type == pygame.QUIT:\n            pygame.quit()\n            sys.exit()\n    # drawing\n    screen.fill(dark_blue)\n    game_grid.draw(screen)\n    pygame.display.update()\n    clock.tick(60)\n<\/code><\/pre>\n\n\n\n<p>and for grid.py i did this <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Grid:\n    def __init__(self):\n        self.num_rows = 20\n        self.num_cols = 10\n        self.cell_size = 30\n        self.grid = &#91;&#91;0 for j in range(self.num_cols)] for i in range(self.num_rows)]\n        self.colors = self.get_cell_colors()\n\n    def print_grid(self):\n        for row in range(self.num_cols):\n            for column in range(self.num_cols):\n                print(self.grid&#91;row]&#91;column], end = \" \")\n        \n    def get_cell_colors(self):\n        dark_grey = (26, 31, 40)\n        green = (47, 230, 23)\n        red = (232, 18, 18)\n        orange = (226, 116, 17)\n        yellow = (237, 234, 4)\n        purple = (166, 0, 247)\n        cyan = (21, 204, 209)\n        blue = (13, 64, 216)\n        return &#91;dark_grey, green, red, orange, yellow, purple, cyan, blue]\n    def draw(self, screen):\n        for row in range(self.num_rows):\n            for column in range(self.num_cols):\n                cell_value = self.grid&#91;row] &#91;column]\n                cell_rect = pygame. Rect(column*self.cell_size +1, row*self.cell_size +1,   \n                self.cell_size -1, self.cell_size -1)\n                pygame.draw.rect(screen, self.colors&#91;cell_value], cell_rect)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>for the main.py i did this and for grid.py i did this<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/posts\/58","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/comments?post=58"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":59,"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/posts\/58\/revisions\/59"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/c_menhart\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}