Writing interactive programmes