User: Lets imagine a very simple computer , one which does only the following : increment / decrement / show / set a number. I want you to give a detailed overview of the implementation in form of a Mechanical computer.
Assistant: Creating a mechanical computer that can increment, decrement, show, and set a number involves designing a series of mechanical components that can physically represent and manipulate numerical values. Here's a detailed overview of how such a computer might be designed:

### Components Overview

1. **Counters as Registers**: The core of the mechanical computer will be a register represented by a series of mechanical gears or dials, which can be incremented or decremented. Each gear represents a single digit in a number (e.g., units, tens, hundreds).

2. **Input Interface**: This includes controls for incrementing, decrementing, showing, and setting values. These controls manipulate the gear mechanism.

3. **Display System**: An interface that shows the current number, typically as a series of numbers corresponding to the state of the gears.

4. **Control Mechanisms**: Levers or knobs connected to cams and ratchets that allow a user to perform each of the four operations.

### Detailed Design and Operation

#### 1. **Counter/Storage System**
- **Gears/Dials**: Use a set of interconnected gears where each gear represents a digit. For example, for a two-digit number, you will have two gears; the first for units and the second for tens.
- **Connections**: Each gear is connected to allow carrying over when a digit surpasses its maximum (e.g., from 9 to 0), similar to the odometer in a car.

#### 2. **Increment Mechanism**
- **Control**: A lever that, when pushed, rotates the unit gear by one position.
- **Ratchet and Pawl**: This mechanism ensures that the gear moves precisely one increment at a time and prevents backward motion unless decremented intentionally.

#### 3. **Decrement Mechanism**
- **Control**: Another lever is dedicated to rotating the unit gear backward.
- **Ratchet and Pawl**: A similar system is used to manage decrements, ensuring correct and precise gear movements.

#### 4. **Show Mechanism**
- The current state of the gears can be directly observed via a window or panel.
- **Magnification Lens**: For better visibility, lenses over each gear can magnify the numbers being displayed.

#### 5. **Set Mechanism**
- **Manual Override**: Gears can be manually rotated to a specific position using a knob or rotating handle, bypassing the increment/decrement function.
- **Locking Mechanism**: Once set, a lock can prevent unintentional movements until unlocking.

### Mechanical Interactions
- **Cams and Followers**: Convert rotary motion from levers into linear or other motions required to move gears.
- **Inter-Gear Operation**: If incrementing the units gear shifts it from 9 to 0, a tooth or lever on the gear advances the tens gear by one position.
- **Stops and Limits**: Mechanical stops prevent gears from rotating beyond their designed maximum, while limits guide levers within operational bounds.

### Calibration and Maintenance
- **Calibration**: Ensure all gears are correctly aligned initially and periodically check to correct for any drift due to wear.
- **Lubrication**: Regularly apply suitable lubricants to reduce friction and wear in moving parts.
- **Inspections**: Conduct routine checks to ensure there aren’t broken or worn-out components, particularly in the ratchet and pawl system which experiences high stress.

### Example Usage
- To **increment**, the user pushes the increment lever, which advances the unit gear by one position, mechanically adding to the stored number.
- To **decrement**, the user pulls the decrement lever, reversing the unit gear by one, consequently subtracting from the current value.
- To **set** a specific number, the user rotates the designated knobs to align each gear with the desired digit before locking them in place.
- To **show** the number, the user views the aligned digits through the mechanical window or lens to read the represented number.

This design ensures that the mechanical computer operates smoothly and accurately, executing simple arithmetic operations while providing clear feedback via its display system.
User: Here is a simple simulation of said device in python :

number = 0
def inc(number=number):
    number += 1
    print("Number Incremented")

def dec(number=number):
    number -= 1
    print("Number Decremented")

def show(number=number):
    print("Current Value :",number)

def set(value,number=number):
    if value >= 0:
        number = value

inc()
inc()
show()
set(8)
show()
dec()
show()

- but it seems that i cant change global variable number from within functions inc / dec / set . how can i fix this
Assistant: