honeycomb: Grid is not calling `.map()`

Here’s a test I wrote that is not throwing an error, but it should:

describe('rectangle()', () => {
  test('returns a new grid', () => {
    const grid = new Grid(createHexPrototype(), rectangle({ width: 2, height: 2 })).map((h) => h).run()
    const newGrid = grid.map((h) => {
      throw new Error('')
    })
    grid.run()
    newGrid.run()
  })
})

This test throws an error, as expected:

describe('rectangle()', () => {
  test('returns a new grid', () => {
-    const grid = new Grid(createHexPrototype(), rectangle({ width: 2, height: 2 })).map((h) => h).run()
+    const grid = new Grid(createHexPrototype(), rectangle({ width: 2, height: 2 })).map((h) => h) //.run()
+    grid.run()
    const newGrid = grid.map((h) => {
      throw new Error('')
    })
    grid.run()
    newGrid.run()
  })
})

version: 4.0.0-alpha.3

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

🎉 This issue has been resolved in version 4.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

I just released alpha.4. It contains a ring() and spiral() traverser and I’ve tried to fix the duplicate hexes that chaining traversers caused. I’m looking forward to your opinion (of course it’s fine if you don’t want to).

I took a quick look at your app, it looks nice and clean. Unfortunately, I don’t know the rules of the game, so I have no idea how to play it. But any game that uses hexagons is worth playing, so I’ll learn this when I have more time.

@flauwekeul this is probably not the best place to post this, but I didn’t want to open another issue for this.

I’ve finished the Cryptid solver and I’ll try it out tomorrow.

Here’s the code and the app: https://vfonic.github.io/honeycomb/ https://github.com/vfonic/honeycomb/tree/gh-pages

As you’ve seen, I’ve made 2 separate issues.

I’ve really struggling to use this library. I thought it would be cool to use a TypeScript version, but maybe I was too early to use it or maybe I’m just not using it correctly?

For you it may have been easier to use v3 (it also has typings, so it can be used with TypeScript), but for me it’s very good you’re using v4-alpha. It gives me a very valuable insight in how other people use my library. Maybe you’re not using v4 as I intend to, but that’s because there’s not much documentation yet. And even if there were plenty of documentation and examples, people write code as they’re used to and that might be different from how I’d like them to.

I’ll look into your code and either make changes in Honeycomb or I could give some advice how to better use Honeycomb (if you want).