Permalink
Browse files

First commit

  • Loading branch information...
zachwill committed May 29, 2011
0 parents commit 71ba37e5d00e9848a07ba408e9929ad21ccfcce2
Showing with 174,163 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +56 −0 README.md
  3. +260 −0 files/images.txt
  4. +2 −0 files/images/README-IMAGES
  5. +173,528 −0 files/word_list.txt
  6. +158 −0 rebus.py
  7. +124 −0 test.py
  8. +34 −0 utils.py
@@ -0,0 +1 @@
+*.png
@@ -0,0 +1,56 @@
+Rebus Generator
+===============
+
+From [ITA puzzles](http://goo.gl/F0z1W).
+
+
+Instructions
+------------
+
+A rebus is a phrase or sentence expressed all or in part through
+pictures. For this puzzle, you will use pictures from this archive (use
+the included file "images.txt" to map pictures to the associated words).
+Write a program that will take an English sentence ([here’s a list of
+test cases for you to
+use](http://www.itasoftware.com/images/careers/Rebus%20Icons/Rebus%20Test%20Cases.txt))
+and generate a rebus from it. Here’s a simple example:
+
+
+ (:dove + sl - d) (:tie + hs - e) (:book + wr - bo) (:bee + hr - b)
+ solve this work here
+
+
+That is, each word becomes a parenthesized expression with up to three
+components: a word corresponding to a picture from the clipart library,
+a sequence of letters to be added to the name of the picture, and a
+sequence of letters to be deleted from the name. Distinguish words used
+as pictures from other sequences of letters by prepending a colon. The
+order of letters must match: the letters to be added must be in the
+order in which they would appear in the target word, and the letters to
+be deleted must be in the order in which they appear in the image name.
+Your program should produce plain text output.
+
+But there’s more to the puzzle than that. Suppose we charge 5 points for
+every consonant you add or delete, and 1 point for every vowel. Now come
+up with a rebus that costs the fewest points. The example above costs 57
+points, but this rebus of the same phrase:
+
+
+ (:love + so - o) (:house + ti - oue) (:rake + wo - ae) (:ear + he - a)
+ solve this work here
+
+
+Finally, you can reduce the cost even further by adding or subtracting
+images (which cost nothing) instead of letters. If you use recursive
+encodings, you can get rid of letters altogether. For instance, a
+recursive rebus for “solve” is:
+
+
+ (:dove + (:castle - :cat) - (:badge - :bag))
+ solve
+
+
+Write a program to generate recursive rebuses like the one above. Your
+program may use a mix of letters and pictures; balance performance
+against optimal scores as you see fit. Even for all-picture rebuses, a
+shorter rebus is better.
@@ -0,0 +1,260 @@
+8ball_form_jarno_vasama.png|pool billiards snooker
+Montacarichi.png|forklift
+abc_blocks_petri_lummema_01.png|blocks
+acquila_architetto_franc_02.png|eagle
+addressed_envelope_with_stamp_01.png|envelope letter
+adventurer_hat_nicu_bucu_01.png|hat fedora
+airplane_nicu_buculei_01.png|airplane plane travel
+ambulanza.png|ambulance
+anchor.png|anchor
+ant.png|ant
+apple_bitten_dan_gerhard_01.png|apple bite
+armadillo_architetto_fra_01.png|armadillo
+as_carreau_jean_victor_b_.png|diamond
+as_pique_jean_victor_bal_.png|spade
+as_trefle_jean_victor_ba_.png|club
+az-lizard_benji_park_01.png|lizard
+barattolo_di_pillole_arc_01.png|pills medicine
+baseball_anthony_liekens_01.png|baseball
+bat_orlando_karam_.png|bat
+battery_01.png|battery
+beagle_copper_ganson.png|beagle dog
+bee3_mimooh_01.png|bee bumblebee
+beer.png|beer mug
+bicycle_01.png|bicycle bike cycle
+birthday_cake.png|birthday cake
+bison_leif_lodahl_01.png|bison
+blacksmith_anvil_ganson.png|anvil blacksmith
+blacksmith_hammer_ganson.png|hammer
+blue_vacuum_cleaner_jaim_01.png|vacuum
+blueman_102_02.png|run running
+blueman_209_01.png|jump jumping
+boat_jarno_vasamaa_.png|boat sail sailboat
+bomb_01.png|bomb
+book_01.png|book
+boomerang_01.png|boomerang
+bowl_of_steaming_soup_01.png|bowl soup hot
+box_juliane_krug_s.png|box package
+broom_nicu_buculei_01.png|broom sweep
+browser.png|ship
+brush_roller_costea_bogd_01.png|roller
+bulb.png|bulb light lightbulb idea
+bus1_jarno_vasamaa_01.png|bus
+cacuts_01.png|cactus desert
+calamita_architetto_fran_01.png|magnet
+camel_head_01.png|camel dromedary
+candy_02.png|candy sweet
+candy_10.png|cane candycane
+candy_31.png|lollipop
+canguro_architetto_franc_01.png|kangaroo wallaby
+car.png|car
+card_figure_joker_nic_r.png|joker jester
+card_figure_king_nicu_r.png|king
+card_figure_queen_nic_r.png|queen
+cardboard_box_jarno_vasa_.png|open cardboard box
+carretta_da_cantiere.png|wheelbarrow
+cartoon_cat_gerald_g._01.png|cat kitty feline
+caterpillar.png|bulldozer dozer
+cayennepepperrevisited_d_01.png|cayenne pepper
+cello_ganson.png|cello
+cestino_pieno_architetto_01.png|trash garbage wastebasket trashcan
+ch_teau-fort_01.png|castle
+cheese_01.png|cheese
+chef_jarno_vasamaa_.png|chef cook
+cherries.png|cherries
+chess_game_01.png|chess
+chiave_architetto_france_01.png|key
+cinepresa_architetto_fra_01.png|movie camera film
+classic_phone_zazou.png|phone
+clessidra_architetto_fra_01.png|hourglass time
+coccinella_architetto_fr_01.png|bug ladybug
+coffee.png|coffee
+cog_01.png|cog gear
+colombo2.png|pigeon bird
+cone1_ganson.png|cone
+coniglio_architetto_fran_01.png|rabbit bunny
+contour_bat.png|bat
+crayon.png|pencil
+crossbones_linda_kim_01.png|poison danger crossbones
+dartboard_ruud_steltenpo_01.png|dartboard darts
+dice.png|die
+dino_architetto_francesc_02.png|dragon
+djambf_ganson.png|drum
+dolphin.png|dolphin porpoise
+double_croche_jean-victo_01.png|music note song
+dove_symbol.png|dove peace
+drums_jarno_vasamaa_.png|drums
+ear_-_body_part_nicu_buc_01.png|ear
+elefante02_architetto_fr_01.png|elephant pachyderm
+emule_icon_emule.org_01.png|mule donkey
+envelop_rikva_01.png|envelope
+erlenmeyer_jean_vitor_ba_.png|flask beaker chemistry science
+estrella_02.png|star
+evolution_steps_marcelo__01.png|evolution
+eye_nicu_buculei_.png|eye lashes
+fall_coloured_leaf_geral_01.png|leaf
+farfalla_butterfly_fra1.png|butterfly
+fire_valessio_soares_de_.png|fire campfire
+fireworks_ganson2.png|fireworks
+flan_jean-victor_balin_01.png|pie flan
+floppy_frederic_moser_01.png|floppy disk
+flying_wasp_gerald_g._01.png|wasp hornet yellowjacket
+football_helmet_gerald_g_01.png|football helmet sports
+footprints_in_sand_ganson.png|footprints sand beach ocean
+french_fries_juliane_kr_r.png|fries
+gabbiano_architetto_fran_01.png|seagull gull
+gallo_di_profilo_archite_01.png|rooster
+gift04.png|gift present
+globe_marcelo_staudt_.png|globe earth planet
+goat_nicu_buculei_01.png|billy goat
+gold_coins_in_a_stack_jo_01.png|coins gold stack
+golf_flag_ball_bram_gron_.png|golf
+gopher_Redhead_anime_girl.png|girl anime
+gramophone.png|gramophone
+grapes_leif_lodahl_02.png|grapes bunch
+green_computer_merzok_01.png|computer terminal
+green_pear_01.png|pear
+grondaia.png|gutter
+gufo_civetta_architetto__01.png|owl
+guitar_jarno_vasamaa1.png|guitar
+hamburger_ganson.png|hamburger burger
+handshake_01.png|shake handshake agree deal
+happy_monkey_benji_park_01.png|monkey chimp
+harp2_ganson.png|harp
+heart-arrow_benji_park_01.png|love
+hearth_christoph_brill_01.png|heart
+home10.png|igloo
+home11.png|tent camping
+home12.png|cabin
+honey.png|honey hexagons
+hot_dog_juliane_krug_r.png|hotdog
+house_gabrielle_nowicki_.png|house home
+ice_cube_jarno_vasamaa_.png|ice
+island_palm_and_the_sun_01.png|island
+johnny_automatic_crashing_wave.png|wave sea
+joystick_black_red_petri_01.png|joystick game
+karate_kick_frouke_01.png|karate kick blackbelt
+kiddy_train_orlando_kara_.png|train
+knot_sqaure.png|knots
+lana_architetto_francesc_01.png|knitting yarn
+leafrake_benji_park_01.png|rake
+left_foot_print_benji_pa_02.png|foot footprint
+lemon.png|lemon
+lemonade.png|lemonade drink
+lighthouse_01.png|lighthouse
+lime_half_ganson.png|lime
+little_tan_suitcase_jona_.png|suitcase briefcase
+livella_architetto_franc_01.png|level
+magic_hat_and_wand_nath_r.png|magic
+magnifying_glass_01.png|magnify
+mailbox2.png|mail mailbox
+mcoon_01.png|egg
+meatgrinder_benji_park_.png|grinder
+microscopio_architetto_f_01.png|microscope scope
+mix_cucina_frullatore_ar_01.png|mixer
+modern_clock_chris_kemps_01.png|clock
+moon-full.png|moon
+motosega.png|chainsaw
+mouth_-_body_part_nicu_b_01.png|mouth teeth
+mouth_-_body_part_nicu_b_05.png|toungue
+mushroom.png|mushroom toadstool
+new_penguin_charles_mcco_01.png|penguin
+newspaper_nicu_buculei_01.png|news newspaper
+orange.png|orange
+orca_matthew_gates_r.png|whale orca
+padlock_aj_ashton_01.png|lock padlock
+paint.png|brush paintbrush
+paint_brush_costea_bogda_01.png|paint palette
+pallone_aerestatico_arch_01.png|balloon
+pannocchia_di_gran_turc_01.png|corn cob corncob
+pansement_jean_victor_ba_.png|bandaid plaster
+paperbag1_juliane_krug.png|bag lunch
+pattino_architetto_franc_01.png|skate iceskate
+people_juliane_krug_05c.png|man person
+people_juliane_krug_07a.png|woman person
+pescetto_arancione_archi_01.png|fish
+pig_marcelo_caiafa1.png|pig
+piggybank.png|bank piggybank save
+pineapple.png|pineapple
+pinzatrice_rollandin_arc_01.png|stapler
+pipo_espresso.png|espresso
+piramide_arjen_meijer_01.png|pyramid
+pizza_4_stagioni_archite_01.png|pizza slice
+pollo_architetto_frances_01.png|turkey
+pop_can.png|soda pop cola coke can
+principessa.png|princess
+puffin-md.png|puffin
+pumpkin2_yemu_01.png|pumpkin halloween
+raccoon_ganson.png|raccoon scavenger
+radio_wireless_tower_cor_.png|wireless radio tower broadcast
+radioactive_sign_01.png|radioactivity nuclear
+rain.png|rain storm
+recycle.png|recycle
+red-eye_frog_mirko_maisc_01.png|frog toad
+red_flower_01.png|flower
+red_lips_01.png|lips
+reminder-hand_benji_park_01.png|reminder finger
+rhinoceros_architetto_fr_01.png|rhino rhinoceros
+right_hand_print_benji_p_01.png|hand
+roundpointshovel_benji_p_01.png|shovel
+rubber_duck2_ganson.png|duck rubber
+rubik.png|cube rubik
+saphire_ganson.png|gem diamond sapphire
+saturn_dan_gerhards_01.png|saturn
+scala_doppia.png|ladder
+scissors.png|scissors
+scorpion-md-v0.1.png|scorpion
+scotch_rollandin_france_01.png|tape dispenser
+seal.png|seal
+sedia_in_legno_architett_01.png|chair seat
+shamrock_for_march_natha_01.png|shamrock luck clover
+shield_matt_todd_01.png|badge shield
+simple_calculator_01.png|calculator
+simple_stylized_wolf_he_01.png|wolf
+simple_teddy_bear_gerald_01.png|teddy bear teddybear
+sledge_01.png|sled
+smiley115.png|sleep snooze
+smoke_nicu_buculei_01.png|pipe smoke
+smoke_nicu_buculei_02.png|cigarette
+snow.png|snow
+snowman_01.png|snowman
+soccer_ball_ganson.png|soccer ball
+spider.png|spider
+stamp_01.png|stamp
+stetoscopio_fonendoscopio.png|stethoscope
+strawberry.png|strawberry
+struzzo.png|ostrich
+sub_subacqueo_architetto_01.png|snorkel underwater
+sunglasses_01.png|sunglasses
+t-shirt_01.png|shirt
+target_with_arrow_virgin_01.png|target arrow
+tavola_esame_ottico.png|eyechart chart
+tavolo_in_legno_architet_01.png|table
+tennis_racket_01.png|tennis racket
+tennis_shoe_jarno_vasama_.png|shoe
+tetris_01.png|tetris
+TheStructorr_sheep.png|sheep lamb ewe
+thumbs_up_nathan_eady_01.png|thumb
+thumbtack_linda_kim_01.png|tack thumbtack
+ticket_benji_park_.png|ticket chit
+tie_-_clothing_nicu_bucu_01.png|tie bowtie
+toothbrush_and_paste_ganson.png|toothbrush
+trattore_architetto_fran_01.png|tractor
+tree_whit_fruits_01.png|tree
+trumpet_pocket_colour_ganso.png|trumpet horn
+two_red_dice_01.png|dice gambling chance odds
+umbrella.png|umbrella
+utensile_sega_architetto_01.png|saw
+vacca_pezzata_rossa_val_01.png|cow heifer steer
+w_cloud.png|cloud
+wagon_01.png|wagon
+wall.png|wall bricks
+watermelon_james_kilfige_01.png|watermelon melon
+wedding_couple_jarno_vas_.png|wedding couple marriage
+wild_summer_shorts_natha_01.png|shorts swimsuit
+wine.png|wine
+wooden_barrel_petri_lumm_01.png|barrel
+wooden_mallot_benji_park_.png|mallet
+xylophone_ganson.png|xylophone
+yeKcim_pirats_boat.png|pirate
+zaino_per_montagna.png|backpack
@@ -0,0 +1,2 @@
+All images in this directory come from the Open Clip Art Library at http://openclipart.org/.
+
Oops, something went wrong.

0 comments on commit 71ba37e

Please sign in to comment.