MCPcopy Create free account
hub / github.com/IntegralPilot/wasm_os / step

Method step

apps/collatz/src/collatz.cpp:8–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "collatz.hpp"
7
8void CollatzSolver::step() {
9 hops++;
10 if (algo.useOnlyOddNumbers) {
11 hops++;
12 }
13 if (stepNumber % 2 == 0) {
14 // it is even
15 stepNumber /= 2;
16 } else {
17 // it is odd
18 stepNumber *= 3;
19 stepNumber++;
20 }
21}
22
23bool CollatzSolver::solve() {
24 if (algo.useOnlyOddNumbers && currentNumber % 2 == 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected