News for hackers. Stuff that matters.
Re:Show HN: Solve and generate mazes with JavaScript on HTML... by bhargav on Sunday January 27, 2019 @03:47PM (#19013706)
Bug Report: http://prntscr.com/mcyc1b

When the website loads, if I put in a large number such as 500 and hit the generate button, it does not clear the previous puzzle and overlays on top. Second click still shows it bit now its a but transparent. Third click removes it altogether. I tried to skim through the code but not sure what the cause is given that you create a new Maze every single time. It seems to be some sort of canvas rendering bug as if I clear the canvas [1] it seems to work.

1: https://stackoverflow.com/a/2142549

Re:Show HN: Solve and generate mazes with JavaScript on HTML... by davidim on Sunday January 27, 2019 @04:17PM (#19013841)
Thanks a lot for the bug report! You're right - I was forgetting to clear the canvas on render. So I added ctx.clearRect(0, 0, WIDTH, HEIGHT); to the start of the render method.