generate-excuse.lisp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. (defvar *first-column*
  2. '("Temporary" "Intermittant" "Partial" "Redundant" "Total" "Multiplexed"
  3. "Inherent" "Duplicated" "Dual-Homed" "Synchronous" "Bidirectional"
  4. "Serial" "Asynchronous" "Multiple" "Replicated" "Non-Replicated"
  5. "Unregistered" "Non-Specific" "Generic" "Migrated" "Localised" "Resignalled"
  6. "Dereferenced" "Nullified" "Aborted" "Serious" "Minor" "Major" "Extraneous"
  7. "Illegal" "Insufficient" "Viral" "Unsupported" "Outmoded" "Legacy" "Permanent"
  8. "Invalid" "Deprecated" "Virtual" "Unreportable" "Undetermined" "Undiagnosable"
  9. "Unfiltered" "Static" "Dynamic" "Delayed" "Immediate" "Nonfatal" "Fatal" "Non-Valid"
  10. "Unvalidated" "Non-Static" "Unreplicatable" "Non-Serious"))
  11. (defvar *first-length* (length *first-column*))
  12. (defvar *second-column*
  13. '("Array" "Systems" "Hardware" "Software" "Firmware" "Backplane" "Logic-Subsystem"
  14. "Integrity" "Subsystem" "Memory" "Comms" "Integrity" "Checksum" "Protocol" "Parity"
  15. "Bus" "Timing" "Synchronisation" "Topology" "Transmission" "Reception" "Stack"
  16. "Framing" "Code" "Programming" "Peripheral" "Environmental" "Loading" "Operation"
  17. "Parameter" "Syntax" "Initialisation" "Execution" "Resource" "Encryption" "Decryption"
  18. "File" "Precondition" "Authentication" "Paging" "Swapfile" "Service" "Gateway" "Request"
  19. "Proxy" "Media" "Registry" "Configuration" "Metadata" "Streaming" "Retrieval" "Installation"
  20. "Library" "Handler"))
  21. (defvar *second-length* (length *second-column*))
  22. (defvar *third-column*
  23. '("Interruption" "Destabilisation" "Destruction" "Desynchronisation" "Failure" "Dereferencing"
  24. "Overflow" "Underflow" "NMI" "Interrupt" "Corruption" "Anomoly" "Seizure" "Override" "Reclock"
  25. "Rejection" "Invalidation" "Halt" "Exhaustion" "Infection" "Incompatibility" "Timeout" "Expiry"
  26. "Unavailability" "Bug" "Condition" "Crash" "Dump" "Crashdump" "Stackdump" "Problem" "Lockout"))
  27. (defvar *third-length* (length *third-column*))
  28. (defvar *optional-fourth-column*
  29. '("Error" "Problem" "Warning" "Signal" "Flag"))
  30. (defvar *fourth-length* (length *optional-fourth-column*))
  31. (defvar *initialized-p* nil)
  32. (defun ensure-positive (number)
  33. (if (< number 0)
  34. (- number)
  35. number))
  36. (defun ensure-initialized ()
  37. (when (not *initialized-p*)
  38. (setq *random-state* (make-random-state t)
  39. *initialized-p* t)
  40. (dotimes (number (ensure-positive (random 100)))
  41. (dotimes (other (ensure-positive (random (1+ number))))
  42. (dotimes (yet-another (ensure-positive (random (1+ other))))
  43. (ensure-positive (random (1+ yet-another))))))))
  44. (defun get-excuse (stream)
  45. (ensure-initialized)
  46. (let ((first-word (nth (ensure-positive (1- (random *first-length*))) *first-column*))
  47. (second-word (nth (ensure-positive (1- (random *second-length*))) *second-column*))
  48. (third-word (nth (ensure-positive (1- (random *third-length*))) *third-column*))
  49. (fourth-word (nth (ensure-positive (1- (random *fourth-length*))) *optional-fourth-column*)))
  50. (format stream "~a ~a ~a (~a)~%" first-word second-word third-word fourth-word)))
  51. (defun main ()
  52. (let ((count (if (not (null (second *posix-argv*)))
  53. (parse-integer (second *posix-argv*) :junk-allowed t)
  54. 1)))
  55. (dotimes (n count)
  56. (declare (ignorable n))
  57. (get-excuse *standard-output*))))