https://github.com/devcybiko/webdevclass
Web Dev Class
https://github.com/devcybiko/webdevclass
Last synced: about 1 year ago
JSON representation
Web Dev Class
- Host: GitHub
- URL: https://github.com/devcybiko/webdevclass
- Owner: devcybiko
- Created: 2019-05-10T03:30:38.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-09T23:34:02.000Z (almost 7 years ago)
- Last Synced: 2025-06-16T15:09:52.627Z (about 1 year ago)
- Language: HTML
- Size: 27.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GREG'S WEB DEV SUPPORT FILES
## Activities
These are Greg's answers to some of the Activities.
Notice that there are some "test" functions in here. Later, we'll learn about various Test Harnesses that will check our code to make sure it works.
### gregcalc
Greg's solutions to the Calculator activity
There are three different methods of computing the calc result:
1. If-Hydra
2. Object dispatcher
3. eval()
### FixBuzz
Here are three student's versions of FizzBuzz - a common interview challenge.
Plus, a one-line FizzBuzz solution that will blow your mind!
### RPSLX - Rock Paper Scissors Lizard Spock
1. rps-solved.html - the if-hydra solution
2. rps-greg.html - Greg's five-line solution to the if-hydra
3. rpslx-solved.html - an extension to the if-hydra to add 'lizard' and 'spock'
4. rpslx-greg.html - Greg's one-line change that allows you to play RPSLX
### MissingCard
Greg's solution to the missing card activity.
The algorithm is to convert the card to an 'ordinal' value.
* diamonds = '0-12'
* hearts = '13-25'
* clubs='26-38'
* spades='39-51'
Then, for each suit, we add the card's ordinal (A=0..King=12).
This gives us a value from 0-51 which represents each card.
Pay particular attention to how we calculate the card's value in cardOrdinal() and then convert it back to a card in toCard().
Finally, we sum all the ordinal values of all the cards in a deck (1326), and subtract the sum of all the cards with the missing card. The result is the ordinal value of the missing card - which we convert back to a card using toCard().
## Examples
* gregArrayMath.js - shows how to do array math using a one-dimensional array to hold values for a two-dimensional array.
## ToolKit
(ToolKit)[./ToolKit]
1. greg.js - a collection of JavaScript functions that you may find useful
2. gregTest.js - a simple test framework to verify the functions work
3. To run the tests run `runtests.sh`
### ToolKit Notes
1. Needs node.js version 12+
2. Warning message is normal: (node:14003) ExperimentalWarning: The ESM module loader is experimental.
3. If all goes well a message will display: Ran without errors.
4. If there are errors a message will display: Errors were found