Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 51 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,76 @@
# Project Name (Start editing here)
# Guess the Picture: Countries
[Link to game on github](http://g174.github.io/project-1)

Hosted on: [My github repo](http://github.com/g174)
<!---
Read Me Contents
-->

# ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Project #1: The Game

### Overview
### The game

Let's start out with something fun - **a game!**
In this game of guess the picture, more of the flag is revealed with each passing second. Can you identify the country within 30 seconds?
Bonus points awarded for fast fingers, solve the question in 5 seconds to win double points.

Everyone will get a chance to **be creative**, and work through some really **tough programming challenges** – since you've already gotten your feet wet with Tic Tac Toe, it's up to you to come up with a fun and interesting game to build.

**You will be working individually for this project**, but we'll be guiding you along the process and helping as you go. Show us what you've got!
### To play

1. Click Start button to play.
2. Textbox placeholder displays hint for word length.
3. Type country in textbox.
4. Click submit to check answer.
5. Score 5 points or more to proceed to level 2.

---

### Technical Requirements

Your app must:

* **Render a game in the browser**
* **Any number of players** will be okay, switch turns will be great
* **Design logic for winning** & **visually display which player won**
* **Include separate HTML / CSS / JavaScript files**
* Stick with **KISS (Keep It Simple Stupid)** and **DRY (Don't Repeat Yourself)** principles
* Use **Javascript** for **DOM manipulation**, jQuery is not compulsory
* **Deploy your game online**, where the rest of the world can access it
* Use **semantic markup** for HTML and CSS (adhere to best practices)
* **No canvas** project will be accepted, only HTML5 + CSS3 + JS please

One player game of trivia.
Made using html, css, javascript.
---

### Necessary Deliverables

* A **working game, built by you**, hosted somewhere on the internet
* A **link to your hosted working game** in the URL section of your GitHub repo
* A **git repository hosted on GitHub**, with a link to your hosted game, and frequent commits dating back to the very beginning of the project
* **A ``readme.md`` file** with explanations of the technologies used, the approach taken, installation instructions, unsolved problems, etc.
### Coding logic

The flags in the game are shuffled without duplication for each new play.
Using math.random, I generated a random number for randomIndex. The random number identifies the index for the corresponding arrays in var country and var flags. To prevent duplication, each new number is pushed to a usedIndex array and used to filter new random numbers for duplicated entries.

```
//shuffle image without duplicate for next question
function shuffleImg() {
randomIndex = Math.floor(Math.random()*5)
if (usedIndex.length < 5){
while (usedIndex.includes(randomIndex)) {
randomIndex = Math.floor(Math.random()*5)
}
usedIndex.push(randomIndex)
}
answer = country[randomIndex]
var flagImage = image[randomIndex]
var $container = $(".container")
$container.css("background-image",flagImage)
}
```
___

### Unsolved problems

* If player scores less than 5 in first try, game restarts at a faster pace and does not score correctly.

---

### Suggested Ways to Get Started
### Ideas for improvement

* **Break the project down into different components** (data, presentation, views, style, DOM manipulation) and brainstorm each component individually. Use whiteboards!
* **Use your Development Tools** (console.log, inspector, alert statements, etc) to debug and solve problems
* Work through the lessons in class & ask questions when you need to! Think about adding relevant code to your game each night, instead of, you know... _procrastinating_.
* **Commit early, commit often.** Don’t be afraid to break something because you can always go back in time to a previous version.
* **Consult documentation resources** (MDN, jQuery, etc.) at home to better understand what you’ll be getting into.
* **Don’t be afraid to write code that you know you will have to remove later.** Create temporary elements (buttons, links, etc) that trigger events if real data is not available. For example, if you’re trying to figure out how to change some text when the game is over but you haven’t solved the win/lose game logic, you can create a button to simulate that until then.
* Improve on user interface for answers, produce boxes for each letter that only accepts one character. Allows player to visualise the length with ease.
* To increase grid density and number of flags in shuffle as difficulty increase.

---

### Potential Project Ideas

##### Blackjack
Make a one player game where people down on their luck can lose all their money by guessing which card the computer will deal next!

##### Self-scoring Trivia
Test your wits & knowledge with whatever-the-heck you know about (so you can actually win). Guess answers, have the computer tell you how right you are!

---

### Useful Resources

* **[MDN Javascript Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** _(a great reference for all things Vanilla Javascript)_
* **[jQuery Docs](http://api.jquery.com)** _(if you're using jQuery)_
* **[GitHub Pages](https://pages.github.com)** _(for hosting your game)_
* **[How to write readme - Markdown CheatSheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)** _(for editing this readme)_
* **[How to write a good readme for github repo!](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2)** _(to make it better)_

---

### Project Feedback + Evaluation

* __Project Workflow__: Did you complete the user stories, wireframes, task tracking, and/or ERDs, as specified above? Did you use source control as expected for the phase of the program you’re in (detailed above)?

* __Technical Requirements__: Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex?

* __Creativity__: Did you add a personal spin or creative element into your project submission? Did you deliver something of value to the end user (not just a login button and an index page)?

* __Code Quality__: Did you follow code style guidance and best practices covered in class, such as spacing, modularity, and semantic naming? Did you comment your code as your instructors have in class?
### Project Evaluation

* __Deployment__: Did you deploy your application to a public url using GitHub Pages?
<img src="assets/img/workflow.jpg">

* __Total__: Your instructors will give you a total score on your project between:
### Acknowledgements

Score | Expectations
----- | ------------
**0** | _Incomplete._
**1** | _Does not meet expectations._
**2** | _Meets expectations, good job!_
**3** | _Exceeds expectations, you wonderful creature, you!_
* **Shumin**
For her endless patience and guidance, this game would not be functional without her help.

This will serve as a helpful overall gauge of whether you met the project goals, but __the more important scores are the individual ones__ above, which can help you identify where to focus your efforts for the next project!
* **CSSbuttonGenerator**
CSS for buttons designed using http://www.bestcssbuttongenerator.com/
151 changes: 151 additions & 0 deletions assets/css/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
.body {
text-align: justify;
font-family: sans-serif;
}

.background {
height: 100%;
width: 100%;
margin: 0 auto;
background-image: url("../img/antique-map.jpg");
background-size: cover;
}


.container {
margin: 0 auto;
background-size: contain;
background-position: right;
width: 600px;
height: 400px;

}

h1 {
margin: 0 auto;
text-align: center;
font-family: monospace, sans-serif;
color: #8c5d00;
text-shadow: 1px 2px black;
font-size: 70px;
font-weight: bold;
text-decoration: underline;
padding-top: 30px;
text-decoration-color: #8c5d00;
}

h2 {
padding-left: 40px;
font-weight: 900;
color: #5e3e00;
text-shadow: 1px 0 black;
}

h3 {
padding-left: 40px;
color: #5e3e00;
text-shadow: 1px 0 black;
}

h4 {
padding-left: 40px;
}

Button {
-moz-box-shadow: 3px 4px 0px 0px #d6d6d6;
-webkit-box-shadow: 3px 4px 0px 0px #d6d6d6;
box-shadow: 3px 4px 0px 0px #d6d6d6;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #94612e), color-stop(1, #a17a52));
background:-moz-linear-gradient(top, #94612e 5%, #a17a52 100%);
background:-webkit-linear-gradient(top, #94612e 5%, #a17a52 100%);
background:-o-linear-gradient(top, #94612e 5%, #a17a52 100%);
background:-ms-linear-gradient(top, #94612e 5%, #a17a52 100%);
background:linear-gradient(to bottom, #94612e 5%, #a17a52 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#94612e', endColorstr='#a17a52',GradientType=0);
background-color:#94612e;
-moz-border-radius:15px;
-webkit-border-radius:15px;
border-radius:15px;
border:4px solid #ad8a6b;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:17px;
padding:7px 25px;
text-decoration:none;
text-shadow:0px 1px 0px #a68988;
}

Button:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #a17a52), color-stop(1, #94612e));
background:-moz-linear-gradient(top, #a17a52 5%, #94612e 100%);
background:-webkit-linear-gradient(top, #a17a52 5%, #94612e 100%);
background:-o-linear-gradient(top, #a17a52 5%, #94612e 100%);
background:-ms-linear-gradient(top, #a17a52 5%, #94612e 100%);
background:linear-gradient(to bottom, #a17a52 5%, #94612e 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a17a52', endColorstr='#94612e',GradientType=0);
background-color:#a17a52;
}

Button:active {
position:relative;
top:1px;
}


.start {
margin-left: 50px;
padding: 10px;
}

.skip {
margin-left: 65%;
margin-bottom: 5px;
padding: 10px;
}

.scoreCounter {
font-size: 32px;
padding-left: 50px;
font-family: monospace, sans-serif;
color: #5e3e00;
text-shadow: 1px 0 black;
}

.grid {
border: 6px solid white;
border-style: ridge;
width: 596px;
height: 392px;
display: grid;
grid-template-columns: repeat(5,1fr);
grid-auto-rows: minmax(78px,auto);
}

.box {
border: 1px solid white;
background-color: white;
width: 118px;
height: 80px;
}

.letters {
text-align: center;
margin: 0 auto;
}

.input {
padding: 8px;
}

.submit {
display: inline-block;
padding: 10px;
margin: 40px auto;
}

.timer {
font-family: monospace, sans-serif;
font-size: 46px;
}
Binary file added assets/img/antique-map.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/china.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/india.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/italy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/mexico.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/vietnam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/workflow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading