Released under MIT by @Mauricio.
Email : Mauricio
This is a recreation of the Solitaire card game entirely out of Javascript and HTML5. Its primary purpose is as a proof of concept.
        You may drag any top card faced up to any of the piles but maintain the sequence of descending value and alternating color. An empty spot in the Tableau may be filled with a king. If you cannot move any cards from the Tableau, 1 card may be drawn from the Stock pile and placed in the Talon.
        When foundations have been filled in ascending order (Ace to King with the same colors), the game is won. If no more moves can be made and the Foundations is incomplete, the game is lost.
- Drag and drop.
- Draw from a deck.
- Restart a game after finishing.
- A comprehensive README
- Instructional guide
- Used a mp3 to make sounds of the cards.
- Made a version of the Cartesian Product from Python's documentation.
Split the objects into 5 modules:
The program is compliant with Google's user interaction requirements. To enable the sound the program is always muted at startup until the user clicks to unmute.
let sound = new Sound(audioPath);
sound.play();
In compliance with Chrome's autoplay policy. More can be found: https://developer.chrome.com/blog/autoplay/#webaudio
function play(){
let promise = this.sound.play()
if (promise !== undefined){
promise.then(_=> {
// it worked
}).catch(error => {
// Required to catch by Google's compliance.
console.warn("Press the unmute button on the top left to hear audio.");
})
}
}
- Has a shape
- Front face image
- Back face image
- Flippable
- Id
- Draggable
let card = new Card(frontImagePath, backImagePath);
// Flipping the card
card.flip()
- Is a data structure of Cards.
- Shuffles
- Draws card(s)
let deck = new Deck();
// Drawing n cards
let n = 5;
let fiveCards = deck.draw(5)
// Drawing with callback
let fiveSpades = deck.draw(5, (card) => card.suit === 'spades');
// Shuffling
deck.shuffle();
- Links cards to positions on a grid.
- Background
- Datastructures are hash optimized.
let board = new Board();
await board.buildBoard();
// Get the Stock stack
let stock = board.deckIndex['stock'];
// Get the Talon elements
let talon = board.elementIndex['talon'];
- Player takes turns to solve the game.
- Is all the logic for making the rules of the game.
let game = new Game();
await game.buildGame();
document.body.appendChild(game.rootelement);
- Cartesian product
- Immutable matrix multiplication.
- Checks system for compatible environments (e.g. Web or NodeJs).
- Debugging tools.
- Proxy tools for more customizations.
- Directory and file operations.
//Cartesian product
product(['ace', 1], ['hearts', 'spades'])
//>> [['ace', 'hearts'], ['ace', ['spades'], [1, 'hearts'], [1, 'spades']]
//Proxy: traps the 'in' operator
let Handler = {
has(target, key) {
let found = Reflect.has(...arguments);
return found || target.foundations.includes(key);
}
}
let board = new Proxy(Board, Handler);
console.log('ace' in board)
//>> true
- Display instructions for the player to learn how to play.
- Pops up quotes.
- Design a wireframe concept and upload design details.
- Create the skeleton of each structure
- Test on command line
- Create the objects.
- Bind the objects to events.
- Improve the game with additional visuals.
-
Includes links to your Github and LinkedIn.
-
Landing page/modal with obvious, clear instructions.
-
Interactivity of some kind.
-
Well styled, clean frontend.
-
If it has music, the option to mute or stop it.
-
Link to live version.
-
Instructions on how to play/interact with the project.
-
List of technologies / libraries.
-
Technical implementation details with (good-looking) code snippets.
-
To-dos / future features.
-
No .DS_Store files / debuggers / console.logs.
-
Organized file structure, with /src and /dist directories.
Mauricio Lomeli Code |
Charis Ginn Mentor |
Paulo Bocanegra Debugging |
Mike Madsen Debugging |
Lyhour(Lee) Lay Debugging |