mastermind's Issues
Package level visibility should not be used
Package level visibility should never be used as it encourages bad practices.
Instead the visibility should be set to one of those three levels (in order of preference): private
, protected
or public
.
MasterMind/src/com/pda/games/MasterMind.java
Lines 7 to 9 in c3d4aa0
MasterMind/src/com/pda/games/MasterMind.java
Lines 16 to 17 in c3d4aa0
MasterMind/src/com/pda/games/MasterMind.java
Lines 20 to 21 in c3d4aa0
Current round should be private and increased by verifyEnter() or verifyEnter2()
The round variable should be private (not directly accessible/modifiable):
Each verification should increase the number of rounds passed:
MasterMind/src/com/pda/games/MasterMind.java
Lines 36 to 45 in c3d4aa0
If we want the current round# to be obtained from the outside, a getter (accesseur) should be used with the proper level of visibility; but round
should be private no matter what.
https://ericreboisson.developpez.com/tutoriels/learningjava1/#LIV
https://openclassrooms.com/fr/courses/26832-apprenez-a-programmer-en-java/21282-creez-votre-premiere-classe#/id/r-21241
"Ex aequo" on Challenger and Duel mode instead of "win"
I played with Challanger mode and I got an ex aequo result even thought I clearly won the game at round 4
Here is my game on Challenger Mode :
choose your game mode
1 -Challenger
2 -Défenseur
3 -Duel
1
Choose the maximum number of rounds
5
Round 1/5
choose four digits between 0 and 9 (included) separated by a space
5 5 5 5
[+, -, +, +]
Round 2/5
choose four digits between 0 and 9 (included) separated by a space
8 2 8 8
[=, -, -, =]
Round 3/5
choose four digits between 0 and 9 (included) separated by a space
8 1 6 8
[=, -, =, =]
Round 4/5
choose four digits between 0 and 9 (included) separated by a space
8 0 6 8
[=, =, =, =]
Ex aequo
try Again ? (Y) (N)
Here is my game on Duel Mode :
choose your game mode
1 -Challenger
2 -Défenseur
3 -Duel
3
Choose the maximum number of rounds
5
choose four digits between 0 and 9 (included) separated by a space
1 2 3 4
[8, 5, 4, 1]
Round 1/5
Human Turn
Choose four digits between 0 and 9 (included) separated by a space
2 7 2 7
[+, -, +, -]
Bot turn
[1, 9, 6, 0]
Say more, less, or equal with these symbols (+ - =)
= - - +
[8, 5, 4, 1]
Round 2/5
Human Turn
Choose four digits between 0 and 9 (included) separated by a space
7 2 7 2
[+, +, -, -]
Bot turn
[1, 4, 2, 5]
Say more, less, or equal with these symbols (+ - =)
= - + -
[8, 5, 4, 1]
Round 3/5
Human Turn
Choose four digits between 0 and 9 (included) separated by a space
8 5 5 0
[=, =, -, +]
Bot turn
[1, 1, 4, 2]
Say more, less, or equal with these symbols (+ - =)
= + - -
A cake is a lie
= + - +
[8, 5, 4, 1]
Round 4/5
Human Turn
Choose four digits between 0 and 9 (included) separated by a space
8 5 4 1
[=, =, =, =]
Bot turn
[1, 2, 3, 3]
Say more, less, or equal with these symbols (+ - =)
= = = +
Ex aequo
try Again ? (Y) (N)
Nitpick: "BLAh".toLowerCase().equals("blah") should be replaced with "BLAJ".equalsIgnoreCase("blah")
Mode should be null we not set properly
During the execution we expect the mode to be set to null
as a possibility:
Lines 18 to 19 in c3d4aa0
So when we do not have a mode selected we should have the mode set to null rather than trying to get the mode immediately again:
Lines 63 to 65 in c3d4aa0
The alternative is to assume that the mode can never be null
.
Unecessary radix definition
Why are we using 4 as a radix in this case? The default sc.nextInt()
is good enough.
Line 49 in c3d4aa0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.