DEV Community

Discussion on: Rethinking Gameboards

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

Why didn't you name the areas A1 to H8 - that way it becomes exactly like chess and makes it even easier to implement moves according to normal chess rules (B2 to B4) etc.

Anyway that is only a minor point, this is a great way to do it using grid! ❤

Collapse
 
parenttobias profile image
Toby Parent

I had actually realized this yesterday, I'm working on this very thing. It's a great point, and thanks to the flexibility of grid-template-area, easily implemented.

Thanks for the feedback!

Collapse
 
parenttobias profile image
Toby Parent

Done and done. Easier change than I'd expected - update the CSS grid-template-areas, then update the class to calculate the clicked grid-area (using Math.ceil() rather than Math.floor()), and working fine.

Thank you again!