Skip to content

Commit f2520e8

Browse files
committed
Compact state only representation
1 parent 1d6d1b3 commit f2520e8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

20.bstate.swift

+6-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var rxIndex: Int?
4242
let verbose = switch CommandLine.arguments.last {
4343
case "-v": 1
4444
case "-vv": 2
45+
case "-vvv": 3
4546
default: 0
4647
}
4748

@@ -158,7 +159,7 @@ func simulate(modules: inout [Module]) -> (Int, Int) {
158159

159160
var (ct, cf) = (0, 0)
160161
func count(_ pulse: Pulse) {
161-
if (verbose > 1) {
162+
if (verbose > 2) {
162163
print(pulse)
163164
}
164165
if pulse.value { ct += 1 }
@@ -190,15 +191,17 @@ func simulate(modules: inout [Module]) -> (Int, Int) {
190191
}
191192
}
192193

193-
if verbose > 0 {
194+
if verbose > 1 {
194195
print("counts", ct, cf)
195196
}
196197
return (ct * cf, rxn ?? 0)
197198
}
198199

199200
func show(modules: [Module]) {
200-
if verbose > 0 {
201+
if verbose > 1 {
201202
print(modules.map({ $0.description }).joined(separator: " · "))
203+
} else if verbose > 0 {
204+
print(modules.compactMap({ $0.stateString }).joined(separator: "·"))
202205
}
203206
}
204207

0 commit comments

Comments
 (0)