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
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "sigleQuote": true, "arrowParens": "avoid" }
136 changes: 2 additions & 134 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,134 +1,2 @@
# 🎃 HacktoberFest Starter Project 🎃

** __Oct 24th, 2017 Update:__ THIS REPO IS TEMPORARILY __NOT MERGING NEW PRs__ until the CONTRIBUTORS.md file is sorted! Thanks for your patience! **

Use this project to make your first contribution to an open source project on GitHub. Practice making your first pull request to a public repository before doing the real thing!

Celebrate [Hacktoberfest](https://hacktoberfest.digitalocean.com/) by getting involved in the open source community by completing some simple tasks in this project.

This repository is open to all members of the GitHub community. Any member may contribute to this project without being a collaborator.

[https://alicewonderland.github.io/hacktoberfest/](https://alicewonderland.github.io/hacktoberfest/)

## What is Hacktoberfest?
A month-long celebration from October 1st - 31st sponsored by [Digital Ocean](https://hacktoberfest.digitalocean.com/) and [GitHub](https://github.com/blog/2433-celebrate-open-source-this-october-with-hacktoberfest) to get people involved in [Open Source](https://github.com/open-source). Create your very first pull request to any public repository on GitHub and contribute to the open source developer community.

[https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/)

## How to contribute to this project
Here are 3 quick and painless ways to contribute to this project:

* Add your name to the `CONTRIBUTORS.md` file
* Add a profile page to the `profiles` directory
* Create a simple "Hello, World" script in a language of your choice

Choose one or all 3, make a pull request for your work and wait for it to be merged!

## Getting started
* Fork this repository (Click the Fork button in the top right of this page, click your Profile Image)
* Clone your fork down to your local machine

```markdown
git clone https://github.com/your-username/hacktoberfest.git
```

* Create a branch

```markdown
git checkout -b branch-name
```

* Make your changes (choose from any task below)
* Commit and push

```markdown
git add .
git commit -m 'Commit message'
git push origin branch-name
```

* Create a new pull request from your forked repository (Click the `New Pull Request` button located at the top of your repo)
* Wait for your PR review and merge approval!
* __Star this repository__ if you had fun!

## Choose from these tasks
### 1. Add your name
Add your name to the `CONTRIBUTORS.md` file using the below convention:

```markdown
#### Name: [YOUR NAME](GitHub link)
- Place: City, State, Country
- Bio: Who are you?
- GitHub: [GitHub account name](GitHub link)
```

### 2. Add a profile page
Add a `Your_Name.md` file to the `profiles` directory. Use any combination of content and Markdown you'd like. Here is an example:

```markdown
# Your Name

### Location

Your City/Country

### Academics

Your School

### Interests

- Some Things You Like

### Development

- Inventor of the My Pillow

### Projects

- [My Project](GitHub Link) Short Description

### Profile Link

[Your Name](GitHub Link)
```

### 3. Create a `Hello, World!` Script
Add a `hello_world_yourusername.xx` script to the `scripts` directory in any language of your choice! Here is an example:

```Javascript
// LANGUAGE: Javascript
// ENV: Node.js
// AUTHOR: Alice Chuang
// GITHUB: https://github.com/AliceWonderland

console.log('Hello, World!');
```

Name the file `hello_world_yourusername.xx`. e.g., `hello_world_alicewonderland.js` or `hello_world_alicewonderland.py`.

Don't forget to include the comments as seen above. Feel free to include additional information about the language you choose in your comments too! Like a link to a helpful introduction or tutorial.

Here is my `hello_world` example: [hello_world_alicewonderland.js](https://github.com/AliceWonderland/hacktoberfest/blob/master/scripts/hello_world_alicewonderland.js)

## BONUS!
* See profiles submitted by fellow coders from around the globe ... from Kathmandu to Copenhagen.
* Discover some obscure to new and trending languages ... from BrainFuck to Groovy.
* Check out some very creative ways to print out a "Hello, World!" string.

## Reference links
Here is a great tutorial for creating your first pull request by [Roshan Jossey](https://github.com/Roshanjossey):
[https://github.com/Roshanjossey/first-contributions](https://github.com/Roshanjossey/first-contributions)

Managing your Forked Repo: [https://help.github.com/articles/fork-a-repo/](https://help.github.com/articles/fork-a-repo/)

Syncing a Fork: [https://help.github.com/articles/syncing-a-fork/](https://help.github.com/articles/syncing-a-fork/)

Keep Your Fork Synced: [https://gist.github.com/CristinaSolana/1885435](https://gist.github.com/CristinaSolana/1885435)

Checkout this list for README examples - Awesome README [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)

Github-Flavored Markdown [https://guides.github.com/features/mastering-markdown/](https://guides.github.com/features/mastering-markdown/)

## Additional references added by contributors
GitHub license explained [https://choosealicense.com](https://choosealicense.com)
# Guess-The-Number
JavaScript based a small app for guessing a umber and scoring according tothe wrong and right guesses
32 changes: 32 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
<title>Guess My Number!</title>
</head>
<body>
<header>
<h1>Guess My Number!</h1>
<p class="between">(Between 1 and 20)</p>
<button class="btn again">Again!</button>
<div class="number">?</div>
</header>
<main>
<section class="left">
<input type="number" class="guess" />
<button class="btn check">Check!</button>
</section>
<section class="right">
<p class="message">Start guessing...</p>
<p class="label-score">💯 Score: <span class="score">20</span></p>
<p class="label-highscore">
🥇 Highscore: <span class="highscore">0</span>
</p>
</section>
</main>
<script src="script.js"></script>
</body>
</html>
110 changes: 110 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
"use strict";

/*
console.log(document.querySelector('.message').textContent);
document.querySelector('.message').textContent = '🎉 Correct Number!';

document.querySelector('.number').textContent = 13;
document.querySelector('.score').textContent = 10;

document.querySelector('.guess').value = 23;
console.log(document.querySelector('.guess').value);
*/

let secretNumber = Math.trunc(Math.random() * 20) + 1;
console.log(secretNumber);

let highScore = 0;
const displayMessage = function (message) {
document.querySelector(".message").textContent = message;
};

document.querySelector("body").style.backgroundColor = "#12566b";
document.querySelector(".number").style.width = "30rem";
let score = 20;
document.querySelector(".check").addEventListener("click", function () {
const guess = Number(document.querySelector(".guess").value);
console.log(guess, typeof guess);

//when there's no input
if (!guess) {
// document.querySelector(".message").textContent = "⛔ No Number!";
displayMessage("⛔ No Number!");
}
//when player wins
else if (guess === secretNumber) {
// document.querySelector(".message").textContent = "🎉 Correct Number!";
displayMessage("🎉 Correct Number!");
document.querySelector(".number").textContent = secretNumber;
document.querySelector("body").style.backgroundColor = "#12566b";
console.log(secretNumber);

if (score > highScore) {
highScore = score;
document.querySelector(".highscore").textContent = highScore;
}
} else if (guess !== secretNumber) {
if (score > 1) {
// document.querySelector(".message").textContent =
// guess > secretNumber ? "📈 Too High!" : "📉 Too Low!";
displayMessage(guess > secretNumber ? "📈 Too High!" : "📉 Too Low!");
score--;
document.querySelector(".score").textContent = score;
} else {
// document.querySelector(".message").textContent = "💣 You lost the game!";
displayMessage("💣 You lost the game!");
document.querySelector(".score").textContent = 0;
}
}

// //when guess is too high
// else if (guess > secretNumber) {
// if (score > 1) {
// document.querySelector(".message").textContent = "📈 Too High!";
// score--;
// document.querySelector(".score").textContent = score;
// } else {
// document.querySelector(".message").textContent = "💣 You lost the game!";
// document.querySelector(".score").textContent = 0;
// }
// }

// //when guess is too low
// else if (guess < secretNumber) {
// if (score > 1) {
// document.querySelector(".message").textContent = "📉 Too Low!";
// score--;
// document.querySelector(".score").textContent = score;
// } else {
// document.querySelector(".message").textContent = "💣 You lost the game!";
// document.querySelector(".score").textContent = 0;
// }
// }
});

///////////////////////////////////////
// Coding Challenge #1

/*
Implement a game rest functionality, so that the player can make a new guess! Here is how:

1. Select the element with the 'again' class and attach a click event handler
2. In the handler function, restore initial values of the score and secretNumber variables
3. Restore the initial conditions of the message, number, score and guess input field
4. Also restore the original background color (#222) and number width (15rem)

GOOD LUCK 😀
*/

document.querySelector(".again").addEventListener("click", function () {
score = 20;
secretNumber = Math.trunc(Math.random() * 20) + 1;
console.log("Secret Number Again", secretNumber);
// document.querySelector(".message").textContent = "Start guessing...";
displayMessage("Start guessing...");
document.querySelector(".score").textContent = score;
document.querySelector(".number").textContent = "?";
document.querySelector(".guess").value = "";
document.querySelector("body").style.backgroundColor = "#222";
document.querySelector(".number").style.width = "15rem";
});
Loading