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

Feature request (yet another) new board type #7

Closed
oneillkza opened this issue Aug 15, 2022 · 6 comments
Closed

Feature request (yet another) new board type #7

oneillkza opened this issue Aug 15, 2022 · 6 comments

Comments

@oneillkza
Copy link
Contributor

Related to #3 :

https://puzzleparadise.net/listing/puzzle-calendar-solve-for-each-day-of-the-year-cherry-pieces-and-walnut-border/107535

Maybe if I have some free time I'll take a look at this.

@oneillkza
Copy link
Contributor Author

OK first problem -- this one has nine pieces, while the others have eight. So the match statement in get_blocks blows chunks, because you can't have an 8-array and a 9-array return in the same match statement. It sounds like using the enum directly in some way may work?

https://www.reddit.com/r/rust/comments/3hfnq6/match_arms_have_incompatible_types_is_there_a/

(Not super familiar with Rust.)

@keiichiw
Copy link
Owner

I don't think I'll support this board by myself because I don't have the puzzle, but pull requests are welcome.
You can see #1 to know which files we should update for a new board.

you can't have an 8-array and a 9-array return in the same match statement.

This shouldn't be a problem if you change the array to Vec:

let pieces = match typ {
  PuzzleType::DragonFjord => {
    // Change fixed-size array to Vec
    vec![HexRect, PentL, PentN, PentP, PentU, PentV, PentY, PentZ]
  }
   ...
};

It'll require an extra heap allocation, but it's negligible.

@oneillkza
Copy link
Contributor Author

Oh lol. Glad there's such a simple solution. I had gone down a very unhelpful rabbit hole of discussions over whether to allow variable-length arrays in Rust.

Anyway, please see #8

I got everything working except the web interface, which runs and shows the options, but doesn't actually return the solution for the correct set.

@oneillkza
Copy link
Contributor Author

Also this is literally my first time coding in Rust, so let me know if anything is deeply wrong in how I've done things.

@keiichiw
Copy link
Owner

It's now available at the page as "Tetromino-type Calendar Puzzle". Thanks @oneillkza for your contribution!

@oneillkza
Copy link
Contributor Author

You're most welcome!

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

2 participants