| 20 | } |
| 21 | |
| 22 | func NewStepper() *Stepper { |
| 23 | s := new(Stepper) |
| 24 | |
| 25 | for i, _ := range s.bits { |
| 26 | s.bits[i] = *NewBit() |
| 27 | } |
| 28 | |
| 29 | s.resetNotGate = *circuit.NewNOTGate() |
| 30 | s.clockInNotGate = *circuit.NewNOTGate() |
| 31 | for i, _ := range s.inputOrGates { |
| 32 | s.inputOrGates[i] = *circuit.NewORGate() |
| 33 | } |
| 34 | |
| 35 | for i, _ := range s.outputAndGates { |
| 36 | s.outputAndGates[i] = *circuit.NewANDGate() |
| 37 | } |
| 38 | s.outputOrGate = *circuit.NewORGate() |
| 39 | |
| 40 | for i, _ := range s.outputNotGates { |
| 41 | s.outputNotGates[i] = *circuit.NewNOTGate() |
| 42 | } |
| 43 | |
| 44 | return s |
| 45 | } |
| 46 | |
| 47 | func (s *Stepper) GetOutputWire(index int) bool { |
| 48 | return s.outputs[index].Get() |