Etterna 0.74.4
Loading...
Searching...
No Matches
HD_MetaSequencing.h
1#pragma once
2#include "HD_BasicSequencing.h"
3
11enum meta_type
12{
13 meta_cccccc,
14 meta_ccacc,
15 meta_acca,
16 meta_ccsjjscc,
17 meta_ccsjjscc_inverted,
18 meta_enigma,
19 meta_meta_enigma,
20 meta_unknowable_enigma,
21 num_meta_types,
22 meta_type_init,
23};
24
32inline auto
33detecc_cccccc(const base_type& now, const base_type& last_last) -> bool
34{
35 // wow it was actually cabbage brain LUL
36 return now == last_last;
37}
38
40inline auto
41detecc_acca(const base_type& a, const base_type& b, const base_type& c) -> bool
42{
43 // 1122, 2211, etc
44 return a == base_single_single && is_cc_tap(b) && c == base_single_single;
45}
46
50inline auto
51detecc_sjjscc(const base_type& last,
52 const base_type& last_last,
53 const base_type& last_last_last) -> bool
54{
55 // check last_last_last first, if it's not cc, throw it out
56 if (!is_cc_tap(last_last_last)) {
57 {
58 {
59 return false;
60 }
61 }
62 }
63
64 // last is exiting the jump, last_last is entering it
65 // note: we don't care about the single/jump jump/single column order
66 // because it can always be inferred from existing data
67 return last == base_jump_single && last_last == base_single_jump;
68}
69
72inline auto
73determine_meta_type(const base_type& now,
74 const base_type& last,
75 const base_type& last_last,
76 const base_type& last_last_last,
77 const meta_type& last_mt) -> meta_type
78{
79 // this is either cccccc or ccacc
80 if (is_cc_tap(now) && is_cc_tap(last_last)) {
81
82 if (detecc_cccccc(now, last_last)) {
83 // 1212, 2121, etc
84 return meta_cccccc;
85 }
86 {
87 // 1221, 2112, etc
88 return meta_ccacc;
89 }
90 }
91
92 /* 1122, 2211, these are generally tricky and we wouldn't be interseted in
93 * using them for downscaling in most contexts, however there are
94 * jumptrillable patterns that exist for which acca is an axiomatic
95 * transition, namely, chains of ccacc, or, ccaccaccaccaccacc, or,
96 * 1221221221221221221, scanning down rows will produce alternating meta
97 * types of ccacc and acca, so we can use this to do very robust detection,
98 * particularly since any other transition type in sequences of these
99 * patterns will actually make them significantly harder to manipulate */
100 if (detecc_acca(now, last, last_last)) {
101 return meta_acca;
102 }
103
104 // we need to be on a cc to have ccsjjscc
105 if (is_cc_tap(now)) {
106
107 // this is a 5 row pattern, so we have to go deep
108 if (detecc_sjjscc(last, last_last, last_last_last)) {
109
110 if (now == last_last_last) {
111 // 12 [12] 12
112 return meta_ccsjjscc;
113 }
114 {
115 // 12 [12] 21
116 return meta_ccsjjscc_inverted;
117 }
118 }
119 }
120
121 // past the point of our current largest meta pattern definitions, so if we
122 // see this, we can stop waiting for something like ccsjjscc
123 if (last_mt == meta_enigma) {
124 return meta_meta_enigma;
125 }
126
127 // there are probably entire packs where we won't even see one of these
128 if (last_mt == meta_meta_enigma) {
129 return meta_unknowable_enigma;
130 }
131
132 // meta_enigma is commonplace for transitions between two meta types, so we
133 // often use it to wait and see what comes next
134 return meta_enigma;
135}