{"id":16859011,"url":"https://github.com/jdmedlock/simon","last_synced_at":"2025-03-18T14:08:45.370Z","repository":{"id":125189908,"uuid":"76606991","full_name":"jdmedlock/simon","owner":"jdmedlock","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-25T22:28:13.000Z","size":223,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T18:47:54.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdmedlock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-16T00:25:25.000Z","updated_at":"2016-12-24T02:41:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"be8bc691-b3bd-4307-8412-324970d6fd18","html_url":"https://github.com/jdmedlock/simon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmedlock%2Fsimon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmedlock%2Fsimon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmedlock%2Fsimon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmedlock%2Fsimon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdmedlock","download_url":"https://codeload.github.com/jdmedlock/simon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244236080,"owners_count":20420759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T14:15:54.797Z","updated_at":"2025-03-18T14:08:45.353Z","avatar_url":"https://github.com/jdmedlock.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simon\n\n## Overview\nThis project implements a virtual Simon game to fulfill the last of the\nAdvanced Frontend Development Certificate offered by\n[freeCodeCamp](http://freeCodeCamp.com).\n\nMy Simon implementation is hosted at http://mysimon.surge.sh\n\n[Simon](https://en.wikipedia.org/wiki/Simon_(game)) is an electronic game\ndeveloped in the late-1970's which tests the players memory by requiring the\nplayer to repeat an increasing series of colors. The game has four buttons,\neach in a primary color, which light up in a random sequence that the players\nmust repeat. The length of the sequence is incremented in each successive\nround of play.\n\nAn example of a Simon simulator can be found\n[here](https://codepen.io/FreeCodeCamp/full/obYBjE) .\n\n### Requirements\nA successful implementation of the Simon game must satisfy the following\nuser stories:\n\n1. I am presented with a random series of button presses.\n2. Each time I input a series of button presses correctly, I see the same series of button presses but with an additional step.\n3. I hear a sound that corresponds to each button both when the series of button presses plays, and when I personally press a button.\n4. If I press the wrong button, I am notified that I have done so, and that series of button presses starts again to remind me of the pattern so I can try again.\n5. I can see how many steps are in the current series of button presses.\n6. If I want to restart, I can hit a button to do so, and the game will return to a single step.\n7. I can play in strict mode where if I get a button press wrong, it notifies me that I have done so, and the game restarts at a new random series of button presses.\n8. I can win the game by getting a series of 20 steps correct. I am notified of my victory, then the game starts over.\n\n### Resources\nMeeting User Story 3 requires the following sound resources:\n\n* https://s3.amazonaws.com/freecodecamp/simonSound1.mp3  \n* https://s3.amazonaws.com/freecodecamp/simonSound2.mp3  \n* https://s3.amazonaws.com/freecodecamp/simonSound3.mp3\n* https://s3.amazonaws.com/freecodecamp/simonSound4.mp3\n\n## Design\n\n### User Interface\n\n#### Example Game Image:\n![alt text](https://github.com/jdmedlock/simon/blob/master/Simon_Game_Example.png?raw=true \"Simon Game Example\")\n\n#### Observations\n\nThe example game image above could be improved by making a few modifications\nto the layout. The layout of the score display and game controls in the inner\ncircle should be organized in a way that is both pleasing to the eye and makes\nit easy for the player to interact with them.\n\nInstead of clumping all controls in the lower half of the inner circle a more\nintuitive layout would place half of the controls, based on their total size,\ninto the top and bottom third of the circle. The Simon game label occupying the\nmiddle third. Furthermore, all buttons should be in the same area with the\nOn/Off button separated from the others to make it more prominent. There should\nalso be sufficient separation between the buttons to prevent accidental\npresses.\n\n### Model\n\n#### States \u0026 Modes\n\nThe terms state and mode are both used to define the condition of the game at\nany point in time. The difference between the two is that a state is the\ncurrent status of the game and encompasses whatever mode of operation it\nhappens to be in at a point in time. The mode describes the operational\ncondition of the game which directs how it is to be played. So, the state\ndescribes the overall condition of the game while the mode prescribes a set of\nrules to be followed for its operation.\n\nIt is important to note that only one state may be in effect at any point in\ntime, but multiple modes of operation by be concurrent with one another as long\nas they are of different categories.\n\n| State\t  | Description                                                  |\n|----------|--------------------------------------------------------------|\n| Game on  | The game is powered on and game play modes are ready for use |\n| Game off | The game is powered off                                      |\n\n| Mode\t         | Description\n|-----------------|--------------------------------------|\n| Game-Inprogress\t| Game play is in progress             |\n| Game-Waiting\t   | Game play is waiting to start        |\n| Play-Normal\t   | Normal game play rules are in effect |\n| Play-Strict\t   | Strict game play rules are in effect |\n\n#### State/Mode Transitions\n\n|Starting \u003cbr/\u003eState/Mode\t| Allowable Actions\t| Next State/Mode |\n|------------|--------------------|-----------------|\n|Game-Off\t   | • On\t              | • Game-On       |\n|Game-On\t   | • Strict\t\u003cbr/\u003e • Start \u003cbr/\u003e • Off | • Play-Strict \u003cbr/\u003e • Play-Normal \u003cbr/\u003e • Game-Off |\n|Play-Normal | • Start \u003cbr/\u003e • Strict (enable) \u003cbr/\u003e • Off \u003cbr/\u003e • Game play | • Play-Normal \u003cbr/\u003e • Play-Strict \u003cbr/\u003e • Game-Off |\n|Play-Strict | • Start \u003cbr/\u003e • Strict (disable) \u003cbr/\u003e • Off \u003cbr/\u003e • Game play\t| • Play-Normal \u003cbr/\u003e • Play-Strict \u003cbr/\u003e • Game-Off |\n\n#### User Interface Rules:\n\n| Component\t      | Purpose\t            | # | Action                        | Desired Result    |\n|-----------------|-----------------------|---|-------------------------------|-------------------|\n| Button - Off/On\t|Turns the game off     | 1 |\tOff\t                          | • No other buttons functional while in off state |\n| Button - Off/On\t|Turn the game on\t      | 2 |\tOn\t                          | • All game controls functional. \u003cbr/\u003e • The game can be turned off at any point as long as it is on. |\n| Button - Start\t|Start new game\t      | 1 |\tStarts a new round of play  \t| • A new round of play is started with a sequence of one. \u003cbr/\u003e • Start can be pressed at any time as long as the game is turned on |\n| Button - Strict\t|Enable Strict mode     | 1 |\tEnables strict game play mode\t| • If an incorrect response is made the game notifies the player and it restarts at a new random series of button presses. \u003cbr/\u003e • The new series has the same length as the prior sequence |\n| Button - Strict\t|Disable Strict mode|2|\tDisable strict game play mode\t|• Return to normal game play mode. \u003cbr/\u003e • If the wrong button is pressed the player is notified and that series of button presses starts again to remind the player of the pattern so she can try again |\n| Count\t          |Game count\t         | 1 |\tDisplays the number of steps in the current sequence. Two digit max.\t| • Updated at the start of each round of play |\n| Count\t          |Error notification    | 2 |\tDisplays a sentinel if an error occurs | • For example, exclamation points. \u003cbr/\u003e • After 2 seconds returns to displaying number of steps in the current series. |\n| Button - Player Response\t|Main game play interface | 1 | Challenge playback\t| • The current round of color/sound sequences are played to challenge the users memory. \u003cbr/\u003e • Each time a series of button presses is correctly entered, the same series of button presses is echoed back, but with an additional step |\n| Button - Player Response\t|Main game play interface\t|2| Player response to challenge playback | • The player presses the buttons in the same sequence as the previous challenge playback to win. \u003cbr/\u003e \t• I hear a sound that corresponds to each button both when the series of button presses plays, and when I personally press a button. \u003cbr/\u003e   • If the wrong button is pressed the player is notified and that series of button presses starts again to remind the player of the pattern so she can try again \u003cbr/\u003e   • A win is a series of 20 correctly entered steps. I am notified of my victory, then the game starts over. |\n\n### Objects\n\nAll Javascript code is contained in simon.js, but is subdivided into the\nfollowing sections:\n\n* Initialization - The \u003ccode\u003e$(document).ready\u003c/code\u003e function definition which\nestablishes the linkage between UI components like buttons to their\ncorresponding event handlers.\n\n* Objects - The various JS objects designed to handle events and control the\ngame flow. The objects in this program are:\n\n  * \u003ccode\u003eonOffButton\u003c/code\u003e - Contains the game state, the on/off button event handler, and\nhelper functions.\n  * \u003ccode\u003estartButton\u003c/code\u003e - Contains the game mode, the start button event handler, and\nhelper functions.\n  * \u003ccode\u003estrictButton\u003c/code\u003e - Contains the play mode (strict or normal), the strict button\nevent handler, and helper functions.\n  * \u003ccode\u003eresponseButton\u003c/code\u003e - This object is the main controller for game play. It\ncontains the event handler for the four player response buttons - red, green,\nblue, and yellow buttons.\n  * \u003ccode\u003egameEngine\u003c/code\u003e - Contains the colors in the current series and helper functions\nto perform tasks such as generating the next entry in the series, comparing the\nmost recent player response, playing back the series (with sounds), etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdmedlock%2Fsimon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdmedlock%2Fsimon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdmedlock%2Fsimon/lists"}