|
|
@@ -73,6 +73,23 @@ func (m *symbol) empty(x int, y int) bool {
|
|
|
return !m.isUsed[y+m.quietZoneSize][x+m.quietZoneSize]
|
|
|
}
|
|
|
|
|
|
+// numEmptyModules returns the number of empty modules.
|
|
|
+//
|
|
|
+// Initially numEmptyModules is symbolSize * symbolSize. After every module has
|
|
|
+// been set (to either true or false), the number of empty modules is zero.
|
|
|
+func (m *symbol) numEmptyModules() int {
|
|
|
+ var count int
|
|
|
+ for y := 0; y < m.symbolSize; y++ {
|
|
|
+ for x := 0; x < m.symbolSize; x++ {
|
|
|
+ if !m.isUsed[y + m.quietZoneSize][x + m.quietZoneSize] {
|
|
|
+ count++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return count
|
|
|
+}
|
|
|
+
|
|
|
// set sets the module at (x, y) to v.
|
|
|
func (m *symbol) set(x int, y int, v bool) {
|
|
|
m.module[y+m.quietZoneSize][x+m.quietZoneSize] = v
|