Chiffres
Chiffres is a sentient economic system where value is alive. Certain in circulation, it mutates at rest in a cosmic gamble influenced by ethical actions and natural cycles. It's a currency that remembers its past, reacts to the collective present, and bets on the future.
Loading...
Searching...
No Matches
Chiffre.h
1#pragma once
2
3#include <cstdint>
4#include <cmath>
5#include <stdexcept>
6#include <random>
7#include <algorithm>
8
9namespace Chiffres {
15 enum class State {
17 Circulation,
19 Rest
20 };
21
22
32 struct EthicsScore {
34 double score = 0.0;
35 };
36
37
45 struct Memory {
47 double volatility_bias = 1.0;
49 double stability_bias = 1.0;
51 std::uint64_t events = 0;
52 };
53
67 struct CyclePhase {
69 double phase = 0.0;
70 };
71
72
90 class Chiffre {
91 public:
98 explicit Chiffre(double initial = 0.0);
99
109 void spend(double amount);
110
120 void receive(double amount);
121
140 double mutate(const EthicsScore &ethics, const CyclePhase &cycle);
141
143 void set_state(State state) noexcept;
144
146 [[nodiscard]] State state() const noexcept;
147
149 [[nodiscard]] double total() const noexcept;
150
152 [[nodiscard]] const Memory &memory() const noexcept;
153
166 void record_flow(double amount, bool incoming);
167
168 private:
185 [[nodiscard]] double draw_mutation_factor(const EthicsScore &ethics, const CyclePhase &cycle) const;
186
188 State state_ = State::Circulation;
189
191 double total_;
192
194 Memory mem_;
195
197 static inline std::mt19937_64 rng{std::random_device{}()};
198 };
199}
Chiffre(double initial=0.0)
Construct a wallet with an initial amount.
Definition Chiffre.cpp:23
const Memory & memory() const noexcept
Access memory snapshot (read-only).
Definition Chiffre.cpp:19
void set_state(State state) noexcept
Set the current wallet state (Circulation or Rest).
Definition Chiffre.cpp:90
double total() const noexcept
Get current balance.
Definition Chiffre.cpp:15
State state() const noexcept
Get current state.
Definition Chiffre.cpp:27
void record_flow(double amount, bool incoming)
Record a deterministic flow (called internally by spend/receive).
Definition Chiffre.cpp:32
void receive(double amount)
Receive into the wallet (deterministic).
Definition Chiffre.cpp:46
double mutate(const EthicsScore &ethics, const CyclePhase &cycle)
Trigger a mutation when the wallet is at rest.
Definition Chiffre.cpp:75
void spend(double amount)
Spend from the wallet (deterministic).
Definition Chiffre.cpp:40
Position within a natural or symbolic cycle.
Definition Chiffre.h:67
double phase
< Normalized cycle position, [0,1].
Definition Chiffre.h:69
Ethical score associated with an actor or portfolio.
Definition Chiffre.h:32
double score
< Range expected in [-1.0, +1.0].
Definition Chiffre.h:34
Memory of past wallet behavior.
Definition Chiffre.h:45
double volatility_bias
amplifies variance in future mutations.
Definition Chiffre.h:47
double stability_bias
damps shocks, makes mutations gentler.
Definition Chiffre.h:49
std::uint64_t events
counts the numbers of recorded events.
Definition Chiffre.h:51