1 | # demo |
---|
2 | import bitutil as pablo |
---|
3 | |
---|
4 | class Groups(): |
---|
5 | starts = 0 |
---|
6 | follows = 0 |
---|
7 | follows_1 = 0 |
---|
8 | follows_2 = 0 |
---|
9 | follows_3 = 0 |
---|
10 | follows_4 = 0 |
---|
11 | follows_5 = 0 |
---|
12 | follows_6 = 0 |
---|
13 | follows_7 = 0 |
---|
14 | follows_8 = 0 |
---|
15 | follows_9 = 0 |
---|
16 | follows_10 = 0 |
---|
17 | follows_11 = 0 |
---|
18 | follows_12 = 0 |
---|
19 | follows_13 = 0 |
---|
20 | follows_14 = 0 |
---|
21 | follows_15 = 0 |
---|
22 | follows_16 = 0 |
---|
23 | follows_0 = 0 |
---|
24 | |
---|
25 | def Gen_lgth_groups(markers, groups): |
---|
26 | |
---|
27 | groups.starts = markers.starts |
---|
28 | groups.follows = markers.follows |
---|
29 | |
---|
30 | cursor = groups.starts |
---|
31 | temp = groups.follows |
---|
32 | |
---|
33 | # Group symbols of length 1 |
---|
34 | cursor = pablo.Advance(cursor) |
---|
35 | groups.follows_1 = cursor & temp |
---|
36 | temp = temp & ~groups.follows_1 |
---|
37 | |
---|
38 | # Group symbols of length 2 |
---|
39 | cursor = pablo.Advance(cursor) |
---|
40 | groups.follows_2 = cursor & temp |
---|
41 | temp = temp & ~groups.follows_2 |
---|
42 | |
---|
43 | # Group symbols of length 3 |
---|
44 | cursor = pablo.Advance(cursor) |
---|
45 | groups.follows_3 = cursor & temp |
---|
46 | temp = temp & ~groups.follows_3 |
---|
47 | |
---|
48 | # Group symbols of length 4 |
---|
49 | cursor = pablo.Advance(cursor) |
---|
50 | groups.follows_4 = cursor & temp |
---|
51 | temp = temp & ~groups.follows_4 |
---|
52 | |
---|
53 | # Group symbols of length 5 |
---|
54 | cursor = pablo.Advance(cursor) |
---|
55 | groups.follows_5 = cursor & temp |
---|
56 | temp = temp & ~groups.follows_5 |
---|
57 | |
---|
58 | # Group symbols of length 6 |
---|
59 | cursor = pablo.Advance(cursor) |
---|
60 | groups.follows_6 = cursor & temp |
---|
61 | temp = temp & ~groups.follows_6 |
---|
62 | |
---|
63 | # Group symbols of length 7 |
---|
64 | cursor = pablo.Advance(cursor) |
---|
65 | groups.follows_7 = cursor & temp |
---|
66 | temp = temp & ~groups.follows_7 |
---|
67 | |
---|
68 | # Group symbols of length 8 |
---|
69 | cursor = pablo.Advance(cursor) |
---|
70 | groups.follows_8 = cursor & temp |
---|
71 | temp = temp & ~groups.follows_8 |
---|
72 | |
---|
73 | # Group symbols of length 9 |
---|
74 | cursor = pablo.Advance(cursor) |
---|
75 | groups.follows_9 = cursor & temp |
---|
76 | temp = temp & ~groups.follows_9 |
---|
77 | |
---|
78 | # Group symbols of length 10 |
---|
79 | cursor = pablo.Advance(cursor) |
---|
80 | groups.follows_10 = cursor & temp |
---|
81 | temp = temp & ~groups.follows_10 |
---|
82 | |
---|
83 | # Group symbols of length 11 |
---|
84 | cursor = pablo.Advance(cursor) |
---|
85 | groups.follows_11 = cursor & temp |
---|
86 | temp = temp & ~groups.follows_11 |
---|
87 | |
---|
88 | # Group symbols of length 12 |
---|
89 | cursor = pablo.Advance(cursor) |
---|
90 | groups.follows_12 = cursor & temp |
---|
91 | temp = temp & ~groups.follows_12 |
---|
92 | |
---|
93 | # Group symbols of length 13 |
---|
94 | cursor = pablo.Advance(cursor) |
---|
95 | groups.follows_13 = cursor & temp |
---|
96 | temp = temp & ~groups.follows_13 |
---|
97 | |
---|
98 | # Group symbols of length 14 |
---|
99 | cursor = pablo.Advance(cursor) |
---|
100 | groups.follows_14 = cursor & temp |
---|
101 | temp = temp & ~groups.follows_14 |
---|
102 | |
---|
103 | # Group symbols of length 15 |
---|
104 | cursor = pablo.Advance(cursor) |
---|
105 | groups.follows_15 = cursor & temp |
---|
106 | temp = temp & ~groups.follows_15 |
---|
107 | |
---|
108 | # Group symbols of length 16 |
---|
109 | cursor = pablo.Advance(cursor) |
---|
110 | groups.follows_16 = cursor & temp |
---|
111 | temp = temp & ~groups.follows_16 |
---|
112 | |
---|
113 | # Group symbols of length greater than 16 |
---|
114 | groups.follows_0 = temp |
---|
115 | |
---|
116 | def Main(markers, groups): |
---|
117 | Gen_lgth_groups(markers, groups) |
---|
118 | |
---|