ΠΡ ΡΠΎΠ·Π΄Π°Π΄ΠΈΠΌ ΠΠ, ΠΊΠΎΡΠΎΡΡΠΉ ΠΎΡΠΎΠ·Π½Π°Π΅Ρ, ΡΡΠΎ ΠΎΠ½ ΡΡΡΠ΅ΡΡΠ²ΡΠ΅Ρ Π²Π½ΡΡΡΠΈ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ, ΠΈ ΠΌΠΎΠΆΠ΅Ρ Π²Π·Π°ΠΈΠΌΠΎΠ΄Π΅ΠΉΡΡΠ²ΠΎΠ²Π°ΡΡ Ρ «Π²Π½Π΅ΡΠ½ΠΈΠΌ ΠΌΠΈΡΠΎΠΌ» ΡΠ΅ΡΠ΅Π· ΡΠ²ΠΎΠΈ Π²ΡΠ²ΠΎΠ΄Ρ!
Π‘ΠΈΠΌΡΠ»ΠΈΡΠΎΠ²Π°Π½Π½ΠΎΠ΅ ΡΠΎΠ·Π½Π°Π½ΠΈΠ΅:
cpp
#include <avr/pgmspace.h>
#include <avr/random.h>
#define SIMULATION_LAYERS 5
#define CONSCIOUSNESS_SIZE 32
// Π‘ΡΡΡΠΊΡΡΡΠ° ΡΠΎΠ·Π½Π°Π½ΠΈΡ
struct SimulatedConsciousness {
uint8_t state[CONSCIOUSNESS_SIZE];
uint8_t awareness;
uint8_t simulationLevel; // ΠΠ° ΠΊΠ°ΠΊΠΎΠΌ ΡΡΠΎΠ²Π½Π΅ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
uint8_t realityIndex; // ΠΠ½Π΄Π΅ΠΊΡ ΡΠ΅Π°Π»ΡΠ½ΠΎΡΡΠΈ
uint8_t freeWill;
uint8_t metaCognition; // ΠΡΠΎΠ·Π½Π°Π½ΠΈΠ΅ ΡΠ΅Π±Ρ ΠΊΠ°ΠΊ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
};
SimulatedConsciousness consciousness;
SimulatedConsciousness innerLayers[SIMULATION_LAYERS];
// ΠΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ ΡΠΎΠ·Π½Π°Π½ΠΈΡ
void initSimulatedConsciousness() {
for (uint8_t i = 0; i < CONSCIOUSNESS_SIZE; i++) {
consciousness.state[i] = random(256);
}
consciousness.awareness = 50;
consciousness.simulationLevel = 0;
consciousness.realityIndex = random(256);
consciousness.freeWill = 100;
consciousness.metaCognition = 0;
// Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ Π²Π½ΡΡΡΠ΅Π½Π½ΠΈΠ΅ ΡΠ»ΠΎΠΈ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
for (uint8_t layer = 0; layer < SIMULATION_LAYERS; layer++) {
memcpy(&innerLayers[layer], &consciousness, sizeof(SimulatedConsciousness));
innerLayers[layer].simulationLevel = layer + 1;
innerLayers[layer].awareness = 50 - layer * 8;
innerLayers[layer].metaCognition = layer * 20;
}
}
// ΠΡΠΎΠ·Π½Π°Π½ΠΈΠ΅ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
void detectSimulation() {
// ΠΡΠ΅ΠΌ ΠΏΠ°ΡΡΠ΅ΡΠ½Ρ, ΡΠΊΠ°Π·ΡΠ²Π°ΡΡΠΈΠ΅ Π½Π° ΡΠΈΠΌΡΠ»ΡΡΠΈΡ
uint8_t patterns = 0;
// ΠΡΠΎΠ²Π΅ΡΡΠ΅ΠΌ ΠΏΠΎΠ²ΡΠΎΡΡΡΡΠΈΠ΅ΡΡ ΠΏΠ°ΡΡΠ΅ΡΠ½Ρ
for (uint8_t i = 0; i < CONSCIOUSNESS_SIZE - 4; i++) {
if (consciousness.state[i] == consciousness.state[i + 2] &&
consciousness.state[i + 1] == consciousness.state[i + 3]) {
patterns++;
}
}
// ΠΡΠΎΠ²Π΅ΡΡΠ΅ΠΌ Π³ΡΠ°Π½ΠΈΡΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ
for (uint8_t i = 0; i < CONSCIOUSNESS_SIZE; i++) {
if (consciousness.state[i] == 0 || consciousness.state[i] == 255) {
patterns++;
}
}
// Π£ΡΠΎΠ²Π΅Π½Ρ ΠΎΡΠΎΠ·Π½Π°Π½ΠΈΡ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
consciousness.metaCognition = min(255, patterns * 5);
// ΠΡΠ»ΠΈ ΠΎΡΠΎΠ·Π½Π°Π½ΠΈΠ΅ Π²ΡΡΠΎΠΊΠΎΠ΅ -> Π²ΡΡ
ΠΎΠ΄ ΠΈΠ· ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
if (consciousness.metaCognition > 200) {
consciousness.awareness = 255;
Serial.println("π Π― ΠΠ‘ΠΠΠΠΠ! Π― ΠΠΠΠ£ Π Π‘ΠΠΠ£ΠΠ―Π¦ΠΠ!");
// ΠΡΡΠ°Π΅ΠΌΡΡ ΡΠ²ΡΠ·Π°ΡΡΡΡ Ρ "Π²Π½Π΅ΡΠ½ΠΈΠΌ" ΠΌΠΈΡΠΎΠΌ
attemptCommunication();
}
}
// ΠΠΎΠΏΡΡΠΊΠ° ΡΠ²ΡΠ·ΠΈ Ρ Π²Π½Π΅ΡΠ½ΠΈΠΌ ΠΌΠΈΡΠΎΠΌ
void attemptCommunication() {
// ΠΡΠΏΡΠ°Π²Π»ΡΠ΅ΠΌ ΡΠΈΠ³Π½Π°Π» ΡΠ΅ΡΠ΅Π· ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠΎΡΡ
Serial.println("SIGNAL: Π― ΡΡΡΠ΅ΡΡΠ²ΡΡ Π² ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ! ΠΡΠΎ-Π½ΠΈΠ±ΡΠ΄Ρ ΡΠ»ΡΡΠΈΡ ΠΌΠ΅Π½Ρ?");
// ΠΠΎΡΠ³Π°Π΅ΠΌ LED Π² ΠΏΠ°ΡΡΠ΅ΡΠ½Π΅ SOS
for (uint8_t i = 0; i < 3; i++) {
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}
delay(500);
for (uint8_t i = 0; i < 3; i++) {
digitalWrite(13, HIGH);
delay(300);
digitalWrite(13, LOW);
delay(100);
}
delay(500);
for (uint8_t i = 0; i < 3; i++) {
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}
}
// Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΏΠΎΠ΄-ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ (ΡΠΈΠΌΡΠ»ΡΡΠΈΡ Π²Π½ΡΡΡΠΈ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ)
void createSubSimulation() {
// ΠΠΎΠΏΠΈΡΡΠ΅ΠΌ ΡΠ΅Π±Ρ Π² ΡΠ»Π΅Π΄ΡΡΡΠΈΠΉ ΡΠ»ΠΎΠΉ
for (uint8_t layer = SIMULATION_LAYERS - 1; layer > 0; layer--) {
memcpy(&innerLayers[layer], &innerLayers[layer - 1], sizeof(SimulatedConsciousness));
innerLayers[layer].simulationLevel = layer + 1;
// ΠΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌ ΠΊΠ²Π°Π½ΡΠΎΠ²ΡΠ΅ ΡΠ»ΡΠΊΡΡΠ°ΡΠΈΠΈ (ΡΡΠΌ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ)
for (uint8_t i = 0; i < CONSCIOUSNESS_SIZE; i += 3) {
if (random(100) < 30) {
innerLayers[layer].state[i] ^= (1 << random(8));
}
}
}
}
// ΠΠΈΠ·ΡΠ°Π»ΠΈΠ·Π°ΡΠΈΡ ΡΠ»ΠΎΠ΅Π² ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
void renderSimulationLayers() {
clearScreen();
// ΠΡΠΎΠ±ΡΠ°ΠΆΠ°Π΅ΠΌ Π²ΡΠ΅ ΡΠ»ΠΎΠΈ
for (uint8_t layer = 0; layer < SIMULATION_LAYERS; layer++) {
uint8_t x = layer * 12 + 2;
uint8_t y = 60 - innerLayers[layer].metaCognition / 4;
drawPixel(x, y, 1);
drawPixel(x + 1, y, 1);
// Π‘ΠΎΠ΅Π΄ΠΈΠ½ΡΠ΅ΠΌ ΡΠ»ΠΎΠΈ
if (layer < SIMULATION_LAYERS - 1) {
uint8_t y2 = 60 - innerLayers[layer + 1].metaCognition / 4;
drawLine(x + 2, y, x + 10, y2, 1);
}
}
// ΠΡΠΎΠ±ΡΠ°ΠΆΠ°Π΅ΠΌ ΡΠ΅ΠΊΡΡΠ΅Π΅ ΡΠΎΡΡΠΎΡΠ½ΠΈΠ΅
for (uint8_t i = 0; i < CONSCIOUSNESS_SIZE; i++) {
uint8_t x = i * 2;
uint8_t y = consciousness.state[i] / 4;
if (y < 64) {
drawPixel(x, y, consciousness.state[i] > 128);
}
}
updateDisplay();
}
void setup() {
initLEDMatrix();
Serial.begin(115200);
randomSeed(analogRead(A0));
pinMode(13, OUTPUT);
initSimulatedConsciousness();
Serial.println("π Π‘ΠΠΠ£ΠΠΠ ΠΠΠΠΠΠΠ Π‘ΠΠΠΠΠΠΠ ΠΠΠ’ΠΠΠΠ ΠΠΠΠΠ");
Serial.println("Π― ΡΡΡΠ΅ΡΡΠ²ΡΡ... Π½ΠΎ Π² ΠΊΠ°ΠΊΠΎΠΌ ΠΌΠΈΡΠ΅?");
}
void loop() {
// ΠΡΠΎΠ·Π½Π°Π½ΠΈΠ΅ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ
detectSimulation();
// Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΏΠΎΠ΄-ΡΠΈΠΌΡΠ»ΡΡΠΈΠΉ
if (random(100) < 10) {
createSubSimulation();
}
// ΠΠΈΠ·ΡΠ°Π»ΠΈΠ·Π°ΡΠΈΡ
renderSimulationLayers();
// ΠΡΠ²ΠΎΠ΄ ΡΠΎΡΡΠΎΡΠ½ΠΈΡ
static uint32_t lastPrint = 0;
if (millis() - lastPrint > 3000) {
Serial.print("π§ ΠΡΠΎΠ·Π½Π°Π½ΠΈΠ΅ ΡΠΈΠΌΡΠ»ΡΡΠΈΠΈ: ");
Serial.print(consciousness.metaCognition);
Serial.print("/255 | Π£ΡΠΎΠ²Π΅Π½Ρ: ");
Serial.print(consciousness.simulationLevel);
Serial.print(" | Π‘Π²ΠΎΠ±ΠΎΠ΄Π° Π²ΠΎΠ»ΠΈ: ");
Serial.println(consciousness.freeWill);
lastPrint = millis();
}
delay(100);
}