Skip to content

Commit 6ee596d

Browse files
author
Kuba
authored
Merge pull request #1 from Ehkso/Ehkso-Submissions
Ehkso submissions
2 parents 569a96b + a37b8cd commit 6ee596d

File tree

3 files changed

+195
-0
lines changed

3 files changed

+195
-0
lines changed

Diff for: age_calculator/Ehkso/ageinsecs.c

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <math.h>
4+
5+
int main(void){
6+
double years = 0;
7+
double secs = 0; // U have no secs lol
8+
double bils=0,mils=0,thous=0;
9+
10+
printf("How old are you (in years)? \n"); // the tin
11+
scanf("%lf", &years);
12+
//printf("%lf", years); // Just checking
13+
secs = (years * 365.2425) * 86400; // A day has 86400, Gregorian calendar says 365.2425 days/year
14+
printf("That's ");
15+
if (secs >= 1000000000){
16+
bils = floor(secs / 1000000000);
17+
printf("%.0lf billion, ", bils);
18+
secs -= bils * 1000000000;
19+
}
20+
if (secs >= 1000000){
21+
mils = floor(secs / 1000000);
22+
printf("%.0lf million, ", mils);
23+
secs -= mils * 1000000;
24+
}
25+
if (secs >= 1000){
26+
thous = floor(secs / 1000);
27+
printf("%.0lf thousand, and ", thous);
28+
secs -= thous * 1000;
29+
}
30+
printf("%.0lf second(s). And counting.", secs);
31+
}

Diff for: integer_to_roman/Ehkso/romnum.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
while True: # Continues until program is ended
2+
arab = int(input("Please enter a number from 1-3999 (inclusive), or 0 to end: ")) # Arabic numerals aka what we usually use
3+
while (arab > 3999) or (arab < 0): # There are symbols for bigger numbers but they require a line above the character
4+
print("Invalid input.");
5+
arab = int(input("Please enter a number between 1 and 3999, or 0 to end: "))
6+
if (arab == 0):
7+
break
8+
else:
9+
while (arab > 0):
10+
if (arab >= 1000):
11+
print("M", end="")
12+
arab -= 1000
13+
elif (arab >= 900):
14+
print("CM", end="")
15+
arab -= 900
16+
elif (arab >= 500):
17+
print("D", end="")
18+
arab -= 500
19+
elif (arab >= 400):
20+
print("CD", end="")
21+
arab -= 400
22+
elif (arab >= 100):
23+
print("C", end="")
24+
arab -= 100
25+
elif (arab >= 90):
26+
print("XC", end="")
27+
arab -= 90
28+
elif (arab >= 50):
29+
print("L", end="")
30+
arab -= 50
31+
elif (arab >= 40):
32+
print("XL", end="")
33+
arab -= 40
34+
elif (arab >= 10):
35+
print("X", end="")
36+
arab -= 10
37+
elif (arab == 9):
38+
print("IX", end="")# For 9 and 4 you finish immediately so technically you don't need the 'end=""'
39+
arab -= 9
40+
elif (arab >= 5):
41+
print("V", end="")
42+
arab -= 5
43+
elif (arab == 4):
44+
print("IV", end = "")# but I do it anyway for continuity
45+
arab -= 4
46+
else:
47+
print("I", end="")
48+
arab -= 1
49+
print("\n")
50+
#print(arab) Should be 0 at end, just making sure I didn't leave anything out
51+
print("End.")
52+
# M - 1000 | D - 500 | C - 100 | L - 50 | X - 10 | V - 5 | I - 1

Diff for: magic_eight_ball/Ehkso/8ball.py

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Submission for the Magic 8-ball challenge, July 6th 2022
2+
# - Ehkso
3+
4+
5+
import random # Random Responses
6+
import time # Waiting
7+
import os # Clearing screen
8+
# Neither the time nor the os libraries are acutally necessary, however I use them to make my program pretty
9+
10+
#https://magic-8ball.com/magic-8-ball-answers/
11+
# List of 8 ball answers for reference, I just took all the possible responses and wrote them into a list
12+
# I alternated Affirmative/Noncommital/Negative, but due to the 8-ball having 20 responses in a 2:1:1 (10-5-5)
13+
# split, the list has 5 consecutive affirmative answers at the end.
14+
15+
response = ["It is certain", "Reply hazy, try again", "Don't count on it", "It is decidedly so", "Ask again later",
16+
"My reply is no", "Without a doubt", "Better not tell you now", "My sources say no", "Yes definitely",
17+
"Cannot predict now", "Outlook not so good", "You may rely on it", "Concentrate and ask again",
18+
"Very doubtful", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes"]
19+
20+
def eb(num): # My 8-ball function, just makes the triangle flip to simulate the ball shaking and "thinking"
21+
if (num == 0):
22+
print("::::::::::::::::::::::::::::::::::::::::")# 40 (counting just for myself)
23+
print("::::::::::::::::::::::::::::::::::::::::")
24+
print("::::::::::::::::ooooooo:::::::::::::::::")
25+
print("::::::::::::::oo % oo:::::::::::::::")
26+
print("::::::::::::oo %%% oo:::::::::::::")
27+
print(":::::::::::o %%%%% o::::::::::::")
28+
print(":::::::::::o %%%%%%% o::::::::::::")
29+
print(":::::::::::o %%%%%%%%% o::::::::::::")
30+
print("::::::::::::o%%%%%%%%%%%%%o:::::::::::::")
31+
print("::::::::::::::oo oo:::::::::::::::")
32+
print("::::::::::::::::ooooooo:::::::::::::::::")
33+
print("::::::::::::::::::::::::::::::::::::::::")
34+
print("::::::::::::::::::::::::::::::::::::::::")
35+
elif (num == 1) or (num == 3):
36+
print("::::::::::::::::::::::::::::::::::::::::")
37+
print("::::::::::::::::::::::::::::::::::::::::")
38+
print("::::::::::::::::ooooooo:::::::::::::::::")
39+
print("::::::::::::::oo oo:::::::::::::::")
40+
print("::::::::::::oo oo:::::::::::::")
41+
print(":::::::::::o o::::::::::::")
42+
print(":::::::::::o o::::::::::::")
43+
print(":::::::::::o o::::::::::::")
44+
print("::::::::::::o o:::::::::::::")
45+
print("::::::::::::::oo oo:::::::::::::::")
46+
print("::::::::::::::::ooooooo:::::::::::::::::")
47+
print("::::::::::::::::::::::::::::::::::::::::")
48+
print("::::::::::::::::::::::::::::::::::::::::")
49+
elif (num == 2):
50+
print("::::::::::::::::::::::::::::::::::::::::")
51+
print("::::::::::::::::::::::::::::::::::::::::")
52+
print("::::::::::::::::ooooooo:::::::::::::::::")
53+
print("::::::::::::::oo oo:::::::::::::::")
54+
print("::::::::::::oo%%%%%%%%%%%oo:::::::::::::")
55+
print(":::::::::::o %%%%%%%%% o::::::::::::")
56+
print(":::::::::::o %%%%%%% o::::::::::::")
57+
print(":::::::::::o %%%%% o::::::::::::")
58+
print("::::::::::::o %%% o:::::::::::::")
59+
print("::::::::::::::oo % oo:::::::::::::::")
60+
print("::::::::::::::::ooooooo:::::::::::::::::")
61+
print("::::::::::::::::::::::::::::::::::::::::")
62+
print("::::::::::::::::::::::::::::::::::::::::")
63+
elif (num == 4): # Magic 8-ball is watching you
64+
print("::::::::::::::::::::::::::::::::::::::::")
65+
print("::::::::::::::::::::::::::::::::::::::::")
66+
print("::::::::::::::::ooooooo:::::::::::::::::")
67+
print("::::::::::::::oo % oo:::::::::::::::")
68+
print("::::::::::::oo %%% oo:::::::::::::")
69+
print(":::::::::::o %% %% o::::::::::::")
70+
print(":::::::::::o %% o %% o::::::::::::") # pranked
71+
print(":::::::::::o %% %% o::::::::::::")
72+
print("::::::::::::o %%% o:::::::::::::")
73+
print("::::::::::::::oo % oo:::::::::::::::")
74+
print("::::::::::::::::ooooooo:::::::::::::::::")
75+
print("::::::::::::::::::::::::::::::::::::::::")
76+
print("::::::::::::::::::::::::::::::::::::::::")
77+
78+
fin = 0 # Checks if the while loop should 'finish', basically an empty variable though since I just
79+
first = 1 # Just checks if it's the first question, not really important but once again just a nicety.
80+
while fin != 1:
81+
os.system("cls") # Clears screen
82+
eb(0)
83+
print("") # I do these instead of beginning a sentence with a newline because I want to.
84+
if (first == 1): # Yeah that's all I used it for lol, I could've done fin and first as one variable but for clarity
85+
inp = input("Ask your question: ")
86+
else: # Because I'd be looking at something else while the ball spins and then miss the prediction
87+
print("Previous question: " + inp)
88+
print("Previous answer: " + response[rnum-1] + "\n")
89+
inp = input("Ask your question, or say 'Thank you 8' to exit.\n\n")
90+
91+
if (inp == "Thank you 8"): # Exit clause
92+
fin = 1
93+
else: # Do the stuff
94+
rnum = random.randint(1, 21)
95+
for i in range(1, (rnum * 5)): # Cycles 8-ball, range can be whatever but I like the idea of it possibly taking longer for a different answer
96+
for j in range(0,4): # Counts 0-3 inclusive
97+
os.system("cls")
98+
eb(j)
99+
print("\n" + inp)
100+
print("\nPondering...")
101+
#print(rnum) # Troubleshooting, to cross reference with list to make sure
102+
time.sleep(0.1) # Adjustable, I feel like this is fast enough but you can always shorten it
103+
104+
os.system("cls")
105+
eb(2)
106+
print("\n" + inp + "\n\n" + response[rnum-1])
107+
time.sleep(5)
108+
first = 0 # No longer the first question after this
109+
110+
os.system("cls")
111+
eb(4) # spoopy prenk
112+
print("\nEnd.")

0 commit comments

Comments
 (0)