Nanowire nanocomputer as a finite-state machine