Due to unusually high levels of website traffic you will be presenting with regular Cloudflare checks for the time being.

Google Bard

Y'know, other stuff, Sinclair related.
Post Reply
User avatar
PeterJ
Site Admin
Posts: 6947
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Google Bard

Post by PeterJ »

Google's answer to Chat GPT

Question: Write a game in Spectrum BASIC

Answer: Sure, here is a simple game in ZX Spectrum BASIC:

Code: Select all

10 REM This is a simple game in ZX Spectrum BASIC.
20 REM The goal of the game is to collect all of the apples.
30 REM The player can move left and right using the arrow keys.
40 REM The player can jump by pressing the space bar.
50 REM If the player touches an apple, it will be collected.
60 REM If the player touches a snake, the game will end.
70 REM The game will end if the player runs out of time.
80 REM
90 REM Initialize variables.
100 apples = 0
110 time = 60
120 snake_x = 32
130 snake_y = 32
140
150 REM Main loop.
160 CLS
170 PRINT "Apples collected: " apples
180 PRINT "Time remaining: " time
190
200 REM Check if the player has touched an apple.
210 IF apples = 10 THEN GOTO 300
220 IF INKEY$ = " " THEN
230 IF snake_x = 32 THEN
240 apples = apples + 1
250 snake_x = snake_x + 1
260 ELSE
270 apples = apples + 1
280 snake_x = snake_x - 1
290 END IF
300 END IF
310
320 REM Check if the player has touched a snake.
330 IF snake_x = 32 THEN
340 IF snake_y = 32 THEN
350 apples = 0
360 time = 0
370 END IF
380 ELSE
390 IF snake_y = 32 THEN
400 apples = 0
410 time = 0
420 END IF
430 END IF
440
450 REM Decrease the time remaining.
460 time = time - 1
470
480 REM Check if the game is over.
490 IF apples = 10 THEN GOTO 500
500 IF time = 0 THEN GOTO 600
510
520 REM Wait for a key press.
530 WHILE INKEY$ = "" DO LOOP
540
550 REM Go to the next frame.
560 GOTO 150
570
580 REM End of game.
590 PRINT "Game over!"
600 END
This game is a simple platform game where the player controls a character who must collect all of the apples on the screen without touching the snakes. The game ends if the player touches a snake or runs out of time.
User avatar
PeterJ
Site Admin
Posts: 6947
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Google Bard

Post by PeterJ »

Asking again, but this time Z80 assembly language rather than BASIC:

Sure, here is a simple game written in Z80 assembly language for the ZX Spectrum:

Code: Select all

; This is a simple game that moves a square around the screen.

; The first thing we need to do is initialize the graphics.
; We do this by clearing the screen and setting the border color.

; Clear the screen
LD A,$00
LD (236),A

; Set the border color
LD A,$0F
LD (237),A

; Now we need to create the square.
; The square will be 10 pixels wide and 10 pixels high.

; Create the square
LD HL,$0000
LD DE,$0101
LD BC,$0A0A
LDIR

; Now we need to start the main loop of the game.
; The main loop will keep moving the square around the screen.

; Main loop
MAIN:

; Get the current position of the square
LD HL,$0000
LD A,(HL)

; Move the square to the left
LD B,A
DEC B
LD (HL),B

; Check if the square has reached the left edge of the screen
CP $00
JP NZ,MAIN

; If the square has reached the left edge of the screen,
; move it to the right edge of the screen.

LD B,$0A
LD (HL),B

; Continue to the next iteration of the main loop
JP MAIN
User avatar
TMD2003
Rick Dangerous
Posts: 2047
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: Google Bard

Post by TMD2003 »

I can't be the only one who seems problems in the BASIC listing.

I would say "this wouldn't even trouble the CSSCGC", but maybe that's tempting fate...
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
Post Reply