Ratismal / UNO

An uno discord bot
69 stars 35 forks source link

sortHand() doesn't work as expected. #30

Open gtm-nayan opened 2 years ago

gtm-nayan commented 2 years ago

Checklist

Expected Behavior

When the bot sends the hand, the hand should be sorted.

Current Behavior

Hand isn't sorted, doesn't change at all.

Possible Solution

The compare function provided here should return the difference in the value of the two cards rather than just a boolean. Can't test if that fixes it myself because of #11 (which is probably referring to a config.json example with all the fields listed but not filled).

Steps to Reproduce (for bugs)

  1. Start a game.
  2. Let the bot send you your hand the first time (isn't sorted).
  3. Do 'uno hand' to get the hand a second time (still isn't sorted).

Context

Figuring out what playable cards I have is harder when I have a lot of them and the hand isn't sorted.

Also, I'll just leave it here since I don't think this warrants a separate issue, the bot seems to be having lag spikes as of late. Not sure if this is due to some memory leak or an influx of players at certain times or some other reason. If it's the second reason, then making a separate command to sort hands and not doing it every turn might help. Sorted hands are not that necessary when a player has just a few cards.