repl.it
@HarveyH/

MULTI MATHS

Python 2.7

A fun multiplayer maths game that gets harder the more answers you get right!

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
bgreen = '\033[1;32m' # bold green
byellow = '\033[1;33m' # bold yellow
bred = '\033[1;31m' # bold red
bblue = '\033[1;34m' # bold blue
bpink = '\033[1;35m' # bold pink
bcyan = '\033[1;36m' # bold cyan
bwhite = '\033[1;37m' # bold white
bold = '\033[1;39m' # bold regular writing
bblack = '\033[1;30m' # bold black
bblackbox = '\033[1;40m' # bold black box
bredbox = '\033[1;41m' # bold red box
bgreenbox = '\033[1;42m' # bold green box
byellowbox = '\033[1;43m' # bold yellow box
bbluebox = '\033[1;44m' # bold blue box
bpinkbox = '\033[1;45m' # bold pink box
bcyanbox = '\033[1;46m' # bold cyan box
green = '\033[32m' # green
yellow = '\033[33m' # yellow
red = '\033[31m' # red
blue = '\033[34m' # blue
pink = '\033[35m' # pink
cyan = '\033[36m' # cyan
white = '\033[37m' # white
black = '\033[30m' # black
blackbox = '\033[40m' # black box
redbox = '\033[41m' # red box
greenbox = '\033[42m' # green box
yellowbox = '\033[43m' # yellow box
bluebox = '\033[44m' # blue box
pinkbox = '\033[45m' # pink box
cyanbox = '\033[46m' # cyan box
custom = '\033[5m' # to customize, change the '00' bit
bcustom = '\033[36;6m' # same as custom but you can also change the '31' bit. If you change the '31' bit to 1, it will be bold.
bcustom2 = '\033[32;6m'

X = '\033[0m' # reset

import time
import random

gamestop = False
points1 = 0
points2 = 0
highscore = 0
random1 = 0
random2 = 2

print('{}Version 1.0.0{}'.format(bcustom, X))
print("")
time.sleep(2)
print('{}A maths multiplayer game...{}'.format(bcustom, X))
time.sleep(2)
print("")
print('{}Made by repl user HarveyH or Youtuber TheDimensionBoy Gaming...{}'.format(bcustom, X))
time.sleep(2)
print("")
time.sleep(2)
print('{}MULTI MATHS!{}'.format(bcustom, X))

while True:
	print("")
	print("Your highscore is... " + str(highscore))
	print("")
	print('Game starts in 3... ')
	time.sleep(2)
	print("")
	print('2... ')
	time.sleep(2)
	print("")
	print('1... ')
	time.sleep(2)
	print("")
	print('{}GO!{}'.format(bpink, X))
	time.sleep(1)
	print("")
	print("{}Player One's Turn!{}".format(bblue, X))
	time.sleep(1)
	while gamestop == False:
		print("")
		random1a = random.randint(random1, random2)
		random2a = random.randint(random1, random2)
		answer1 = random1a + random2a
		p1 = int(raw_input("What is " + str(random1a) + " + " + str(random2a) + "?"))
		if p1 == answer1:
			random1 -= 1
			random2 += 1
			points1 += 1
			continue
		elif p1 != answer1:
			print("")
			print('{}You got the question wrong... {}'.format(bred, X))
			print("")
			print("{}Player Two's Turn!{}".format(byellow, X))
			random1 = 0
			random2 = 2
			if points1 > highscore:
				highscore = points1
			gamestop = True
	while gamestop == True:
		print("")
		random1b = random.randint(random1, random2)
		random2b = random.randint(random1, random2)
		answer2 = random1b + random2b
		p2 = int(raw_input("What is " + str(random1b) + " + " + str(random2b) + "?"))
		if p2 == answer2:
			random1 -= 1
			random2 += 1
			points2 += 1
			continue
		elif p2 != answer2:
			print("")
			print('{}You got the question wrong... {}'.format(bred, X))
			random1 = 0
			random2 = 2
			if points1 > highscore:
				highscore = points1
			if points2 > highscore:
				highscore = points2
		if points1 > points2:
			print("")
			print("Player One got " + str(points1) + " points and Player Two got " + str(points2) + " points...")
			print("")
			time.sleep(2)
			print('{}Player One wins!{}'.format(bcustom2, X))
			gamestop = False
			points1 = 0
			points2 = 0
			continue
		if points2 > points1:
			print("")
			print("Player One got " + str(points1) + " points and Player Two got " + str(points2) + " points...")
			print("")
			time.sleep(2)
			print('{}Player Two wins!{}'.format(bcustom2, X))
			gamestop = False
			points1 = 0
			points2 = 0
			continue
		if points1 == points2:
			print("")
			print("Player One got " + str(points1) + " points and Player Two got " + str(points2) + " points...")
			print("")
			time.sleep(2)
			print("{}It's a tie!{}".format(bcustom2, X))
			gamestop = False
			points1 = 0
			points2 = 0
			continue