Giter Site home page Giter Site logo

tetris-fumen's Issues

field.fill can't draw floating pieces

data: https://harddrop.com/fumen/?v115@vhAVLn
Code:

const {decoder} = require("tetris-fumen");
const pages = decoder.decode("v115@vhAVLn");
console.log(pages[0].field.str());
pages[0].field.fill(pages[0].operation);

Result:

Error: Cannot fill piece on field

REPL

Is this intended? Quote from README:

Fill piece even if not on the ground, and return the mino as the placed

If floating pieces are not allowed, how does it differ from field.put?

Make field.fill return piece position

I'd like to draw the current operation with a lightened color. I need the position after the piece is filled in the field. Example:

const pages = decoder.decode(data);
const field = pages[0].field.copy();
const changedTiles = field.fill(pages[0].operation);

for (let y = 0; y < 20; y++) {
  for (let x = 0; x < 10; x++) {
    myCanvas.draw(x, y, field.at(x, y));
  }
}
for (const [x, y] of changedTiles) {
  myCanvas.lighten(x, y);
}

Maybe we can also add this feature to field.put?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.