Giter Club home page Giter Club logo

code-institute-submissions / ms2-monkey-brain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lavadax/ms2-monkey-brain

0.0 0.0 0.0 1.44 MB

2nd milestone project for CodeInstitute course. This is focused on HTML, CSS and JS. subject of the project is based on the Ai Project from the Primate Research Institute in Kyoto.

Home Page: https://lavadax.github.io/MS2-Monkey-Brain/

License: MIT License

Dockerfile 3.11% Shell 3.25% CSS 13.07% HTML 10.20% JavaScript 70.37%

ms2-monkey-brain's Introduction


Logo

Monkey Brain

2nd milestone project for CodeInstitute course. This is focused on HTML, CSS and JS. Subject of the project is based on the Ai Project from the Primate Research Institute in Kyoto.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Deployment
  3. Usage
  4. Roadmap
  5. Testing
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgements

About The Project

Below you can see a few screenshots of the finished project.

Intro during first page visit:

desktop-intro mobile-intro

Game page after intro:

desktop-clear mobile-clear

History page without game history:

desktop-no-history mobile-no-history

Game page after game is started:

desktop-game mobile-game

Daily history with sample data:

desktop-day mobile-day

Weekly history with sample data:

desktop-week mobile-week

Monthly history with sample data:

desktop-month mobile-month

Built With

  • Bootstrap 4.6 - Used to assist responsiveness and streamline the positioning & styling of the site.
  • Gitpod / Gitpod Chrome extension - Used to develop the site and push the project to Github.
  • FontAwesome - Used to add icons for social media links.
  • GitHub - Used to host the project during and after development.
  • MockFlow - Used to set up the wireframes at the start of the dev cycle.
  • favicon.io - Used to generate the favicon files.
  • Chart.js - Used to create the charts for the history tab.
  • Intro.js - Used to add an easily understandable introduction to the page.

Deployment

GitHub Pages

The project was deployed to GitHub Pages using the following steps...

  1. Log in to GitHub and locate the GitHub Repository.
  2. At the top of the Repository (not top of page), locate the "Settings" Button on the menu.
  3. On the left hand side, click the "Pages" section.
  4. Under "Source", click the dropdown called "None" and select "Master Branch".
  5. Click "Save".
  6. The page will automatically refresh.
  7. Locate the now published site link in the Green box on the top part of the page.

Forking the GitHub Repository

By forking the GitHub Repository we make a copy of the original repository on our GitHub account to view and/or make changes without affecting the original repository by using the following steps...

  1. Log in to GitHub and locate the GitHub Repository.
  2. At the top right of the Repository (not top of page) just above the "Settings" Button on the menu, locate the "Fork" Button.
  3. You should now have a copy of the original repository in your GitHub account.

Making a Local Clone

  1. Log in to GitHub and locate the GitHub Repository.
  2. Under the repository name, click "Clone or download".
  3. To clone the repository using HTTPS, under "Clone with HTTPS", copy the link.
  4. Open Git Bash
  5. Change the current working directory to the location where you want the cloned directory to be made.
  6. Type git clone, and then paste the URL you copied in Step 3.
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
  1. Press Enter. Your local clone will be created.
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `CI-Clone`...
> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.

Click Here to retrieve pictures for some of the buttons and more detailed explanations of the above process.

Usage

Wireframes

All wireframes are in a single file and can be found here.

User Stories

First Time Visitors

  • As a new user, I want to easily understand the purpose of the site.
  • As a new user, I want to be able to easily navigate the site and access the content it provides.

Returning Visitors

  • As a returning user, I want to easily return to where I left off previously.
  • As a returning user, I want to easily check my progress so far.
  • As a returning user, I want the possibility of accessing my previous data on new devices.

Roadmap

0.0.x Edits are reserved for minor unplanned edits.
0.x.0 Edits are reserved for planned milestones.
x.0.0 Edits are reserved for major milestones explained below.

0.1.0: Project inception: Files are created, basic file tree is in place, README and license are initialized.
0.2.0: Basic usage: Basic HTML and CSS are up and running on PC screens without major issues.
0.3.0: Basic responsiveness: Page is responsive for all screen sizes without major issues.
1.0.0: Basic javascript: Basic javascript is up and running, completing minimum goals of the project.
2.0.0: Save state: Added usage of local storage and save export.
3.0.0: More options: expansion on 2.0.0 by adding options on page themes.

Future Plans

Open Issues

See the open issues for a list of proposed features (and known issues).

Past Issues

See the closed issues for a list of the past issues.

Notable past issues:

  • When testing the collision detection script initially, it would infinitely loop around 20-25% of the time due to incorrect variable manipulation turning integers into strings while checking overlap.
  • While the initial plan was to use cookies to save data, I decided to move to local storage instead, at the suggestion of my mentor.
  • Initial feedback from friends was heavily focused on needing an introduction/tutorial of the page, as the purpose/navigation wasn't easily figured out, requiring the unplanned use of Intro.js.
  • As the historical data is stored as a string in local storage, converting it to specific days/months was easy, but sorting by week required a more complex solution of changing the string to a date object and then checking for specific weekdays.
  • Importing data worked smoothly once I figured out how to copy variable data, but due to how I set up the function calls, if there was data saved locally for the current date, while also importing data for the current date, the data would be added together giving an incorrect result.

Site & Methodology Changes

As I'm still learning about Github while working on these projects, the features I started using more recently are projects and releases.

During the initial planning phase, I had the idea of using cookies to keep track of past activity/records, and preferred theme, but my mentor suggested using localStorage instead.
As I had no backend information on either option, I went with the suggestion and started planning for it while working on the html & javascript.
At some point I got concerned about storage limitation so I ran some tests, and here are the results: localStorage commands
Based on the results, I can reasonably assume that if someone plays 1000 times, every single day, I can store upwards of 722 days of data.
Even after the exact syntax of the localStorage has changed, I would still estimate the browser would have roughly 500 days worth of space.

The initial plan was to use a canvas as a game area, however it quickly became clear that hooking event listeners to auto-generated objects would require a lot of effort, so I changed my focus to SVG instead.

Testing

Validation

As the first part of validation, I decided to validate the CSS files using jigsaw, as any potential errors would be quick and easy to fix.
Both CSS files came back clean without any errors.

style.css:
style.css validation

themes.css:
themes.css validation

Moving on, I ran my html through the markup validator by opening my page and copying the html code, as some of it is applied by javascript.
I used the game code as a first test, which unfortunately returned the same code 4 times, along with a warning which can be seen below.

first game validation

After fixing the aforementioned errors, All that was left was the warning, which didn't affect the page in its current state.
putting the history code through the validator gave the same result, as the core html is largely the same across both pages.

Game code:
second game validation

History code:
history validation

Lastly, there's the javascript code. For this I used JSHint to validate the code.
After removing any mention of ES6 features, and letting JSHint assume jQuery was being used, I'm left with 24 warnings and 2 undefined variables.
The variables were actually native chartJS and introJS variables, so these can be ignored.

first javascript validation

The most common issue was missing semicolons, which are fixed very easily.
This leaves me with 3 warnings: Redefining "history", a "for in" not being wrapped in an if statement, and a misleading line break.
Until now I was unaware "history" was a reserved word in javascript, but this is an easy fix: change all mentions of "history" to "hist".
Wrapping the for loop in an if statement seemed kind of pointless, so I instead replaced it with a forEach.
Lastly, I'm leaving the misleading line break in, since I broke the line in 2 on purpose, to prevent it from becoming too long. You can see the result below.

second javascript validation

Testing User Stories

First Time Visitor goals

  • I want to easily understand the purpose of the site

In order to make sure the purpose of the site is clear when opening the page, A simple site introduction has been implemented that will automatically launch when the site is opened.

  • I want to be able to easily navigate the site and access the content it provides

The site content is spread across 2 pages with very minimal navigational elements as a result.
All buttons have appropriate text content and have a clear purpose.
Every button has a size that makes it easy to both click on with a mouse, or tap with a finger in the case of a mobile device/touch screen functionality.

Returning Visitor Goals

  • I want to easily return to where I left off previously

At the end of every session, and at specific moments while navigating the site, current progress is saved in localstorage and is loaded again every time the site is opened.

  • I want to easily check my progress so far

The site contains a history tab, where the previously achieved progress can be viewed in an easy to read format.

  • I want the possibility of accessing my previous data on new devices

As the current progress is saved in the browser's local storage, progress is limited to only that specific browser, on that specific device.
In order to facilitate cross-platform and cross-browser progress, it is possible to extract the progress through the site's export function, and import it into the preferred device/browser.

Functional Testing

As the functional testing section is quite expansive, it has been given its own file here.
As a few edits have been made to the javascript code during functional testing, it has been put through JSHint again, and no new errors have been added.

Accessibility Testing

  • Wave accessibility test

The first test using Wave pointed out the footer links were missing screen reader labels.

first wave test

After Adding the aria-labels, the only issue is the built-in low contrast issue from introJS.

second wave test

  • Websiteplanet responsiveness test

The first test using website Planet made it clear how limited the responsiveness of the page is.

first responsiveness test

Further investigation showed that any screen with a width of less than 445 pixels would have issues with the buttons in the header.
After adding more responsiveness to the header, it is now responsive for screen widths of 359px and up.

At this point I tested the site on the most common web browsers: Opera
Opera GX
Google Chrome
Microsoft Edge
Brave

Lastly, after all the modifications made to the code, I ran all HTML, CSS and javascript through another validation check, which they all passed.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Lavadax - Twitter - facebook

Project Link: https://github.com/lavadax/MS2-Monkey-Brain

Acknowledgements

ms2-monkey-brain's People

Contributors

lavadax avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.