-
Notifications
You must be signed in to change notification settings - Fork 66
Code review exercise: Tay Duncan #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
codingmugen007
wants to merge
31
commits into
MCR-Digital:master
Choose a base branch
from
codingmugen007:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
3c20dab
Introduce a missing intentional difference
mrmanc 97a5e8c
Merge pull request #1 from mrmanc/patch-1
codingmugen007 135a047
Update README.md
codingmugen007 7d26e6c
Refactor game logic and variable names
codingmugen007 3a5bf59
Increase iteration count in golden master test
codingmugen007 a071934
rename variables
codingmugen007 582f310
rename variable
codingmugen007 d1caad0
Refactor currentCategory to getCurrentCategory
codingmugen007 481d4cd
Refactor category check in getCurrentCategory function
codingmugen007 623059f
Refactored category logic in game.js
codingmugen007 a50e18c
Refactor getCurrentCategory function to use modulo operator
codingmugen007 6197cb9
Fix isWinner function to use strict inequality operator
codingmugen007 1c87834
Refactor player addition logic in Game constructor
codingmugen007 3b11a38
Refactor askQuestion function to use displayQuestion helper
codingmugen007 bc14f69
Refactor penalty box logic in game.js
codingmugen007 8531706
Refactor game.js to use shorthand assignment operators
codingmugen007 914c4c0
Refactor board update logic in game.js
codingmugen007 6f88b68
Refactor game.js: Initialize arrays using array literal syntax
codingmugen007 1d5fa36
Refactor game.js to use constants for maximum players and winning gol…
codingmugen007 9fa1b55
Refactor add() method in Game class
codingmugen007 c4cb135
add logPlayerRoll method
codingmugen007 80308c6
add movePlayer Method
codingmugen007 1f19b50
move logic to ask question to movePlayer method
codingmugen007 3fb3975
refactor correctAnswer method
codingmugen007 641e275
Refactor changePlayer method in Game class
codingmugen007 7e5fecc
Add Player class and update game logic
codingmugen007 1c74f20
add player purse to Player class
codingmugen007 44182fd
refactor correctAnswer method
codingmugen007 0b6eddb
add isGettingOutOfPenaltyBox to Player class
codingmugen007 9272d87
add penaltybox state for player
codingmugen007 2422bba
Update exercises/nodejs/src/game.js
codingmugen007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export class Player { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice job creating Player class 👍 |
||
| constructor(name) { | ||
| this.name = name | ||
| this.purse = 0 | ||
| this.inPenaltyBox = false | ||
| this.isGettingOutOfPenaltyBox = false | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| import getResult from './golden-master' | ||
| import gameRunner from '../src/game' | ||
| import runGame from '../src/game' | ||
| import captureOutput from './capture-console-output' | ||
|
|
||
| describe('Running the golden master', () => { | ||
| it('should run against 50 results from the golden master and be equivalent', () => { | ||
| for (let i = 0; i < 50; i++) { | ||
| for (let i = 0; i < 500; i++) { | ||
| const result = getResult(i) | ||
|
|
||
| expect(result).toEqual(captureOutput(() => gameRunner(i))) | ||
| expect(result).toEqual(captureOutput(() => runGame(i))) | ||
| } | ||
| }) | ||
| }) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could potentially extract Board into its own class?