chatGPT creates Arduboy Game

AI generated Arduboy Game!
chatGPT.ino-arduboy.hex (19.0 KB)

If you haven’t seen already the same people behind the image generator DallE2, open AI they released a chat bot that’s pretty clever and can produce code examples:

Well, I asked it to make me an Arduboy game!

It’s… something! At least it knows to use the Arduboy 2 library.

I had to try the prompt a few times actually, the first result which you may notice tries to redefine a const:

image

5 Likes

Were Doomed GIFs | Tenor

Had it write a poem! What the actual f

5 Likes

Yes, it’s amazing. For chat i have a question. Quality of generated code is very good with comments asw… I like but i have ask for example for a Tetris code. I have all the beginning of the code but it’s cut due to the size of the message i think. Any solution to have all the generated code ?

You can say “keep going” and it will add the rest of the code, but things fall apart pretty quickly after that it seems.

1 Like

When i try below the partial code, i have the 3 moving dots but no answer. It’s too bad, because it’s code creation is amazing good…

It has no idea what it is doing, it’s just spitting out someone else code it stole from the internet.

1 Like

Let’s be honest, that poem is better than what 99% of the human population could write (including me). We are screwed.

Hmm,
I asked it to write Gallaga for me and got this. Certainly, it created the skell.

#include <Arduboy2.h>

// Arduboy object
Arduboy2 arduboy;

// Constants for game dimensions
const int SCREEN_WIDTH = 128;
const int SCREEN_HEIGHT = 64;

// Player position variables
int playerX;
int playerY;

// Enemy position variables
int enemyX;
int enemyY;

// Enemy movement direction
int enemyDir;

void setup() {
  // Initialize the Arduboy
  arduboy.begin();
  arduboy.setFrameRate(60);

  // Initialize player and enemy positions
  playerX = SCREEN_WIDTH / 2;
  playerY = SCREEN_HEIGHT - 8;
  enemyX = SCREEN_WIDTH / 2;
  enemyY = 8;
  enemyDir = 1;
}

void loop() {
  // Clear the screen
  arduboy.clear();

  // Check for input
  if (arduboy.pressed(LEFT_BUTTON) && playerX > 0) {
    playerX--;
  }
  if (arduboy.pressed(RIGHT_BUTTON) && playerX < SCREEN_WIDTH - 8) {
    playerX++;
  }
  if (arduboy.justPressed(A_BUTTON)) {
    // Fire a bullet
  }

  // Draw the player
  arduboy.drawRect(playerX, playerY, 8, 8, WHITE);

  // Move the enemy
  enemyX += enemyDir;
  if (enemyX <= 0 || enemyX >= SCREEN_WIDTH - 8) {
    enemyDir *= -1;
    enemyY += 8;
  }

  // Draw the enemy
  arduboy.drawRect(enemyX, enemyY, 8, 8, WHITE);

  // Update the screen
  arduboy.display();
}

@fredster,

When posting code in this forum please enclose it in code tags:
start with a line containing three backtics and cpp to indicate C++ code and end with a line containing three backticks:
```cpp
(your code goes here)
```

I done this for you in the above post but in the future please do it yourself.


This thing is awesome.

It tries to say like “I’m not programmed to insult things” but if you redo it enough times, it’ll usually do it.

The Playdate is cool and all but it’s even more expensive than the Arduboy and feels a bit more professional and less community-driven.

1 Like