Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

A (one dimensional) cellular automaton is a function1 F : Σ → Σ with the property that there is a K > 0 such that F (x)i depends only on the 2K + 1 coordinates xi−K , xi−K+1, . . . , xi−1, xi, xi+1, . . . , xi+K . A periodic point of σ is any x such that σ^p (x) = x for some p ∈ N, and a periodic point of F is any x such that F^q (x) = x for some q ∈ N. Given a cellular automaton F, a point x ∈ Σ is jointly periodic if there are p, q ∈ N such that σ^p (x) = F^q (x) = x, that is, it is a periodic point under both functions.

This project aims to explore the nature of one-dimensional Cellular Automata, in the hope of finding the structure of cellular automata through its periodic points.

2034 views
License: MIT
ubuntu2004
1
/*
2
* Copyright (C) 2004 Bryant Lee
3
*
4
* This file is part of FProbPeriod.
5
*
6
* FProbPeriod is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* FProbPeriod is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with FProbPeriod; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
/*
22
* StorageKeyUInt
23
*
24
* Each unsigned int represents a short string, for example when N = 2,
25
* every bit represents a coordinate. We need an array of UInts because
26
* we might get larger than what 1 UInt can hold.
27
*
28
* Comparisons are allowed and are according
29
* to lexicographic order of the words.
30
*
31
* Written by: Bryant Lee
32
* Date: 9/19/05
33
*/
34
35
#ifndef STORAGE_KEY_UINT_H
36
#define STORAGE_KEY_UINT_H
37
38
extern int UINTSIZE;
39
40
class StorageKeyUInt {
41
public:
42
unsigned int * word;
43
private:
44
unsigned int wordLength;
45
46
//compare
47
//if > m, return positive
48
//if < m, return negative
49
//if == m, return 0
50
int compareTo(const StorageKeyUInt &m) const {
51
unsigned int i = 0;
52
int ret = 0;
53
54
for(i = 0; i < wordLength; i++) {
55
if(word[i] != m.word[i]) {
56
ret = word[i] - m.word[i];
57
break;
58
}
59
}
60
61
return ret;
62
};
63
64
public:
65
//no argument constructor
66
StorageKeyUInt() {
67
word = NULL;
68
wordLength = 0;
69
};
70
71
//primary constructor
72
StorageKeyUInt(unsigned int *inWord, unsigned int inLength) {
73
unsigned int i = 0;
74
75
wordLength = inLength;
76
word = new unsigned int[wordLength];
77
78
//copy
79
for(i = 0; i < wordLength; i++) {
80
word[i] = inWord[i];
81
}
82
};
83
84
//copy constructor
85
StorageKeyUInt(const StorageKeyUInt &m) {
86
word = NULL;
87
wordLength = 0;
88
89
operator=(m);
90
};
91
92
//destructor
93
~StorageKeyUInt() {
94
delete[] word;
95
};
96
97
//operator =
98
const StorageKeyUInt & operator=(const StorageKeyUInt &right) {
99
unsigned int i = 0;
100
101
delete[] word; //delete the old word
102
103
wordLength = right.wordLength;
104
word = new unsigned int[wordLength];
105
106
//copy
107
for(i = 0; i < wordLength; i++) {
108
word[i] = right.word[i];
109
}
110
111
return (*this);
112
};
113
114
//relational operators
115
bool operator==(const StorageKeyUInt &right) const {
116
return (compareTo(right) == 0);
117
};
118
119
bool operator!=(const StorageKeyUInt &right) const {
120
return (compareTo(right) != 0);
121
};
122
123
bool operator<(const StorageKeyUInt &right) const {
124
return (compareTo(right) < 0);
125
};
126
127
bool operator>(const StorageKeyUInt &right) const {
128
return (compareTo(right) > 0);
129
};
130
131
bool operator<=(const StorageKeyUInt &right) const {
132
return (compareTo(right) <= 0);
133
};
134
135
bool operator>=(const StorageKeyUInt &right) const {
136
return (compareTo(right) >= 0);
137
};
138
139
//print
140
void print() const {
141
//NOTE: this will print the word, along with extraneous trailing 0's.
142
printUIntArray(word, wordLength * UINTSIZE);
143
};
144
};
145
146
#endif
147
148