Skip to content

Commit

Permalink
added total memory used count in analysis output
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Sep 6, 2015
1 parent a00bf72 commit ecff800
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/groovy/net/zomis/brainf/analyze/Brainalyze.groovy
Expand Up @@ -68,6 +68,7 @@ class Brainalyze implements BrainfuckListener {
})
println()
println 'Tape summary'
int totalUsed = 0
for (int i = 0; i < tapeValues.length; i++) {
int value = tapeValues[i]
String hexAddress = String.format("%04X", i)
Expand All @@ -80,7 +81,12 @@ class Brainalyze implements BrainfuckListener {
String reads = String.format("%6d", memoryRead[i]);
String writes = String.format("%6d", memoryWrite[i]);
println "Hex $hexAddress\tDec $decAddress\tValue $decValue '$chrValue' \tReads: $reads\tWrites: $writes"
if (memoryRead[i] > 0 || memoryWrite[i] > 0) {
totalUsed++
}
}
println "Total memory used = $totalUsed"
println()
println 'Memory reads'
println memoryRead
println()
Expand Down

0 comments on commit ecff800

Please sign in to comment.