Skip to content

Instantly share code, notes, and snippets.

@dmberry
Created February 20, 2012 11:21
Show Gist options
  • Save dmberry/1868847 to your computer and use it in GitHub Desktop.
Save dmberry/1868847 to your computer and use it in GitHub Desktop.
Shakespeare Insult Generator 2.1
# ------------------------------------------------------
#
# Shakespeare Insult Generator 2.1
#
# The program generates a random Shakespearean insult.
# Based on the original Perl code by Stephen Ramsay
#
# Written by David M. Berry
# 09 February 2012
#
# Modified 20/12/2012 to incorporate true typefaces into
# display of text.
#
# For the Critical Code Workshop 2012
#
# Written in Zajal ( http://zajal.cc )
#
# ------------------------------------------------------
# ------------------------------------------------------
# Here be arrays
# ------------------------------------------------------
firstarray = ["artless", "bawdy", "beslubbering", "bootless", "churlish","cockered", "clouted", "craven","currish", "dankish","dissembling", "droning","errant", "fawning","fobbing", "froward","frothy", "gleeking", "goatish", "gorbellied","impertinent", "infectious", "jarring", "loggerheaded","lumpish", "mammering", "mangled", "mewling","paunchy", "pribbling", "puking", "puny","qualling","rank", "reeky","roguish","ruttish", "saucy", "spleeny", "spongy","surly", "tottering", "unmuzzled","vain","venomed", "villainous", "warped", "wayward","weedy", "yeasty", "cullionly","fusty","caluminous", "wimpled","burly-boned", "misbegotten","odiferous", "poisonous", "fishified","Wart-necked"]
secondarray = ["base-court", "bat-fowling", "beef-witted","beetle-headed","boil-brained", "clapper-clawed", "clay-brained", "common-kissing","crook-pated","dismal-dreaming", "dizzy-eyed", "doghearted","dread-bolted", "earth-vexing","elf-skinned","fat-kidneyed","fen-sucked", "flap-mouthed","fly-bitten", "folly-fallen","fool-born", "full-gorged", "guts-griping", "half-faced","hasty-witted", "hedge-born", "hell-hated", "idle-headed","ill-breeding", "ill-nurtured","knotty-pated", "milk-livered","motley-minded", "onion-eyed", "plume-plucked", "pottle-deep","pox-marked", "reeling-ripe","rough-hewn", "rude-growing","rump-fed", "shard-borne", "sheep-biting", "spur-galled","swag-bellied", "tardy-gaited","tickle-brained", "toad-spotted","urchin-snouted", "weather-bitten", "whoreson", "malmsey-nosed","rampallian", "lily-livered","scurvy-valiant", "brazen-faced","unwash'd", "bunch-back'd","leaden-footed", "muddy-mettled"]
thirdarray = ["apple-john", "baggage", "barnacle","bladder","boar-pig","bugbear", "bum-bailey", "canker-blossom","clack-dish", "clotpole", "coxcomb", "codpiece","death-token", "dewberry", "flap-dragon", "flax-wench","flirt-gill", "foot-licker", "fustilarian", "giglet","gudgeon", "haggard", "harpy", "hedge-pig","horn-beast", "hugger-mugger", "joithead","lewdster","lout","maggot-pie","malt-worm", "mammet","measle", "minnow","miscreant", "moldwarp","mumble-news", "nut-hook", "pigeon-egg", "pignut","puttock", "pumpion", "ratsbane","scut","skainsmate", "strumpet", "varlot", "vassal","whey-face", "wagtail", "knave", "blind-worm","popinjay","scullian", "jolt-head", "malcontent","devil-monk", "toad", "rascal", "Basket-Cockle"]
# ------------------------------------------------------
# Here be font declarations (note these fonts need to be installed
# Folio font called ilshake.ttf: http://www.dafont.com/the-illinois-shakespeare-festival.d694
# ------------------------------------------------------
impact = Font.new "/Library/Fonts/impact.ttf", 14 # here, 14 is the size of the font
impact2 = Font.new "/Library/Fonts/impact.ttf", 12 # here, 12 is the size of the font
folio12 = Font.new "/Library/Fonts/ilshake.ttf", 12 # here, 12 is the size of the font
folio14 = Font.new "/Library/Fonts/ilshake.ttf", 14 # here, 14 is the size of the font
folio16 = Font.new "/Library/Fonts/ilshake.ttf", 16 # here, 16 is the size of the font
# ------------------------------------------------------
# Here be variable declarations
# ------------------------------------------------------
word1 = ""
word2 = ""
word3 = ""
# ------------------------------------------------------
# jpg of shkespeare from http://blog.someassemblyrequired.com/wp-content/uploads/2008/05/shakespeare.jpg
# this image is automatically pulled from the web :-)
# ------------------------------------------------------
shakespeare = Image.new "http://blog.someassemblyrequired.com/wp-content/uploads/2008/05/shakespeare.jpg"
# ------------------------------------------------------
# Here be the setup initialiser (constructor?)
# ------------------------------------------------------
setup do
word1 = firstarray[rand(firstarray.count)] + " "
word2 = secondarray[rand(secondarray.count)] + " "
word3 = thirdarray[rand(thirdarray.count)]
background 200,190,160 # a nice bookish background
end
# ------------------------------------------------------
# Here be the main loop called 'draw'
# ------------------------------------------------------
draw do
shakespeare.draw 10,350, 100, 130
color :black
text ""
impact.draw "-----------------------------------------------------------------------------", 10, 30
color :black
folio12.draw "A New Edition of Stephen Ramsay's World Famous:", 10, 50
folio14.draw "Shakespeare Insult Generator", 80, 80
color :black
impact.draw "-----------------------------------------------------------------------------", 10, 110
color :black
folio16.draw "Thou "+word1+word2+word3, 10,240 # folio font doesn't have a '!'
color :white
folio12.draw " Press mouse for more....", 70,460
end
# ------------------------------------------------------
# Here be the event method for 'mouse_down'
# ------------------------------------------------------
mouse_down do
word1 = firstarray[rand(firstarray.count)] + " "
word2 = secondarray[rand(secondarray.count)] + " "
word3 = thirdarray[rand(thirdarray.count)]
end
# ------------------------------------------------------
# Here be the end
# ------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment