Categories: Technology

ChatGPT Live Challenge: The first version doesn’t work and destroys our layout!

Patrick Toggweiler

This story will be constantly updated. You can use the menu to go directly to the last item.

9:30 am: I like programming!

I once programmed, really coded: an unbeatable cute cat game called “Clumsy Karate Cat” for Android and Apple phones. It was the designated successor to Flappy Bird, waiting to be downloaded by the masses. And it waited and waited and waited for it to be removed from both app stores. Unfortunately, I had to learn that marketing is everything. The cutest cat won’t help.

Not only the game has disappeared from the shops, but also my rudimentary knowledge of programming. At that time I was able to use a programming interface called “Corona”. The surface, as you can guess, no longer exists under that name. All that remained was my frustration that I never really learned to program. Neither HTML nor Javascript.

But now with ChatGPT there is an artificial intelligence that does the tedious programming work for me. At least that’s what the exuberant tweets tell me about the upgrade to version 4. And as so often these days, I’m taking on a challenge: Can I do it tonight (almost) without any programming knowledge with ChatGPT Tic-tac-toe game computer programming?

Wish me luck!

1st attempt: greets the page

What the many enthusiastic tweets don’t say: Chat GPT-4 is smart, but not a racehorse. Because I’m pressed for time, I decide to make a first version with GPT-3.5. It can’t be that hard…

I try the following prompt:

Programming a tic-tac-toe game in HTML that I can embed in my homepage. And with the following conditions:

The background must be black.
The grid of the playing field and the playing pieces must be pink.
The player plays against a computer opponent.
The player always starts.
When the game is over, it should be stated who won – or if there was a tie.
A button should appear below it to start a new game.
It should have the following caption: “Start a new game”.

GPT-3.5 works like Valentino Rossi and writes me code in seconds.

But what good is the code? I build it into our homepage, which thanks to our content management system (CMS) is child’s play, even for a layman like me. And voila!

Noughts and crosses


function startGame() { gameStatus=""; currentPlayer="X"; squares.forEach(square => square.innerHTML = ''); document.getElementById('message').innerHTML = ''; }

function handleMove(e) { const clickedSquare = e.target; if (gameStatus !== '' || clickedSquare.innerHTML !== '') return; clickedSquare.innerHTML = currentPlayer; if (checkWin()) { gameStatus = `${currentPlayer} hat gewonnen!`; } else if (checkTie()) { gameStatus="Unentschieden!"; } else { currentPlayer = currentPlayer === 'X' ? 'O' : 'X'; } document.getElementById('message').innerHTML = gameStatus; }

function checkWin() { return winningCombinations.some(combination => { return combination.every(index => { return squares[index].innerHTML === currentPlayer; }); }); }

function checkTie() { return squares.every(square => square.innerHTML !== ''); }

for (let i = 0; i < 9; i++) { const square = document.createElement('div'); square.classList.add('square'); square.addEventListener('click', handleMove); board.appendChild(square); squares.push(square); } document.getElementById('new-game').addEventListener('click', startGame); startGame();

aaaaaaaaaaa

With my HTML element I destroy the layout of our beautiful news page. Ha! The tingling feeling of power arises, because everyone knows: whoever wants to create must also be able to destroy! Or something.

But now the sales team is behind me and listening. That's how quickly omnipotence turns into powerlessness. I feel like Goethe's sorcerer's apprentice. How the hell do I get rid of the ghosts I called?

And above all: what has Chat-GPT 3.5 programmed here? The rendering of the playing field is reminiscent of a Basquiat painting and there is no computer opponent either. But I'll have to take care of that later. Now I need to get our watson layout back in order. Otherwise I will be quickly banned from trying here.

Wish me luck! Now I really need it!

Patrick Toggweiler

Source: Watson

Share
Published by
Ella

Recent Posts

Terror suspect Chechen ‘hanged himself’ in Russian custody Egyptian President al-Sisi has been sworn in for a third term

On the same day of the terrorist attack on the Krokus City Hall in Moscow,…

1 year ago

Locals demand tourist tax for Tenerife: “Like a cancer consuming the island”

class="sc-cffd1e67-0 iQNQmc">1/4Residents of Tenerife have had enough of noisy and dirty tourists.It's too loud, the…

1 year ago

Agreement reached: this is how much Tuchel will receive for his departure from Bayern

class="sc-cffd1e67-0 iQNQmc">1/7Packing his things in Munich in the summer: Thomas Tuchel.After just over a year,…

1 year ago

Worst earthquake in 25 years in Taiwan +++ Number of deaths increased Is Russia running out of tanks? Now ‘Chinese coffins’ are used

At least seven people have been killed and 57 injured in severe earthquakes in the…

1 year ago

Now the moon should also have its own time (and its own clocks). These 11 photos and videos show just how intense the Taiwan earthquake was

The American space agency NASA would establish a uniform lunar time on behalf of the…

1 year ago

This is how the Swiss experienced the earthquake in Taiwan: “I saw a crack in the wall”

class="sc-cffd1e67-0 iQNQmc">1/8Bode Obwegeser was surprised by the earthquake while he was sleeping. “It was a…

1 year ago