Skip to content

Commit

Permalink
Added Shakespeare
Browse files Browse the repository at this point in the history
  • Loading branch information
yuelvic committed Oct 8, 2018
1 parent 876463f commit c196b47
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 121 deletions.
30 changes: 14 additions & 16 deletions C++/factorial.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#include<bits/stdc++.h>

#include<iostream>
using namespace std;

map<int,int> f;

int fact(int n){

if(n==1 || n==0)
return 1;
else if(f[n])
return f[n];
else
return f[n]=n*fact(n-1);
int factorial(int n)
{
if(n==1 || n==0)
return 1;
else
return n*factorial(n-1);
}

int main(){
cout<<fact(5);
int main()
{
int n;
cout << "Enter a positive integer: ";
cin >> n;
cout << "Factorial of " << n << " = " << factorial(n)<<endl;
return 0;
}
23 changes: 8 additions & 15 deletions C++/hello world.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
#include<iostream>
using namespace std;
class Message
{
public:
void display() {
cout << "Hello World\n";
}
};
int main()
{
Message c;
c.display();
return 0;
}
#include <iostream>
using namespace std;

int main()
{
cout << "Hello, World!";
return 0;
}
5 changes: 2 additions & 3 deletions Golang/helloworld.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import "fmt"

// this is a comment
import "fmt"

func main() {
fmt.Println("Hello World")
fmt.Println("Hey, Hello Go. I started learning you")
}
11 changes: 8 additions & 3 deletions Html/helloworld.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<!--Creating a webpage that displays 'Hello World' in webpage-->

<!DOCTYPE html>
<html>
<header>
<title>Halo Dunia</title>
<title>Hello World!</title>
</header>

<body>
<h1><B><U><I>Halo Dunia!</body>
<h1><B><U><I>Hello World!</I></U></B></h1>
<bg>orange</bg>
</body>

<footer>
<p> Hacktoberfest 2018 </p>
</footer>
</html>
2 changes: 1 addition & 1 deletion Python/helloworld.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
print("Hello World");
print("Hello World")
127 changes: 44 additions & 83 deletions Python/rockpaperscissors.py
Original file line number Diff line number Diff line change
@@ -1,83 +1,44 @@
# Simple console rock paper scissors game,
# If you want to play it you can paste this code to a site like
# https://www.onlinegdb.com/online_python_compiler

import random
from time import sleep

choices = [
'rock',
'paper',
'scissors',
]

def get_input():
valid = False
while valid == False:
global player_choice
player_choice = str(input('Rock paper or scissors?: ')).lower()
if player_choice == 'rock' or player_choice == "paper" or player_choice == "scissors":
valid = True
else:
print('Please choose a valid option. Rock, paper and scissors only')

def again():
sleep(0.5)
again = str(input("Do you want to play again (y/n) ?: "))
if again == 'y':
get_result()
elif again == 'n':
return
else:
print("You can only respon with 'y' or 'n'")

def loss():
msg = """
You lost.
The computer chose {}
"""
print(msg.format(computer_choice))
again()
def win():
msg = """
You won!
The computer chose {}
"""
print(msg.format(computer_choice))
again()
def draw():
msg = """
It's a draw.
The computer chose {}
"""
print(msg.format(computer_choice))
again()

def get_result():
get_input()
global computer_choice
computer_choice = random.choice(choices)
if player_choice == 'rock':
if computer_choice == 'rock':
draw()
elif computer_choice == 'paper':
loss()
else:
win()
elif player_choice == 'paper':
if computer_choice == 'rock':
win()
elif computer_choice == 'paper':
draw()
else:
loss()
elif player_choice == 'scissors':
if computer_choice == 'rock':
loss()
elif computer_choice == 'paper':
win()
else:
draw()

get_result()

import random

r = "rock"
p = "paper"
s = "scissors"

choices = [r, p, s]

win = False

player = input("Enter 'rock', 'paper', or 'scissors': ")

if player not in choices:
print("invalid input")

else:

robot = choices[random.randint(0,2)] # pick a random element from choices[]

# rock beats scissors, paper beats rock, scissors beats paper

if player == r:
if robot == s:
win = True
if player == p:
if robot == r:
win = True
if player == s:
if robot == p:
win = True
if player == robot:
win = None

# print end screen

print("You picked " + player)
print("I picked " + robot)
if win:
print("You win >:(")
elif win == None:
print("Draw")
else:
print("YOU LOSE!!!!!!")
print("MUAHAHAHAAHAH")
88 changes: 88 additions & 0 deletions Shakespeare/hello.spl
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.


Act I: Hamlet's insults and flattery.

Scene I: The insulting of Romeo.

[Enter Hamlet and Romeo]

Hamlet:
You lying stupid fatherless big smelly half-witted coward!
You are as stupid as the difference between a handsome rich brave
hero and thyself! Speak your mind!

You are as brave as the sum of your fat little stuffed misused dusty
old rotten codpiece and a beautiful fair warm peaceful sunny summer's
day. You are as healthy as the difference between the sum of the
sweetest reddest rose and my father and yourself! Speak your mind!

You are as cowardly as the sum of yourself and the difference
between a big mighty proud kingdom and a horse. Speak your mind.

Speak your mind!

[Exit Romeo]

Scene II: The praising of Juliet.

[Enter Juliet]

Hamlet:
Thou art as sweet as the sum of the sum of Romeo and his horse and his
black cat! Speak thy mind!

[Exit Juliet]

Scene III: The praising of Ophelia.

[Enter Ophelia]

Hamlet:
Thou art as lovely as the product of a large rural town and my amazing
bottomless embroidered purse. Speak thy mind!

Thou art as loving as the product of the bluest clearest sweetest sky
and the sum of a squirrel and a white horse. Thou art as beautiful as
the difference between Juliet and thyself. Speak thy mind!

[Exeunt Ophelia and Hamlet]


Act II: Behind Hamlet's back.

Scene I: Romeo and Juliet's conversation.

[Enter Romeo and Juliet]

Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!

Juliet:
Speak YOUR mind! You are as bad as Hamlet! You are as small as the
difference between the square of the difference between my little pony
and your big hairy hound and the cube of your sorry little
codpiece. Speak your mind!

[Exit Romeo]

Scene II: Juliet and Ophelia's conversation.

[Enter Ophelia]

Juliet:
Thou art as good as the quotient between Romeo and the sum of a small
furry animal and a leech. Speak your mind!

Ophelia:
Thou art as disgusting as the quotient between Romeo and twice the
difference between a mistletoe and an oozing infected blister! Speak
your mind!

[Exeunt]

0 comments on commit c196b47

Please sign in to comment.