Giter Club home page Giter Club logo

mastermind's Introduction

#MasterMind

forthebadge

Mastermind crée pour le projet 3 du parcours de Développeur d'application JAVA https://openclassrooms.com/fr/projects/140/assignment

##Pré-requis:

  • Java 8 minimum
  • Ajouter le dossier "lib" dans le ClassPath

##Démarrage

  • Configuer le jeu à partir du fichier resources/config.properties

    • "sizeOfLineToFin" définie le nombre de chiffres que contiendras le mastermind

    • "maximumValue" définie le nombre maximum

    • "minimalValue" définie le nombre minimum

    • "maximumOfRounds" définie le nombre de round maximum

    • "devMod" permet d'activer ou non le mode Dev

  • Executer la méthode Main

Version 1.00 (Stable)

Lauris Hebert alias @Pandanam

mastermind's People

Contributors

laurishebert avatar

Stargazers

 avatar etienne avatar

Watchers

 avatar  avatar

mastermind's Issues

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

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.

final static int size = 4;
final static int minRange = 0;
final static int maxRange = 9;

int maxRound;
int round = 0;

boolean correspondence = false;
boolean correspondence2 = false;

MasterMind(int maxRound, int[] defenseNumber){

MasterMind(int maxRound, int[] defenseNumber, int[] defenseNumber2){

void verifyEnter(int[] attackNumber){

void verifyEnter2(int[] attackNumber){

abstract void clue();

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:

void verifyEnter(int[] attackNumber){
if (canPlayAgain()){
correspondence = Arrays.equals(defenseNumber, attackNumber);
}
}
void verifyEnter2(int[] attackNumber){
if (canPlayAgain()){
correspondence2 = Arrays.equals(defenseNumber2, attackNumber);
}
}

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

Mode should be null we not set properly

During the execution we expect the mode to be set to null as a possibility:

MasterMind/src/Main.java

Lines 18 to 19 in c3d4aa0

MasterMind mode = chooseGame();
if (mode != null){

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:

MasterMind/src/Main.java

Lines 63 to 65 in c3d4aa0

default:
System.out.println("Enter only 1 2 or 3");
chooseGame();

The alternative is to assume that the mode can never be null.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.