Commit 4bab3e5b authored by Adam P. Goucher's avatar Adam P. Goucher

Produce Wechsler of single phase

parent f34d23a6
Pipeline #55801967 passed with stages
in 8 minutes and 19 seconds
#ifndef LIFELIB_VERSION /*
__version__=[x.replace('"', '') for x in '''
*/
#define LIFELIB_VERSION "ll2.2.10"
#define LIFELIB_VERSION "ll2.2.11"
// '''.split() if ('ll' in x)][0][2:]
#endif
......@@ -235,6 +235,12 @@ extern "C"
s.copy(buffer, 2048);
}
void GetWechslerOfPattern(void* pat, char* buffer) {
auto ppat = reinterpret_cast<apg::pattern*>(pat);
std::string s = ppat->phase_wechsler();
s.copy(buffer, 2048);
}
void GetApgcodeOfPattern(void* pat, char* buffer) {
auto ppat = reinterpret_cast<apg::pattern*>(pat);
std::string s = ppat->apgcode();
......
......@@ -581,6 +581,10 @@ namespace apg {
}
}
std::string phase_wechsler() {
return phase_wechsler(rule_symmetries());
}
std::string apgcode() {
/*
* Returns the apgcode of a still-life, oscillator or spaceship:
......
......@@ -76,7 +76,7 @@ restypes = {'DeletePattern': None, 'GetBeszelIndex': c_uint64, 'GetUlqomaIndex':
'GetSolidForPattern': c_void_p, 'GetOriginState': c_uint64, 'GetCells': None, 'SetCells': None,
'CreatePatternFromFile': c_void_p, 'MakeSpaceshipStream': c_void_p, 'GetCompiledVersion': None,
'GetCoords': None, 'GetPatternBound': c_uint64, 'GetSubpops': None, 'Hashsoup': c_void_p,
'FindConnectedComponent': c_void_p, 'GetOneCell': c_void_p, 'CopyPattern': c_void_p}
'FindConnectedComponent': c_void_p, 'GetOneCell': c_void_p, 'CopyPattern': c_void_p, 'GetWechslerOfPattern': None}
def call_underlying(lifelib, fname_and_args):
......
......@@ -371,6 +371,10 @@ class Pattern(object):
return self.lifelib('GetRuleOfPattern', self.ptr, [2048])
def phase_wechsler(self):
return self.lifelib('GetWechslerOfPattern', self.ptr, [2048])
def oscar(self, maxexp=24, eventual_oscillator=True, verbose=True, return_apgcode=False):
logdiam = self.lifelib('GetDiameterOfPattern', self.ptr)
......@@ -669,6 +673,11 @@ class Pattern(object):
populations = [self.lifelib('GetPopulationOfPattern', self.ptr, p) for p in relprimes]
return chinese_remainder(relprimes, populations)
@property
def wechsler(self):
return self.phase_wechsler()
@property
def apgcode(self):
......
......@@ -139,6 +139,8 @@ $.4B$4B$3B$2B!'''
osc = coe.oscar()
self.assertEqual(osc['period'], 16)
self.assertEqual(coe.wechsler, 'gcbgzvgg826frc')
def test_io(self):
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment