{"id":64,"date":"2026-02-13T15:35:55","date_gmt":"2026-02-13T15:35:55","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/r_najim\/?p=64"},"modified":"2026-02-13T15:35:55","modified_gmt":"2026-02-13T15:35:55","slug":"friday-fed-13-2026","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/r_najim\/2026\/02\/13\/friday-fed-13-2026\/","title":{"rendered":"Friday, FED 13, 2026"},"content":{"rendered":"\n<p>                   Today This Free Friday I am working on project on YouTube a Snake game part 2.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=bfRwxS5d0SI&amp;t=730s\">https:\/\/www.youtube.com\/watch?v=bfRwxS5d0SI&amp;t=730s<\/a><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>class Snake:\n    \n    def __init__(self):\n        self.body_size = BODY_PARTS\n        self.coordinates = &#91;]\n        self.squares = &#91;]\n\n        for i in range(0, BODY_PARTS):\n            self.coordinates.append(&#91;0, 0])\n\n        for x, y in self.coordinates:\n            square = canvas.create_rectangle(x, y, x + SPACE_SIZE, y + SPACE_SIZE, fill=SNAKE_COLOR, tag=\"snake\")\n            self.squares.append(square)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This part of the code is for the snake body part size.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def change_direction(new_direction):\n    \n    global direction\n\n    if new_direction == 'Left':\n        if direction != 'right':\n            direction = new_direction\n    elif new_direction == 'right':\n        if direction != 'Left':\n            direction = new_direction\n    elif new_direction == 'up':\n        if direction != 'down':\n            direction = new_direction\n    elif new_direction == 'down':\n        if direction != 'up':\n            direction = new_direction\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This part of the code is for the direction for the snake.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def next_turn(snake,food):\n    x, y = snake.coordinates&#91;0]\n\n    if direction == \"up\":\n        y-= SPACE_SIZE\n    elif direction == \"down\":\n        y += SPACE_SIZE\n    elif direction == \"left\":\n        x -= SPACE_SIZE\n    elif direction == \"right\":\n        x += SPACE_SIZE\n\n    snake.coordinates.insert(0, (x,y))\n\n    snake.coordinates.insert(x, y, x + SPACE_SIZE, y + SPACE_SIZE, fill=SNAKE_COLOR)\n\n    snake.squares.insert(0, square)\n\n    del snake.coordinates&#91;-1]\n\n    if x == food.coordinates&#91;0] and y == food.coordinates&#91;1]:\n\n        global score\n\n        score += 1\n\n        Label.cofing(text=\"Score:{}\" .format(score))\n\n        canvas.delete(\"food\")\n\n        food = Food()\n\n    else:\n     del snake.coordinates&#91;-1]\n\n     canvas.delete(snake.squares&#91;-1])\n\n     del snake.squares&#91;-1]\n\n    if check_collisions(snake):\n        game_over()<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This part of the code is for the coordinates of<\/li>\n\n\n\n<li>Snake direction<\/li>\n\n\n\n<li>Food<\/li>\n\n\n\n<li>SPACE_SIZE\n<ul class=\"wp-block-list\">\n<li>This part of the code is for the score and to check for collisions.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Today This Free Friday I am working on project on YouTube a Snake game part 2.<\/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-64","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":65,"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/posts\/64\/revisions\/65"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/r_najim\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}