<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vũ Hoàng Lê Nguyễn</title>
    <description>The latest articles on DEV Community by Vũ Hoàng Lê Nguyễn (@haydensg2002).</description>
    <link>https://dev.to/haydensg2002</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3160538%2F2452a6f9-59ac-4d8d-b9d7-fdec4f90f50a.png</url>
      <title>DEV Community: Vũ Hoàng Lê Nguyễn</title>
      <link>https://dev.to/haydensg2002</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/haydensg2002"/>
    <language>en</language>
    <item>
      <title>🐍 Build a Classic Snake Game with Python and Pygame on WSL using Amazon Q CLI</title>
      <dc:creator>Vũ Hoàng Lê Nguyễn</dc:creator>
      <pubDate>Thu, 29 May 2025 11:01:07 +0000</pubDate>
      <link>https://dev.to/haydensg2002/build-a-classic-snake-game-with-python-and-pygame-on-wsl-using-amazon-q-cli-2og8</link>
      <guid>https://dev.to/haydensg2002/build-a-classic-snake-game-with-python-and-pygame-on-wsl-using-amazon-q-cli-2og8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ficjmh02dv1vu9e6a2wbh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ficjmh02dv1vu9e6a2wbh.png" alt="Image description" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🎮 &lt;strong&gt;Snake Game&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This classic &lt;strong&gt;Snake Game&lt;/strong&gt; brings back nostalgic gameplay in a modern Python environment using &lt;strong&gt;Pygame&lt;/strong&gt;. Built and tested on &lt;strong&gt;Ubuntu via WSL&lt;/strong&gt;, this project also leverages &lt;strong&gt;Amazon Q CLI&lt;/strong&gt; to streamline development, debug faster, and manage Python packages directly in the terminal — making the entire process smoother and more efficient.&lt;/p&gt;

&lt;p&gt;Players control a growing snake that must eat red food to gain points and grow longer, while avoiding collisions with walls and its own body. As the game progresses, the challenge increases, offering an engaging experience through simple yet addictive mechanics.&lt;/p&gt;




&lt;h3&gt;
  
  
  🚀 Why Amazon Q CLI?
&lt;/h3&gt;

&lt;p&gt;By using &lt;strong&gt;Amazon Q CLI&lt;/strong&gt;, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get instant coding assistance for Python logic&lt;/li&gt;
&lt;li&gt;Debug runtime errors in real time&lt;/li&gt;
&lt;li&gt;Automate virtual environment setup and dependency management&lt;/li&gt;
&lt;li&gt;Ask technical questions while coding — all directly in the CLI&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Amazon Q CLI made it easier for me to stay focused and productive during the entire dev process.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  🎮 How to Play
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run the game:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  python3 snake_game.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Controls:

&lt;ul&gt;
&lt;li&gt;↑ Up arrow: Move up
&lt;/li&gt;
&lt;li&gt;↓ Down arrow: Move down
&lt;/li&gt;
&lt;li&gt;← Left arrow: Move left
&lt;/li&gt;
&lt;li&gt;→ Right arrow: Move right
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Objective:

&lt;ul&gt;
&lt;li&gt;Eat red food to grow and increase your score
&lt;/li&gt;
&lt;li&gt;Avoid hitting the walls or your own body
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;After Game Over:

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;Q&lt;/code&gt; to quit
&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;C&lt;/code&gt; to play again
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔥 Game Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Real-time score tracking
&lt;/li&gt;
&lt;li&gt;Increasing difficulty as the snake grows
&lt;/li&gt;
&lt;li&gt;Game Over screen with restart option
&lt;/li&gt;
&lt;li&gt;Smooth controls and collision detection
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  💻 Requirements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Python 3
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.pygame.org/" rel="noopener noreferrer"&gt;Pygame&lt;/a&gt; library
&lt;/li&gt;
&lt;li&gt;WSL (Ubuntu 22.04 recommended)
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/q/cli/latest/userguide/what-is-q-cli.html" rel="noopener noreferrer"&gt;Amazon Q CLI&lt;/a&gt; (optional but highly recommended)&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📦 Installation Steps
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Ensure Python 3 is installed:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   python3 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install Pygame:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   pip &lt;span class="nb"&gt;install &lt;/span&gt;pygame
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Clone or download this project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the game:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   python3 snake_game.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;(Optional) Use Amazon Q CLI:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   q &lt;span class="nb"&gt;help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🧠 Code Structure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;snake_game.py&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;Game window setup
&lt;/li&gt;
&lt;li&gt;Snake movement and logic
&lt;/li&gt;
&lt;li&gt;Food generation
&lt;/li&gt;
&lt;li&gt;Collision detection
&lt;/li&gt;
&lt;li&gt;Score tracking
&lt;/li&gt;
&lt;li&gt;Game restart/quit logic
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  🌱 Future Improvements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add sound effects
&lt;/li&gt;
&lt;li&gt;Introduce multiple difficulty levels
&lt;/li&gt;
&lt;li&gt;Save and display high scores
&lt;/li&gt;
&lt;li&gt;Add obstacles or maze elements
&lt;/li&gt;
&lt;li&gt;Add power-ups for special abilities
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📸 Screenshot
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;(Bạn có thể chèn ảnh minh họa game tại đây)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;![&lt;/span&gt;&lt;span class="nv"&gt;Snake Game Screenshot&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://link-den-anh-game.png&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🪪 License
&lt;/h3&gt;

&lt;p&gt;This project is &lt;strong&gt;open-source&lt;/strong&gt; and free to use, modify, and improve!&lt;/p&gt;

</description>
      <category>amazonqcli</category>
      <category>awscommunity</category>
    </item>
  </channel>
</rss>
