{"id":57,"date":"2025-12-05T16:31:10","date_gmt":"2025-12-05T16:31:10","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/d_torres\/?p=57"},"modified":"2025-12-05T16:31:10","modified_gmt":"2025-12-05T16:31:10","slug":"free-friday-12-5-2025","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/d_torres\/2025\/12\/05\/free-friday-12-5-2025\/","title":{"rendered":"free friday 12\/5\/2025"},"content":{"rendered":"\n<p>The thing i worked on today was something new i worked on tetris the game doesn&#8217;t fully load but I&#8217;ll get it to work but for now i wrote a good amount of code i really like this game because its relaxing in my opinion <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pygame \n\nW, H = 10, 20\nTILE = 45 \nGAME = W * TILE, H * TILE\nFPS = 60\n\npygame.init()\ngame_sc = pygame.display.set_mode(GAME_RES)\nclock = pygame.time.clock()\n\ngrid = &#91;pygame.Rect(X * TILE, Y * TILE) for x in range (W) for y in range(H)]\n\nfigures_pos = &#91;&#91;(-1, 0), (-2, 0), (0, 0), (1, 0)],\n              &#91;(0, -1), (-1, -1), (-1, 0), (0, 0)],\n              &#91;(-1, 0), (-1, 1), (0, 0), (0, -1)],\n              &#91;(0, 0), (-1, 0), (0, 1), (-1, -1)],\n              &#91;(0, 0), (0, -1), (0, 1), (-1, -1)],\n              &#91;(0, 0), (0, -1), (0, 1), (-1, -1)],\n              &#91;(0, 0), (0, -1), (0, 1), (-1, 0)]]\n\nfigures = &#91;&#91;pygame. Rect(x + W \/\/ 2, y + 1, 1, 1) for x, y in fig_pos] for fig_pos in figures_pos]\nfigure_rect = pygame. Rect(0, 0, TILE - 2, TILE - 2)\n\nanim_count, anim_speed, anim_limit = 0, 60, 2000\nfigure = deepcopy(figures&#91;3])\n\n\n\ndef check_borders():\n    if figure&#91;i].x &lt; 0 or figure&#91;i].x > W - 1:\n        return False\n    return True\n\n\nwhile True:\n    dx = 0\n    game_sc.fill(pygame. Color('black'))\n    # control\n    for event in pygame. event.get():\n      if event. type == pygame . QUIT :\n        exit()\n        if event. type == pygame . KEYDOWN:\n          if event. key == pygame. K_LEFT:\n             dx = -1\n          elif event. key == pygame. K_RIGHT:\n                dx = 1 \n          elif event. key == pygame. K_DOWN:\n                anim_limit + 100\n          \n\n    # move x\n    figure_old = deepcopy(figure)\n    for i in range(4):\n       figure &#91;i] . x += dx\n       if not check_borders():\n           figure = deepcopy(figure_old)\n           break <\/code><\/pre>\n\n\n\n<p>i will try my best for it to work next time im close to it though <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The thing i worked on today was something new i worked on tetris the game doesn&#8217;t fully load but I&#8217;ll [&hellip;]<\/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-57","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/posts\/57","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":58,"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/posts\/57\/revisions\/58"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_torres\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}