Skip to content

Conversation

@renataestes
Copy link
Owner

Checkpoint Rubric

This is the rubric that your instructor will use to grade your checkpoints. Please do not edit.

Checkpoint 1

  • All tests passed: 40 points
  • Proper use of documentation (commenting on code): 15 points
  • Properly indented code: 15 points
  • Demonstrated effective use of JavaScript: 30 points

Checkpoint 2

  • The application works as it should: 40 points
  • Proper use of documentation (commenting on code): 15 points
  • Properly indented code: 15 points
  • Demonstrated effective use of JavaScript and the DOM API: 30 points

Checkpoint 3

  • Use of React: 25 points
  • Accesses an API: 25 points
  • Proper use of documentation (commenting on code): 25 points
  • The application functions as it should: 25 points

function mastermind(guess) {
if (guess === generatedCode) {
console.log('You win!');
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to return your "win" statement here, instead of just console logging here.

See line 161 to test instructions.

if (gueArray[3] === genArray[3]) {
positionCounter+=1;
}
console.log('you have '+positionCounter+' letters in the correct position');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return statement here showing correct letters and correct letter locations.

console.log('you have '+counter+' correct letters');

let positionCounter=0;
if (gueArray[0] === genArray[0]) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidate lines 121-132 using a for loop and indexof() to check your guess against solution.


for(let i = 0; i < gueArray.length;i++)
{
for(let j=0; j < genArray.length;j++)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only need one loop here.

for(let j=0; j < genArray.length;j++)
{
if (gueArray[i]===genArray[j])
counter+=1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also use ++ here to increment by one.

gameCounter+=1;
if (gameCounter > 10) {
console.log("GAME OVER!!")
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty return statements from your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants