function to print the current state