repl.it
@AlexTerm/

Blindle Beta

Python

No description

fork
loading
Files
  • main.py
  • coins.py
  • passwords.py
  • usernames.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import time
import random
from passwords import *
from usernames import *
counter = 0
LoggedInput1 = ""
#Made by AlexTerm

with open("usernames.py", 'r') as f:
   for line in f:
       counter += 1


print('Current Number of Existing Users is ' + str(counter))

UserNo = counter + 1

Numbers = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20']

PlNo1 = 0
PlNo2 = 0
PlMys = 0
PlSum = 0
######
AINo1 = 0
AINo2 = 0
AINo3 = 0
AISum = 0
######
GameBet = 0
GameInput = ""
######
Winnings = 0
######
username = open("usernames.py","a+")
password = open("passwords.py","a+")
coins = open("coins.py","a+")

readingusername = open("usernames.py")
readingpassword = open("passwords.py")
readingcoins = open("coins.py")
######
CoinsAmount = 0
ExistMinusOne = 1
######
def wait(a):
  time.sleep(a)

#(random.choice(Numbers))
def Play():
  print("")
  #WholeLineCoins = readingcoins.readlines()
  #StringedLineCoins = (WholeLineCoins[ExistMinusOne])
  print(CoinsAmount)
  #CoinsAmount = StringedLineCoins[9:]
  print('Loading...')
  wait(3)
  print("")
  print("Welcome to Blindle")
  wait(1)
  PlNo1 = (random.choice(Numbers))
  PlNo2 = (random.choice(Numbers))
  PlMys = (random.choice(Numbers))
  #print(PlNo1, PlNo2, PlMys)
  PlSum = (int(PlNo1) + int(PlNo2) + int(PlMys))
  #print(PlSum)
  ######
  AINo1 = (random.choice(Numbers))
  AINo2 = (random.choice(Numbers))
  AINo3 = (random.choice(Numbers))
  AISum = (AINo1 + AINo2 + AINo3)
  #print(AINo1, AINo2, AINo3)
  #print(AISum)
  print('How many coins will you bet? [Higher than or equal to 10]')
  GameBet = input('>')
  print(GameBet)
  print(CoinsAmount)
  if float(GameBet) > float(CoinsAmount):
    print('Error: Entered number too high.')
  elif float(GameBet) <= 10.0:
    print("Error: Less than 10")
  else:
    GameBet150 = float(GameBet) * (1.5)
    Winnings = float(CoinsAmount) + float(GameBet150)
    StoredMinus = StoredCoinsAmount - GameBet
    StoredPlus = Winnings
    if float(GameBet) >= 10.0:
      print('')
      print("Your numbers:")
      print("Number 1: " + str(PlNo1))
      print("Number 2: " + str(PlNo2))
      print("Number 3: ???")
      print('')
      print("My numbers:")
      print("Number 1: " + str(AINo1))
      print("Number 2: " + str(AINo2))
      print("Number 3: " + str(AINo3))
      print()
      print('What is your input?')
      print("[Fold = Higher Sum, Play = Lower or Equal Sum")
      GameInput = input(">")
      if str(GameInput) == 'Fold':
        if int(PlSum) > int(AISum):
          print("You won!")
          print("Your third number was: " + PlMys)
          print("")
          
          #this wont work because it is writing and not rewriting, work out a system to read via userno and rewrite that line 
          #VVVVVV
          coins.write('Coins' + str(UserNo) + ' = ' + StoredPlus +'\n')


          print("Now you have " + Winnings)

        elif PlSum <= AISum:
          print("You lost!")
          print("Your third number was: " + PlMys)
      elif GameInput == 'Play':
        if PlSum <= AISum:
          print("You won!")
          print("Your third number was: " + PlMys)
        elif PlSum > AISum:    
          print("You lost!")
          print("Your third number was: " + PlMys)
    else:
      print("ERROR: LESS THAN 10")
#def li1f(a):
  #while True:
    #if LoggedInput1.lower() == "rules":
      #print('Rules:')
      #print('   1. Deposit some coins.')
      #print('   2. If you win, you get 150% of what you deposit')
      #print('   3. If you lose, I take 100% of what you deposit')
      #wait(3)
      #li1f(1)
    #else: #LoggedInput1.lower() == "play"
          #print("That's the end of the Beta!")
          #break

print('Welcome to Blindle!')
wait(1)
print('Do you want to login or register?')
print('Enter:')
print(' R for Register')
print(' L for Login')
Action = input('>')
if Action.lower() == 'r':
  print('Enter your Username:')
  NewUsername = input('>')
  Message = NewUsername
  print('Enter your Password:')
  ConfirmPass1 = input('>')
  print('\n' * 100)
  print('Please Confirm your Password:')
  ConfirmPass2 = input('>')

  if str(ConfirmPass1) == str(ConfirmPass2):
    NewPassword = ConfirmPass1
    Message2 = str(NewPassword)
    print('\n' * 100)
    print('Successfully Registered!')
    wait(1)
    print('\nInfo:')
    print('Username: ' + str(NewUsername))
    print('User Number: #' + str(UserNo))
    print('!!! YOU NEED TO REMEMBER YOUR USER NUMBER !!!')
    NewPassword = ConfirmPass1
    print('Password: ' + str(NewPassword[:1]) + '**********'+ str(NewPassword[-1:]))
    username.write('Username' + str(UserNo) + ' = ' + "'" + str(Message)+ "'" +'\n')
    password.write('Password' + str(UserNo) + ' = ' + "'" + str(Message2) + "'" +'\n')
    coins.write('Coins' + str(UserNo) + ' = ' +  str(1000) +'\n')

  else:
   print('Sorry, but the two passwords are different. Please rerun the program.')
elif Action.lower() == 'l':

  print('Please enter your User Number:')



  #try:
  ExistingUserNo = int(input('> #')) #slice slring down there.
  #except IndexError:
    #print('Error, There is currently no user with this number.')
    
  ExistMinusOne = ExistingUserNo - 1
  
  WholeLine = readingusername.readlines()

  StringedLine = (WholeLine[ExistMinusOne])
 
  MinusLastCharacters = StringedLine[13:]

  ExistingUserName = MinusLastCharacters[:-2]


  print('Is your username '+ str(ExistingUserName) + ' ?')
  print('Enter')
  print(' Y for Yes')
  print(' N for No')
  VerifyNumber = input('>')
  if VerifyNumber.lower() == "y":
    print('Please enter your password for this account:')
    VerifyPass = input('>')

    WholeLinePass = readingpassword.readlines()
    StringedLinePass = (WholeLinePass[ExistMinusOne])
    MinusLastCharactersPass = StringedLinePass[13:]
    ExistingUserPass = MinusLastCharactersPass[:-2]

    if VerifyPass == ExistingUserPass:
      WholeLineCoins = readingcoins.readlines()
      StringedLineCoins = (WholeLineCoins[ExistMinusOne])
      CoinsAmount = StringedLineCoins[9:]
      StoredCoinsAmount = CoinsAmount
      print('\n' * 100)
      print("Blindle")
      print("")
      print('Hello, ' + str(ExistingUserName) + '!')
      print("")
      print('Your User Number is: #' + str(ExistingUserNo))###
      print('You currently have ' + CoinsAmount + ' Coins')
      print('')
      while True:
        if LoggedInput1.lower() == "":
          print("")
          print('Actions:')
          print('> [R]ules/How to Play')
          print('> [P]lay')
          print('> [S]hop')
          print('> [C]redits')
          print('')
          print('Input:')
          LoggedInput1 = input('>')
        #li1f(1)
        elif LoggedInput1.lower() == "[r]" or LoggedInput1.lower() == "r":
          print('\n' * 100)
          print('Rules:')
          print('   1. If you win, you get 150% of what you deposit')
          print('   2. If you lose, I take 100% of what you deposit')
          print("   3. You can't cheat")
          print("")
          print('How to Play:')
          print("   1. Deposit Coins")
          print("   2. I will give you 2 numbers ranging from 1-20. These will be your numbers.")
          print("   3. I will give you another 3 numbers. These will be my numbers.")
          print("   4. There will be a secret number. This can range from 1-20. This will be you 3rd number.")
          print("   5. If your think that the sum of your numbers will be lower than mine, enter 'Play'.")
          print("   6. If your think that the sum of your numbers will be higher than mine, enter 'Fold'.")
          print("   7. The third number is revealed.")
          print("   8. If you have entered Play and the sum is lower, you win.")
          print("   9. If you have entered Fold and the sum is higher, you win.")
          print("   10. If you have entered Play and the sum is lower, you lose.")
          print("   11. If you have entered Fold and the sum is higher, you lose.")
          print('\n' * 10)
          wait(8)  
          LoggedInput1 = "" 
        else: #LoggedInput1.lower() == "p" or LoggedInput1.lower() == "[p]"
          Play()

          print("That's the end of the Beta!")
          break
    elif VerifyPass == 'SadFace':
      print('\t                             ')
      print('\t     |                  |      ')
      print('\t     |                  |      ')
      print('\t                             ')
      print('\t                             ')
      print('\t   _______________________                         ')
      print('\t  /                       \   ')
      print('\t /                         \ ')
    else:
      print('Error, Incorrect Password. :(')
  elif VerifyNumber.lower() == "n":
    print('Sorry, an error occured.')
    print('Please make sure that you entered the right user Number.')
    print('Rerun the program.')

?