-
Notifications
You must be signed in to change notification settings - Fork 0
/
beast_debian.py
1520 lines (1311 loc) · 52.7 KB
/
beast_debian.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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
import curses
from random import randint
from os import system, popen
from time import sleep
import threading
##################################-- starting game statistics
lives = 5 # starting lives
###############################
beast_speed = 1.5 # seconds between enemy moves
monster_speed = 1.1 # seconds between enemy moves
egg_speed = 3 # seconds between countdown
incubate = 3
##################################-- game scoring balance
beast_scr = 2 # points for killing beasts
egg_scr = 4 # points for killing eggs
monster_scr = 6 # points for killing monsters
##################################-- game speed
LCD_TIME = .04
####################################-- move constants
MOVES = {
'U': { 'ra':-1, 'ca':0 }, # ra - "row adjustment"
'D': { 'ra':1, 'ca':0 }, # ca - "column adjustment"
'L': { 'ra':0, 'ca':-1 },
'R': { 'ra':0, 'ca':1 },
'UL': { 'ra':-1, 'ca':-1 },
'UR': { 'ra':-1, 'ca':1 },
'DL': { 'ra':1, 'ca':-1 },
'DR': { 'ra':1, 'ca':1 }
}
KEY_UP = 259
KEY_DOWN = 258
KEY_RIGHT = 261
KEY_LEFT = 260
KEY_P_DOWN = 0
KEY_P_RIGHT = 0
KEY_P_LEFT = 0
KEY_P_UP = 0
mi1_opt = 2
keypress = ''
debug = False
last_frame = 1
timeout = 0
pulling = 'hold' # 'hold / 'tog' / 'swi' / 'sin'
game_play_mode = False
##################################-- formatted character constants
# (ANSI styles) FG + BG + Style + Characters + Reset
BAKGRD = '\033[40m' + ' '
BLOCK = '\033[43m' + ' ' + '\033[0m'
KILLBLOCK = '\033[31m' '\033[43m' + '\033[7m\033[2m' + chr(9618) + chr(9618) + '\033[0m'
BOX = '\033[32m' + '\033[40m' + chr(9618) + chr(9618) + '\033[0m'
XPBOX = '\033[32m' + '\033[40m' + '\033[2m' + chr(9618) + chr(9618) + '\033[0m'
BEAST = '\033[31m' + '\033[40m' + chr(9500) + chr(9508) + '\033[0m'
MONSTER = '\033[31m' + '\033[40m' + chr(9568) + chr(9571) + '\033[0m'
PLAYER = '\033[34m' + '\033[40m' + chr(9664) + chr(9654) + '\033[0m'
# http://wiki.bash-hackers.org/scripting/terminalcodes
eggsub = 8329 # unicode key for subscript 9 (8328 = 8, and so on)
egg2nd = 32 # unicode key for a space character
def EGG(sub):
return '\033[37m\033[40m\033[2m' + chr(11052) + '\033[1m' + chr(sub) + '\033[0m'
def deteggt(chegg):
if (chegg[0:15] == '\033[37m\033[40m\033[2m' + chr(11052)): return True
###################################-- Pawn Classes (Dictionaries)
##################################-- Pawn Lists
# pawn lists dynamically grows and shrink with
beasts = [{
'frames': (int(beast_speed / LCD_TIME)),
'frame':0,
'chr': BEAST,
'pnts': beast_scr
}]
monsters = [{
'frames': (int(monster_speed / LCD_TIME)),
'frame':0,
'chr': MONSTER,
'pnts': monster_scr
}]
eggs = [{
'frames': (int(egg_speed / LCD_TIME)),
'frame':0,
'incu_frames': (int(1 / LCD_TIME)), # incu_frames add up to 1 second
'incu_frame': 0,
'pnts': egg_scr
}]
# 'sub' updated digital unicode reference to subscript character
# 'wait' randomized wait time before hatching countdown
player = [{
'flash_frames': (int(.05 / LCD_TIME) * 2),
'chr': PLAYER,
'pnts': 10
}]
plr_flashes = 5
plr_flash = 0
plr_frames = (int(.05 / LCD_TIME) * 2)
plr_frame = 0
# 'tug'
# 'ro' row
# 'co' col
# 'stg' "stagger" (frame of movement) compared to others
################################################################################################
####################################################################-- level 1 setup --#########
################################################################################################
level = 0 # change in order to start on a specific level
score = 0 # in-game total score
points = 0 # in-game level points added at end of level
################################################################################################
board = [] #########################################################-- board setup --###########
blank_board = [] ###############################################################################
reset_board = [] ###########-- classic board size variables
play_rows = 20 # only change this in-game
play_cols = 40 # only change this in-game
board_rows = play_rows + 2
board_cols = play_cols + 2
######################################-- board dimensions
classic = True
left_margin = 0
top_margin = 0
stat_rows = 3
def plan_the_board(): #{
global save_top, save_left, top_margin, left_margin, board_rows, board_cols, play_rows, play_cols, stat_rows, stat_space, classic, ttyCols, ttyRows
ttyRows, ttyCols = popen('stty size', 'r').read().split()
ttyRows = int(ttyRows)
ttyCols = int(ttyCols)
screen_rows = ttyRows
screen_cols = int(ttyCols / 2)
if (screen_cols < 44) & (ttyRows < 28): classic = False
elif (ttyCols < 60) & (ttyRows < 20):
print('This area is impossibly small')
sleep(3)
system('reset')
else: classic = True
if (classic):
board_rows = play_rows + 2
board_cols = play_cols + 2
top_margin = int((screen_rows - board_rows - stat_rows) / 2)
left_margin = int((ttyCols - board_cols*2) / 2)
else:
stat_space = 0
board_rows = screen_rows - stat_rows - 1
board_cols = screen_cols
top_margin = 0
left_margin = 0
save_top = top_margin # assigned for the debug feature
save_left = left_margin # assigned for the debug feature
stat_space = int((board_cols * 2 - (4 * 14 )) / 5) # calculate this for the print_board function
if stat_space < 0: stat_space = 0
#}
# BUILDS a blank board
def build_the_board(): #{
global board_cols, board_rows
screen_board = []
for rowi in range(board_rows): # builds the board based on 'board_rows' and 'board_cols' which includes room for borders
screen_board.append([])
for coli in range(board_cols):
screen_board[rowi].append([])
screen_board[rowi][coli] = BAKGRD
for rowi in range(board_rows): # draws the game boarders on the board
for coli in range(board_cols):
if(rowi == 0) | (rowi == (board_rows - 1)) | (coli == 0) | (coli == (board_cols - 1)):
screen_board[rowi][coli] = BLOCK
return screen_board
#}
board = build_the_board()
reset_board = build_the_board()
blank_board = build_the_board()
########################################################-- set cursor functions
def set_topleft_ref(top, left):
global top_margin, left_margin
print('\033[?25l\033[' + str(top_margin + top) + ';' + str(left_margin + left) + 'H\033[s\033[0m')
def set_topmid_ref(top, leftkeel):
global top_margin, left_margin, board_cols
print('\033[' + str(top_margin + 1 + top) + ';' + str(left_margin + int(board_cols) - leftkeel) + 'H\033[s\033[0m')
def set_cursor_avoid():
global top_margin, left_margin, board_rows
print('\033[' + str(top_margin + board_rows) + ';0H\033[0m\033[30m')
######################################################-- print board function
def print_board(board_array): #{
global ttyCols, top_margin, left_margin, points, score, lives, level, board_rows, board_cols, save_top, save_left, stat_space, stat_rows
set_topleft_ref(0,0)
for rowi in range(board_rows + 1):
print('\033[u' + '\033[' + str(rowi) + 'B' + ''.join(board_array[rowi - 1]))
if (debug):
print('\033[u' + '\033[' + str(len(board) + 4) + 'B' + '\rPlayer: ' + str(player) )
for i in range(0, len(eggs)):
if i == 0: print('\033[u' + '\033[' + str(len(board) + 6 + i) + 'B' + '\r\033[K\033[1B\033[K\033[1AEggs: ' + str(eggs[i]))
else: print('\033[u' + '\033[' + str(len(board) + 6 + i) + 'B' + '\r\033[K\033[1B\033[K\033[1A\tEgg ' + str(i) + ': ' + str(eggs[i]))
for i in range(0, len(beasts)):
if i == 0: print('\033[u' + '\033[' + str(len(board) + len(eggs) + 7 + i) + 'B' + '\r\033[K\033[1B\033[K\033[1ABeasts: ' + str(beasts[i]))
else: print('\033[u' + '\033[' + str(len(board) + len(eggs) + 7 + i) + 'B' + '\r\033[K\033[1B\033[K\033[1A\tBeast ' + str(i) + ': ' + str(beasts[i]))
for i in range(0, len(monsters)):
if i == 0: print('\033[u' + '\033[' + str(len(board) + len(eggs) + len(beasts) + 8 + i) + 'B' + '\r\033[K\033[1B\033[K\033[1AMonsters: ' + str(monsters[i]))
else: print('\033[u' + '\033[' + str(len(board) + len(eggs) + len(beasts) + 8 + i) + 'B' + '\r\033[K\033[1B\033[K\033[1A\tMonster ' + str(i) + ': ' + str(monsters[i]))
print('\033[u\033[0m\033[37m\033[' + str(len(board) + 2) + 'B' + '\033[' + str(stat_space) + 'C' + '\033[s' + chr(9477) +
' ' + 'TOTAL: ' + str(score) + ' ' + chr(9477) + '\033[u\033[' + str((stat_space + 14) * 1) + 'C' + chr(9477) +
' ' + 'TALLY: ' + str(points) + ' ' + chr(9477) + '\033[u\033[' + str((stat_space + 14) * 2) + 'C' + chr(9477) +
' ' + 'LIVES: ' + str(lives) + ' ' + chr(9477) + '\033[u\033[' + str((stat_space + 14) * 3) + 'C' + chr(9477) +
' ' + 'LEVEL: ' + str(level) + ' ' + chr(9477))
print('\033[H\033[8m')
##########################################################################################################
##############################################################################-- play audio function --###
##########################################################################################################
def play_audio(filename): system('aplay -q audio/' + filename + '.wav &')
play_audio('menu_item_tick')
##########################################################################################################
###############################################################################-- place the pieces -- ####
##########################################################################################################
def place_beasts(count):
global beasts, board, BAKGRD, beast_speed, LCD_TIME
beasts[0]['frames'] = (int(beast_speed / LCD_TIME))
step = 0
while(step < count):
row = randint(1, (board_rows - 1))
col = randint(1, (board_cols - 1))
if(board[row][col] == BAKGRD):
board[row][col] = beasts[0]['chr']
beasts.append({'ro':row, 'co':col, 'stg':0 })
step += 1
beasts[step]['stg'] = randint(1, (beasts[0]['frames']))
###########################################################################################
def hatch_monster(row, col):
global monsters, board, MONSTER, LCD_TIME, monster_speed
monsters[0]['frames'] = (int(monster_speed / LCD_TIME))
stagger = randint(1, (monsters[0]['frames']))
board[row][col] = MONSTER
monsters.append({'ro':row, 'co':col,'stg':stagger })
def place_monsters(count):
global monsters, board, BAKGRD
step = 0
while(step < count):
row = randint(1, (board_rows - 1))
col = randint(1, (board_cols - 1))
if(board[row][col] == BAKGRD):
hatch_monster(row, col)
step += 1
###########################################################################################################
########################################################################################-- EGGS --#########
###########################################################################################################
def lay_egg(row, col):
global incubate, monsters, beasts, eggs, board, egg_speed, LCD_TIME
enemy_total = len(eggs) + len(beasts) + len(monsters)
eggs[0]['frames'] = (int(egg_speed / LCD_TIME))
wait_frames = int(eggs[0]['incu_frames'] * (( enemy_total * incubate ) / 10) + randint(0, (2 * eggs[0]['incu_frames']))) # seconds of wait time before egg starts counting down
stag = randint(1, eggs[0]['frames']) # the frame that the egg counts down on
board[row][col] = EGG(32)
eggs.append({'ro': row, 'co': col, 'wait': wait_frames, 'stg': stag, 'sub':32})
##############################################################################################
def place_eggs(count):
global board, BAKGRD
step = 0
while(step < count):
row = randint(1, (board_rows - 1))
col = randint(1, (board_cols - 1))
if(board[row][col] == BAKGRD):
lay_egg(row, col)
step += 1
#####################################################################
def hatch_eggs():
# this function runs through all the eggs, and increments their time
# it transition eggs from wait phase, to countdown, to Monster
# wait_time is number of enemies at the time of creation times 4-16 (in seconds)
# egg_speed is usually between 2 and 4 seconds. It is the time between countdown numbers
global eggs, board, egg_speed, LCD_TIME, audio
di = 0 # keeps track of index to accomodate for egg deletions
if eggs[0]['frame'] >= eggs[0]['frames']:
eggs[0]['frame'] = 0
else:
eggs[0]['frame'] += 1
if eggs[0]['incu_frame'] >= eggs[0]['incu_frames']:
eggs[0]['incu_frame'] = 0
else:
eggs[0]['incu_frame'] += 1
# egg_speed, incu_frames, incu_frame, frames, frame, wait, stg
# each egg: wait, stg
for i in range(1, (len(eggs))):
if (eggs[i - di]['wait'] > 0):
eggs[i - di]['wait'] -= 1
elif (eggs[i - di]['wait'] == 0) & (eggs[i - di]['sub'] == 32):
eggs[i - di]['sub'] = 8329
elif (eggs[i - di]['wait'] == 0) :
if ((eggs[i - di]['stg'] == eggs[0]['frame']) & (eggs[i - di]['sub'] > 8320)):
eggs[i - di]['sub'] -= 1
board[eggs[i - di]['ro']][eggs[i - di]['co']] = EGG(eggs[i - di]['sub'])
elif ((eggs[i - di]['sub'] == 8320) & (eggs[i - di]['stg'] == eggs[0]['frame'])):
hatch_monster(eggs[i - di]['ro'], eggs[i - di]['co'])
del eggs[i - di]
play_audio('hatch')
di += 1
##############################################################################
###############################################-- move pieces --##############
##############################################################################
def flash_player():
global player, PLAYER, plr_flashes, plr_flash, plr_frames, plr_frame
neg_PLAYER = '\033[7m\033[34m\033[40m' + chr(9664) + chr(9654) + '\033[0m'
pos_PLAYER = '\033[34m\033[40m' + chr(9664) + chr(9654) + '\033[0m'
if plr_flash <= plr_flashes:
if plr_frame < plr_frames:
plr_frame += 1
elif plr_frame == plr_frames:
plr_frame = 0
if board[player[1]['ro']][player[1]['co']] == PLAYER:
board[player[1]['ro']][player[1]['co']] = neg_PLAYER
else:
board[player[1]['ro']][player[1]['co']] = PLAYER
plr_flash += 1
# if the flash is greater than 0
def place_player():
global player, PLAYER, plr_flash
step = 0
while(step < 1):
row = randint(1, (board_rows - 1))
col = randint(1, (board_cols - 1))
if(board[row][col] == BAKGRD):
board[row][col] = PLAYER
step += 1
player.append({'ro': row, 'co': col, 'tug': False })
step += 1
plr_flash = 0
def kill_player():
global BAKGRD, player, lives, board, timeout
board[ player[1]['ro'] ][ player[1]['co'] ] = BAKGRD
lives -= 1
del player[1]
if lives > 0:
place_player()
timeout += 1
play_audio('death')
def move_enemies(pawns): #{
global board, player, MOVES
if pawns[0]['frame'] >= pawns[0]['frames']:
pawns[0]['frame'] = 0
else:
pawns[0]['frame'] += 1
move_priority = []
move = ''
breakloop = False
lay = False
likely_moves = []
for pwni in range(1, (len(pawns))): # in a given frame, loops through all pawns in a list if the pawn is staggered to move in the present frame, the pawn moves to a space
if (pawns[pwni]['stg'] == pawns[0]['frame']):
rdistance = player[1]['ro'] - pawns[pwni]['ro'] # player row minus beast row
cdistance = player[1]['co'] - pawns[pwni]['co'] # player column minus beast column
if (rdistance == 0) | (cdistance == 0): # avoid division by zero
distance_ratio = 0.0 # if the player is on the same row or column, the distance ratio is zero
else:
distance_ratio = rdistance / cdistance # division of row distance by column distance
if ((rdistance < 0.0) & (cdistance < 0.0) & (distance_ratio >= .5) & (distance_ratio <= 2.0)):
move_priority = [ 'UL', 'U', 'L', 'DL', 'UR', 'D', 'R', 'DR' ] # UPPER LEFT range priorities
elif ((rdistance < 0.0) & (cdistance > 0.0) & (distance_ratio <= -.5) & (distance_ratio >= -2.0)):
move_priority = [ 'UR', 'U', 'R', 'UL', 'DR', 'L', 'DL', 'D' ] # UPPER RIGHT range priorities
elif ((rdistance > 0.0) & (cdistance > 0.0) & (distance_ratio >= .5) & (distance_ratio <= 2.0)):
move_priority = [ 'DR', 'D', 'R', 'DL', 'UR', 'U', 'L', 'UL' ] # DOWN RIGHT range priorities
elif ((rdistance > 0.0) & (cdistance < 0.0) & (distance_ratio <= -.5) & (distance_ratio >= -2.0)):
move_priority = [ 'DL', 'D', 'L', 'UL', 'DR', 'U', 'R', 'UR' ] # DOWN LEFT range priorities
elif ((rdistance < 0.0) & ((abs(distance_ratio) > 2.0) | (distance_ratio == 0.0))):
move_priority = [ 'U', 'UL', 'UR', 'L', 'R', 'DL', 'DR', 'D' ] # UPWARD range priorities
elif ((cdistance > 0.0) & ((abs(distance_ratio) < .5) | (distance_ratio == 0.0))):
move_priority = [ 'R', 'UR', 'DR', 'U', 'D', 'UL', 'DL', 'L' ] # RIGHT range priorities
elif ((rdistance > 0.0) & ((abs(distance_ratio) > 2.0) | (distance_ratio == 0.0))):
move_priority = [ 'D', 'DL', 'DR', 'L', 'R', 'UL', 'UR', 'U' ] # DOWNWARD range priorities
elif ((cdistance < 0.0) & ((abs(distance_ratio) < .5) | (distance_ratio == 0.0))):
move_priority = [ 'L', 'UL', 'DL', 'U', 'D', 'UR', 'DR', 'R' ] # LEFT range priorities
priority_odds = [ #145 total
[98, False], #98 **********************************************
[18, False], #18 or 36 * These values determine the odds of moves *
[18, False], #18 or 36 * for an enemy if those moves are available. *
[4, False], #4 or 8 * If a move has an equivalent priority to *
[4, False], #4 or 8 * another, but it is a box, then its odds *
[1, False], #1 or 2 * are absorbed by the other. *
[1, False], #1 or 2 * DO NOT CHANGE NUMBER OF PRIORITIES!!!!!!! *
[1, False] #1 **********************************************
]
for priopti in range(8):
# if the first priority move is the player, then take that move
if ((board[ ((pawns[pwni]['ro']) + (MOVES[move_priority[0]]['ra'])) ][ ((pawns[pwni]['co']) + (MOVES[move_priority[0]]['ca'])) ]) == PLAYER ):
move = move_priority[0]
board[pawns[pwni]['ro']][pawns[pwni]['co']] = BAKGRD
pawns[pwni]['ro'] = player[1]['ro']
pawns[pwni]['co'] = player[1]['co']
kill_player()
board[pawns[pwni]['ro']][pawns[pwni]['co']] = pawns[0]['chr']
breakloop = True
break
# else if the priority move is not available, then mark it as unavailable
elif ((board[ ((pawns[pwni]['ro']) + (MOVES[move_priority[priopti]]['ra'])) ][ ((pawns[pwni]['co']) + (MOVES[move_priority[priopti]]['ca'])) ]) == BAKGRD ):
priority_odds[priopti][1] = True
else:
priority_odds[priopti][1] = False
# if the pawn is a monster, and there is a monster or beast in the space, then lay an egg
if ((pawns[0]['chr'] == MONSTER) & ((board[ ((pawns[pwni]['ro']) + (MOVES[move_priority[0]]['ra'])) ][ ((pawns[pwni]['co']) + (MOVES[move_priority[0]]['ca'])) ] == MONSTER) | (board[ ((pawns[pwni]['ro']) + (MOVES[move_priority[0]]['ra'])) ][ ((pawns[pwni]['co']) + (MOVES[move_priority[0]]['ca'])) ] == BEAST))):
lay = True
if (breakloop):
break
for prioddi in range(8): # loop through priorities to add them to likely_moves if available
if (priority_odds[prioddi][1] == True): # if it is true that the priority move is a blank space, then loop through and fill out the likely_moves list
for ti in range(priority_odds[prioddi][0]): # loop through by number in "priorities" loop, to fill out likely_moves list
likely_moves.append(move_priority[prioddi])
if ((prioddi == 2) | (prioddi == 4) | (prioddi == 6)):
if ((not priority_odds[prioddi - 1][1]) & (priority_odds[prioddi][1] == True)):
for ti in range(priority_odds[prioddi][0]):
likely_moves.append(move_priority[prioddi])
# the move is finally decided out of the available set in the list
if (len(likely_moves) > 0):
move = likely_moves[randint(0, (len(likely_moves)) - 1)]
likely_moves = []
# pawn row plus move row adjustment
# pawn col plus move col adjustment
board[ pawns[pwni]['ro'] + MOVES[move]['ra'] ][ pawns[pwni]['co'] + MOVES[move]['ca'] ] = pawns[0]['chr']
# pawn row and pawn col = bakgrd
board[ pawns[pwni]['ro'] ][ pawns[pwni]['co'] ] = BAKGRD
# pawn[pawni] row and col = new row and col
pawns[pwni]['ro'] = pawns[pwni]['ro'] + MOVES[move]['ra']
pawns[pwni]['co'] = pawns[pwni]['co'] + MOVES[move]['ca']
#}
def push_tree(intent):
global player, eggs, board, BLOCK, MOVES, BAKGRD, BOX, PLAYER
push_eggs = []
stnce_r = player[1]['ro']
stnce_c = player[1]['co']
tug_r = stnce_r - MOVES[intent]['ra']
tug_c = stnce_c - MOVES[intent]['ca']
intend_r = stnce_r + MOVES[intent]['ra']
intend_c = stnce_c + MOVES[intent]['ca']
def probe_r(p_ind):
return player[1]['ro'] + p_ind * MOVES[intent]['ra']
def probe_c(p_ind):
return player[1]['co'] + p_ind * MOVES[intent]['ca']
def wall_r(p_ind):
return player[1]['ro'] + (p_ind + 1) * MOVES[intent]['ra']
def wall_c(p_ind):
return player[1]['co'] + (p_ind + 1) * MOVES[intent]['ca']
def ram_r(p_ind):
return player[1]['ro'] + (p_ind - 1) * MOVES[intent]['ra']
def ram_c(p_ind):
return player[1]['co'] + (p_ind - 1) * MOVES[intent]['ca']
def push_move():
global BOX, BAKGRD, PLAYER, player
for i in range(probe):
board[ probe_r(probe - i) ][ probe_c(probe - i) ] = board[ probe_r(probe - 1 - i) ][ probe_c(probe - 1 - i) ] # make board space same as preceeding space
for i in range(len(push_eggs)):
eggs[push_eggs[i]]['ro'] += MOVES[intent]['ra']
eggs[push_eggs[i]]['co'] += MOVES[intent]['ca']
if ((player[1]['tug']) & (board[tug_r][tug_c] == BOX)):
board[tug_r][tug_c] = BAKGRD
board[stnce_r][stnce_c] = BOX
else:
board[ player[1]['ro'] ][ player[1]['co'] ] = BAKGRD
player[1]['ro'] = intend_r
player[1]['co'] = intend_c # make player fol and fow the player
board[intend_r][intend_c] = PLAYER # move_player()
def kill_enemy(pawns, row, col):
global points, board
del_index = 0
for i in range(1, (len(pawns))):
if ((pawns[i]['ro'] == row) & (pawns[i]['co'] == col)):
del_index = i
break
del pawns[del_index]
points += pawns[0]['pnts']
probe = 2
loop = True
while (loop):
space = board[probe_r(probe)][probe_c(probe)]
ram_space = board[ram_r(probe)][ram_c(probe)]
if (((probe_r(probe) != 0) & (probe_r(probe) != (len(board) - 1))) & ((probe_c(probe) != 0) & (probe_c(probe) != len(board[0]) - 1))):
wall_space = board[wall_r(probe)][wall_c(probe)]
if (space == BOX): # if space is a box
probe += 1 # start loop over
elif (space == BAKGRD): # if space is
push_move()
loop = False
elif (deteggt(space) == True): # if space is a egg
if (wall_space == BLOCK) | (wall_space == KILLBLOCK): # if next block after egg is a border
kill_enemy(eggs, probe_r(probe), probe_c(probe)) # del egg from global egg list
play_audio('hatch')
push_move()
loop = False # make space same as preceeding space
# elif ((wall_space == BAKGRD) | (wall_space == BOX)):
else:
for i in range(1, len(eggs)):
if ((eggs[i]['ro'] == probe_r(probe)) & (eggs[i]['co'] == probe_c(probe))):
push_eggs = [i] + push_eggs
probe += 1
elif (space == BLOCK): # if space is a border
loop = False
elif (space == KILLBLOCK): # if space is a killblock
play_audio('flatten')
push_move()
board[probe_r(probe - 1)][probe_c(probe - 1)] = KILLBLOCK
loop = False
elif (space == BEAST): # if space is a beast
if ((wall_space == KILLBLOCK) | (wall_space == BOX) | (wall_space == BLOCK)):
kill_enemy(beasts, probe_r(probe), probe_c(probe))
play_audio('squish')
push_move()
loop = False
elif (space == MONSTER):# if space is a monster
if ((wall_space == KILLBLOCK) | (wall_space == BLOCK)):
kill_enemy(monsters, probe_r(probe), probe_c(probe))
play_audio('squish')
push_move()
loop = False
else:
system('echo \"' + str(space) + '\" >> probe_space.txt')
loop = False
def move_player(direction):
global PLAYER, player, board, MOVES, BAKGRD, BOX, pulling
row = player[1]['ro']
col = player[1]['co']
fow = row + MOVES[direction]['ra']
fol = col + MOVES[direction]['ca']
rtug = row - MOVES[direction]['ra']
ctug = col - MOVES[direction]['ca']
board[fow][fol] = PLAYER
if (player[1]['tug']) & (board[rtug][ctug] == BOX):
board[rtug][ctug] = BAKGRD
board[row][col] = BOX
if (pulling == 'hold'):
player[1]['tug'] == False
else:
board[row][col] = BAKGRD
player[1]['ro'] = fow
player[1]['co'] = fol
def direct_move(tap_move):
global player, MOVES, board
space = board[player[1]['ro'] + MOVES[tap_move]['ra'] ][ player[1]['co'] + MOVES[tap_move]['ca'] ]
if (space == BAKGRD):
move_player(tap_move)
elif (space == BOX):
push_tree(tap_move)
elif (space == MONSTER) | (space == BEAST) | (space == KILLBLOCK):
kill_player()
def direct_keypress(tap):
global player, MOVES, board, KEY_P_UP, KEY_P_DOWN, KEY_P_RIGHT, KEY_P_LEFT, KEY_UP, KEY_DOWN, KEY_RIGHT, KEY_LEFT, pulling
if (tap == KEY_UP):
direct_move('U')
elif (tap == KEY_LEFT):
direct_move('L')
elif (tap == KEY_DOWN):
direct_move('D')
elif (tap == KEY_RIGHT):
direct_move('R')
if (pulling == 'hold'):
if (tap == KEY_P_UP):
player[1]['tug'] = True
direct_move('U')
player[1]['tug'] = False
elif (tap == KEY_P_LEFT):
player[1]['tug'] = True
direct_move('L')
player[1]['tug'] = False
elif (tap == KEY_P_RIGHT):
player[1]['tug'] = True
direct_move('R')
player[1]['tug'] = False
elif (tap == KEY_P_DOWN):
player[1]['tug'] = True
direct_move('D')
player[1]['tug'] = False
######################################################################
########################-- question user about board-size --##########
######################################################################
def pause():
global board_rows, board_cols, left_margin, top_margin
play_audio('pause')
pauseleft = (left_margin + board_cols - 8)
pausetop = (top_margin + int(board_rows/4))
print('\033[0m\033[40m')
print('\033[' + str(pausetop) + ';' + str(pauseleft) + 'H' + ' '*16)
print('\033[' + str(pausetop + 1) + ';' + str(pauseleft) + 'H' + ' ' + chr(9556) + chr(9552)*12 + chr(9559) + ' ')
print('\033[' + str(pausetop + 2) + ';' + str(pauseleft) + 'H' + ' ' + chr(9553) + ' ' + chr(9553) + ' ')
print('\033[' + str(pausetop + 3) + ';' + str(pauseleft) + 'H' + ' ' + chr(9553) + ' PAUSED ' + chr(9553) + ' ')
print('\033[' + str(pausetop + 4) + ';' + str(pauseleft) + 'H' + ' ' + chr(9553) + ' ' + chr(9553) + ' ')
print('\033[' + str(pausetop + 5) + ';' + str(pauseleft) + 'H' + ' ' + chr(9562) + chr(9552)*12 + chr(9565) + ' ')
print('\033[' + str(pausetop + 6) + ';' + str(pauseleft) + 'H' + ' '*16)
print('\033[H\033[0m')
while(keypress == ord('p')):
sleep(.08)
play_audio('pause')
#####################################################################################################
#######################################################-- main function calls -######################
#####################################################################################################
def build_level():
global incubate, egg_speed, beast_speed, monster_speed, keypress
global play_rows, play_cols, board_rows, board_cols, reset_board, blank_board
global board, level, lives, score, points, mi1_opt
global lvl_block_cnt, lvl_beast_cnt, lvl_monster_cnt, lvl_egg_cnt, lvl_box_cnt, block_type
global BAKGRD, BLOCK, KILLBLOCK, last_frame, top_margin, left_margin, LCD_TIME
global KEY_UP, KEY_DOWN, KEY_RIGHT, KEY_LEFT, KEY_P_UP, KEY_P_DOWN, KEY_P_LEFT, KEY_P_RIGHT, pulling
stdscr = curses.initscr()
stdscr.keypad(1)
stdscr.refresh()
block_type = BLOCK
lvl_block_cnt = 10
lvl_beast_cnt = 0
lvl_monster_cnt = 0
lvl_egg_cnt = 0
invisibleBEAST = '\033[30m\033[40m' + chr(9500) + chr(9508) + '\033[0m'
print_board(board)
sleep(.5)
board = []
board = build_the_board()
print_board(board)
if (level == 0):
sleep(1)
set_topmid_ref(3, 29)
play_audio('begin')
print('\033[u\033[2B' + invisibleBEAST + BEAST*4 + BAKGRD*2 + BEAST*5 + BAKGRD*3 + BEAST*1 + BAKGRD*4 + BEAST*3 + BAKGRD*2 + BEAST*5)
print('\033[u\033[3B' + invisibleBEAST + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*6 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*2 + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*3 + BEAST*1)
print('\033[u\033[4B' + invisibleBEAST + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*5 + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*7 + BEAST*1)
print('\033[u\033[5B' + invisibleBEAST + BEAST*4 + BAKGRD*2 + BEAST*3 + BAKGRD*3 + BEAST*5 + BAKGRD*2 + BEAST*3 + BAKGRD*4 + BEAST*1)
print('\033[u\033[6B' + invisibleBEAST + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*5 + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*5 + BEAST*1 + BAKGRD*3 + BEAST*1)
print('\033[u\033[7B' + invisibleBEAST + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*5 + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*1 + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*3 + BEAST*1)
print('\033[u\033[8B' + invisibleBEAST + BEAST*4 + BAKGRD*2 + BEAST*5 + BAKGRD*1 + BEAST*1 + BAKGRD*3 + BEAST*1 + BAKGRD*2 + BEAST*3 + BAKGRD*4 + BEAST*1)
set_cursor_avoid()
sleep(.4)
set_topmid_ref(17, 35)
print('\033[37m\033[2m\033[40mPress the Spacebar to Play . . .\033[0m')
set_cursor_avoid()
while (keypress != ord(' ')):
sleep(.2)
set_topmid_ref(17, 35)
print('\033[37m\033[2m\033[40mPress \033[36mtab \033[37mfor \033[35mSettings\033[30m . . . \033[0m')
sleep(1.2)
if (lives == 0):
score += points
if level != 0: score -= 75
level -= 3
if level < 1: level = 1
lives = 5
points = 0
for i in range(1, len(player)): del player[1]
for i in range(1, len(beasts)): del beasts[1]
for i in range(1, len(monsters)): del monsters[1]
for i in range(1, len(eggs)): del eggs[1]
else:
level += 1
score += points
points = 0
for i in range(1, len(player)): del player[1]
def lvl_set(beas, mons, egs, blctp):
global block_type, lvl_beast_cnt, lvl_monster_cnt, lvl_egg_cnt
lvl_beast_cnt = beas
lvl_monster_cnt = mons
lvl_egg_cnt = egs
block_type = blctp
def lvl_set(beas, mons, egs, blctp):
global lvl_beast_cnt, lvl_monster_cnt, lvl_egg_cnt, block_type
lvl_beast_cnt = beas
lvl_monster_cnt = mons
lvl_egg_cnt = egs
block_type = blctp
if level == 1: lvl_set(3, 0, 0, BLOCK)
elif level == 2: lvl_set(5, 0, 0, KILLBLOCK)
elif level == 3: lvl_set(5, 0, 2, BLOCK)
elif level == 4: lvl_set(4, 1, 1, KILLBLOCK)
elif level == 5: lvl_set(4, 2, 2, BLOCK)
elif level == 6: lvl_set(8, 0, 0, KILLBLOCK)
elif level == 7: lvl_set(0, 0, 8, KILLBLOCK)
elif level == 8: lvl_set(0, 8, 0, KILLBLOCK)
elif level == 9: lvl_set(3, 3, 3, BLOCK)
elif level == 10: lvl_set(2, 4, 3, BLOCK)
elif level == 11: lvl_set(1, 5, 4, KILLBLOCK)
elif level == 12: lvl_set(1, 6, 4, KILLBLOCK)
elif level == 13: lvl_set(0, 0, 12, KILLBLOCK)
elif level == 14: lvl_set(0, 12, 0, KILLBLOCK)
elif level == 15: lvl_set(15, 0, 0, KILLBLOCK)
else:
lvl_beast_cnt = int(level / 3)
lvl_monster_cnt = int(level / 3)
lvl_egg_cnt = int(level / 3)
if (level % 2 == 0): block_type = KILLBLOCK
else: block_type = BLOCK
if (level % 3) == 1: lvl_beast_cnt += 1
elif (level % 3) == 2:
lvl_beast_cnt += 1
lvl_egg_cnt += 1
lower_boxes = int(play_rows * play_cols / 4 - 10)
upper_boxes = int(play_rows * play_cols / 4 + 10)
lvl_box_cnt = randint(lower_boxes, upper_boxes)
lvl_block_cnt = 10
main_menu = 0
item_menu = 0
controls_menu = 9
menu_ref = '\033[' + str(top_margin + 3) + ';' + str(left_margin + 6) + 'H\033[s\033[0m'
dim = '\033[0m\033[40m\033[2m'
norm = '\033[0m\033[40m'
ltab = '\033[0m\033[7m\033[40m'
dtab = '\033[0m\033[7m\033[40m\033[2m'
speedbg = '\033[40m\033[34m|||\033[32m|||||\033[33m\033[31m||\033[37m\033[40m'
speed_arrow = '\033[40m\033[35m' + chr(9632) + '\033[40m' # 10219 (thin double) 9193 (skip) 9670 (diamon)
chr_cnt = 0
mi1_shade = '' ###############-- item 1
#mi1_opt = 2 # (set globally on line 52)
mi2_shade = '' ###############-- item 2
mi2_opt = 0
if pulling == 'hold': mi2_opt = 1
elif pulling == 'toggle': mi2_opt = 2
elif pulling == 'single': mi2_opt = 3
elif pulling == 'auto': mi2_opt = 4
# pulling set globally on line 74
toggle, single, auto = '', '', ''
mi3_shade = '' ###############-- item 3
mi4_shade = '' ###############-- item 4
mi5_shade = '' ###############-- item 5
mi6_shade = '' ###############-- item 6
mi7_shade = '' ###############-- item 7
mi8_shade = '' ###############-- item 8
mi8_opt = 0
if block_type == BLOCK: mi8_opt = 1
elif block_type == KILLBLOCK: mi8_opt = 2
normalyellow, dangerousorange = '', ''
mi9_shade = '' ###############-- item 9
beast_speed_min = .3
beast_speed_max = 2.3
beast_speed_inc = .2
beast_speed = beast_speed - (beast_speed % beast_speed_inc)
if (beast_speed > beast_speed_max): beast_speed = beast_speed_max
elif (beast_speed < beast_speed_min): beast_speed = beast_speed_min
beast_arrows = int((beast_speed - beast_speed_min ) / beast_speed_inc)
mi10_shade = '' ##############-- item 10
monster_speed_min = .3
monster_speed_max = 2.3
monster_speed_inc = .2
monster_speed = monster_speed - (monster_speed % monster_speed_inc)
if (monster_speed > monster_speed_max): monster_speed = monster_speed_max
elif (monster_speed < monster_speed_min): monster_speed = monster_speed_min
monster_arrows = int((monster_speed - monster_speed_min) / monster_speed_inc)
mi11_shade = '' ##############-- item 11
incubate_min = 4
incubate_max = 40
incubate_inc = 4
incubate = incubate - (incubate % incubate_inc)
if (incubate > incubate_max): incubate = incubate_max
elif (incubate < incubate_min): incubate = incubate_min
incubate_arrows = int((incubate - incubate_min) / incubate_inc)
mi12_shade = '' ##############-- item 12
timer_min = .5
timer_max = 5
timer_inc = .5
egg_speed = egg_speed - (egg_speed % timer_inc)
if (egg_speed > timer_max): egg_speed = timer_max
elif (egg_speed < timer_min): egg_speed = timer_min
timer_arrows = int((egg_speed - timer_min) / timer_inc)
def dim_menus(mi):
global mi1_shade, mi2_shade, mi3_shade, mi4_shade, mi5_shade, mi6_shade, mi7_shade, mi8_shade, mi9_shade, mi10_shade, mi11_shade, mi12_shade
if mi != 1: mi1_shade = dim ##############-- item 1
else: mi1_shade = norm
if mi != 2: mi2_shade = dim ##############-- item 2
else: mi2_shade = norm
if mi != 3: mi3_shade = dim ##############-- item 3
else: mi3_shade = norm
if mi != 4: mi4_shade = dim ##############-- item 4
else: mi4_shade = norm
if mi != 5: mi5_shade = dim ##############-- item 5
else: mi5_shade = norm
if mi != 6: mi6_shade = dim ##############-- item 6
else: mi6_shade = norm
if mi != 7: mi7_shade = dim ##############-- item 7
else: mi7_shade = norm
if mi != 8: mi8_shade = dim ##############-- item 8
else: mi8_shade = norm
if mi != 9: mi9_shade = dim ##############-- item 9
else: mi9_shade = norm
if mi != 10: mi10_shade = dim ##############-- item 10
else: mi10_shade = norm
if mi != 11: mi11_shade = dim ##############-- item 11
else: mi11_shade = norm
if mi != 12: mi12_shade = dim ##############-- item 12
else: mi12_shade = norm
def main_menu_1():
global mi1_opt, mi1_shade, mi2_shade, wasd, arrows, vi, pulling, single, toggle, auto
print('\033[u\033[3B' + mi1_shade + 'Movement Keys: ' + wasd + mi1_shade + arrows + mi1_shade + vi)
print('\033[u\033[5B' + mi2_shade + 'Pulling Boxes: ' + hold + mi2_shade + toggle + mi2_shade + single + mi2_shade + auto)
pullkey = ''
if (pulling == 'hold'):
if (mi1_opt == 1): pullkey = 'Shift '
elif (mi1_opt == 2): pullkey = 'Ctrl '
elif (mi1_opt == 3): pullkey = 'Shift '
else: pullkey = 'Spacebar'
print('\033[u\033[8B\033[0m\033[40m\033[37m\033[2m' + ' '*32 + 'Block-Pull Key: \033[36m' + pullkey + ' \033[0m')
print('\033[u\033[15B\033[0m\033[40m\033[37m\033[2mPress \033[36mESC \033[37mto enter the game')
print('\033[u\033[16B\033[0m\033[40m\033[37m\033[2mPress \033[36mTab \033[37mto switch menu tabs\033[0m')
def main_menu_2():
global mi3_shade, mi4_shade, mi5_shade, mi6_shade, mi7_shade, mi8_shade, BLOCK, block_type, KILLBLOCK, normalyellow, dangerousorange, play_rows, play_cols
#global lvl_block_cnt, lvl_box_cnt, lvl_beast_cnt, lvl_monster_cnt, lvl_egg_cnt,
global lvl_beast_cnt, lvl_monster_cnt, lvl_egg_cnt
print('\033[u\033[4B\033[34C' + dim + 'Total Spaces: \033[36m' + str(play_rows * play_cols) + ' \033[37m')
print('\033[u\033[5B\033[35C' + dim + 'Used Spaces: \033[36m' + str(lvl_box_cnt + lvl_block_cnt + lvl_monster_cnt + lvl_beast_cnt + lvl_egg_cnt) + ' \033[37m')
print('\033[u\033[6B\033[35C' + dim + 'Free Spaces: \033[36m' + str((play_rows * play_cols) - (lvl_block_cnt + lvl_box_cnt + lvl_monster_cnt + lvl_beast_cnt + lvl_egg_cnt)) + ' \033[37m')
print('\033[u\033[3B' + mi3_shade + BEAST + mi3_shade + '\033[40m - Beast Count: \033[35m' + str(lvl_beast_cnt) + ' \033[37m')
print('\033[u\033[5B' + mi4_shade + MONSTER + mi4_shade + '\033[40m - Monster Count: \033[35m' + str(lvl_monster_cnt) + ' \033[37m')
print('\033[u\033[7B' + mi5_shade + EGG(32) + mi5_shade + '\033[40m - Egg Count: \033[35m' + str(lvl_egg_cnt) + ' \033[37m')
print('\033[u\033[9B' + mi6_shade + BOX + mi6_shade + '\033[40m - Box Count: \033[35m' + str(lvl_box_cnt) + ' \033[37m')
print('\033[u\033[11B' + mi7_shade + block_type + mi7_shade + '\033[40m - Block Count: \033[35m' + str(lvl_block_cnt) + ' \033[37m')
print('\033[u\033[13B' + mi8_shade + block_type + mi8_shade + '\033[40m - Block Type: ' + normalyellow + mi8_shade + dangerousorange + mi8_shade + ' \033[37m')
def main_menu_3():
global mi9_shade, mi10_shade, mi11_shade, mi12_shade, incubate
print('\033[u\033[3B' + mi9_shade + BEAST + mi9_shade + ' - Beast: slower ' + speedbg + ' faster\033[' + str(beast_arrows + 8) + 'D' + speed_arrow + '\033[30m')
print('\033[u\033[5B' + mi10_shade + MONSTER + mi10_shade + ' - Monster: slower ' + speedbg + ' faster\033[' + str(monster_arrows + 8) + 'D' + speed_arrow + '\033[30m')
print('\033[u\033[7B' + mi11_shade + EGG(32) + mi11_shade + ' - Egg Incubate: slower ' + speedbg + ' faster\033[' + str(incubate_arrows + 8) + 'D' + speed_arrow + '\033[30m')
print('\033[u\033[9B' + mi12_shade + EGG(8320) + mi12_shade + ' - Egg Timer: slower ' + speedbg + ' faster\033[' + str(timer_arrows + 8) + 'D' + speed_arrow + '\033[30m')
def mi1_controls(opt):
global KEY_UP, KEY_DOWN, KEY_RIGHT, KEY_LEFT, KEY_P_UP, KEY_P_DOWN, KEY_P_LEFT, KEY_P_RIGHT, wasd, arrows, vi, pulling
if opt == 1:
wasd = '[\033[35m w,a,s,d \033[37m]'
arrows = ' arrows '
vi = ' h,j,k,l '
KEY_UP = 119
KEY_DOWN = 115
KEY_RIGHT = 100
KEY_LEFT = 97
KEY_P_UP = 87
KEY_P_DOWN = 83