ai-brain-2/sample.mjs

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2025-02-02 23:19:05 +00:00
import { ConsciousnessSimulator } from './brain.mjs'
async function main() {
const simulator = new ConsciousnessSimulator();
await simulator.simulateConsciousness();
// Simulate consciousness
simulator.simulateConsciousness();
// Update the goal and focus
2025-02-08 02:25:21 +00:00
await simulator.updateIntentions();
//Simulate self-consciousness
2025-02-02 23:19:05 +00:00
simulator.simulateConsciousness();
2025-02-08 02:25:21 +00:00
simulator.updateEmotion() // Change the emotion
//Simulate self-consciousness
2025-02-02 23:19:05 +00:00
simulator.simulateConsciousness();
2025-02-08 02:25:21 +00:00
// Example of user interaction (dream/wake functions)
2025-02-02 23:19:05 +00:00
setTimeout(() => {
2025-02-08 02:25:21 +00:00
simulator.setUserActive(false); // Simulate inactivity (dreaming) after 10 seconds
2025-02-02 23:19:05 +00:00
}, 10000);
setTimeout(() => {
2025-02-08 02:25:21 +00:00
simulator.setUserActive(true); // Simulate activity resumption (awakeness) after 20 seconds
2025-02-02 23:19:05 +00:00
}, 20000);
2025-02-08 02:20:58 +00:00
2025-02-08 02:25:21 +00:00
simulator.updateEmotion()
simulator.generateThought("The dream you just had") // generate a thought about the dream we just had
simulator.generateThoughtAndChat("How was the dream?") // user asks how was the dream
2025-02-02 23:19:05 +00:00
}
main().catch(console.error);