воскресенье, 11 августа 2019 г.

willie, python script

count_in_serial = 3 # count in serie
overall_count = 20 # series count
sleep_sec = 5 # series delay

incomp_punch = { 9 : [8], 8: [9], 3 : [4], 4: [3], 3: [3], 4: [4] }

import random
import win32com.client as wincl
import time
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Rate = -2

random.seed()

for i in range(overall_count):
    str = ""
    ser = [random.randint(1, 9) for x in range(count_in_serial)]
    for j in range(count_in_serial-1):
        while ser[j+1] in incomp_punch.get(ser[j],[]):
            ser[j+1] = random.randint(1, 10)
    print(ser.__str__())
    speak.Speak(ser.__str__().replace(',',' '))
    time.sleep(sleep_sec)

Комментариев нет:

Отправить комментарий