We have played Rock, Paper, Scissors, but have you played Rock, Paper, Scissors, Lizard, Spock!!! This is the infamous game brought to popularity with the TV show The Big Bang Theory.
Here I have written a rock_paper_scissors_lizard_spock.cpp
program that:
- Prompts the user to select either Rock, Paper, Scissors, Lizard, or Spock.
- Instructs the computer to randomly select either Rock, Paper, Scissors, Lizard, or Spock.
- Compares the user’s choice and the computer’s choice and determine the winner.
- Informs the user who the winner is.
Note from the creator, Sam Kass:
"I invented this game (with Karen Bryla) because it seems like when you know someone well enough, 75-80% of any Rock Paper Scissors games you play with that person end up in a tie. Well, here is a slight variation that reduces that probability. This version is also nice because it satisfies the Law of Fives."
Lets get acquainted with the game logic:
- Scissors cuts Paper.
- Paper covers Rock.
- Rock crushes Lizard.
- Lizard poisons Spock.
- Spock smashes Scissors.
- Scissors decapitate Lizard.
- Lizard eats Paper.
- Paper disproves Spock.
- Spock vaporizes Rock.
- (and as it always has) Rock crushes Scissors.
- It’s game time! And by that here is a project where I've built a game: UFO.
The premise:
Invaders from outer space have arrived and are abducting humans using tractor beams. Players must crack the codeword to stop the abduction!
Ok, it’s quite a bit like that classic game, “Hangman”, but with a better premise. Plus, building this command-line game was part of a Software Engineer Internship Backend Programming Challenge!
“A thousand years or more ago,
When I was newly sewn,
There lived four wizards of renown,
Whose names are still well known.”
The Hogwarts School of Witchcraft and Wizardry welcomes everyone! First-year students must go through the annual Sorting Ceremony. The Sorting Hat is a talking hat at Hogwarts that magically determines which of the four school Houses each new student belongs most to:
gryffindor
hufflepuff
ravenclaw
slytherin
Here I have written a sortinghat.cpp
program that asks the user some questions and places them into one of the four Houses based on their answers!
- Takes a phrase like "turpentine and turtles" and translate it into its “whale talk” equivalent, "uueeieeauuee".
There are a few simple rules I maintained for translating text to whale language:
There are no consonants. Only vowels excluding the letter y.
The u‘s and e‘s are extra long, so they are doubled.
Once converting text to the whale language is done, the result is sung slowly, as is custom in the ocean.
Here I have written a whale.cpp
program that accomplishes this translation.
Here I have written a leap_year.cpp
program that:
- Takes a year as input.
- Checks to see if the year is a four-digit number.
- Displays whether or not the year falls on a leap year.
There are 3 criteria that have been taken into account to identify a leap year:
- If the year can be evenly divided by 4 then it is a leap year, however…
- If that year can be evenly divided by 100, and it is not evenly divided by 400, then it is NOT a leap year.
- If that year is evenly divisible by 400, then it is a leap year.
The Magic 8-Ball is a super popular toy used for fortune-telling or seeking advice, developed in the 1950s!
Here I have written a magic8.cpp
program that will output a random fortune each time it executes. The answers inside a standard Magic 8-Ball are:
- It is certain.
- It is decidedly so.
- Without a doubt.
- Yes - definitely.
- You may rely on it.
- As I see it, yes.
- Most likely.
- Outlook good.
- Yes.
- Signs point to yes.
- Reply hazy, try again.
- Ask again later.
- Better not tell you now.
- Cannot predict now.
- Concentrate and ask again.
- Don't count on it.
- My reply is no.
- My sources say no.
- Outlook not so good.
- Very doubtful.
For example:
MAGIC 8-BALL:
It is decidedly so.
Or:
MAGIC 8-BALL:
Very doubtful.
"How old is your fuzzy friend in human years?" Dogs mature at a faster rate than human beings. Every dog owner might’ve heard this rule: one year for Snoopy equals seven years for human. Turns out, the math isn’t that simple. Dogs mature more quickly than we do early on. Here’s how to convert your dog’s age into human years:
The first two years of a dog’s life count as 21 human years. Each following year counts as 4 human years. So a one-year-old dog is 10.5 years old in human years, and a two-year-old dog is 21 years old in human years.
- I have written a C++ program called
dog_years.cpp
that take dogs age data from user and calculate the age, in human years, of any dog older than TWO=2.
Little Mac is an interplanetary space boxer, who is trying to win championship belts for various weight categories on other planets within the solar system.
Here is a space.cpp
program that helps him keep track of his target weight by:
- It will ask him what his earth weight is.
- Ask him to enter a number for the planet he wants to fight on.
- It will then compute his weight on the destination planet.
No. | Planets | Relative Gravity |
---|---|---|
1 | Mercury | 0.38 |
2 | Venus | 0.91 |
3 | Mars | 0.38 |
4 | Jupiter | 2.34 |
5 | Saturn | 1.06 |
6 | Uranus | 0.92 |
7 | Neptune | 1.19 |
Fizz Buzz is a classic developer interview question that is asked or referred to so often for so long, it is almost a cliché! It is designed to weed out 99.5% programming job candidates who cannot creatively use their coding knowledge to solve simple problems.
- Here I have written a
fizzbuzz.cpp
program that outputs numbers from 1 to 100. - But for multiples of 3, print Fizz instead of the number
- For the multiples of 5, print Buzz.
- For numbers which are multiples of both 3 and 5 print, FizzBuzz.
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
As the inventor of this challenge, Imran Ghory, states:
"After a fair bit of trial and error I’ve come to discover that people who struggle to code
don’t just struggle on big problems, or even smallish problems. They struggle with tiny problems. So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play in schools in the UK.”
A traveller just returned from a trip from South America. The countries he visited were Colombia, Brazil, and Peru. He arrived back in the country with some foreign currencies from these three countries.
- Here is a C++ program called
currency.cpp
that prompts the user for the amount of each foreign currency. The prompts should look like:
Enter number of Colombian Pesos:
Enter number of Brazilian Reais:
Enter number of Peruvian Soles:
- The program then converts the amount entered by the user and display the total amount of USD. The final output should look like:
US Dollars = $______
In algebra, a quadratic equation is an equation having the form:
The corresponding x values are the x-intercepts of the graph, while a, b, and c are constants.
- Here I have written a C++ program called
quadratic.cpp
that solves the quadratic equation for the x‘s:
A new match-making service: The Object of Your Affection or OOYA for short, I have built a pretty well-organized system of dating profiles.
- The Profile stores the following information:
User’s name
User’s age
User’s city
User’s country
User’s pronouns
User’s hobbies
And this is how users should be able to interact with their own profiles:
- Create a new profile with some information
- Add hobbies
- View profile