DEV Community

scorder
scorder

Posted on

I made a Blackjack game with ChatGPT

My friend recently worked on an HTML Blackjack game. The Javascipt code for the game was 335 lines long and full of bugs. Fast-forward a few weeks, I really wanted to play Blackjack online but couldn't find a website with a good UI, ads not bombarding my screen and no casinos with hot girls trying to take my money.

So I decided to do it myself.

Image description

I gave Chatgpt a very simple prompt to begin with. I wanted to see what it comes up with without me having any specific prefereneces.

Prompt -
Make a blackjack game using react, typescript and tailwind.

I set up a new project in VSCode and pasted the code in it.
I now had a very simple, playable Blackjack game.

Image description

First thing I wanted to change was the display of your cards. It does the job, but actual cards would look much better.

Prompt -
Instead of numbers and icons, make a card component and use it.

Image description

This will do the job.
Finally, I asked chatGPT to add animations with motion.

At this point, I had a game that worked perfectly. I can play it just fine, and it simply works while looking nice and minimal. But there was something missing. It just didn't have that juice.

I knew I had to make some manual changes.

  • First thing I did was center the game vertically.
  • Added a navbar and moved the heading "Blackjack" away from the game.
  • Added some icons to the buttons to make things clearer.
  • Made it so startGame() was being called when opening the site or refreshing.
  • Added a How to Play section that was written by ChatGPT.
  • Changed the title, description, and logo.
  • Added confetti when you win.

Now it looks like this -

Image description

Conclusion

As you can see, I added quite a few things to the game manually. They are not too complex, if I asked chatGPT, or better yet an AI based IDE to do it I'm pretty sure it'd do them without much problems. But here's the thing -
I'm a developer, not a manager. I don't want to explain to an AI exactly what I want done, provide minute details, repeat the phrase "YOU ARE A SENIOR DEVELOPER" etc. I'd rather save the time and headache and do it myself. It'd take 5 minutes and I'd actually enjoy building.

However, I was just too tired to implement the Blackjack logic myself, and that's where AI really shines. The mundane, boring stuff.

A hot take,
AI can help a lot to build much bigger projects a lot faster. But it cannot yet be a replacement. A lot of people advertise building a complete app with AI and getting rich, but that dream is yet to be realized. If you want software that people will love using, you will need to step in at some point. Think of AI art vs human art. AI art isn't that moving. Similarly, a visitor to a website will notice the difference.

Finally,
There are a lot more improvements that can be done to the website. Custom backgrounds, total card value, betting with fake money and more. But I've left those to you guys. Find this project on GitHub and send some pull requests. Let's make this the best Blackjack game to exist!

https://github.com/scorder96/blackjack

Top comments (10)

Collapse
 
litzondy profile image
Litzondy • Edited

Tried playing some online Blackjack myself and got so frustrated with pop-ups and cluttered sites. Ended up stumbling on a community forum where someone shared a heritage sportsbook review—not for Blackjack exactly, but it led me to better, cleaner sports betting sites that actually value user experience

Collapse
 
scorder profile image
scorder

That's cool! I'll definitely check it out.

Collapse
 
armusteer profile image
Armusteer

I see it's been a while since you've posted, but I just want to ask—did you keep working on this project or maybe build something new with ChatGPT since then? I've been experimenting with using it to add simple strategy hints to games, and I’m curious if anyone’s tried integrating things like card counting tips or probability feedback in a fun, educational way.

Collapse
 
scorder profile image
scorder

Hi! I didn't work further on this project. But I do use ChatGPT every now and then to help me solve problems or implement boring logic here and there.
Your idea sounds interesting, and I'd love to see an actual implementation of that someday. I do wonder how AI can replace/add to computed hints.

Collapse
 
khulanerdene profile image
KhulanErdene • Edited

That sounds like a solid project! If you want to see how Blackjack works in a real online setting, mongolia-1xbet.com in Iraq offers a platform where you can try different strategies and observe outcomes, which can complement your programming experiment nicely.

Collapse
 
dizzyma17 profile image
DizzyMa17 • Edited

That's awesome! Building a Blackjack game with ChatGPT is a great way to dive into coding and game logic. It's impressive how AI can assist in creating such interactive experiences. If you're looking to expand your project, you might consider integrating real-world casino elements. For instance, casino en ligne belgique offers a curated list of licensed Belgian online casinos, providing insights into various games like Blackjack, Roulette, and Slots. They highlight platforms that are not only entertaining but also legally compliant, ensuring a safe gaming environment. Exploring such resources can give you a deeper understanding of how real-world casinos operate, which could be beneficial if you plan to develop more advanced gaming projects in the future. Keep up the great work, and happy coding!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.