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

renamed function to be more readable #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions inde.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
// do the bit manipulation and iterate through each
// occupied block (x,y) for a given piece
//------------------------------------------------
function eachblock(type, x, y, dir, fn) {
function eachBlock(type, x, y, dir, fn) {
var bit, result, row = 0, col = 0, blocks = type.blocks[dir];
for(bit = 0x8000 ; bit > 0 ; bit = bit >> 1) {
if (blocks & bit) {
Expand All @@ -143,7 +143,7 @@
//-----------------------------------------------------
function occupied(type, x, y, dir) {
var result = false
eachblock(type, x, y, dir, function(x, y) {
eachBlock(type, x, y, dir, function(x, y) {
if ((x < 0) || (x >= nx) || (y < 0) || (y >= ny) || getBlock(x,y))
result = true;
});
Expand Down Expand Up @@ -334,7 +334,7 @@
}

function dropPiece() {
eachblock(current.type, current.x, current.y, current.dir, function(x, y) {
eachBlock(current.type, current.x, current.y, current.dir, function(x, y) {
setBlock(x, y, current.type);
});
}
Expand Down Expand Up @@ -435,7 +435,7 @@
}

function drawPiece(ctx, type, x, y, dir) {
eachblock(type, x, y, dir, function(x, y) {
eachBlock(type, x, y, dir, function(x, y) {
drawBlock(ctx, x, y, type.color);
});
}
Expand Down