python-discord / sir-lancebot

A Discord bot started as a community project for Hacktoberfest 2018, later evolved to an introductory project for aspiring new developers starting out with open source development.
MIT License
242 stars 239 forks source link

Sudoku command #985

Open DMFriends opened 2 years ago

DMFriends commented 2 years ago

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

Would you like to implement this yourself?

b0nes1 commented 2 years ago

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?

DMFriends commented 2 years ago

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

b0nes1 commented 2 years ago

image

The rules are the same, just with less numbers

DMFriends commented 2 years ago

image

The rules are the same, just with less numbers

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

onerandomusername commented 2 years ago

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.

DMFriends commented 2 years ago

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

onerandomusername commented 2 years ago

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

DMFriends commented 2 years ago

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.

onerandomusername commented 2 years ago

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...

b0nes1 commented 2 years ago

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

onerandomusername commented 2 years ago

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

See https://github.com/python-discord/sir-lancebot/pull/956#issuecomment-997322591

I'm not familar with PIL myself, either

DMFriends commented 2 years ago

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...

Yeah, I think that is the best option for the input because the bot needs to know exactly what row and column the user is inputting a number so I think I'm going to stick with that.

About the button implementation, I'm honestly at odds as to what the best way to implement this is. I did have the idea of using modified images with PIL, but I'm not really that good at it (i.e. I don't really understand how it works, just like I said in the comment that arl linked). I'm going to think about this more and write up my thoughts here. If anyone else has any ideas as to how best to implement this, please let me know. Thanks!

DMFriends commented 2 years ago

@onerandomusername Actually, I did end up thinking of another way to implement the user input that's better than what I had originally proposed. We could have the user enter their input like so: row #, col #, # (one message) Or:

row # 
col # 
# 

(^ separate messages, and maybe have the bot send an embed saying "Enter row #" then enter row # then another embed, etc.) What do you think?

onerandomusername commented 2 years ago

it's possible, yeah.

I think it's safe to implement it now as it is, but write a separate method to get the input so we can continue to bikeshed it and make it easier to change in the future.

DMFriends commented 2 years ago

it's possible, yeah.

I think it's safe to implement it now as it is, but write a separate method to get the input so we can continue to bikeshed it and make it easier to change in the future.

So are you saying it's fine to implement the user input the way I originally proposed? @onerandomusername

onerandomusername commented 2 years ago

I'm thinking that's the input style we should use for now unless someone has a really really really great fantastic user input idea

DMFriends commented 2 years ago

I'm thinking that's the input style we should use for now unless someone has a really really really great fantastic user input idea

Alright, sounds good. I mean, the only other thing I can think of (and you mentioned this yourself I believe) is that I could use dropdowns. Do you think I should do that or just stick with the original proposal? @onerandomusername

DMFriends commented 2 years ago

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...

Yeah, I think that is the best option for the input because the bot needs to know exactly what row and column the user is inputting a number so I think I'm going to stick with that.

About the button implementation, I'm honestly at odds as to what the best way to implement this is. I did have the idea of using modified images with PIL, but I'm not really that good at it (i.e. I don't really understand how it works, just like I said in the comment that arl linked). I'm going to think about this more and write up my thoughts here. If anyone else has any ideas as to how best to implement this, please let me know. Thanks!

Ok, so I think I have made my final thoughts about this.

Here's my opinion: I think I should 1) not use 4x4 because as I said earlier, it's a bit too easy and may make the game not as interesting to play and 2) wait until PyDis supports threads (if it's not too far from now), that way the game doesn't block the entire sir-lancebot-playground channel and also allow me to make the game the original 9x9 game.

If none of you like that idea, then I think it's safe to say this won't be possible, unless you guys have other ideas. (cc @Sn4u @onerandomusername )

DMFriends commented 2 years ago

Ok, so based off this discussion (starts there), I have (hopefully) made my final decisions as to how I (and others) want this implemented.

I believe those are the main takeaways from that conversation I linked. @onerandomusername @Sn4u Let me know if I missed anything.

Lastly, just to make sure: @jb3, do you still approve of this happening with those changes I mentioned above (in this comment)?

DMFriends commented 2 years ago

Quick update on this: I am still working on this, just haven't opened a PR yet - I don't think I'm ready to do that yet. I'm planning on getting it to a state where I will feel comfortable opening a PR sometime between now and the end of August. (Yes I know that's a large timeframe, but this turned out to be a lot harder than I initially thought but I like the challenge so I'm going to keep working on this for now.)

DMFriends commented 2 years ago

I do not wish to continue working on this (you can see the code I wrote so far here), feel free to ask to be assigned to this issue if you would like to work on it. Thanks!!

n0Oo0Oo0b commented 1 year ago

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

DMFriends commented 1 year ago

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

Go ahead! Good luck!

wookie184 commented 1 year ago

@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)

n0Oo0Oo0b commented 1 year ago
wookie184 commented 1 year ago

Sounds good 👍

Xithrius commented 10 months ago

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

n0Oo0Oo0b commented 10 months ago

@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.