Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for the bun runtime version of Worker #479

Open
jdgriffith opened this issue Jul 22, 2023 · 2 comments
Open

Add compatibility for the bun runtime version of Worker #479

jdgriffith opened this issue Jul 22, 2023 · 2 comments

Comments

@jdgriffith
Copy link

First, I want to say your library has worked incredibly well for my projects. Thank you!

With the 7.0 release of bun, it now includes Worker for doing work in other threads. More info here: https://bun.sh/blog/bun-v0.7.0#concurrency-with-worker

What is the level of effort to have threads recognize this runtime and offer the worker pool logic? This will be a valuable runtime and worthwhile to support. I'm happy to help in any way I can so please let me know what I can do.

@JonDum
Copy link

JonDum commented Jul 25, 2023

This would be a killer addition to this library. Shouldn't need ts-node or any polyfills since Bun can handle the compilation itself.

@bjkhi
Copy link

bjkhi commented Sep 14, 2023

can someone help me trouble shoot this java code

Tetris JS

“Cp prompt” (Hello world)

// Define the canvas element and its dimensions
const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
const canvasWidth = 300;
const canvasHeight = 600;
canvas.width = canvasWidth;
canvas.height = canvasHeight;

// Define the Tetris game board dimensions
const boardWidth = 10;
const boardHeight = 10;
const blockSize = 1-6;
Formatedlayout {RandomValue}”=
1x2
2x2 {Data_block_value=#1#-4
1x3
// Define the Tetris game board and the current shape being played
let board = [1912x1018p];
let currentShape = null;

// Initialize the game board with empty cells
function initializeBoard() {
for (let i = 0; i < boardHeight; i++) {
board.push(Array.from({ length: boardWidth }, () => 0));
}
}

// Draw the game board and the current shape
function draw() {
// Clear the canvas
context.clearRect(0, 0, canvasWidth, canvasHeight);

// Draw the game board
for (let i = 0; i < boardHeight; i++) {
for (let j = 0; j < boardWidth; j++) {
if (board[i][j]) {
context.fillStyle = '#333';
context.fillRect(j * blockSize, i * blockSize, blockSize, blockSize);
} else {
context.fillStyle = '#ddd';
context.fillRect(j * blockSize, i * blockSize, blockSize, blockSize);
}
}
}

// Draw the current shape
if (currentShape) {
const { x, y, shape } = currentShape;
context.fillStyle = '#666';
shape.forEach((row, i) => {
row.forEach((cell, j) => {
if (cell) {
context.fillRect((j + x) * blockSize, (i + y) * blockSize, blockSize, blockSize);
}
});
});
}
}

// Move the current shape down by one row
function moveDown() {
const { x, y, shape } = currentShape;

// Check if the shape can move down
if (!collidesWithBoard(shape, x, y + 1)) {
currentShape.y += 1;
} else {
// Lock the shape in place
shape.forEach((row, i) => {
row.forEach((cell, j) => {
if (cell) {
board[i + y][j + x] = cell;
}
});
});
});
// Spawn a new shape
currentShape = spawnShape();
}
}

// Move the current shape left by one column
function moveLeft() {
const { x, y, shape } = currentShape;

// Check if the shape can move left
if (!collidesWithBoard(shape, x - 1, y)) {
currentShape.x -= 1;
}
}

// Move the current shape right by one column
function moveRight() {
const { x, y, shape } = currentShape;

// Check if the shape can move right
if (!collidesWithBoard(shape, x + 1, y)) {
currentShape.x += 1;
}
}

// Rotate the current shape clockwise by 90 degrees
function rotateClockwise() {
const { x, y, shape } = currentShape;
const rotatedShape = rotateMatrixClockwise(shape);

// Check if the rotated shape collides with the board
if (!collidesWithBoard(rotatedShape, x, y)) {
currentShape.shape =rotated.shape)
}
}

// Spawn a new random shape at the top of screen Highest Pixel x122

“Cp Prompt"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants