Update src/design/algorithms.md
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
misterfinigan 2024-03-15 08:36:45 -04:00
parent 3634559f6a
commit 2733401cc2

View file

@ -1,11 +1,38 @@
# Algorithms
## Calculating action cards on the game
## Calculating action cards effects on the game
```rust
//After the debate phase, when all card challenges and supports have been resolved…
supporting_influence<opposing_influence {
do_not_resolve_effects();
else {
match card.effect {
progress => match beneficiary{/* Checks player position against card position */}
influence => player.influence += card.effect.effect_number;
/*there are many other effects, not all of which I am listing.*/
}
}
```
## Calculating influence after turns
## Calculating player position effects on the game
Depending on the position, the effects will be resolved in much the same way.
Each position has an effect which might be resolved at different times. For example, the minister of propaganda gains influence based on his public opinion. His effect would be resolved much like this:
```rust
//resolved before influence is collected
if PropagandaChief.exists() {
PropagandaChief.influence += (PropagandaChief.public_view / 2);
}
```
Or the economic minister, who gets influence gain for every 7 cards successfully played.
```rust
//resolved after the debate phase
if EconomyChief.exists() {
if EconomyChief.played_card() && EconomyChief.played_cards%7 == 0{
EconomyChief.influence_gain++;
}
}
```
The other positions do not yet have specific effects, but they will be done in a similar way.