Creating a Game With ChatGPT

A Man Working With ChatGPT on a Computer

Creating a game from scratch can be a challenging task, but with the help of ChatGPT, I embarked on this coding adventure. Armed with my HTML, CSS, and JavaScript files, I sought to build a solitaire game that can be played in the browser. In this blog series, I’ll share my experiences as I build the game.

Development Plan

My plan is to build a functioning game with as few visuals as possible. I will add a graphical user interface (GUI) afterwards. This strategy will give us greater flexibility to experiment with accessibility features.

Pivoting after a Failed Attempt

My first attempt to build the game did not go smoothly. I spent a bunch of time making the game look good before the game was playable. We built a deck, shuffled and dealt the cards. Then, when trying to move the cards, I discovered that the location of the cards on screen didn’t always match their true position. I had to rewrite a lot of code and kept encountering errors. Finally, I decided to start over with the strategy I mentioned above: I would get a working game before I fussed about how it would display on screen.

Completed Tasks

In the Works

  • Define the rules
  • Refine the controls
  • Launch a demo

Project Definitions

Video Game Terms

GUI (Graphic User Interface)
The visual elements, like buttons, icons and indicators that allow a user to interact with the game.

Solitaire Terminology

Suits
A card deck is grouped into four categories called suits. The suit is represented by a symbol: a heart, diamond, club or spade. Hearts and diamonds are red suits; clubs and spades are black.
Rank
There are 13 cards in each suit, each with a different rank. The ranks are King, Queen, Jack, 9, 8, 7, 6, 5, 4, 3, 2 and Ace.
Value
Each rank can be assigned a number as its value. In solitaire, Kings have the highest value and Aces have the lowest.
Foundation Piles
The objective of solitaire is to organize the deck into four piles, one for each suit. These piles are called foundations.
Tableau Piles
The game starts with piles of unordered cards, called tableaus. The player wants to move the cards from these piles into the foundations.
Stock Pile
Not all of the cards start in the tableaus. Some are left in a separate pile called the stock. Cards in this pile are placed face-down.
Waste Pile
The player is able to flip over cards from the stock pile as the game progresses. This new stack of cards is called the waste.

Conclusions

ChatGPT’s contributions proved invaluable in speeding up the development process. Although it made a lot of mistakes, it enabled me to do much more than I could have done on my own. I’m excited to continue this project and witness its evolution into a fully playable solitaire game.


Posted

by

in

Last Updated