Skip to content

Latest commit

 

History

History
61 lines (57 loc) · 6.11 KB

devlog.md

File metadata and controls

61 lines (57 loc) · 6.11 KB

An implementation of a Sudoku solver, utilising JFrames, that I made during uni in my second year (2013), as the first project I really enjoyed, because it's easier to learn programming if you're using it to build something that has a purpose, as opposed to throw-away tutorial code.

I made it with the intent of formalising how easy a particlar sudoku puzzle would be to solve by determining what moves can be made, deterministically, rather than just iterating guesses.

See the code as close to as it originally was that I could find, or the release of that version.

What I'd like to make it

The "goal" of this is to """eventually""" create something similar to opensudoku, or the newer, current newerer, currenterer, version of it, as well as putting it on the playstore similar to ~, with the inclusion of the originally intended feature/purpose of the JFrame app of determining available moves and how complex a particular game is.

Devlog

Java Build Tools

Although as part of the eventual goal of using this project as a canvas to learn some of the components of the Android development tool chain, I'd like to eventually try and swap from Maven to Gradle, I've had to remove the old gradle files that were loosely hanging around, as GitHub's CodeQL tool for scanning java projects, which currently includes kotlin, will autobuild using Gradle rather than Maven if it detects any Gradle files present.

Linting

The code is pretty gross at the moment, so we'll need to add a linter. VS Code's page on linting java suggets Checkstyle (source) (plugin). The Sun Java Style is the default style rule set. The other already included rule set is the Google Java Style. The rule set for Sun Style are apparently enforcing Oracle's Code Conventions for the Java Programming Language (from 20th April 1999???) and is using this config. The rule set for Google Style are enforcing a much more recent set of rules, the Google Java Style Guide, using this config. There exists the option to use inline configuration, but it replaces entirely, rather than overrides inplace, any other specified config. For instance, the following block will only evaluate against the LineLength rule.

<configuration>
  <configLocation>sun_checks.xml</configLocation>
  <checkstyleRules>
    <module name="Checker">
      <module name="LineLength">
        <property name="max" value="240" />
        <property name="fileExtensions" value="java"/>
      </module>
    </module>
  </checkstyleRules>
</configuration>

Although Google's style appears more readily meaningful, the sun_checks.xml option yields around 3300-ish errors, as opposed to google_checks.xml which only yields around 6700-ish warnings, but no errors. If we want to actually override the settings provided, we'll need to copy one of the existing rule sets and edit it and check it in.

Some quick find and replaces

A lot of the 3300-ish errors (according to the sun_checks.xml) are very similar. What are some quick find and replaces?

  • Replace ){ with ) {
  • Replace for( with for (
  • Add spaces around single + operators
    • Replace (?<=[^\+ ])\+(?=[^\+]) with +
    • Replace (?<=[^\+])\+(?=[^\+ ]) with +
    • Fix a whoopsie by replacing \+ = with +=
  • Replace \t (tab) with " " (four spaces)
  • Halve all leading spaces indentation; (spaces followed by a letter, right curly, forward slash, or space and asterisk)
    • Replace ^ {4}(?=[\w}/]|( \*)) with " " (two spaces)
    • Replace ^ {8}(?=[\w}/]|( \*)) with " " (four spaces)
    • etc. (up to ^ {56}(?=[\w}/]|( \*)) with 28 spaces, apparently)
  • Chomp all only whitespace lines;
    • Replace ^\s*$ with nothing.
  • Replace /\*\*\* with /**
  • Replace if\( with if (
  • Use (?<!\/\*|\/|^ |^ )\* to find * that aren't part of some Javadoc's left most *;
    • Negates ^\s+\/** and ^\s+*
    • Fixed length (?<!...) only
      • Knowing we only have ^\s+* at one or three indents.
  • Add spaces around single - operators
    • Replace (?<=[^- ])-(?=[^-=]) with -
    • Replace (?<=[^-])-(?=[^- =]) with -
  • Add spaces around single * operators
    • Replace (?<=[^/\* ])\*(?=[^/\*=]) with *
    • Replace (?<=[^/\*])\*(?=[^/\* =]) with *
  • Add spaces around single / operators
    • Replace (?<=[^/ \*])/(?=[^/\*]) with /
    • Replace (?<=[^/\*])/(?=[^/ \*]) with /
  • Replace (?<! )&& with &&
  • Replace &&(?! ) with &&