Skip to content

Sudoku command #985

Open
Open

Description

@DMFriends

Description

I would like to make a Sudoku game command for Lancebot. Here are the rules for playing Sudoku, in case you don't know: https://sudoku.com/how-to-play/sudoku-rules-for-complete-beginners/

Reasoning

Sudoku is one of the most popular puzzle games in the world currently and it provides a good challenge for your brain.

Proposed Implementation

  • The bot will print an embed with a 6x6 Sudoku board, like so:
    image
  • The grid will have the columns numbered and rows alphabetized, like so:
    image
  • User will simply enter their input for the game by typing the coordinates of the square that they want to enter a number in (ex. A3), then the number they want to input (ex. 8). So in this case, what the user would type is: A3 8. If the user guesses correctly, then the bot will automatically update the original embed with the correct guess added. If the user wishes to edit their guess, they may do so by simply editing the message. If the user wants to remove a number from a square, they can type something like this: A3 X.
  • Make 2 buttons, one called "Hint" and the other "Give Up". I think it's obvious what I want those buttons to do :)
  • To avoid spam of the "Hint" button, I'm going to record the last time the button is pressed using the built-in time module in Python and count 3 minutes from that time and after that time elapses, allow the user to click that button again. Then the process repeats.
  • I am also considering the possibility of the bot generating puzzles with multiple or no solutions. The way I'm going to prevent this from happening is by using the backtracking method. I did some research online and I will be using this website as a guide.

Would you like to implement this yourself?

  • I'd like to implement this feature myself
  • Anyone can implement this feature

Activity

  1. b0nes1 commented on Dec 19, 2021

    @b0nes1
    Contributor

    Sudoku is fun, but I'm not sure it's well suited to be played in discord. An average Sudoku game takes about 20 minutes to play which seems quite a long time for a discord mini game. What about a mini Sudoku in a 4x4 grid?

  2. DMFriends commented on Dec 19, 2021

    @DMFriends
    ContributorAuthor

    Sudoku is fun, but I'm not sure it's well suited to be played in discord. An average Sudoku game takes about 20 minutes to play which seems quite a long time for a discord mini game. What about a mini Sudoku in a 4x4 grid?

    Ok, maybe you're right about the game being too long, but how would a 4x4 grid work? @sn4u

  3. b0nes1 commented on Dec 19, 2021

    @b0nes1
    Contributor

    image

    The rules are the same, just with less numbers

  4. DMFriends commented on Dec 19, 2021

    @DMFriends
    ContributorAuthor

    image

    The rules are the same, just with less numbers

    Ok, if that's the case, then I can do that.

  5. added
    status: approvedThe issue has received a core developer's approval
    and removed on Dec 20, 2021
  6. onerandomusername commented on Dec 20, 2021

    @onerandomusername
    Contributor

    As we were talking about on discord, by reducing the size to a 4x4, we could use buttons for the user interface instead
    Although, a 4x4 seems kind of small for a sudoku game, it should be fun enough.

    However, if using buttons, it would not be possible to expand it any larger, so it would be a tradeoff that we would need to make.

  7. DMFriends commented on Dec 20, 2021

    @DMFriends
    ContributorAuthor

    As we were talking about on discord, by reducing the size to a 4x4, we could use buttons for the user interface instead Although, a 4x4 seems kind of small for a sudoku game, it should be fun enough.

    However, if using buttons, it would not be possible to expand it any larger, so it would be a tradeoff that we would need to make.

    I think 4x4 should be fine with buttons. Not sure what you mean by "tradeoff" @onerandomusername

  8. onerandomusername commented on Dec 20, 2021

    @onerandomusername
    Contributor

    Given we can only have 5x5 buttons in total as discord limitation, if we use buttons we cannot ever grow beyond that size.

  9. DMFriends commented on Dec 20, 2021

    @DMFriends
    ContributorAuthor

    Given we can only have 5x5 buttons in total as discord limitation, if we use buttons we cannot ever grow beyond that size.

    Ah, I see. To be honest, now that I think about this, I feel like 4x4 would a bit too easy. Another thought I had was to make this game thread based so it's not taking up the entire channel but they haven't been enabled on PyDis yet, so I'm not sure if that's possible, at least without making this issue stalled.

  10. onerandomusername commented on Dec 20, 2021

    @onerandomusername
    Contributor

    Its not possible right now to use threads, no. I do know that you would be able to get some nice colours out of the codeblock by setting the codeblock language.

    The main reason I was on buttons is because the suggested input does not seem the most user-friendly--but only if there's a better option.

    r[insert row #]c[insert column #]v[insert # (value)]

    This looks complicated to me, although its probably the best way to input a number. We maybe could try something with selects and buttons... but this works so...

  11. b0nes1 commented on Dec 20, 2021

    @b0nes1
    Contributor

    What about an image of the board that we edit every time the player makes a move? Could be done with PIL

  12. 13 remaining items

  13. DMFriends commented on Aug 22, 2023

    @DMFriends
    ContributorAuthor

    @DMFriends I would like to have a go at this.

    Go ahead! Good luck!

  14. wookie184 commented on Aug 23, 2023

    @wookie184
    Contributor

    @n0Oo0Oo0b I've assigned you.

    Given there have been a few different proposals for how this could be done here, could you clarify what you are working on? (e.g. what size, how it will be displayed to the user, how the user will enter guesses)

  15. salty-tree commented on Aug 23, 2023

    @salty-tree
    • For grid size, I will start with a 4x4 but I might also add a 6x6 option later
    • The grid will be displayed as an image
    • .sudoku start to start, .sudoku [location] [number] to enter guesses. If the guess is correct, the board will be updated (most likely edit the original message). If the guess is incorrect, the bot will indicate it (perhaps a :x: reaction) and leave the board unchanged.
  16. wookie184 commented on Aug 26, 2023

    @wookie184
    Contributor

    Sounds good 👍

  17. Xithrius commented on Dec 1, 2023

    @Xithrius
    Contributor

    @n0Oo0Oo0b Hello. Just wondering if there has been any progress on this feature. I'd like to see it get implemented. Thanks!

  18. salty-tree commented on Dec 2, 2023

    @salty-tree

    @n0Oo0Oo0b Hello. Just wondering if there has been any progress on this feature. I'd like to see it get implemented. Thanks!

    I did have some progreess on the board generation but this has been on my backburner for a while. I'll be able to work on it soon once my exams are over and I'll open a draft PR once the board generation is done.

  19. DMFriends commented on Aug 2, 2025

    @DMFriends
    ContributorAuthor

    Hey @n0Oo0Oo0b! Have you worked on this issue at all since your last comment? If so (or even if you haven't) and you're still interested in working on it, I'm free for the next few weeks until I start college and would love to work on it together if that's cool with you. Let me know. Thanks!

  20. salty-tree commented on Aug 3, 2025

    @salty-tree

    @DMFriends Sure, I'd be happy to work on it together! I only have a bit of uncommitted code for generating the sudoku board. How would collaboration work git-wise?

  21. DMFriends commented on Aug 3, 2025

    @DMFriends
    ContributorAuthor

    I will invite you as a collaborator to my fork.

  22. salty-tree commented on Aug 5, 2025

    @salty-tree

    I think adding multiplayer functionality similar to the duck game could also work pretty well. Something like +1 point for filling in a digit correctly / -1 point for an incorrect guess; once the whole grid is filled, the bot would display each user's total score.

  23. DMFriends commented on Aug 5, 2025

    @DMFriends
    ContributorAuthor

    Interesting idea. Let's see what the Core Devs think. @wookie184 thoughts?

  24. DMFriends commented on Aug 5, 2025

    @DMFriends
    ContributorAuthor

    Also can I be assigned to the issue again since I'm now working on this together with n0ob?

  25. Xithrius commented on Aug 6, 2025

    @Xithrius
    Contributor

    @DMFriends assigned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

status: approvedThe issue has received a core developer's approvaltype: featureRelating to the functionality of the application.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions