AlvinRamoutar / sudoku-api

Simple, flutter widget API for implementing a Sudoku puzzle game.
BSD 3-Clause "New" or "Revised" License
14 stars 11 forks source link

isPrefill marked as null after generating a puzzle #2

Closed JoseGeorges8 closed 4 years ago

JoseGeorges8 commented 4 years ago

Quickest steps to reproduce:

  1. Create a new puzzle as stated in the example
  2. generate puzzle
  3. loop through the cells inside each row in the grid and called their prefill() getter. This will return null
AlvinRamoutar commented 4 years ago

The prefill property of a Cell was not kept when performing Grid.deepClone().

This has been fixed by adding: _target.matrix()[r][c].setPrefill(source.matrix()[r][c].prefill()); To: Grid.deepClone(Grid source)

I've also added a test to generation_test specifically for prefill validity.

Let me know if this resolves your issue @JoseGeorges8 .

AlvinRamoutar commented 4 years ago

If you can confirm this resolution, then I'll close this issue, proceed with merging the fix into dev, and ask you to adjust PR #4.

JoseGeorges8 commented 4 years ago

Just checked it out and can confirm that fixes the issue 👍

AlvinRamoutar commented 4 years ago

Thanks @JoseGeorges8 , closing and completing merge.