#Code Guessing Game Review

1 messages · Page 1 of 1 (latest)

fast summit
#

Hi All,

I am teaching myself Java and this is my first project. I was hoping someone could review it and give me any tips!

The game is based in the terminal. You have to guess a 4 digit code, the code is 4 different numbers (no repeats) and when you input a guess it will tell you how many correct positions and correct numbers you have. When you get the correct code the program stops.

Here is the code: https://github.com/jacoboneill/learning-programming/tree/main/practice-projects/code-guessing-game-java

Please either reply to this post or put it in the issues part of the repository

  • Jacob
GitHub

Contribute to jacoboneill/learning-programming development by creating an account on GitHub.

exotic epochBOT
#

⌛ This post has been reserved for your question.

Hey @fast summit! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

stark abyss
#
  • Nice separation of concerns
#
  • Class names could probably be way better though
#
  • The generated code's digits order is more arbitrary than random. Consider using a LinkedHashSet instead so that the digits come out in the same order as they were added, thus keeping the original random order
#
  • avoid constantly referencing this. this.code here, this.code there, whose else's code would that be? Just write code. Coming from Python?
coarse quarry
#

(or js)

stark abyss
#
  • consider proper rejection of invalid user input. That's one typical way to have vulnerabilities
coarse quarry
exotic epochBOT
coarse quarry
#

flushing the output stream in the same class there is probably also unnecessary?

exotic epochBOT
exotic epochBOT
#

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

fast summit
fast summit
stark abyss
#

Something that would be like GameState, Display, and UserInput

fast summit
stark abyss
fast summit
stark abyss
fast summit
stark abyss
fast summit
coarse quarry
#

localization is the process of transforming content of something to be appropriate for a culturally different audience, it can involve translating text and speech, modifying assets to match cultural ideas, or replacing content like jokes for appropriate counterparts

fast summit
exotic epochBOT
# fast summit Ah Okay, Thank you <@996096255237296269>

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

fast summit
fast summit
fast summit
stark abyss
fast summit
stark abyss
fast summit
coarse quarry
fast summit
fast summit
stark abyss
fast summit
#

All the suggestions have been great. Does anyone have any ideas for terminal like games I can do like this to try and implement this and learn more about Java?

fast summit
coarse quarry
#

in increasing order of difficulty, hangman, checkers, battleship, chess, scrabble
seem like pretty promising games for a terminal context

fast summit
coarse quarry
#

i think mastermind is still easier than hangman so that seems like a reasonable next step

#

conway's game of life is probably really shit in terms of UI/UX for only text input and no GUI though so i'll retract that

stark abyss
fast summit
fast summit
coarse quarry
stark abyss
coarse quarry
#

my implementation just used a fixed size grid that updated every so often

#

it's bad for UX for drawing cells though

fast summit
coarse quarry
#

default fonts are monospace but not full-width, meaning they aren't squares

fast summit
coarse quarry
#

anyways that's not exactly what i mean, i mean when you initialize the board with alive/dead cells, that's going to be a pain without a GUI

coarse quarry
fast summit
coarse quarry
#

uh, 2 spaces

fast summit
#

No I was thinking of something that would look like [] but the full height and width

#

but spaces should also work @coarse quarry

fast summit
exotic epochBOT