Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions PyCube.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import multiprocessing
from quat import *
from geometry import *
import keypress

import pygame
from pygame.locals import *
Expand Down Expand Up @@ -343,24 +342,16 @@ def update():
zoom = 1

if event.key == pygame.K_EQUALS:
p = multiprocessing.Process(target=keypress.wail, args=(moves,))
# thread.daemon = True
p.start()
p.join()
self.scramble(moves)
print()
print(moves)
moves = ''
print(moves)


if event.key == pygame.K_MINUS:
mvs = 'fFbBlLrRuUdD'
scrambled = ''.join(random.choice(mvs) for _ in range(20))
p = multiprocessing.Process(target=self.scramble, args=(scrambled,))
# p.daemon = True
p.start()
p.join()
# self.scramble()
self.scramble(scrambled)

if event.type == pygame.KEYUP:
# Stoping rotation
Expand Down Expand Up @@ -403,9 +394,12 @@ def update():
sys.stdout.flush()
# time.sleep(5000)

def scramble(self, scrambled):

keypress.wail(scrambled)
def scramble(self, moves):
if moves:
moves = list(reversed(list(moves.swapcase())))
for move in moves:
newevent = pygame.event.Event(pygame.locals.KEYDOWN, unicode=move, key=pygame.key.key_code(move), mod=pygame.locals.KMOD_NONE)
pygame.event.post(newevent)

def draw_cube(self):

Expand Down
57 changes: 0 additions & 57 deletions keypress.py

This file was deleted.