Skip to content

Commit

Permalink
solving is finally complete
Browse files Browse the repository at this point in the history
  • Loading branch information
lGrom committed Jul 26, 2024
1 parent adf5dac commit e3c9fba
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 116 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ TODO:
- [ ] make the styling automatically adjust for the width and heigh of the board
- [ ] make a solvable board generator with with options for difficulty and guess and check
- [ ] add styling to webpage
- [ ] make jsdoc more consistent (eg. dashes after param names)
- [ ] make jsdoc more consistent (eg. dashes after param names, capitalization)
- [ ] add dev documentation

more specific things
- [ ] make position arrays start at 0 instead of 1
- [ ] name "uni/bi-directional" variables as "cardinal" and "orthognol" (or however it's spelled)
- [ ] store runs as 2 dimensional arrays where inner arrays = all indexes of squares in that run instead of just storing the start, end, and length of each run.
- [ ] add testing for execution time
- [ ] for the countHorizontal/VerticalRuns functions you could update them to use indexes instead of position arrays. then instead of having an array of objects with length, start, and end properties, you just get the array's length, the first index, or the last index *

to finish solving:
- [X] function to check for runs
- [ ] function to update shipsLeft, maybe memoized in the future
- [X] function to update shipsLeft, maybe memoized in the future
- [ ] check where the longest ship could fit, then re-run the

PS: for the countHorizontal/VerticalRuns functions you could update them to use indexes instead of position arrays. then instead of having an array of objects with length, start, and end properties, you just get the array's length, the first index, or the last index
4 changes: 3 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ const preset = new BoardBuilder(15, 15)
.setShip([7, 14], GRAPHICAL_TYPES.WATER, true)
.setShip([4, 15], GRAPHICAL_TYPES.WATER, true)
.setShip([15, 15], GRAPHICAL_TYPES.SINGLE, true)
.computeGraphicalTypes();
.computeGraphicalTypes()
// .setShip(202, GRAPHICAL_TYPES.SINGLE, true)
;

class App extends React.Component {
render () {
Expand Down
2 changes: 1 addition & 1 deletion src/Board/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class Board extends React.Component {
super(props);

this.state = {
board: new BoardBuilder(this.props.width, this.props.height, this.props.preset, undefined, this.props.columnCounts, this.props.rowCounts, this.props.shipsLeft)
board: new BoardBuilder(this.props.width, this.props.height, this.props.preset, undefined, this.props.columnCounts, this.props.rowCounts, this.props.runs)
};
}

Expand Down
Loading

0 comments on commit e3c9fba

Please sign in to comment.