I made the Memory Game in the "Vibe Coding" style!
You can play it just by chatting with Amazon Q CLI!
神経衰弱ゲーム (Memory Game)
Pygameを使用したトランプの神経衰弱ゲームです。
概要
このプロジェクトは、Pygameを使用して作成された神経衰弱(メモリーゲーム)です。 トランプカードを使用し、同じカードのペアを見つけるゲームです。
機能
- トランプカードを使った神経衰弱ゲーム
- 自動生成されるトランプカード画像
- スコア表示(試行回数、マッチ数、経過時間)
- ゲームクリア画面
- Noto Sans JPフォントを使用した日本語表示
必要条件
- Python 3.6以上
- Pygame
- Requests (フォントのダウンロードに使用)
インストール方法
- 必要なパッケージをインストールします:
pip install -r requirements.txt
使い方
- ゲームを起動します:
python memory_game.py
初回起動時には、Noto Sans JPフォントが自動的にダウンロードされます。
- カードをクリックして、ペアを見つけます
- すべてのペアを見つけるとゲームクリアです
- 「R」キーを押すとゲームをリスタートできます
ゲームルール
- カードをクリックすると裏返ります
- 2枚のカードをめくり、同じカードであればマッチとなります
- マッチしたカードはゲーム盤から消えます
- マッチしなかった場合、カードは再び裏返ります
- すべてのカードのペアを見つけるとゲームクリアです
ファイル構成
-
memory_game.py
- メインゲームファイル -
generate_cards.py
- トランプカード画像生成スクリプト -
download_font.py
- Noto Sans JPフォントをダウンロードするスクリプト -
resources/cards/
- 生成されたカード画像が保存されるディレクトリ -
resources/fonts/
- ダウンロードされたフォントが保存されるディレクトリ
操作方法
- マウスクリック: カードを選択
- ESCキー: ゲーム終了
- Rキー: ゲームリスタート(ゲームクリア後)
This is the event of "Build Games with Amazon Q CLI and score a T shirt".
Let's check how to make it.
Install Amazon Q CLI
It's an example for macOS.
brew install amazon-q
Lunch "Amazon Q" app and sign in with AWS Builder ID.
Just all.
Start Vibe Coding
Let's chat with Amazon Q CLI.
% q chat ⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀ ⠀⠀⠀⣾⡿⢻⣿⡆⠀⠀⠀⢀⣄⡄⢀⣠⣤⣤⡀⢀⣠⣤⣤⡀⠀⠀⢀⣠⣤⣤⣤⣄⠀⠀⢀⣤⣤⣤⣤⣤⣤⡀⠀⠀⣀⣤⣤⣤⣀⠀⠀⠀⢠⣤⡀⣀⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠋⠀⠀⠀⠙⣿⣿⡆ ⠀⠀⣼⣿⠇⠀⣿⣿⡄⠀⠀⢸⣿⣿⠛⠉⠻⣿⣿⠛⠉⠛⣿⣿⠀⠀⠘⠛⠉⠉⠻⣿⣧⠀⠈⠛⠛⠛⣻⣿⡿⠀⢀⣾⣿⠛⠉⠻⣿⣷⡀⠀⢸⣿⡟⠛⠉⢻⣿⣷⠀⠀⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⢸⣿⣿ ⠀⢰⣿⣿⣤⣤⣼⣿⣷⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⢀⣴⣶⣶⣶⣿⣿⠀⠀⠀⣠⣾⡿⠋⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⡇⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⣇⠀⠀⠀⠀⠀⢸⣿⡿ ⢀⣿⣿⠋⠉⠉⠉⢻⣿⣇⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⣿⣿⡀⠀⣠⣿⣿⠀⢀⣴⣿⣋⣀⣀⣀⡀⠘⣿⣿⣄⣀⣠⣿⣿⠃⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣦⣀⣀⣀⣴⣿⡿⠃ ⠚⠛⠋⠀⠀⠀⠀⠘⠛⠛⠀⠘⠛⠛⠀⠀⠀⠛⠛⠀⠀⠀⠛⠛⠀⠀⠙⠻⠿⠟⠋⠛⠛⠀⠘⠛⠛⠛⠛⠛⠛⠃⠀⠈⠛⠿⠿⠿⠛⠁⠀⠀⠘⠛⠃⠀⠀⠘⠛⠛⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⣿⣿⣋⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢿⡧ ╭─────────────────────────────── Did you know? ────────────────────────────────╮ │ │ │ You can execute bash commands by typing ! followed by the command │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ /help all commands • ctrl + j new lines • ctrl + s fuzzy search ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ > 神経衰弱をpygameを使って作りたいです。トランプを使ったものにしたいので、トランプの画像も生成してください。
The above prompt means I want to make a memory game using pygame. I want to use playing cards, so please generate images of playing cards.
In some chats with Amazon Q, I could make the Memory Game.
I only requested thinking on Amazon Q.
> 少し下が見切れているので、画面をもう少し縦に広げて。 🛠️ Using tool: fs_read (trusted) ⋮ ● Reading file: /Users/takuya/project/amazon_q/a/memory_game.py, from line 1 to 20 ⋮ ● Completed in 0.0s 🛠️ Using tool: fs_write (trusted) ⋮ ● Path: memory_game.py 1, 1: import pygame 2, 2: import sys 3, 3: import os 4, 4: import random 5, 5: import time 6, 6: from download_font import download_noto_sans_jp 7, 7: 8, 8: # 定数 9, 9: SCREEN_WIDTH = 800 - 10 : SCREEN_HEIGHT = 600 + 10: SCREEN_HEIGHT = 700 # 画面の高さを600から700に増加 11, 11: CARD_WIDTH = 100 12, 12: CARD_HEIGHT = 150 13, 13: CARD_MARGIN = 10 14, 14: ROWS = 4 15, 15: COLS = 6 16, 16: FPS = 60 17, 17: BACKGROUND_COLOR = (50, 150, 100) # 緑色の背景 18, 18: FONT_COLOR = (255, 255, 255) # 白色のテキスト Updating: memory_game.py ⋮ ● Completed in 0.2s
Above is an example.
I chatted with Amazon Q to "The bottom row of cards is not visible, so please make it visible".
Then, Amazon Q rewrote the window size.
Wrap up
This report is straightforward because I only have some chats, and Amazon Q CLI is mighty.
Let's challenge and feel yourself with Amazon Q CLI power!
Top comments (0)