Consciousness is just a feature of that algorithm, in which it just becomes aware of its own existence and then ponder its implications.