AWS Logo
Menu
Random-warShift: A unpredictable Chess Game hosted in amazon-s3

Random-warShift: A unpredictable Chess Game hosted in amazon-s3

This game spices up traditional chess by randomly transforming pieces—queens become pawns, rooks turn into knight etc.

Published Dec 4, 2024
Last Modified Dec 6, 2024

Introduction

In a recent Amazon hackathon, I embarked on creating an innovative chess game called Random-warShift. This project involved designing a chess variant where pieces randomly change type without moving positions. Leveraging Amazon Q Chat tools, I completed the game within a day, a significant improvement in development speed compared to my previous projects.
Development Journey
The process started with brainstorming, and once I pitched the idea to Amazon Q Chat, the tool swiftly provided foundational files: index.html, game.js, and styles.css. Its "insert at cursor" feature made integrating code seamless, making copying easy.
image of insert at cursor logo
Insert at cursor function
After testing the initial version, I suggested improvements, including AI integration and a full recoding of the game.js file. Within moments, the tool generated over 500 lines of refined code incorporating my feedback.
However, some areas required manual tweaks. For instance, I noticed that AI piece movement didn't visually update the board until a human moved. To address this, I modified the code to improve real-time updates, ensuring smoother gameplay.
Enhancements
Amazon Q Chat suggested additional features to enhance user experience:
  • Sound Effects: Integrated customizable audio feedback.
  • Winner Popup: A visual display to announce the game winner.
  • UI Improvements: Polished designs for a better aesthetic.
These enhancements were straightforward to implement, involving minimal effort like inserting code and updating file paths.
chat from amazon Q developer
code given for sound effects by amazon Q
Hosting
I used Amazon S3 for hosting my static website as it is enough for game with no backend.
The steps are:
  1. Login to AWS Console: Go to AWS Console.
  2. Create an S3 Bucket:
    • Navigate to S3.
    • Click "Create bucket".
    • Set the bucket name
    • Uncheck "Block all public access" to allow public access to the bucket.
    • Acknowledge the warning and create the bucket.
  3. Upload Your Website Files:
    • Upload your HTML, CSS, JS, and other files to the S3 bucket.
    • Use the "Upload" button and set the files as public.

2. Enable Static Website Hosting

  1. Go to the S3 bucket.
  2. Click on the "Properties" tab.
  3. Scroll down to "Static website hosting" and click "Edit".
  4. Choose "Enable" and:
    • Set "Index document" to index.html.
  5. GOTO properties scroll down to see bucket website endpoint
  6. If you cannot see you website still then Go to the "Permissions" tab in the S3 bucket.
  7. Click "Bucket policy".
  8. Add the following policy to allow public access:

Comparison with Previous Projects

Previously, I developed Attack on Titan chess, a creative variant featuring cannons to shoot bullets and blocks to protect the king (Titan). This project took two weeks of manual coding from scratch, including bot implementation and UI enhancements. In contrast, Random-warShift was completed within a day, showcasing how tools like Amazon Q Chat can significantly accelerate development.

Comments