Skip to content
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

Improve Acey Ducey JavaScript port #332

Merged

Conversation

domenic
Copy link
Contributor

@domenic domenic commented Jan 1, 2022

Notable changes:

  • Use informative variable names instead of q, a, b, m, and c
  • Use a lookup table instead of chained ifs for face cards
  • Refactor I/O helpers into a separate file
  • Refactor random card logic into its own function
  • Support any case for "yes" input
  • Add a few comments to non-obvious parts of the game logic
  • Insert "HERE IS THE CARD WE DREW:" into the output since just printing the card was pretty confusing
  • Make indentation uniform
  • Make bracing style uniform
  • Use conventional JavaScript camelCasing
  • Use top-level await in a module instead of a main() function
  • Clean up the HTML shell page for modern best practices (including a mobile-friendly viewport)

Notable changes:

* Use informative variable names instead of q, a, b, m, and c
* Use a lookup table instead of chained ifs for face cards
* Refactor I/O helpers into a separate file
* Refactor random card logic into its own function
* Support any case for "yes" input
* Add a few comments to non-obvious parts of the game logic
* Insert "HERE IS THE CARD WE DREW:" into the output since just printing the card was pretty confusing
* Make indentation uniform
* Make bracing style uniform
* Use conventional JavaScript camelCasing
* Use top-level await in a module instead of a main() function
* Clean up the HTML shell page for modern best practices (including a mobile-friendly viewport)
@coding-horror
Copy link
Owner

Thank you!

@coding-horror coding-horror merged commit 0db6e2d into coding-horror:main Jan 1, 2022
@domenic domenic deleted the acey-ducey-js-improvements branch January 1, 2022 21:09
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.

2 participants