2048.cpp icon indicating copy to clipboard operation
2048.cpp copied to clipboard

Add option to forfeit/quit an active game session

Open pauloserrafh opened this issue 4 years ago • 5 comments

Rather than having to ctrl+c to end the current game in progress, there could be an option to forfeit/quit the current game and return to menu.

I've noticed that there is already an CODE_HOTKEY_QUIT_ENDLESS_MODE that is somewhat similar to the proposed idea, but as far as I could tell, the endless mode is not yet implemented (is that right?).

pauloserrafh avatar Sep 29 '19 23:09 pauloserrafh

Hi @pauloserrafh, thanks for opening up an Issue. :smiley_cat:

Rather than having to ctrl+c to end the current game in progress, there could be an option to forfeit/quit the current game and return to menu.

I agree :+1: , sounds like a good plan of action.

I've noticed that there is already an CODE_HOTKEY_QUIT_ENDLESS_MODE that is somewhat similar to the proposed idea, but as far as I could tell, the endless mode is not yet implemented (is that right?).

There is an "endless-mode" in this game however only when you reach the target score tile (2048). You are then presented with an option to activate it (to continue playing to gain higher scores). This endless-mode should be its own game mode but it hasn't been made a promoted / first-class feature yet.

So as you rightly saw, the "mechanics" of a "player to quit current game and return to main-menu" semi-exists, it just hasn't been fully fleshed-out yet! :smile_cat:

tcoyvwac avatar Oct 01 '19 10:10 tcoyvwac

Would your suggestion be best implemented like this?

Scenario / Story: Player is playing a 2048 session but needs to quit session early.

  1. Player presses a designated hotkey to end 2048 session.
  2. Game notes hotkey has been pressed and responds with a question to player.
  3. Game asks question if player want to end their 2048 session and awaits response.
  4. Player confirms to Game's question by pressing a hotkey for yes / no.
  5. Game notes hotkey response and:
    • If yes: A. Returns to main menu.
    • If no: B: Continues current 2048 game session.

tcoyvwac avatar Oct 01 '19 10:10 tcoyvwac

Hello @tcoyvwac, Yes, I think the way you put it is mostly what I had in mind. Regarding the implementation itself:

  1. Should the already existing CODE_HOTKEY_QUIT_ENDLESS_MODE be used (After changing the name to a more appropriate one)?

  2. Should the behavior of saving highscores/statistics be kept when quitting the game?

IMO, there should be no difference between endless mode and regular mode. It doesn't matter which one you choose, the game always start the same way and the difference is that if you don't want to play after you reach 2048, you just choose the option to don't continue.

I'd like to take a shot at it, if you (or someone else) hadn't yet started. I might not be able to work on this until the weekend, tho.

pauloserrafh avatar Oct 01 '19 23:10 pauloserrafh

@pauloserrafh, apologies for the delay! Efforts are welcomed in the project and we appreciate yours :cat:!

I am all for an endless-mode in the game! However, I am a bit confused by this GitHub issue's focus. Your initial post of this issue's topic was about quitting the 2048 game session early via an alternative keypress... :dart: :mag:


If you would like to take the challenge of the scenario / story listed earlier, feel free too! Minimal changes to a codebase always is a good way for a PR to be accepted into many-a-project.

So, to answer your numbered points:

  1. Should the already existing CODE_HOTKEY_QUIT_ENDLESS_MODE be used (After changing the name to a more appropriate one)?
  1. Yes, however I think a more appropriate name for the keycode would be: CODE_HOTKEY_QUIT_CURRENT_2048_SESSION.

2. Should the behavior of saving highscores/statistics be kept when quitting the game?

  1. No. When the player quits the game early, it should not save any player's data or performance. To do opposite (as in, to save the data) has a lot of hidden challenges lurking within! :ghost: :mag: To make an incoming PR for this issue small, to ignore saving behaviour would be a good default plan-of-action :sun_with_face: !

Your issue has spurred me to finish a change in the codebase which touches upon some code you have mentioned at the start of this issue.

May I ask, because of this, could you wait for 7 days or so and update your knowledge on the altered codebase after the incoming merge?

Please note, the general solving of the challenge ("quit-2048-session-while-in-play-early") would basically be tackled the same way (regardless of the incoming codebase update or not), just some of the API called and used would be slightly different. This issue will be referenced in the PR merge as a "ping" to know that the API has changed.

As for adding an "endless-mode" as a promoted / first-class feature and the plans for that, please feel free to make a new GitHub issue on the matter. Of course, looking forward to discussing and focusing further with you on making it happen! :rocket: :smile_cat:

tcoyvwac avatar Oct 05 '19 12:10 tcoyvwac

Hi @tcoyvwac, Sure I can wait for the changes.

Sorry for causing the confusion, indeed the point of the issue was to focus on having a method to quit the current session without having to interrupt the program.

I'd like to take a shot at it, if you (or someone else) hadn't yet started. I might not be able to work on this until the weekend, tho.

When I said this I was talking about the original point of the issue, but re-reading I see now that was a bit confusing given how I wrote, mb.

Waiting for the updated codebase, then! :)

pauloserrafh avatar Oct 05 '19 14:10 pauloserrafh