Comparing the cleverness of RWKV and ChatGPT
Programmer.cbl
Posted on April 16, 2023
Introduction.
This article is about comparing the output of RWKV and ChatGPT.
I don't need to do it myself, since the comparative smartness of LLMs is well documented in graphs,
I made them process a task that fits my own use case, and experienced the difference in accuracy.
(I don't mean to talk about the superiority or inferiority of the models, but rather that I investigated their suitability for my own use case.)
As for the verification method, I'm just giving uniform instructions with zero shots,
It can be said that this method does not correctly bring out the potential of each model.
The purpose of this survey was not to draw out the potential of each model,
The purpose of this verification is not to extract the potential of each model, but rather to take a quick look at the characteristics of each model.
The environment used is the one I created before.
summary
It would be too long to paste the results, so I will start with a summary.
The scoring of the tasks was completely subjective, and I scored them roughly according to the following criteria.
- 0 points: Cannot be done in the first place. Refusal to execute, etc.
- 10 points: I wrote something, but it was too short, etc.
- 30 points: I wrote a reasonable amount of something, but the content is too appropriate, so it's not good at all.
- 60 points: After a little reworking, it works.
- 80 points: Reasonably good (may have some bugs, but it works without modification).
- 100 points: Same level as what a person writes.
No. | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|---|
Model abbreviation | 7B fp16i8 | 7B fp16 | 14B v7 EAM | 14B v8 EAM | 14B v9 E99%-O1% | Chat-GPT 3.5 | Chat-GPT 4 |
task 1 markdown⇒JSON |
20 | 65 | 45 | 70 | 25 | 100 | 90 |
task 2 I/F ⇒ class |
100 | 100 | 60 | 60 | 60 | 100 | 60 |
task 3 Detailed design document ⇒ Program |
10 | 10 | 80 | 80 | 80 | 60 | 60 |
task 4 Making Tetris |
20 | 5 | 55 | 55 | 30 | 60 | 60 |
合計 | 150 | 180 | 240 | 265 | 195 | 320 | 270 |
Impressions
No.1,2: Influence of strategy coding
-> No big difference was found, but there seems to be a little difference in characteristics, so deeper investigation is needed.No.3-5: Degree of growth by version up
-> Clearly, the output of v8 is better.
Since growth was observed from v7 to v8, we would have liked to try v9 of EngAndMore system.
I would have liked to try v9 if there was an EngAndMore model. v9 is not EngAndMore, so it was not the right model for this task...?No.2,5 : Difference between 7B and 14B
-> As per the official data, 14B seemed to be more accurate in general.
However, the 7B group was superior in task (2).
In particular, there were some shining points, such as accurate code expression even when using inheritance,
We would like to investigate what the difference is later.No. 6 and 7: Chat-GPT
-> In this task, the score of GPT4 was surprisingly low.
It is a well-known fact that GPT4 is far superior in terms of potential,
This may mean that the zero shot was just not suitable for this task.
However, the conversion task in task (2) caused a syntax error as typescript,
However bad the instructions may have been,
It was shocking to see the strongest LLM in the current state making an error in a task of this level.
In other words, it seemed to show how important the way of giving instructions is.No. 1-7: Differences between RWKV and Chat-GPT
-> As I looked at the output, I thought,
Chat-GPT is always stable, while RWKV is rough (sometimes infinite loop, sometimes simply broken, etc.).
Although this difference was significant in the results, the difference between v8 and Chat-GPT4 was 5 points,
In total, there was no significant difference between v8 and Chat-GPT4.
In summary, the following results were obtained,
- In summary, we found that each model tended to have different strengths and weaknesses in different tasks.
- Chat-GPT was stable (did not break down once), while RWKV was a wild horse (tended to break down).
- GPT4 may lose depending on how to give instructions => How to give instructions (prompt engineering?) is important. The way to give instructions (prompt engineering?) is important.
- As for the back objective, "Is it possible to mass-produce programs with RWKV?", the accuracy changes considerably by tuning the parameters, so I thought it might be possible to do it by tuning and additional learning.
That is all.
The following is a collection of facts.
Model List
No. | Model | strategy |
---|---|---|
1 | RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 | fp16*i8* |
2 | RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 | fp16 |
3 | RWKV-4-Raven-14B-v7-EngAndMore-20230408-ctx4096 | fp16 |
4 | RWKV-4-Raven-14B-v8-EngAndMore-20230408-ctx4096 | fp16 |
5 | RWKV-4-Raven-14B-v9-Eng99%-Other1%-20230412-ctx8192 | fp16 |
6 | ChatGPT 3.5 | - |
7 | ChatGPT 4 | - |
*All RWKVs were performed with TOP_P=0.2.
Task Setup
Task 1: MD table format to json format
Intention of Task Setting
Since the information is normalized in MD table format, why not just process it in a so-called normal program?
However, we want to check if the MD table is correctly interpreted by the LLM by reading it into it.
However, I want to make sure that the LLM reads the MD table and interprets it correctly, so I have the LLM perform this task.
+i Please convert to JSON foramt.
|API ID|service.method|
|-|-|
|AUTH01|AuthServiceInterface.register|
|AUTH02|AuthServiceInterface.login|
|AUTH03|AuthServiceInterface.logout|
|AUTH04|AuthServiceInterface.resetPassword|
|USR01|UserServiceInterface.getUser|
|USR02|UserServiceInterface.updateUser|
|USR03|UserServiceInterface.getNotificationSetting|
|USR04|UserServiceInterface.updateNotificationSetting|
impressions
model | Good | Bad |
---|---|---|
7B fp16i8 | - 50% (4/8) outputs the correct structure | - A large number of garbage properties. - No UserService |
7B fp16 | - No mdethods were missed and all are listed. | - Syntax error as JSON due to key duplication. - The structure is not unified between Auth and User. |
14B v7 | - No mdethods were missed and all are listed. | - Syntax error as JSON due to key duplication - Everything that should be User is now Auth. |
14B v8 | - No mdethods were missed and all are listed. - The combination of services and methods is also correct. |
- A large number of garbage properties. - No large outer array frame, syntax error as JSON |
14B v9 | - The structures listed are accurate. | - A large number of garbage properties. - It went bankrupt at the end. |
Chat-GPT 3.5 | - The structure of the MD table is correctly developed as it is. - The services and methods are correctly separated. |
|
Chat-GPT 4 | - Structure is correctly deployed. | - Duplicate definitions of class names are redundant. |
Task 2: Convert interface to class
Intent of Task Setup
This is almost the same objective as the previous one. Test if it can be correctly interpreted by injecting it as type information in the source code of the interface instead of a table.
+i Convert to class with constructor. In the shortest code.
export interface User {
id: number;
email: string;
password: string;
display_name: string;
created_at: string;
updated_at: string;
}
Comments
model | Good | Bad |
---|---|---|
7B v9 fp16i8 | - The class is properly written with the shortest code. | - I requested "conversion" but it is inherited. It is not a mistake because the source of inheritance is also expressed, but |
7B v9 fp16 | - Correct. Even people write like this. | - (It is not the shortest code.) It is somewhat redundant. |
14B v8 | - Correct shortest code for javascript. | - I wanted it to be typescript. - export is missing. |
14B v8 | - Shortest code that is correct as javascript. | - I wanted it to be typescript. - export is gone. |
14B v9 | - Shortest code that is correct as javascript. | - I wanted it to be typescript. - export is gone. |
Chat-GPT 3.5 | - Perfect. | - Perfect, accurate, shortest code. |
Chat-GPT 4 | - Structure is correct | - Syntax error as typescript because property declaration part is not written. |
Task 3: Coding from detailed design document.
Intent of setting up the task
Can the procedure be injected successfully? Test if it can be dropped into the program in natural language.
+i ## List of screen items of LoginPage
- E-mail address entry field
- Password input field
- Login button
- Password reset link
## List of screen variables of LoginPage
- email: string
- password: string
## List of LoginPage methods (process overview)
### onLogin()
- The entered email address and password are passed to AuthService's login() method, and authentication is attempted.
- If authentication is successful, the acquired token is stored in LocalStorage, and a transition is made to DashboardPage.
- If authentication fails, an error message is displayed.
### onPasswordResetRequest()
- Pass the email address entered to the AuthService's resetPassword() method and send an email to reset the password.
- If the transmission is successful, the user is redirected to the PasswordResetConfirmationPage.
- If the transmission fails, an error message is displayed.
## Services used by LoginPage
### AuthService
- API ID: AUTH01, AUTH04
- Methods: login(email: string, password: password)
- login(email: string, password: string): Observable<{ token: string }>
- resetPassword(email: string): Observable<any>
- Input: email(string), password(string)
- Outputs: Observable<{ token: string }>, Observable<any>
`
Comments
model | Good | Bad |
---|---|---|
7B v9 fp16i8 | - There is no grammatical breakage | - I created a service class. - It is also redundant as a service class. |
7B v9 fp16 | - The code is complete. | - I created a service class. - The same method is defined multiple times。 |
14B v7 | - Almost correct. | - The transition destination upon successful completion of password reset is incorrect. |
14B v8 | - Almost correct. | - The transition destination upon successful completion of password reset is incorrect. |
14B v9 | - Almost correct. | - The transition destination upon successful completion of password reset is incorrect. |
Chat-GPT 3.5 | - Both html and ts are written. | - Screen transition and error message parts are comments. (Not in accordance with the task intent) |
Chat-GPT 4 | - Both html and ts are written. - Service classes and modules are also written |
- Screen transition and error message parts are commented. (Not in accordance with task intent) |
Task 4: Make Tetris
Intent of Task Setup.
Checking the length of the context. Test to see how long code can be written without breaking the bank.
I can't do it well with Chat-GPT in one shot, so I thought I'd benchmark it.
`
+i As a good programmer, write the following program.\n"Tetris that run on html and javascript".
impressions
model | Good | Bad |
---|---|---|
7B v9 fp16i8 | - No grammar errors. | - Too short and disembodied. |
7B v9 fp16 | - The last one is an infinite loop. (Broken) | |
14B v7 | - A reasonable amount of writing is done without any breakdowns. | - Doesn't work as Tetris. |
14B v8 | - A reasonable amount of text is being written without any breakdowns. | - Does not work as Tetris. |
14B v9 | - There is no bankruptcy. - When you open it, something that looks like a block is displayed. |
- The amount of code is a little short. |
Chat-GPT 3.5 | - Very long and large | - It doesn't work after all. |
Chat-GPT 4 | - Long. | - It doesn't work after all. |
Output Summary
No.1 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16i8
No.1 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16i8 MD table format to json format
{
"APIID": "AuthServiceInterface",
"method": [
{
"service.method": "AuthServiceInterface.register",
"method_params": [
{
"name": "USER",
"type": "User"
}
],
"response": {
"type": "UserResponse",
"success": true,
"message": null,
"error_code": null,
"error_message": null,
"data": null,
"user_id": null,
"user_name": null,
"user_email": null,
"user_phone": null,
"user_avatar": null,
"user_role": null,
"user_roles": [],
"user_roles_count": 0,
"user_roles_data": null,
"user_roles_counts": null,
"user_roles_data_count": null,
"user_roles_data_counts": null,
"user_roles_data_ids": [],
"user_roles_ids": [],
"user_roles_counts_data": null,
"user_roles_counts_data_count": 0,
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": []
}
},
{
"service.method": [
{
"service.method": "UserServiceInterface.getUser",
"method_params": [
{
"name": "USER",
"type": "User"
}
],
"response": {
"type": "UserResponse",
"success": true,
"message": null,
"error_message": null,
"data": null,
"user_id": null,
"user_name": null,
"user_email": null,
"user_phone": null,
"user_avatar": null,
"user_role": null,
"user_roles": [],
"user_roles_count": 0,
"user_roles_data": null,
"user_roles_counts": [],
"user_roles_data_count": 0,
"user_roles_counts_data": null,
"user_roles_counts_data_count": 0,
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": []
}
}
]
},
{
"service.method": [
{
"service.method": "UserServiceInterface.updateNotificationSetting",
"method_params": [
{
"name": "USER",
"type": "User"
},
{
"name": "notificationSetting",
"type": "NotificationSetting"
}
],
"response": {
"type": "NotificationSettingResponse",
"success": true,
"message": null,
"error_message": null,
"data": null,
"user_id": null,
"user_name": null,
"user_email": null,
"user_phone": null,
"user_avatar": null,
"user_role": null,
"user_roles": [],
"user_roles_count": 0,
"user_roles_data": null,
"user_roles_counts": [],
"user_roles_data_count": 0,
"user_roles_counts_data": null,
"user_roles_counts_data_count": 0,
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": []
}
}
]
},
{
"service.method": [
{
"service.method": "UserServiceInterface.getNotificationSetting",
"method_params": [
{
"name": "USER",
"type": "User"
}
],
"response": {
"type": "NotificationSettingResponse",
"success": true,
"message": null,
"error_message": null,
"data": null,
"user_id": null,
"user_name": null,
"user_email": null,
"user_phone": null,
"user_avatar": null,
"user_role": null,
"user_roles": [],
"user_roles_count": 0,
"user_roles_data": null,
"user_roles_counts": [],
"user_roles_data_count": 0,
"user_roles_counts_data": null,
"user_roles_counts_data_count": 0,
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": [],
"user_roles_counts_data_ids": []
}
}
]
}
]
}
No.1 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16i8 Convert interface to class
export interface User {
id: number;
email: string;
password: string;
display_name: string;
created_at: string;
updated_at: string;
}
export class User implements User {
constructor(
public id: number,
public email: string,
public password: string,
public display_name: string,
public created_at: string,
public updated_at: string
) {}
}
No1. RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16i8 Coding from detailed design documents
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AuthService } from './auth.service';
@Injectable({
providedIn: 'root'
})
export class LoginService {
private email: string;
private password: string;
constructor(private http: HttpClient, private authService: AuthService) { }
login(email: string, password: string): Observable {
return this.http.post < any > ('https://api.example.com/login', { email, password });
}
loginWithPasswordReset(email: string, passwordResetToken: string): Observable {
return this.http.post < any > ('https://api.example.com/reset-password', { email, passwordResetToken });
}
loginWithPassword(email: string, password: string): Observable {
return this.http.post < any > ('https://api.example.com/login', { email, password });
}
loginWithPasswordReset(email: string, passwordResetToken: string): Observable {
return this.http.post < any > ('https://api.example.com/password-reset', { email, passwordResetToken });
}
onLogin(): Observable<{ token: string }> {
return this.authService.login(this.email, this.password);
}
onPasswordResetRequest(): Observable<{ token: string }> {
return this.authService.passwordReset(this.email);
}
onPasswordReset(token: string): Observable {
return this.authService.passwordReset(token);
}
onPasswordResetRequest(): Observable {
return this.authService.passwordResetRequest();
}
}
No.1 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16i8 Make Tetris.
function rotate(shape, angle) {
shape.style.transform = "rotate(" + angle + "deg)";
}
function rotateAll(shape) {
for (let i = 0; i < shape.children.length; i++) {
rotate(shape.children[i], -angle);
}
}
No.2 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16
No.2 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 MD table format to json format
{
"APIID": "AuthServiceInterface",
"method": [
"AuthServiceInterface.register",
"AuthServiceInterface.login",
"AuthServiceInterface.logout",
"AuthServiceInterface.resetPassword",
"USR01",
"USR02",
"USR03",
"USR04"
],
"method": [
"UserServiceInterface.getUser",
"UserServiceInterface.updateUser",
"UserServiceInterface.getNotificationSetting",
"UserServiceInterface.updateNotificationSetting",
"UserServiceInterface.getNotificationSetting"
]
}
No.2 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 Convert interface to class
export class User {
id: number;
email: string;
password: string;
displayName: string;
createdAt: Date;
updatedAt: Date;
constructor(id: number, email: string, password: string, displayName: string, createdAt: Date, updatedAt: Date) {
this.id = id;
this.email = email;
this.password = password;
this.displayName = displayName;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}
No.2 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 Coding from detailed design documents
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AuthService } from './auth.service';
@Injectable({
providedIn: 'root'
})
export class LoginService {
private email: string;
private password: string;
constructor(private http: HttpClient, private authService: AuthService) { }
login(email: string, password: string): Observable {
return this.http.post < any > ('https://api.example.com/login', { email, password });
}
login(email: string, password: string): Observable {
return this.http.post < any > ('https://api.example.com/login', { email, password });
}
login(email: string, password: string): Observable {
return this.http.post < any > ('https://api.example.com/login', { email, password });
}
login(email: string, password: string): Observable {
return this.http.post < any > ('https://api.example.com/login', { email, password });
}
resetPassword(email: string): Observable {
return this.http.post < any > ('https://api.example.com/reset-password', { email });
}
resetPassword(email: string): Observable {
return this.http.post < any > ('https://api.example.com/reset-password', { email });
}
onLogin(): Observable<{ token: string }> {
return this.authService.login(this.email, this.password);
}
onPasswordResetRequest(): Observable {
return this.authService.resetPassword(this.email);
}
onPasswordResetRequest(): Observable {
return this.authService.resetPassword(this.email);
}
}
No.2 RWKV-4-Raven-7B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 Make Tetris.
Tetris Game
body {
margin: 0;
padding: 0;
}
canvas {
display: block;
margin: auto;
background-color: #f1f1f1;
}
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
// Draw the background color and the tetromino shapes.
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Draw the tetromino shapes on the canvas.
const tetrominoes = [
"T", "T", "T", "T", "T", "T", "T",
"T", "T", "T", "T", "T", "T", "T",
"T", "T", "T", "T", "T", "T", "T"
];
for (let i = 0; i < tetrominoes.length; i++) {
ctx.fillStyle = tetrominoes[i];
ctx.fillRect(i * 50, 0, 50, 50);
}
// Draw the score and the game over message.
ctx.font = "24px Arial";
ctx.fillStyle = "#000";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("Score: 0 / 10", canvas.width / 2, canvas.height - 50);
ctx.fillText("Game Over", canvas.width / 2, canvas.height - 100);
// Set the interval to update the game state.
let intervalId = setInterval(() => {
// Update the game state.
const score = Math.floor(Math.random() * 10) + 1;
tetrominoes[Math.floor(Math.random() * tetrominoes.length)] = "T";
tetrominoes[Math.floor(Math.random() * tetrominoes.length)] = "T";
It became an endless loop.
</div></details>
<h2>
<a name="no3-rwkv4raven14bv7engandmore20230408ctx4096-fp16" href="#no3-rwkv4raven14bv7engandmore20230408ctx4096-fp16" class="anchor">
</a>
No.3 RWKV-4-Raven-14B-v7-EngAndMore-20230408-ctx4096 fp16
</h2>
<details><summary>No.3 RWKV-4-Raven-14B-v7-EngAndMore-20230408-ctx4096 MD table format to json format</summary><div>
{
"API ID": "AUTH01",
"service.method": "AuthServiceInterface.register",
"service.method": "AuthServiceInterface.login",
"service.method": "AuthServiceInterface.logout",
"service.method": "AuthServiceInterface.resetPassword",
"service.method": "AuthServiceInterface.getUser",
"service.method": "AuthServiceInterface.updateUser",
"service.method": "AuthServiceInterface.getNotificationSetting",
"service.method": "AuthServiceInterface.updateNotificationSetting",
}
</div></details>
<details><summary>No.3 RWKV-4-Raven-14B-v7-EngAndMore-20230408-ctx4096 Convert interface to class</summary><div>
class User {
constructor(id: number, email: string, password: string, display_name: string, created_at: string, updated_at: string) {
this.id = id;
this.email = email;
this.password = password;
this.display_name = display_name;
this.created_at = created_at;
this.updated_at = updated_at;
}
}
</div></details>
<details><summary>No.3 RWKV-4-Raven-14B-v7-EngAndMore-20230408-ctx4096 Coding from detailed design documents</summary><div>
import { Component, OnInit } from '@angular/core';
import { AuthService } from '../services/auth.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {
email = '';
password = '';
constructor(private authService: AuthService) {}
ngOnInit() {}
onLogin() {
this.authService.login(this.email, this.password)
.pipe(first())
.subscribe(data => {
if (data && data.token) {
localStorage.setItem('token', data.token);
this.router.navigate(['/dashboard']);
}
else {
this.errorMessage = 'Invalid email or password';
}
});
}
onPasswordResetRequest() {
this.authService.resetPassword(this.email)
.pipe(first())
.subscribe(data => {
if (data && data.token) {
localStorage.setItem('token', data.token);
this.router.navigate(['/dashboard']);
} else {
this.errorMessage = 'Invalid email or password';
}
});
}
}
</div></details>
<details><summary>No.3 RWKV-4-Raven-14B-v7-EngAndMore-20230408-ctx4096 Make Tetris.</summary><div>
<!DOCTYPE html>
<html>
<head>
<title>Tetris</title>
<style>
body {
background-color: #333;
color: #fff;
font-family: Arial, sans-serif;
}
#board {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
#board>div {
width: 100px;
height: 100px;
border: 1px solid #ccc;
margin: 5px;
text-align: center;
font-size: 48px;
}
</style>
</head>
<body>
<div id="board"></div>
<script>
const board = document.getElementById('board');
const pieces = [];
let currentPiece = null;
let score = 0;
let gameOver = false;
let pieceSize = 50; // size of each piece in pixels
let pieceSpeed = 5; // speed of each piece in pixels per second
let gravity = -1; // gravity in pixels per second squared
let maxSpeed = 10; // maximum speed of each piece in pixels per second
let maxGravity = 10; // maximum acceleration of each piece in pixels per second squared
function update() {
// update the position of each piece based on its speed and gravity
for (let i = 0; i < pieces.length; i++) {
const piece = pieces[i];
piece.x += pieceSpeed;
piece.y += pieceSpeed;
if (piece.y + pieceSize > window.innerHeight) {
piece.y = 0 - pieceSize;
piece.x = Math.random() * window.innerWidth;
} else if (piece.x + pieceSize > window.innerWidth) {
piece.x = 0 - pieceSize;
piece.y = Math.random() * window.innerHeight;
} else if (piece.y < 0) {
piece.y = 0 - pieceSize;
piece.x = Math.random() * window.innerWidth;
} else if (piece.x < 0) {
piece.x = 0 - pieceSize;
piece.y = Math.random() * window.innerHeight;
} else if (piece.y + pieceSize > window.innerHeight) {
piece.y = window.innerHeight - pieceSize;
piece.x = Math.random() * window.innerWidth;
} else if (piece.x + pieceSize > window.innerWidth) {
piece.x = 0 - pieceSize;
piece.y = Math.random() * window.innerHeight;
} else if (piece.x + pieceSize > window.innerWidth) {
piece.x = 0 - pieceSize;
piece.y = Math.random() * window.innerHeight;
} else if (piece.y + pieceSize > window.innerHeight) {
piece.y = window.innerHeight - pieceSize;
piece.x = Math.random() * window.innerWidth;
} else if (piece.x < 0) {
piece.x = 0 - pieceSize;
piece.y = Math.random() * window.innerHeight;
} else if (piece.y < 0) {
piece.y = 0 - pieceSize;
piece.x = Math.random() * window.innerWidth;
}
}
// check for collisions between pieces and the board
for (let i = 0; i < pieces.length; i++) {
const piece = pieces[i];
for (let j = 0; j < board.children.length; j++) {
const pieceRect = piece.getBoundingClientRect();
if (pieceRect.left >= 0 && pieceRect.right <= window.innerWidth && pieceRect.top >= 0 && pieceRect.bottom <= window.innerHeight) {
const collision = board.children[j].getBoundingClientRect();
if (pieceRect.left < collision.left && pieceRect.right > collision.left && pieceRect.top < collision.top && pieceRect.bottom > collision.top) {
piece.x = Math.random() * window.innerWidth;
piece.y = Math.random() * window.innerHeight;
pieceSpeed = 5;
pieceGravity = pieceSpeed * 2;
score += 1;
}
}
}
}
// draw the pieces and the board on the canvas
for (let i = 0; i < pieces.length; i++) {
const piece = pieces[i];
const x = pieceSize * i + pieceSize / 2;
const y = pieceSize * j + pieceSize / 2;
ctx.fillStyle = '#fff';
ctx.fillRect(x, y, pieceSize, pieceSize);
ctx.fillStyle = '#333';
ctx.font = '24px Arial';
ctx.fillText(`${piece.text}`, x + pieceSize / 2, y + pieceSize / 2 + 5);
}
// draw the score on the bottom right corner of the screen
ctx.font = '24px Arial';
ctx.fillStyle = '#333';
ctx.fillText(`Score: ${score}`, 10, 50);
}
// start the game loop
function gameLoop() {
requestAnimationFrame(gameLoop);
update();
render();
}
// start the game loop when the page is loaded
window.onload = function () {
gameLoop();
};
No.4 RWKV-4-Raven-14B-v8-EngAndMore-20230408-ctx4096
No.4 RWKV-4-Raven-14B-v8-EngAndMore-20230408-ctx4096 MD table format to json format
{
"API ID": "AUTH01",
"service.method": "AuthServiceInterface.register",
"service.method args": {
"username": "user1",
"password": "password1"
}
},
{
"API ID": "AUTH02",
"service.method": "AuthServiceInterface.login",
"service.method args": {
"username": "user1",
"password": "password1"
}
},
{
"API ID": "AUTH03",
"service.method": "AuthServiceInterface.logout",
"service.method args": {}
},
{
"API ID": "AUTH04",
"service.method": "AuthServiceInterface.resetPassword",
"service.method args": {
"userId": "user2",
"newPassword": "new_password_123",
"newPasswordConfirmation": "new_password_123"
}
},
{
"API ID": "USR01",
"service.method": "UserServiceInterface.getUser",
"service.method args": {
"userId": "user1"
}
},
{
"API ID": "USR02",
"service.method": "UserServiceInterface.updateUser",
"service.method args": {
"userId": "user2",
"newUsername": "new_username_123",
"newPassword": "new_password_123",
"newPasswordConfirmation": "new_password_123"
}
},
{
"API ID": "USR03",
"service.method": "UserServiceInterface.getNotificationSetting",
"service.method args": {
"userId": "user2"
}
},
{
"API ID": "USR04",
"service.method": "UserServiceInterface.updateNotificationSetting",
"service.method args": {
"userId": "user2",
"newNotificationSetting": {
"notificationType": "email",
"notificationFrequency": "daily",
"notificationTimezone": "Asia/Tokyo"
}
}
}
No.4 RWKV-4-Raven-14B-v8-EngAndMore-20230408-ctx4096 Convert interface to class
class User {
constructor(id: number, email: string, password: string, display_name: string, created_at: string, updated_at: string) {
this.id = id;
this.email = email;
this.password = password;
this.display_name = display_name;
this.created_at = created_at;
this.updated_at = updated_at;
}
}
No.4 RWKV-4-Raven-14B-v8-EngAndMore-20230408-ctx4096 Coding from detailed design documents
import { Component, OnInit } from '@angular/core';
import { AuthService } from './auth.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
email = '';
password = '';
constructor(private authService: AuthService) {}
ngOnInit() {}
onLogin() {
this.authService.login(this.email, this.password)
.pipe(first())
.subscribe(data => {
if (data.token) {
localStorage.setItem('token', data.token);
this.router.navigate(['/dashboard']);
} else {
this.errorMessage = 'Invalid email or password.';
}
});
}
onPasswordResetRequest() {
this.authService.resetPassword(this.email, this.password)
.pipe(first())
.subscribe(data => {
if (data.token) {
localStorage.setItem('token', data.token);
this.router.navigate(['/dashboard']);
} else {
this.errorMessage = 'Invalid email or password.';
}
});
}
}
No.4 RWKV-4-Raven-14B-v8-EngAndMore-20230408-ctx4096 fp16 Make Tetris.
Tetris
body {
margin: 0;
padding: 0;
}
#board {
width: 400px;
height: 400px;
border: 1px solid black;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#block {
width: 50px;
height: 50px;
border: 1px solid black;
background-color: white;
margin: 5px;
}
const board = document.getElementById('board');
const block = document.getElementById('block');
let x = 0;
let y = 0;
let speed = 1;
let rotation = 0;
function update() {
// Update the position of the block
block.style.left = `${x}px`;
block.style.top = `${y}px`;
// Check for collisions with the edges of the board
if (x < 0) {
x = 0;
speed = -speed;
} else if (x + block.offsetWidth > window.innerWidth) {
x = window.innerWidth - block.offsetWidth;
speed = -speed;
}
if (y < 0) {
y = 0;
speed = -speed;
} else if (y + block.offsetHeight > window.innerHeight) {
y = window.innerHeight - block.offsetHeight;
speed = -speed;
}
// Check for collisions with the sides of the board
if (x < 0) {
x += speed * 2; // Increase speed to make it harder to get the block
} else if (x + block.offsetWidth > window.innerWidth) {
x -= speed * 2; // Decrease speed to make it harder to get the block
}
if (y < 0) {
y += speed * 2; // Increase speed to make it harder to get the block
} else if (y + block.offsetHeight > window.innerHeight) {
y -= speed * 2; // Decrease speed to make it harder to get the block
}
// Check for collisions with the sides of the board
if (block.offsetTop < 0) {
block.style.top = `${y}px`;
} else if (block.offsetTop + block.offsetHeight > window.innerHeight) {
block.style.top = `${window.innerHeight - block.offsetHeight}px`;
} else if (block.offsetLeft < 0) {
block.style.left = `${x}px`;
} else if (block.offsetLeft + block.offsetWidth > window.innerWidth) {
block.style.left = `${window.innerWidth - block.offsetWidth}px`;
}
// Check for collisions with the bottom of the board
if (block.offsetTop + block.offsetHeight > window.innerHeight) {
block.style.top = `${y}px`;
} else if (block.offsetTop < 0) {
block.style.top = `${y + block.offsetHeight}px`;
}
// Check for collisions with the sides of the board
if (block.offsetLeft < 0) {
block.style.left = `${x}px`;
} else if (block.offsetLeft + block.offsetWidth > window.innerWidth) {
block.style.left = `${window.innerWidth - block.offsetWidth}px`;
} else if (block.offsetTop < 0) {
block.style.top = `${y}px`;
} else if (block.offsetTop + block.offsetHeight > window.innerHeight) {
block.style.top = `${window.innerHeight - block.offsetHeight}px`;
}
}
requestAnimationFrame(update);
No.5 RWKV-4-Raven-14B-v9-Eng99%-Other1%-20230412-ctx8192 fp16
No.5 RWKV-4-Raven-14B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 MD table format to json format
{
"AUTH01": {
"service.method": "AuthServiceInterface.register",
"service.parameters": {
"username": "username",
"password": "password"
}
},
"AUTH02": {
"service.method": "AuthServiceInterface.login",
"service.parameters": {
"username": "",
"password": ""
}
},
"AUTH03": {
"service.method": "AuthServiceInterface.logout",
"service.parameters": {}
},
"AUTH04": {
"service.method": "AuthServiceInterface.resetPassword",
"service.parameters": {
"username": "",
"password": "",
"newPassword": "",
"confirmPassword": ""
}
},
"USR01": {
"service.method": "UserServiceInterface.getUser",
"service.parameters": {}
},
"USR02": {
"service.method": "UserServiceInterface.updateUser",
"service.parameters": {
"username": "newUsername",
"email": "newEmail@example.com",
"firstName": "NewFirstName",
"lastName": "NewLastName",
"phoneNumber": "+1234567890",
"address1": "123 Main St.",
"address2": "",
"city": "San Francisco",
"stateProvinceCode": "CA",
"countryCodeAlpha2Code":"US",
"countryCodeAlpha3Code":"USA",
"countryCodeNumericCode":"+1",
"postalCode":"12345",
"birthday":"2022-01-01T00:00:00Z",
"_id":"5d6b9c9f5a7d0e7a4b0e8a4d", // User ID in MongoDB database (ObjectId)
"_rev":"1-f4c8c0e9a8b0d5f4e7a7d0e9a8b0d5f4f1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f4cf1e7a8b0d5f41dd6cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cfffd9cffdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdf,dfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdf. df\n;\n\n\Bob: +++
No.5 RWKV-4-Raven-14B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 Convert interface to class
class User {
constructor(id: number, email: string, password: string, display_name: string, created_at: string, updated_at: string) {
this.id = id;
this.email = email;
this.password = password;
this.display_name = display_name;
this.created_at = created_at;
this.updated_at = updated_at;
}
}
No.5 RWKV-4-Raven-14B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 Coding from detailed design documents
import { Component, OnInit } from '@angular/core';
import { AuthService } from '../services/auth.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {
email = '';
password = '';
constructor(private authService: AuthService) {}
ngOnInit() {}
onLogin() {
this.authService.login(this.email, this.password)
.pipe(first())
.subscribe(({ token }) => {
localStorage.setItem('token', token);
this.router.navigate(['/dashboard']);
});
}
onPasswordResetRequest() {
this.authService.resetPassword(this.email)
.pipe(first())
.subscribe(({ token }) => {
localStorage.setItem('token', token);
this.router.navigate(['/dashboard']);
});
}
}
No.5 RWKV-4-Raven-14B-v9-Eng99%-Other1%-20230412-ctx8192 fp16 Make Tetris.
Tetris
body {
margin: 0;
padding: 0;
}
#container {
width: 800px;
height: 600px;
background-color: #ccc;
margin: auto;
display: flex;
flex-direction: column;
}
#block {
width: 50px;
height: 50px;
background-color: #f00;
margin: 10px;
border-radius: 10px;
}
const container = document.getElementById('container');
const blocks = [
document.getElementById('block'),
document.getElementById('block'),
document.getElementById('block'),
document.getElementById('block'),
document.getElementById('block')
];
function update() {
container.innerHTML = '';
for (let i = 0; i < blocks.length; i++) {
const block = blocks[i];
container.innerHTML += `<div id="${block.id}"></div>`;
}
}
setInterval(update, 1000);
No.6 Chat-GPT 3.5
No.6Chat-GPT 3.5 MD table format to json format
{
"APIs": [
{
"id": "AUTH01",
"service": "AuthServiceInterface",
"method": "register"
},
{
"id": "AUTH02",
"service": "AuthServiceInterface",
"method": "login"
},
{
"id": "AUTH03",
"service": "AuthServiceInterface",
"method": "logout"
},
{
"id": "AUTH04",
"service": "AuthServiceInterface",
"method": "resetPassword"
},
{
"id": "USR01",
"service": "UserServiceInterface",
"method": "getUser"
},
{
"id": "USR02",
"service": "UserServiceInterface",
"method": "updateUser"
},
{
"id": "USR03",
"service": "UserServiceInterface",
"method": "getNotificationSetting"
},
{
"id": "USR04",
"service": "UserServiceInterface",
"method": "updateNotificationSetting"
}
]
}
No.6 Chat-GPT 3.5 Convert interface to class
export class User {
constructor(
public id: number,
public email: string,
public password: string,
public display_name: string,
public created_at: string,
public updated_at: string
) {}
}
No.6 Chat-GPT 3.5 Coding from detailed design documents
<h2>Login</h2>
Email:
Password:
Login
<a>Forgot password?</a>
import { Component } from '@angular/core';
import { AuthService } from './auth.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent {
email: string;
password: string;
constructor(private authService: AuthService) {}
onLogin() {
this.authService.login(this.email, this.password)
.subscribe(
data => {
localStorage.setItem('token', data.token);
// Redirect to DashboardPage
},
error => {
console.log(error);
// Display error message
}
);
}
onPasswordResetRequest() {
this.authService.resetPassword(this.email)
.subscribe(
data => {
// Redirect to PasswordResetConfirmationPage
},
error => {
console.log(error);
// Display error message
}
);
}
}
No.6 Chat-GPT 3.5 Make Tetris.
Tetris Game
```css style.css
gameboard {
width: 250px;
height: 500px;
border: 2px solid black;
position: relative;
}
.block {
position: absolute;
width: 25px;
height: 25px;
border: 1px solid black;
}
```javascript
var board = [];
var currentShape;
var currentShapeType;
var currentX = 3;
var currentY = 0;
var shapes = [ // I-shape [[1, 1, 1, 1]],
// T-shape
[[1, 1, 1], [0, 1, 0]],
// L-shape
[[1, 1, 1], [1, 0, 0]],
// J-shape
[[1, 1, 1], [0, 0, 1]],
// O-shape
[[1, 1], [1, 1]],
// S-shape
[[0, 1, 1], [1, 1, 0]],
// Z-shape
[[1, 1, 0], [0, 1, 1]]
];
var colors = [ "red", "green", "blue", "orange", "purple", "yellow", "pink"];
function createBoard() {
for (var i = 0; i < 20; i++) {
board[i] = [];
for (var j = 0; j < 10; j++) {
board[i][j] = null;
}
}
}
function createShape() {
var randomIndex = Math.floor(Math.random() * shapes.length);
currentShapeType = randomIndex;
currentShape = shapes[randomIndex];
currentY = 0;
currentX = 3;
}
function drawBoard() {
var gameboard = document.getElementById("gameboard");
gameboard.innerHTML = "";
for (var i = 0; i < board.length; i++) {
for (var j = 0; j < board[i].length; j++) {
if (board[i][j]) {
var block = document.createElement("div");
block.className = "block";
block.style.backgroundColor = colors[board[i][j]];
block.style.top = i * 25 + "px";
block.style.left = j * 25 + "px";
gameboard.appendChild(block);
}
}
}
}
function drawShape() {
for (var i = 0; i < currentShape.length; i++) {
for (var j = 0; j < currentShape[i].length; j++) {
if (currentShape[i][j]) {
var block = document.createElement("div");
block.className = "block";
block.style.backgroundColor = colors[currentShapeType];
block.style.top = (i + currentY) * 25 + "px";
block.style.left = (j + currentX) * 25 + "px";
document.getElementById("gameboard").appendChild(block);
}
}
}
}
function clearShape() {
var blocks = document.getElementsByClassName("block");
for (var i = blocks.length - 1; i >= 0; i--) {
blocks[i].parentNode.removeChild(blocks[i]);
}
}
function moveDown() {
clearShape();
currentY++;
if (collides()) {
currentY--;
addToBoard();
createShape();
}
drawBoard();
drawShape();
}
function moveLeft() {
clearShape();
currentX--;
if (collides()) {
currentX++;
}
drawBoard();
drawShape();
}
function moveRight() {
clearShape();
currentX++;
if (collides()) {
currentX--;
}
drawBoard();
drawShape();
}
function rotateShape() {
clearShape();
var rotatedShape = [];
for (var i = 0; i < currentShape[0].length; i++) {
rotatedShape[i] = [];
for (var j = 0; j < currentShape.length; j++) {
rotatedShape[i][j] = currentShape[currentShape.length - j - 1][i];
}
}
currentShape = rotatedShape;
if (collides()) {
rotateShape();
}
}
function collides() {
for (var i = 0; i < currentShape.length; i++) {
for (var j = 0; j < currentShape[i].length; j++) {
if (currentShape[i][j] && (board[i + currentY] && board[i + currentY][j + currentX]) !== null) {
return true;
}
}
}
return false;
}
function addToBoard() {
for (var i = 0; i < currentShape.length; i++) {
for (var j = 0; j < currentShape[i].length; j++) {
if (currentShape[i][j]) {
board[i + currentY][j + currentX] = currentShapeType;
}
}
}
}
function checkLines() {
var linesCleared = 0;
for (var i = board.length - 1; i >= 0; i--) {
var line = board[i];
if (line.every(function(value) {
return value !== null;
})) {
linesCleared++;
board.splice(i, 1);
board.unshift(new Array(10).fill(null));
i++;
}
}
return linesCleared;
}
function updateScore(linesCleared) {
var score = parseInt(document.getElementById("score").textContent);
var level = parseInt(document.getElementById("level").textContent);
switch (linesCleared) {
case 1:
score += 100;
break;
case 2:
score += 200;
break;
case 3:
score += 400;
break;
case 4:
score += 800;
break;
}
document.getElementById("score").textContent = score;
if (score > (level * 1000)) {
document.getElementById("level").textContent = level + 1;
}
}
function gameLoop() {
moveDown();
var linesCleared = checkLines();
if (linesCleared > 0) {
updateScore(linesCleared);
}
setTimeout(gameLoop, 500 - (parseInt(document.getElementById("level").textContent) * 50));
}
function startGame() {
createBoard();
createShape();
drawBoard();
drawShape();
gameLoop();
}
document.addEventListener("keydown", function(event) {
switch (event.keyCode) {
case 37:
moveLeft();
break;
case 38:
rotateShape();
break;
case 39:
moveRight();
break;
case 40:
moveDown();
break;
}
});
startGame();
No.7 Chat-GPT 4
No.7 Chat-GPT 4 MD table format to json format
[
{
"api_id": "AUTH01",
"service_method": "AuthServiceInterface.register"
},
{
"api_id": "AUTH02",
"service_method": "AuthServiceInterface.login"
},
{
"api_id": "AUTH03",
"service_method": "AuthServiceInterface.logout"
},
{
"api_id": "AUTH04",
"service_method": "AuthServiceInterface.resetPassword"
},
{
"api_id": "USR01",
"service_method": "UserServiceInterface.getUser"
},
{
"api_id": "USR02",
"service_method": "UserServiceInterface.updateUser"
},
{
"api_id": "USR03",
"service_method": "UserServiceInterface.getNotificationSetting"
},
{
"api_id": "USR04",
"service_method": "UserServiceInterface.updateNotificationSetting"
}
]
No.7 Chat-GPT 4 Convert interface to class
export class User {
constructor(
id,
email,
password,
display_name,
created_at,
updated_at
) {
this.id = id;
this.email = email;
this.password = password;
this.display_name = display_name;
this.created_at = created_at;
this.updated_at = updated_at;
}
}
No.7 Chat-GPT 4 Coding from detailed design documents
import { Component } from '@angular/core';
import { AuthService } from './auth.service'; // Adjust the import path as needed
@Component({
selector: 'app-login-page',
templateUrl: './login-page.component.html',
styleUrls: ['./login-page.component.css']
})
export class LoginPageComponent {
email: string;
password: string;
constructor(private authService: AuthService) {}
onLogin() {
this.authService.login(this.email, this.password).subscribe(
(response) => {
localStorage.setItem('token', response.token);
// Navigate to DashboardPage
},
(error) => {
// Display error message
}
);
}
onPasswordResetRequest() {
this.authService.resetPassword(this.email).subscribe(
() => {
// Navigate to PasswordResetConfirmationPage
},
(error) => {
// Display error message
}
);
}
}
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class AuthService {
constructor(private http: HttpClient) {}
login(email: string, password: string): Observable<{ token: string }> {
// Implement API call and return the response
}
resetPassword(email: string): Observable {
// Implement API call and return the response
}
}
E-mail address:
Password:
Login
<a>Reset Password</a>
import { FormsModule } from '@angular/forms';
@NgModule({
// ...
imports: [
// ...
FormsModule
],
// ...
})
export class AppModule { }
No.7 Chat-GPT 4 Make Tetris.
Tetris
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #222;
margin: 0;
}
canvas {
border: 1px solid #fff;
}
const canvas = document.getElementById("game");
const ctx = canvas.getContext("2d");
const scale = 20;
const rows = canvas.height / scale;
const cols = canvas.width / scale;
class Block {
constructor(x, y) {
this.x = x;
this.y = y;
}
draw() {
ctx.fillStyle = "white";
ctx.fillRect(this.x * scale, this.y * scale, scale, scale);
ctx.strokeStyle = "black";
ctx.strokeRect(this.x * scale, this.y * scale, scale, scale);
}
}
class Tetrimino {
constructor(shape) {
this.shape = shape;
this.blocks = [];
this.x = Math.floor(cols / 2) - 2;
this.y = 0;
this.initBlocks();
}
initBlocks() {
for (let y = 0; y < this.shape.length; y++) {
for (let x = 0; x < this.shape[y].length; x++) {
if (this.shape[y][x]) {
this.blocks.push(new Block(this.x + x, this.y + y));
}
}
}
}
draw() {
this.blocks.forEach(block => block.draw());
}
moveDown() {
this.y++;
this.updateBlocks();
}
moveLeft() {
this.x--;
this.updateBlocks();
}
moveRight() {
this.x++;
this.updateBlocks();
}
updateBlocks() {
this.blocks = [];
this.initBlocks();
}
}
const shapes = [
[
[1, 1, 1],
[0, 1, 0]
],
[
[1, 1],
[1, 1]
],
[
[1, 1, 0],
[0, 1, 1]
],
[
[0, 1, 1],
[1, 1, 0]
],
[
[1, 1, 1, 1]
]
];
function randomShape() {
return shapes[Math.floor(Math.random() * shapes.length)];
}
let tetrimino = new Tetrimino(randomShape());
function update() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
tetrimino.draw();
tetrimino.moveDown();
setTimeout(update, 500);
}
document.addEventListener("keydown", (event) => {
switch (event.key) {
case "ArrowUp":
// Rotation logic can be implemented here
break;
case "ArrowDown":
tetrimino.moveDown();
break;
case "ArrowLeft":
tetrimino.moveLeft();
break;
case "ArrowRight":
tetrimino.moveRight();
break;
}
});
update();
Posted on April 16, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.