@nickfernandez/

OvalLargeRuntimeenvironment

Python

No description

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
import replit
import random
import time
replit.clear()

width = 30
height = 10
screen = []
ground = []
loops = 100
percentage = 1

def init():
  for i in range(height):
    row = []
    for j in range(width):
        row.append(" ")
    screen.append(row)

def run():
  global percentage 
  if(random.randrange(40) < 1):
    percentage += 1

  replit.clear();
  draw()
  loop()

def loop():
  ground.clear()
  bottom = screen.pop();
  for s in bottom:
    if(s == '*'):
      ground.append('_')
    else:
      ground.append(' ')

  row = []
  for i in range(width):
    if(random.randrange(200) < percentage):
      row.append("*")
    else:
      row.append(" ")
  screen.insert(0, row);

def draw():
  print("%: ", percentage)
  for row in screen:
    print(*row)

  print(*ground)

def main():
  init()
  
  for i in range(loops):
    run();
    time.sleep(1/4)
  


main();