GithubHelp home page GithubHelp logo

teogor / sudoklify Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 3.0 1.29 MB

๐Ÿงฉ Sudoklify is a versatile and intuitive Sudoku puzzle generation library written in Kotlin. ๐ŸŽฒ Generate, manipulate, and solve Sudoku puzzles effortlessly. ๐Ÿง  Perfect for games, apps, and educational projects. ๐Ÿš€

Home Page: https://source.teogor.dev/sudoklify

License: Apache License 2.0

Kotlin 99.73% Shell 0.27%

sudoklify's Introduction

๐Ÿ‘‹๐Ÿป Hey there, I'm Teodor Grigor ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป

About Me

I'm a dedicated open-source enthusiast, Android engineer, video game developer, and UI/UX designer. My passion lies in crafting innovative solutions and making meaningful contributions to the open-source community.

Current Focus

I'm deeply engaged in developing open-source libraries for Android, with a specific focus on Kotlin Multiplatform (KMP). These libraries are geared towards enhancing the Android development landscape and offering valuable tools to fellow developers.

Supporting My Endeavors

I'm actively involved in contributing to open-source projects during my free time. Sponsorship plays a pivotal role in sustaining my efforts by covering essential expenses, allowing me to allocate more time to open-source work, and ensuring the continuity of my contributions without the constraints of a full-time job. If you'd like to support my endeavors, you can do so by visiting my sponsorship page.

Discover More About Me ๐ŸŒ

  • Dive into my portfolio at teogor.dev
  • Connect with me on LinkedIn ๐Ÿ’ผ
  • Catch up with me on Instagram ๐Ÿ“ธ
  • Explore my professional journey through my resume

Get in Touch ๐Ÿ“ฌ

Don't hesitate to reach out, connect, or delve into my work. I'm enthusiastic about collaborating and sharing knowledge with the open-source community! ๐Ÿš€

GitHub Stats

Teodor's GitHub Stats

Top Languages

sudoklify's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sudoklify's Issues

Provide Optional Default `valueMapper` for `decodeAsBoard` to Simplify Usage

The current decodeAsBoard function in your code expects a valueMapper function to translate decoded integers into cell values. This flexibility is valuable, but for simpler use cases, providing a default valueMapper that simply returns the integer value itself could be beneficial.

Justification:

  • Not all board representations require complex value mapping. In these cases, a default valueMapper of this would save users the effort of providing a custom function.
  • This makes the decodeAsBoard function more user-friendly and reduces boilerplate code for common scenarios.
  • Optional parameters allow flexibility for both simple and complex mapping needs.

Proposed Change:

Modify the decodeAsBoard function signature to include an optional valueMapper parameter:

inline fun <T> String.decodeAsBoard(
  gameType: GameType,
  valueMapper: (Int) -> T = { it }, // Default valueMapper returns the integer itself
): List<List<T>> {
  // ... (Rest of the code remains unchanged)
}

Create Code of Conduct

As our community grows, it's important to establish clear guidelines and expectations for how we interact with each other. Creating a Code of Conduct will help ensure that our community remains a welcoming and respectful environment for all participants.

Goals:

  • Define a set of behavior expectations for community members.
  • Provide guidelines for respectful communication and collaboration.
  • Establish procedures for reporting and addressing violations.

Proposed Tasks:

  1. Research and identify existing open-source code of conduct templates that align with our project's values.
  2. Adapt the chosen template to fit the specific needs and culture of our community.
  3. Review and refine the adapted code of conduct with input from community members.
  4. Publish the finalized code of conduct in our project's repository and documentation.

Benefits:

  • Fosters a positive and inclusive community atmosphere.
  • Provides a framework for resolving conflicts and addressing inappropriate behavior.
  • Builds trust and confidence among community members.

Let's collaborate on creating a Code of Conduct that reflects the values and aspirations of our project.

Typo in Package Name for Extensions

There is a typo in the package name for extensions in the Sudoklify codebase. The correct spelling should be extensions, but it's currently spelled as exntensions. This typo is causing issues with accessing the extension functions and could lead to confusion for developers trying to use them.

I propose that we update the package name to the correct spelling (extensions) to ensure consistency and avoid any potential problems down the line. This will help improve the usability and maintainability of the library.

Incorrect Data Types in Accessing Generated Sudoku Documentation

In the documentation section for "Accessing Generated Sudoku," there is a discrepancy between the stated data types of puzzleString and solutionString and their actual data types. The documentation suggests that both puzzleString and solutionString are of type String, but they are actually of type Board.

This inconsistency could lead to confusion for developers trying to access and utilize the generated Sudoku properties correctly. To address this, we should update the documentation to accurately reflect that puzzleString and solutionString are of type Board.

Here is the corrected version of the code snippet and explanation:

val puzzleBoard = generatedSudoku.puzzle
val solutionBoard = generatedSudoku.solution
val difficulty = generatedSudoku.difficulty
val type = generatedSudoku.type

// Print the properties
println("Puzzle Board: $puzzleBoard")
println("Solution Board: $solutionBoard")
println("Difficulty: $difficulty")
println("Grid Type: $type")

This update will ensure that developers have accurate information when working with the generated Sudoku properties.

`decodeAsBoard`: `valueMapper` should receive row and column information

The decodeAsBoard function in your code expects the valueMapper function to only operate on a single integer value. However, the function should actually receive and utilize not only the value but also its corresponding row and column position within the board.

Justification:

  • The provided documentation states that decodeAsBoard deserializes a string into a list of lists representing a game board.
  • This implies that the valueMapper needs context beyond just the individual value to correctly map it to a cell within the grid.
  • For example, placing a specific value might have different meanings depending on its position on the board (e.g., empty cell vs. given clue).

Suggested Changes:

  1. Modify the function signature:
    • Change the valueMapper parameter to accept three arguments: value: Int, row: Int, and column: Int.
  2. Update the documentation:
    • Document the new behavior of the valueMapper function, emphasizing the importance of row and column information.
  3. Refactor existing code:
    • Adjust any code using decodeAsBoard to pass row and column information to the valueMapper function.

Inconsistent Puzzle-Solution Pattern in SudokuBlueprint

I've noticed an inconsistency in the pattern between the puzzles and their respective solutions within the SudokuBlueprint instances in the code. The puzzle patterns and solution strings for each instance do not align as expected.

Affected Code:

SudokuBlueprint(
    puzzle = "ABCD----CDAB----",
    solution = "ABCDDBACBCADCDAB",
    difficulty = Difficulty.EASY,
    type = Type.TWO_BY_TWO,
  ),
SudokuBlueprint(
    puzzle = "BADC----CABD----",
    solution = "BACDADBCDBACCDAB",
    difficulty = Difficulty.MEDIUM,
    type = Type.TWO_BY_TWO,
  ),
SudokuBlueprint(
    puzzle = "CDBA----ABCD----",
    solution = "CDBACDABABCDABCD",
    difficulty = Difficulty.HARD,
    type = Type.TWO_BY_TWO,
  ),
SudokuBlueprint(
    puzzle = "DCBA----BADC----",
    solution = "DCBAADCBBADCABCD",
    difficulty = Difficulty.EXPERT,
    type = Type.TWO_BY_TWO,
  ),

Expected Behavior

The puzzle patterns should accurately represent the initial state of the Sudoku puzzle before any moves are made, and the solution strings should reflect the completed Sudoku puzzle with correct solutions.

Actual Behavior

Currently, there is a discrepancy between the puzzle patterns and the corresponding solutions. This discrepancy could lead to unexpected behavior and incorrect results when working with these Sudoku blueprints.

Steps to Reproduce

  1. Create a Sudoku puzzle using the provided SudokuBlueprint instances.
  2. Compare the puzzle pattern with the solution.
  3. Observe the discrepancy between the puzzle and solution.

Proposed Solution

I recommend verifying and correcting the puzzle patterns to ensure they match the intended initial state of the Sudoku puzzles. This will help ensure consistent and accurate representations of puzzles and their solutions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.