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 .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ let yourVariableHere = readline.question("Enter your name: ")

Replace the link below with the link to your Trello project:

[Trello](https://trello.com/b/vbKtMOKj/text-based-adventure-project-plan)
[Trello](https://trello.com/b/dind6477/text-base-advent)


## Rubric
Expand Down
61 changes: 61 additions & 0 deletions miniGolf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const readlineSync = require('readline-sync')


function startGolf()
// welcome to the game
{ const nameInput = readlineSync.question('Hello, what is your name ? \n')
console.log(`Hi ${nameInput}, welcome to miniGolf. \n`)


if(readlineSync.keyInYN('Would you like to play miniGolf ?\n')) {
play()
}
else {
leaveGolf()
}

console.log('Okay then, from the back 9th let\'s get started. \n\n', 'miniGolf - Rules: \n\n', 'The virtual miniGolf course has 9 marked holes that are numbered. \n', 'Players must complete each hole in number order without skipping any hole. \n', 'Players hit the golf ball from the tee area and straight into the hole. \n', 'The objective is to make it into each hole in as few strokes as possible. \n\n', 'The game begins\, The maximum number of strokes per hole is 6. \n', 'If the 6-stroke fails\, the player receives one penalty stroke and scores 7 in the scorecard. \n\n')
console.log(' Scoring Terms What It Means \n', 'Ace Hole in one (One point) \n', 'Albatross/double eagle Three strokes under par on a hole (Two points) \n', 'Eagle Two strokes under par on a hole. (Three points) \n', 'Birdie One stroke under par on a hole. (Four points) \n', 'Par Score a good player would expect to make on a hole or round. (Five Points) \n', 'Bogey One stroke over par on a hole. (Six points) \n', 'Double bogey Two strokes over par on a hole (Seven points) \n\n')


if(readlineSync.keyInYN('Now that you know the rules, are you ready to play ? \n')) {
play()
}

else {
leaveGolf()
}



}

const leaveGolf = () => {
console.log('Oh well, thanks from MiniGolf, come back soon. \n')
process.exit()
}
//player swings
// ramdom number from 1 - 7
// use switch func.
// func if randNum = 1 go to next hole (console.log ("") )
// swing again =
// else if randNum < 7 && ! > 7
// swing again add sum of num

const play = () => {
}
//let hole1 = ''
//let swing = ''
//const play = () => {
//if(readlineSync.keyInYN('? \n'))





play()



startGolf()

19 changes: 18 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 59 additions & 3 deletions textBasedAdventure.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
const readline1 = require('readline-sync')
const readlineSync = require('readline-sync')

let nameInput = readline.question("Enter your name: ")

console.log(`Hello ${nameInput}! Welcome to my game.`)
function startGolf()
// welcome to the game
{ const nameInput = readlineSync.question('Hello, what is your name ? \n')
console.log(`Hi ${nameInput}, welcome to miniGolf. \n`)


if(readlineSync.keyInYN('Would you like to play miniGolf ?\n')) {
play()
}
else {
leaveGolf()
}

console.log('Okay then, from the back 9th let\'s get started. \n\n', 'miniGolf - Rules: \n\n', 'The virtual miniGolf course has 9 marked holes that are numbered. \n', 'Players must complete each hole in number order without skipping any hole. \n', 'Players hit the golf ball from the tee area and straight into the hole. \n', 'The objective is to make it into each hole in as few strokes as possible. \n\n', 'The game begins\, The maximum number of strokes per hole is 6. \n', 'If the 6-stroke fails\, the player receives one penalty stroke and scores 7 in the scorecard. \n\n')
console.log(' Scoring Terms What It Means \n', 'Ace Hole in one (One point) \n', 'Albatross/double eagle Three strokes under par on a hole (Two points) \n', 'Eagle Two strokes under par on a hole. (Three points) \n', 'Birdie One stroke under par on a hole. (Four points) \n', 'Par Score a good player would expect to make on a hole or round. (Five Points) \n', 'Bogey One stroke over par on a hole. (Six points) \n', 'Double bogey Two strokes over par on a hole (Seven points) \n\n')


if(readlineSync.keyInYN('Now that you know the rules, are you ready to play ? \n')) {
play()
}

else {
leaveGolf()
}



}

const leaveGolf = () => {
console.log('Oh well, thanks from MiniGolf, come back soon. \n')
process.exit()
}
//player swings
// ramdom number from 1 - 7
// use switch func.
// func if randNum = 1 go to next hole (console.log ("") )
// swing again =
// else if randNum < 7 && ! > 7
// swing again add sum of num

const play = () => {
}
//let hole1 = ''
//let swing = ''
//const play = () => {
//if(readlineSync.keyInYN('? \n'))





play()



startGolf()