evo-alphas.html


001| ####################################################################################################
002| from sys import stdout, argv, exc_info
003| from traceback import extract_tb
004| from os import path, environ
005| from time import process_time_ns
006| from random import randint
007| from files import datafile, textfile, linefile, csvfile
008| from goodies import divisions, intervals, marker, combine
009| from webpage import KWARG
010| from evolution import Alphabet,RandString, GetAlphabet,GetFullAlphabet
011| ####################################################################################################
012| BasePath = r'C:\CJS\prj\Python\app\arc\evo'
013| 
014| def dump_random_strings (count, length):
015|     for _ in range(count):
016|         print(RandString(length))
017|     print()
018| 
019| Alphabets = [
020|     GetAlphabet(0,0,0,0,0), # 0.0 (reverse first two and last three)
021|     GetAlphabet(1,0,0,0,0), # 1.0
022|     GetAlphabet(1,0,1,0,0), # 1.1
023|     GetAlphabet(1,0,0,1,0), # 1.2
024|     GetAlphabet(1,0,1,1,0), # 1.3 (skip .4 and .5)
025|     GetAlphabet(1,0,0,1,1), # 1.6
026|     GetAlphabet(1,0,1,1,1), # 1.7
027|     GetAlphabet(0,1,0,0,0), # 2.0
028|     GetAlphabet(0,1,1,0,0), # 2.1
029|     GetAlphabet(0,1,0,1,0), # 2.2
030|     GetAlphabet(0,1,1,1,0), # 2.3 (skip .4 and .5)
031|     GetAlphabet(0,1,0,1,1), # 2.6
032|     GetAlphabet(0,1,1,1,1), # 2.7
033|     GetAlphabet(1,1,0,0,0), # 3.0
034|     GetAlphabet(1,1,1,0,0), # 3.1
035|     GetAlphabet(1,1,0,1,0), # 3.2
036|     GetAlphabet(1,1,1,1,0), # 3.3 (skip .4 and .5)
037|     GetAlphabet(1,1,0,1,1), # 3.6
038|     GetAlphabet(1,1,1,1,1), # 3.7
039|     GetFullAlphabet()
040| ]
041| def list_Alphabets ():
042|     for ix,a in enumerate(Alphabets):
043|         print('[%2d] (%d) <%s>' % (ix,len(a),a))
044|     print()
045| 
046| def wrap_around_demo ():
047|     adjust = lambda n: (n if n < (len(Alphabet)/2) else abs(n-len(Alphabet)))
048| 
049|     h = list(range(1,len(Alphabet)))
050|     g = [adjust(n) for n in h]
051|     print(h)
052|     print(g)
053| 
054| 
055| 
056| ####################################################################################################
057| '''eof'''
058|