From 98892b167b2d2f74e070c2e64189a3dab60c4074 Mon Sep 17 00:00:00 2001 From: Colby Gutierrez-Kraybill Date: Sat, 21 Oct 2017 21:31:54 -0400 Subject: [PATCH 1/3] Refactor post_challenges and transform.py The existing transform looked like it could use some improvement. This seems to work on all of the existing challenges, and also handles dealing with challenges that have unexpected numbers embedded, like a date. --- .../challenge_text.md | 0 .../challenge_text.md | 0 .../solutions/solution.py | 0 .../solutions/solution.rb | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../solutions/solution.c | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../solutions/solution.py | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../solutions/solution.c | 0 .../challenge_text.md | 0 .../solutions/solution.py | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../solutions/solution.c | 0 .../challenge_text.md | 0 .../solutions/solution.py | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../solutions/solution.py | 0 .../challenge_text.md | 0 .../solutions/solution.c | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md" | 0 .../challenge_text.md" | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 43 +++++++++ .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md" | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 .../challenge_text.md | 0 transform.py | 93 +++++++++---------- 156 files changed, 86 insertions(+), 50 deletions(-) rename Easy Challenges/{Challenge #260 [Easy] Garage Door Opener => Challenge 0260 Easy - Garage Door Opener}/challenge_text.md (100%) rename Easy Challenges/{Challenge #261 [Easy] verifying 3x3 magic squares => Challenge 0261 Easy - verifying 3x3 magic squares}/challenge_text.md (100%) rename Easy Challenges/{Challenge #261 [Easy] verifying 3x3 magic squares => Challenge 0261 Easy - verifying 3x3 magic squares}/solutions/solution.py (100%) rename Easy Challenges/{Challenge #261 [Easy] verifying 3x3 magic squares => Challenge 0261 Easy - verifying 3x3 magic squares}/solutions/solution.rb (100%) rename Easy Challenges/{Challenge #262 [Easy] MaybeNumeric => Challenge 0262 Easy - MaybeNumeric}/challenge_text.md (100%) rename Easy Challenges/{Challenge #263 [Easy] Calculating Shannon Entropy of a String => Challenge 0263 Easy - Calculating Shannon Entropy of a String}/challenge_text.md (100%) rename Easy Challenges/{Challenge #263 [Easy] Calculating Shannon Entropy of a String => Challenge 0263 Easy - Calculating Shannon Entropy of a String}/solutions/solution.c (100%) rename Easy Challenges/{Challenge #264 [Easy] Sort my code => Challenge 0264 Easy - Sort my code}/challenge_text.md (100%) rename Easy Challenges/{Challenge #265 [Easy] Permutations and combinations part 1 => Challenge 0265 Easy - Permutations and combinations part 1}/challenge_text.md (100%) rename Easy Challenges/{Challenge #265 [Easy] Permutations and combinations part 2 => Challenge 0265 Easy - Permutations and combinations part 2}/challenge_text.md (100%) rename Easy Challenges/{Challenge #266 [Easy] Basic Graph Statistics Node Degrees => Challenge 0266 Easy - Basic Graph Statistics Node Degrees}/challenge_text.md (100%) rename Easy Challenges/{Challenge #267 [Easy] All the places your dog didn't win => Challenge 0267 Easy - All the places your dog didn't win}/challenge_text.md (100%) rename Easy Challenges/{Challenge #267 [Easy] All the places your dog didn't win => Challenge 0267 Easy - All the places your dog didn't win}/solutions/solution.py (100%) rename Easy Challenges/{Challenge #268 [Easy] Network and Cards Part 1, The network => Challenge 0268 Easy - Network and Cards Part 1, The network}/challenge_text.md (100%) rename Easy Challenges/{Challenge #269 [Easy] BASIC Formatting => Challenge 0269 Easy - BASIC Formatting}/challenge_text.md (100%) rename Easy Challenges/{Challenge #271 [Easy] Critical Hit => Challenge 0271 Easy - Critical Hit}/challenge_text.md (100%) rename Easy Challenges/{Challenge #271 [Easy] Critical Hit => Challenge 0271 Easy - Critical Hit}/solutions/solution.c (100%) rename Easy Challenges/{Challenge #272 [Easy] What's in the bag => Challenge 0272 Easy - What's in the bag}/challenge_text.md (100%) rename Easy Challenges/{Challenge #272 [Easy] What's in the bag => Challenge 0272 Easy - What's in the bag}/solutions/solution.py (100%) rename Easy Challenges/{Challenge #273 [Easy] Getting a degree => Challenge 0273 Easy - Getting a degree}/challenge_text.md (100%) rename Easy Challenges/{Challenge #275 [Easy] Splurthian Chemistry 101 => Challenge 0275 Easy - Splurthian Chemistry 101}/challenge_text.md (100%) rename Easy Challenges/{Challenge #275 [Easy] Splurthian Chemistry 101 => Challenge 0275 Easy - Splurthian Chemistry 101}/solutions/solution.c (100%) rename Easy Challenges/{Challenge #276 [Easy] Recktangles => Challenge 0276 Easy - Recktangles}/challenge_text.md (100%) rename Easy Challenges/{Challenge #276 [Easy] Recktangles => Challenge 0276 Easy - Recktangles}/solutions/solution.py (100%) rename Easy Challenges/{Challenge #277 [Easy] Simplifying fractions => Challenge 0277 Easy - Simplifying fractions}/challenge_text.md (100%) rename Easy Challenges/{Challenge #278 [EasyMed] Weave insert Part 1 => Challenge 0278 Easy - Weave insert Part 1}/challenge_text.md (100%) rename Easy Challenges/{Challenge #279 [Easy] Uuencoding => Challenge 0279 Easy - Uuencoding}/challenge_text.md (100%) rename Easy Challenges/{Challenge #280 [Easy] 0 to 100, Real Quick => Challenge 0280 Easy - 0 to 100, Real Quick}/challenge_text.md (100%) rename Easy Challenges/{Challenge #281 [Easy] Something about bases => Challenge 0281 Easy - Something about bases}/challenge_text.md (100%) rename Easy Challenges/{Challenge #282 [Easy] Unusual Bases => Challenge 0282 Easy - Unusual Bases}/challenge_text.md (100%) rename Easy Challenges/{Challenge #283 [Easy] Anagram Detector => Challenge 0283 Easy - Anagram Detector}/challenge_text.md (100%) rename Easy Challenges/{Challenge #284 [Easy] Wandering Fingers => Challenge 0284 Easy - Wandering Fingers}/challenge_text.md (100%) rename Easy Challenges/{Challenge #285 [Easy] Cross PlatformLanguage Data Encoding part 1 => Challenge 0285 Easy - Cross PlatformLanguage Data Encoding part 1}/challenge_text.md (100%) rename Easy Challenges/{Challenge #286 [Easy] Reverse Factorial => Challenge 0286 Easy - Reverse Factorial}/challenge_text.md (100%) rename Easy Challenges/{Challenge #286 [Easy] Reverse Factorial => Challenge 0286 Easy - Reverse Factorial}/solutions/solution.py (100%) rename Easy Challenges/{Challenge #287 [Easy] Kaprekar's Routine => Challenge 0287 Easy - Kaprekar's Routine}/challenge_text.md (100%) rename Easy Challenges/{Challenge #287 [Easy] Kaprekar's Routine => Challenge 0287 Easy - Kaprekar's Routine}/solutions/solution.c (100%) rename Easy Challenges/{Challenge #288 [Easy] Detecting Alliteration => Challenge 0288 Easy - Detecting Alliteration}/challenge_text.md (100%) rename Easy Challenges/{Challenge #289 [Easy] It's super effective! => Challenge 0289 Easy - It's super effective!}/challenge_text.md (100%) rename Easy Challenges/{Challenge #290 [Easy] Kaprekar Numbers => Challenge 0290 Easy - Kaprekar Numbers}/challenge_text.md (100%) rename Easy Challenges/{Challenge #291 [Easy] Goldilocks' Bear Necessities => Challenge 0291 Easy - Goldilocks' Bear Necessities}/challenge_text.md (100%) rename Easy Challenges/{Challenge #292 [Easy] Increasing range parsing => Challenge 0292 Easy - Increasing range parsing}/challenge_text.md (100%) rename Easy Challenges/{Challenge #293 [Easy] Defusing the bomb => Challenge 0293 Easy - Defusing the bomb}/challenge_text.md (100%) rename Easy Challenges/{Challenge #294 [Easy] Rack management 1 => Challenge 0294 Easy - Rack management 1}/challenge_text.md (100%) rename Easy Challenges/{Challenge #295 [Easy] Letter by letter => Challenge 0295 Easy - Letter by letter}/challenge_text.md (100%) rename Easy Challenges/{Challenge #296 [Easy] The Twelve Days of... => Challenge 0296 Easy - The Twelve Days of...}/challenge_text.md (100%) rename Easy Challenges/{Challenge #298 [Easy] Too many Parentheses => Challenge 0298 Easy - Too many Parentheses}/challenge_text.md (100%) rename Easy Challenges/{Challenge #300 [EasyIntermediate] Let's make some noise part 2 => Challenge 0300 Easy - Let's make some noise part 2}/challenge_text.md (100%) rename Easy Challenges/{Challenge #300 [Easy] Let's make some noise => Challenge 0300 Easy - Let's make some noise}/challenge_text.md (100%) rename Easy Challenges/{Challenge #301 [EasyIntemerdiate] Looking for patterns => Challenge 0301 Easy - Looking for patterns}/challenge_text.md (100%) rename Easy Challenges/{Challenge #302 [Easy] Spelling with Chemistry => Challenge 0302 Easy - Spelling with Chemistry}/challenge_text.md (100%) rename Easy Challenges/{Challenge #303 [Easy] Ricochet => Challenge 0303 Easy - Ricochet}/challenge_text.md (100%) rename Easy Challenges/{Challenge #304 [Easy] Little Accountant => Challenge 0304 Easy - Little Accountant}/challenge_text.md (100%) rename Easy Challenges/{Challenge #305 [Easy] Permutation base => Challenge 0305 Easy - Permutation base}/challenge_text.md (100%) rename Easy Challenges/{Challenge #306 [Easy] Pandigital Roman Numbers => Challenge 0306 Easy - Pandigital Roman Numbers}/challenge_text.md (100%) rename Easy Challenges/{Challenge #307 [Easy] base 255 part1 => Challenge 0307 Easy - base 255 part1}/challenge_text.md (100%) rename Easy Challenges/{Challenge #308 [Easy] Let it burn => Challenge 0308 Easy - Let it burn}/challenge_text.md (100%) rename Easy Challenges/{Challenge #310 [Easy] Kids Lotto => Challenge 0310 Easy - Kids Lotto}/challenge_text.md (100%) rename Easy Challenges/{Challenge #311 [Easy] Jolly Jumper => Challenge 0311 Easy - Jolly Jumper}/challenge_text.md (100%) rename Easy Challenges/{Challenge #312 [Easy] L33tspeak Translator => Challenge 0312 Easy - L33tspeak Translator}/challenge_text.md (100%) rename Easy Challenges/{Challenge #313 [Easy] Subset sum => Challenge 0313 Easy - Subset sum}/challenge_text.md (100%) rename Hard Challenges/{Challenge #260 [Hard] Never Ending Snake => Challenge 0260 Hard - Never Ending Snake}/challenge_text.md (100%) rename Hard Challenges/{Challenge #261 [Hard] magic square dominoes => Challenge 0261 Hard - magic square dominoes}/challenge_text.md (100%) rename Hard Challenges/{Challenge #262 [Hard] 4x4 puzzle swapper => Challenge 0262 Hard - 4x4 puzzle swapper}/challenge_text.md (100%) rename Hard Challenges/{Challenge #263 [Hard] Hashiwokakero => Challenge 0263 Hard - Hashiwokakero}/challenge_text.md (100%) rename Hard Challenges/{Challenge #264 [Hard] Detecting Poetry Forms => Challenge 0264 Hard - Detecting Poetry Forms}/challenge_text.md (100%) rename Hard Challenges/{Challenge #265 [Hard] Permutations with repeat => Challenge 0265 Hard - Permutations with repeat}/challenge_text.md (100%) rename Hard Challenges/{Challenge #266 [Hard] Finding Friends in the Social Graph => Challenge 0266 Hard - Finding Friends in the Social Graph}/challenge_text.md (100%) rename Hard Challenges/{[2016-05-20] Challenge #267 [Hard] IDDQD => Challenge 0267 Hard - IDDQD}/challenge_text.md (100%) rename Hard Challenges/{Challenge #268 [Hard] Network and Cards Part 3, The cheaters => Challenge 0268 Hard - Network and Cards Part 3, The cheaters}/challenge_text.md (100%) rename Hard Challenges/{Challenge #270 [Hard] Alien Invasion Inversion => Challenge 0270 Hard - Alien Invasion Inversion}/challenge_text.md (100%) rename Hard Challenges/{Challenge #271 [Hard] Formatting J code => Challenge 0271 Hard - Formatting J code}/challenge_text.md (100%) rename Hard Challenges/{Challenge #272 [Hard] Air Pressure router valve - Part 1. => Challenge 0272 Hard - Air Pressure router valve - Part 1.}/challenge_text.md (100%) rename Hard Challenges/{Challenge #272 [Hard] Air Pressure router valve - Part 1 => Challenge 0272 Hard - Air Pressure router valve - Part 1}/challenge_text.md (100%) rename Hard Challenges/{Challenge #273 [Hard] Elggob - Make a Boggle Layout => Challenge 0273 Hard - Elggob - Make a Boggle Layout}/challenge_text.md (100%) rename "Hard Challenges/Challenge #274 [Hard] \342\210\236 Loop solver/challenge_text.md" => "Hard Challenges/Challenge 0274 Hard - \342\210\236 Loop solver/challenge_text.md" (100%) rename "Hard Challenges/Challenge #276 [Hard] \342\210\236 Loop solver part 2/challenge_text.md" => "Hard Challenges/Challenge 0276 Hard - \342\210\236 Loop solver part 2/challenge_text.md" (100%) rename Hard Challenges/{Challenge #277 [Hard] Trippy Julia fractals => Challenge 0277 Hard - Trippy Julia fractals}/challenge_text.md (100%) rename Hard Challenges/{Challenge #280 [Hard] Free Flow Solver => Challenge 0280 Hard - Free Flow Solver}/challenge_text.md (100%) rename Hard Challenges/{Challenge #281 [Hard] Minesweeper Solver => Challenge 0281 Hard - Minesweeper Solver}/challenge_text.md (100%) rename Hard Challenges/{Challenge #282 [Hard] Hidato => Challenge 0282 Hard - Hidato}/challenge_text.md (100%) rename Hard Challenges/{Challenge #283 [Hard] Guarding the Coast => Challenge 0283 Hard - Guarding the Coast}/challenge_text.md (100%) rename Hard Challenges/{Challenge #284 [Hard] Winning the Tournament => Challenge 0284 Hard - Winning the Tournament}/challenge_text.md (100%) rename Hard Challenges/{Challenge #285 [Hard] Math Proofs => Challenge 0285 Hard - Math Proofs}/challenge_text.md (100%) rename Hard Challenges/{Challenge #286 [Hard] Rush Hour Solver => Challenge 0286 Hard - Rush Hour Solver}/challenge_text.md (100%) rename Hard Challenges/{Challenge #287 [Hard] Word Numbers => Challenge 0287 Hard - Word Numbers}/challenge_text.md (100%) rename Hard Challenges/{Challenge #288 [Hard] Adjacent Numbers problems => Challenge 0288 Hard - Adjacent Numbers problems}/challenge_text.md (100%) rename Hard Challenges/{Challenge #289 [Hard] Spot it! cards generator => Challenge 0289 Hard - Spot it! cards generator}/challenge_text.md (100%) rename Hard Challenges/{Challenge #290 [Hard] Gophers and Robot Dogs => Challenge 0290 Hard - Gophers and Robot Dogs}/challenge_text.md (100%) rename Hard Challenges/{Challenge #291 [Hard] Spaghetti Wiring => Challenge 0291 Hard - Spaghetti Wiring}/challenge_text.md (100%) rename Hard Challenges/{Challenge #293 [Hard] Zombies 2 - Your Princess is in Another Castle! => Challenge 0293 Hard - Zombies 2 - Your Princess is in Another Castle!}/challenge_text.md (100%) rename Hard Challenges/{Challenge #294 [Hard] Rack management 3 => Challenge 0294 Hard - Rack management 3}/challenge_text.md (100%) rename Hard Challenges/{Challenge #295 [Hard] Advanced pacman => Challenge 0295 Hard - Advanced pacman}/challenge_text.md (100%) rename Hard Challenges/{Challenge #296 [Hard] Flood Fill Puzzle Game => Challenge 0296 Hard - Flood Fill Puzzle Game}/challenge_text.md (100%) rename Hard Challenges/{Challenge #297 [Hard] Parentheses trees => Challenge 0297 Hard - Parentheses trees}/challenge_text.md (100%) rename Hard Challenges/{Challenge #298 [Hard] Functional Maze solving => Challenge 0298 Hard - Functional Maze solving}/challenge_text.md (100%) rename Hard Challenges/{Challenge #299 [Hard] Functional Graph solving => Challenge 0299 Hard - Functional Graph solving}/challenge_text.md (100%) rename Hard Challenges/{Challenge #300 [Hard] Let's make some noise part 3 => Challenge 0300 Hard - Let's make some noise part 3}/challenge_text.md (100%) rename Hard Challenges/{Challenge #301 [Hard] Guitar Tablature => Challenge 0301 Hard - Guitar Tablature}/challenge_text.md (100%) rename Hard Challenges/{Challenge #302 [Hard] ASCII Histogram Maker Part 2 - The Proper Histogram => Challenge 0302 Hard - ASCII Histogram Maker Part 2 - The Proper Histogram}/challenge_text.md (100%) rename Hard Challenges/{Challenge #303 [Hard] Escaping a dangerous maze => Challenge 0303 Hard - Escaping a dangerous maze}/challenge_text.md (100%) rename Hard Challenges/{Challenge #304 [Hard] Generating a fractal using affine transformation => Challenge 0304 Hard - Generating a fractal using affine transformation}/challenge_text.md (100%) rename Hard Challenges/{Challenge #305 [Hard] Numbers for Sale => Challenge 0305 Hard - Numbers for Sale}/challenge_text.md (100%) rename Hard Challenges/{Challenge #306 [Hard] Generate Strings to Match a Regular Expression => Challenge 0306 Hard - Generate Strings to Match a Regular Expression}/challenge_text.md (100%) rename Hard Challenges/{Challenge #308 [Hard] Slider Game Puzzle => Challenge 0308 Hard - Slider Game Puzzle}/challenge_text.md (100%) rename Hard Challenges/{Challenge #309 [Hard] Patterns overlap => Challenge 0309 Hard - Patterns overlap}/challenge_text.md (100%) rename Hard Challenges/{Challenge #310 [Hard] The Guards and the Mansion => Challenge 0310 Hard - The Guards and the Mansion}/challenge_text.md (100%) rename Hard Challenges/{Challenge #311 [Hard] Procedural Dungeon Generation => Challenge 0311 Hard - Procedural Dungeon Generation}/challenge_text.md (100%) rename Hard Challenges/{Challenge #312 [Hard] Text Summarizer => Challenge 0312 Hard - Text Summarizer}/challenge_text.md (100%) rename Hard Challenges/{Challenge #313 [Hard] Embedded word list => Challenge 0313 Hard - Embedded word list}/challenge_text.md (100%) create mode 100644 Hard Challenges/Challenge 0336 Hard - Van der Waerden numbers/challenge_text.md rename Intermediate Challenges/{Challenge #261 [Intermediate] rearranged magic squares => Challenge 0261 Intermediate - rearranged magic squares}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #262 [Intermediate] Base 64 compression => Challenge 0262 Intermediate - Base 64 compression}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #263 [Intermediate] Help Eminem win his rap battle! => Challenge 0263 Intermediate - Help Eminem win his rap battle!}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #264 [Intermediate] Gossiping bus drivers => Challenge 0264 Intermediate - Gossiping bus drivers}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #266 [Intermediate] Graph Radius and Diameter => Challenge 0266 Intermediate - Graph Radius and Diameter}/challenge_text.md (100%) rename "Intermediate Challenges/[2016-05-18] Challenge #267 [Intermediate] Vive la r\303\251sistance!/challenge_text.md" => "Intermediate Challenges/Challenge 0267 Intermediate - Vive la r\303\251sistance!/challenge_text.md" (100%) rename Intermediate Challenges/{Challenge #268 [Intermediate] Network and Cards Part 2, The cards => Challenge 0268 Intermediate - Network and Cards Part 2, The cards}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #269 [Intermediate] Mirror encryption => Challenge 0269 Intermediate - Mirror encryption}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #270 [Intermediate] Generating Text with Markov Processes => Challenge 0270 Intermediate - Generating Text with Markov Processes}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #271 [Intermediate] Making Waves => Challenge 0271 Intermediate - Making Waves}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #272 [Intermediate] Dither that image => Challenge 0272 Intermediate - Dither that image}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #273 [Intermediate] Twist up a message => Challenge 0273 Intermediate - Twist up a message}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #274 [Intermediate] Calculating De Bruijn sequences => Challenge 0274 Intermediate - Calculating De Bruijn sequences}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #275 [Intermediate] Splurthian Chemistry 102 => Challenge 0275 Intermediate - Splurthian Chemistry 102}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #276 [Intermediate] Key function => Challenge 0276 Intermediate - Key function}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #277 [Intermediate] Fake coins => Challenge 0277 Intermediate - Fake coins}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #279 [Intermediate] Text Reflow => Challenge 0279 Intermediate - Text Reflow}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #280 [Intermediate] Anagram Maker => Challenge 0280 Intermediate - Anagram Maker}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #281 [Intermediate] Dank usernames => Challenge 0281 Intermediate - Dank usernames}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #282 [Intermediate] The final Quixo move => Challenge 0282 Intermediate - The final Quixo move}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #284 [Intermediate] Punch Card Creator => Challenge 0284 Intermediate - Punch Card Creator}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #285 [Intermediate] Cross PlatformLanguage Data Encoding part 2 => Challenge 0285 Intermediate - Cross PlatformLanguage Data Encoding part 2}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #286 [Intermediate] Zeckendorf Representations of Positive Integers => Challenge 0286 Intermediate - Zeckendorf Representations of Positive Integers}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #287 [Intermediate] Mathagrams => Challenge 0287 Intermediate - Mathagrams}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #288 [Intermediate] Stars and Stripes and Vertices => Challenge 0288 Intermediate - Stars and Stripes and Vertices}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #289 [Intermediate] Metro trip planner => Challenge 0289 Intermediate - Metro trip planner}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #290 [Intermediate] Blinking LEDs => Challenge 0290 Intermediate - Blinking LEDs}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #291 [Intermediate] Reverse Polish Notation Calculator => Challenge 0291 Intermediate - Reverse Polish Notation Calculator}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #293 [Intermediate] Defusing the second bomb => Challenge 0293 Intermediate - Defusing the second bomb}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #294 [Intermediate] Rack management 2 => Challenge 0294 Intermediate - Rack management 2}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #295 [Intermediate] Seperated Spouses => Challenge 0295 Intermediate - Seperated Spouses}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #296 [Intermediate] Intersecting Area Of Overlapping Rectangles => Challenge 0296 Intermediate - Intersecting Area Of Overlapping Rectangles}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #298 [Intermediate] Too many or too few Parentheses => Challenge 0298 Intermediate - Too many or too few Parentheses}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #299 [Intermediate] From Maze to graph => Challenge 0299 Intermediate - From Maze to graph}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #302 [Intermediate] ASCII Histogram Maker Part 1 - The Simple Bar Chart => Challenge 0302 Intermediate - ASCII Histogram Maker Part 1 - The Simple Bar Chart}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #304 [Intermediate] Horse Race Sorting => Challenge 0304 Intermediate - Horse Race Sorting}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #305 [Intermediate] The Best Conjunction => Challenge 0305 Intermediate - The Best Conjunction}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #306 [Intermediate] Gray Code => Challenge 0306 Intermediate - Gray Code}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #307 [Intermediate] Scrabble problem => Challenge 0307 Intermediate - Scrabble problem}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #309 [Intermediate] SequentialFinite state machines => Challenge 0309 Intermediate - SequentialFinite state machines}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #310 [Intermediate] Simplifying square roots => Challenge 0310 Intermediate - Simplifying square roots}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #311 [Intermediate] IPv4 Subnet Calculator => Challenge 0311 Intermediate - IPv4 Subnet Calculator}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #312 [Intermediate] Next largest number => Challenge 0312 Intermediate - Next largest number}/challenge_text.md (100%) rename Intermediate Challenges/{Challenge #313 [Intermediate] PGM image manipulation => Challenge 0313 Intermediate - PGM image manipulation}/challenge_text.md (100%) diff --git a/Easy Challenges/Challenge #260 [Easy] Garage Door Opener/challenge_text.md b/Easy Challenges/Challenge 0260 Easy - Garage Door Opener/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #260 [Easy] Garage Door Opener/challenge_text.md rename to Easy Challenges/Challenge 0260 Easy - Garage Door Opener/challenge_text.md diff --git a/Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/challenge_text.md b/Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/challenge_text.md rename to Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/challenge_text.md diff --git a/Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.py b/Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.py rename to Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.py diff --git a/Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.rb b/Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.rb similarity index 100% rename from Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.rb rename to Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.rb diff --git a/Easy Challenges/Challenge #262 [Easy] MaybeNumeric/challenge_text.md b/Easy Challenges/Challenge 0262 Easy - MaybeNumeric/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #262 [Easy] MaybeNumeric/challenge_text.md rename to Easy Challenges/Challenge 0262 Easy - MaybeNumeric/challenge_text.md diff --git a/Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/challenge_text.md b/Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/challenge_text.md rename to Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/challenge_text.md diff --git a/Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/solutions/solution.c b/Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/solutions/solution.c rename to Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/solutions/solution.c diff --git a/Easy Challenges/Challenge #264 [Easy] Sort my code/challenge_text.md b/Easy Challenges/Challenge 0264 Easy - Sort my code/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #264 [Easy] Sort my code/challenge_text.md rename to Easy Challenges/Challenge 0264 Easy - Sort my code/challenge_text.md diff --git a/Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 1/challenge_text.md b/Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 1/challenge_text.md rename to Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 1/challenge_text.md diff --git a/Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 2/challenge_text.md b/Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 2/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 2/challenge_text.md rename to Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 2/challenge_text.md diff --git a/Easy Challenges/Challenge #266 [Easy] Basic Graph Statistics Node Degrees/challenge_text.md b/Easy Challenges/Challenge 0266 Easy - Basic Graph Statistics Node Degrees/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #266 [Easy] Basic Graph Statistics Node Degrees/challenge_text.md rename to Easy Challenges/Challenge 0266 Easy - Basic Graph Statistics Node Degrees/challenge_text.md diff --git a/Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/challenge_text.md b/Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/challenge_text.md rename to Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/challenge_text.md diff --git a/Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/solutions/solution.py b/Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/solutions/solution.py rename to Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/solutions/solution.py diff --git a/Easy Challenges/Challenge #268 [Easy] Network and Cards Part 1, The network/challenge_text.md b/Easy Challenges/Challenge 0268 Easy - Network and Cards Part 1, The network/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #268 [Easy] Network and Cards Part 1, The network/challenge_text.md rename to Easy Challenges/Challenge 0268 Easy - Network and Cards Part 1, The network/challenge_text.md diff --git a/Easy Challenges/Challenge #269 [Easy] BASIC Formatting/challenge_text.md b/Easy Challenges/Challenge 0269 Easy - BASIC Formatting/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #269 [Easy] BASIC Formatting/challenge_text.md rename to Easy Challenges/Challenge 0269 Easy - BASIC Formatting/challenge_text.md diff --git a/Easy Challenges/Challenge #271 [Easy] Critical Hit/challenge_text.md b/Easy Challenges/Challenge 0271 Easy - Critical Hit/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #271 [Easy] Critical Hit/challenge_text.md rename to Easy Challenges/Challenge 0271 Easy - Critical Hit/challenge_text.md diff --git a/Easy Challenges/Challenge #271 [Easy] Critical Hit/solutions/solution.c b/Easy Challenges/Challenge 0271 Easy - Critical Hit/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #271 [Easy] Critical Hit/solutions/solution.c rename to Easy Challenges/Challenge 0271 Easy - Critical Hit/solutions/solution.c diff --git a/Easy Challenges/Challenge #272 [Easy] What's in the bag/challenge_text.md b/Easy Challenges/Challenge 0272 Easy - What's in the bag/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #272 [Easy] What's in the bag/challenge_text.md rename to Easy Challenges/Challenge 0272 Easy - What's in the bag/challenge_text.md diff --git a/Easy Challenges/Challenge #272 [Easy] What's in the bag/solutions/solution.py b/Easy Challenges/Challenge 0272 Easy - What's in the bag/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #272 [Easy] What's in the bag/solutions/solution.py rename to Easy Challenges/Challenge 0272 Easy - What's in the bag/solutions/solution.py diff --git a/Easy Challenges/Challenge #273 [Easy] Getting a degree/challenge_text.md b/Easy Challenges/Challenge 0273 Easy - Getting a degree/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #273 [Easy] Getting a degree/challenge_text.md rename to Easy Challenges/Challenge 0273 Easy - Getting a degree/challenge_text.md diff --git a/Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/challenge_text.md b/Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/challenge_text.md rename to Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/challenge_text.md diff --git a/Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/solutions/solution.c b/Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/solutions/solution.c rename to Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/solutions/solution.c diff --git a/Easy Challenges/Challenge #276 [Easy] Recktangles/challenge_text.md b/Easy Challenges/Challenge 0276 Easy - Recktangles/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #276 [Easy] Recktangles/challenge_text.md rename to Easy Challenges/Challenge 0276 Easy - Recktangles/challenge_text.md diff --git a/Easy Challenges/Challenge #276 [Easy] Recktangles/solutions/solution.py b/Easy Challenges/Challenge 0276 Easy - Recktangles/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #276 [Easy] Recktangles/solutions/solution.py rename to Easy Challenges/Challenge 0276 Easy - Recktangles/solutions/solution.py diff --git a/Easy Challenges/Challenge #277 [Easy] Simplifying fractions/challenge_text.md b/Easy Challenges/Challenge 0277 Easy - Simplifying fractions/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #277 [Easy] Simplifying fractions/challenge_text.md rename to Easy Challenges/Challenge 0277 Easy - Simplifying fractions/challenge_text.md diff --git a/Easy Challenges/Challenge #278 [EasyMed] Weave insert Part 1/challenge_text.md b/Easy Challenges/Challenge 0278 Easy - Weave insert Part 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #278 [EasyMed] Weave insert Part 1/challenge_text.md rename to Easy Challenges/Challenge 0278 Easy - Weave insert Part 1/challenge_text.md diff --git a/Easy Challenges/Challenge #279 [Easy] Uuencoding/challenge_text.md b/Easy Challenges/Challenge 0279 Easy - Uuencoding/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #279 [Easy] Uuencoding/challenge_text.md rename to Easy Challenges/Challenge 0279 Easy - Uuencoding/challenge_text.md diff --git a/Easy Challenges/Challenge #280 [Easy] 0 to 100, Real Quick/challenge_text.md b/Easy Challenges/Challenge 0280 Easy - 0 to 100, Real Quick/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #280 [Easy] 0 to 100, Real Quick/challenge_text.md rename to Easy Challenges/Challenge 0280 Easy - 0 to 100, Real Quick/challenge_text.md diff --git a/Easy Challenges/Challenge #281 [Easy] Something about bases/challenge_text.md b/Easy Challenges/Challenge 0281 Easy - Something about bases/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #281 [Easy] Something about bases/challenge_text.md rename to Easy Challenges/Challenge 0281 Easy - Something about bases/challenge_text.md diff --git a/Easy Challenges/Challenge #282 [Easy] Unusual Bases/challenge_text.md b/Easy Challenges/Challenge 0282 Easy - Unusual Bases/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #282 [Easy] Unusual Bases/challenge_text.md rename to Easy Challenges/Challenge 0282 Easy - Unusual Bases/challenge_text.md diff --git a/Easy Challenges/Challenge #283 [Easy] Anagram Detector/challenge_text.md b/Easy Challenges/Challenge 0283 Easy - Anagram Detector/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #283 [Easy] Anagram Detector/challenge_text.md rename to Easy Challenges/Challenge 0283 Easy - Anagram Detector/challenge_text.md diff --git a/Easy Challenges/Challenge #284 [Easy] Wandering Fingers/challenge_text.md b/Easy Challenges/Challenge 0284 Easy - Wandering Fingers/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #284 [Easy] Wandering Fingers/challenge_text.md rename to Easy Challenges/Challenge 0284 Easy - Wandering Fingers/challenge_text.md diff --git a/Easy Challenges/Challenge #285 [Easy] Cross PlatformLanguage Data Encoding part 1/challenge_text.md b/Easy Challenges/Challenge 0285 Easy - Cross PlatformLanguage Data Encoding part 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #285 [Easy] Cross PlatformLanguage Data Encoding part 1/challenge_text.md rename to Easy Challenges/Challenge 0285 Easy - Cross PlatformLanguage Data Encoding part 1/challenge_text.md diff --git a/Easy Challenges/Challenge #286 [Easy] Reverse Factorial/challenge_text.md b/Easy Challenges/Challenge 0286 Easy - Reverse Factorial/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #286 [Easy] Reverse Factorial/challenge_text.md rename to Easy Challenges/Challenge 0286 Easy - Reverse Factorial/challenge_text.md diff --git a/Easy Challenges/Challenge #286 [Easy] Reverse Factorial/solutions/solution.py b/Easy Challenges/Challenge 0286 Easy - Reverse Factorial/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #286 [Easy] Reverse Factorial/solutions/solution.py rename to Easy Challenges/Challenge 0286 Easy - Reverse Factorial/solutions/solution.py diff --git a/Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/challenge_text.md b/Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/challenge_text.md rename to Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/challenge_text.md diff --git a/Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/solutions/solution.c b/Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/solutions/solution.c rename to Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/solutions/solution.c diff --git a/Easy Challenges/Challenge #288 [Easy] Detecting Alliteration/challenge_text.md b/Easy Challenges/Challenge 0288 Easy - Detecting Alliteration/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #288 [Easy] Detecting Alliteration/challenge_text.md rename to Easy Challenges/Challenge 0288 Easy - Detecting Alliteration/challenge_text.md diff --git a/Easy Challenges/Challenge #289 [Easy] It's super effective!/challenge_text.md b/Easy Challenges/Challenge 0289 Easy - It's super effective!/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #289 [Easy] It's super effective!/challenge_text.md rename to Easy Challenges/Challenge 0289 Easy - It's super effective!/challenge_text.md diff --git a/Easy Challenges/Challenge #290 [Easy] Kaprekar Numbers/challenge_text.md b/Easy Challenges/Challenge 0290 Easy - Kaprekar Numbers/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #290 [Easy] Kaprekar Numbers/challenge_text.md rename to Easy Challenges/Challenge 0290 Easy - Kaprekar Numbers/challenge_text.md diff --git a/Easy Challenges/Challenge #291 [Easy] Goldilocks' Bear Necessities/challenge_text.md b/Easy Challenges/Challenge 0291 Easy - Goldilocks' Bear Necessities/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #291 [Easy] Goldilocks' Bear Necessities/challenge_text.md rename to Easy Challenges/Challenge 0291 Easy - Goldilocks' Bear Necessities/challenge_text.md diff --git a/Easy Challenges/Challenge #292 [Easy] Increasing range parsing/challenge_text.md b/Easy Challenges/Challenge 0292 Easy - Increasing range parsing/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #292 [Easy] Increasing range parsing/challenge_text.md rename to Easy Challenges/Challenge 0292 Easy - Increasing range parsing/challenge_text.md diff --git a/Easy Challenges/Challenge #293 [Easy] Defusing the bomb/challenge_text.md b/Easy Challenges/Challenge 0293 Easy - Defusing the bomb/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #293 [Easy] Defusing the bomb/challenge_text.md rename to Easy Challenges/Challenge 0293 Easy - Defusing the bomb/challenge_text.md diff --git a/Easy Challenges/Challenge #294 [Easy] Rack management 1/challenge_text.md b/Easy Challenges/Challenge 0294 Easy - Rack management 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #294 [Easy] Rack management 1/challenge_text.md rename to Easy Challenges/Challenge 0294 Easy - Rack management 1/challenge_text.md diff --git a/Easy Challenges/Challenge #295 [Easy] Letter by letter/challenge_text.md b/Easy Challenges/Challenge 0295 Easy - Letter by letter/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #295 [Easy] Letter by letter/challenge_text.md rename to Easy Challenges/Challenge 0295 Easy - Letter by letter/challenge_text.md diff --git a/Easy Challenges/Challenge #296 [Easy] The Twelve Days of.../challenge_text.md b/Easy Challenges/Challenge 0296 Easy - The Twelve Days of.../challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #296 [Easy] The Twelve Days of.../challenge_text.md rename to Easy Challenges/Challenge 0296 Easy - The Twelve Days of.../challenge_text.md diff --git a/Easy Challenges/Challenge #298 [Easy] Too many Parentheses/challenge_text.md b/Easy Challenges/Challenge 0298 Easy - Too many Parentheses/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #298 [Easy] Too many Parentheses/challenge_text.md rename to Easy Challenges/Challenge 0298 Easy - Too many Parentheses/challenge_text.md diff --git a/Easy Challenges/Challenge #300 [EasyIntermediate] Let's make some noise part 2/challenge_text.md b/Easy Challenges/Challenge 0300 Easy - Let's make some noise part 2/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #300 [EasyIntermediate] Let's make some noise part 2/challenge_text.md rename to Easy Challenges/Challenge 0300 Easy - Let's make some noise part 2/challenge_text.md diff --git a/Easy Challenges/Challenge #300 [Easy] Let's make some noise/challenge_text.md b/Easy Challenges/Challenge 0300 Easy - Let's make some noise/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #300 [Easy] Let's make some noise/challenge_text.md rename to Easy Challenges/Challenge 0300 Easy - Let's make some noise/challenge_text.md diff --git a/Easy Challenges/Challenge #301 [EasyIntemerdiate] Looking for patterns/challenge_text.md b/Easy Challenges/Challenge 0301 Easy - Looking for patterns/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #301 [EasyIntemerdiate] Looking for patterns/challenge_text.md rename to Easy Challenges/Challenge 0301 Easy - Looking for patterns/challenge_text.md diff --git a/Easy Challenges/Challenge #302 [Easy] Spelling with Chemistry/challenge_text.md b/Easy Challenges/Challenge 0302 Easy - Spelling with Chemistry/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #302 [Easy] Spelling with Chemistry/challenge_text.md rename to Easy Challenges/Challenge 0302 Easy - Spelling with Chemistry/challenge_text.md diff --git a/Easy Challenges/Challenge #303 [Easy] Ricochet/challenge_text.md b/Easy Challenges/Challenge 0303 Easy - Ricochet/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #303 [Easy] Ricochet/challenge_text.md rename to Easy Challenges/Challenge 0303 Easy - Ricochet/challenge_text.md diff --git a/Easy Challenges/Challenge #304 [Easy] Little Accountant/challenge_text.md b/Easy Challenges/Challenge 0304 Easy - Little Accountant/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #304 [Easy] Little Accountant/challenge_text.md rename to Easy Challenges/Challenge 0304 Easy - Little Accountant/challenge_text.md diff --git a/Easy Challenges/Challenge #305 [Easy] Permutation base/challenge_text.md b/Easy Challenges/Challenge 0305 Easy - Permutation base/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #305 [Easy] Permutation base/challenge_text.md rename to Easy Challenges/Challenge 0305 Easy - Permutation base/challenge_text.md diff --git a/Easy Challenges/Challenge #306 [Easy] Pandigital Roman Numbers/challenge_text.md b/Easy Challenges/Challenge 0306 Easy - Pandigital Roman Numbers/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #306 [Easy] Pandigital Roman Numbers/challenge_text.md rename to Easy Challenges/Challenge 0306 Easy - Pandigital Roman Numbers/challenge_text.md diff --git a/Easy Challenges/Challenge #307 [Easy] base 255 part1/challenge_text.md b/Easy Challenges/Challenge 0307 Easy - base 255 part1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #307 [Easy] base 255 part1/challenge_text.md rename to Easy Challenges/Challenge 0307 Easy - base 255 part1/challenge_text.md diff --git a/Easy Challenges/Challenge #308 [Easy] Let it burn/challenge_text.md b/Easy Challenges/Challenge 0308 Easy - Let it burn/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #308 [Easy] Let it burn/challenge_text.md rename to Easy Challenges/Challenge 0308 Easy - Let it burn/challenge_text.md diff --git a/Easy Challenges/Challenge #310 [Easy] Kids Lotto/challenge_text.md b/Easy Challenges/Challenge 0310 Easy - Kids Lotto/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #310 [Easy] Kids Lotto/challenge_text.md rename to Easy Challenges/Challenge 0310 Easy - Kids Lotto/challenge_text.md diff --git a/Easy Challenges/Challenge #311 [Easy] Jolly Jumper/challenge_text.md b/Easy Challenges/Challenge 0311 Easy - Jolly Jumper/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #311 [Easy] Jolly Jumper/challenge_text.md rename to Easy Challenges/Challenge 0311 Easy - Jolly Jumper/challenge_text.md diff --git a/Easy Challenges/Challenge #312 [Easy] L33tspeak Translator/challenge_text.md b/Easy Challenges/Challenge 0312 Easy - L33tspeak Translator/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #312 [Easy] L33tspeak Translator/challenge_text.md rename to Easy Challenges/Challenge 0312 Easy - L33tspeak Translator/challenge_text.md diff --git a/Easy Challenges/Challenge #313 [Easy] Subset sum/challenge_text.md b/Easy Challenges/Challenge 0313 Easy - Subset sum/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #313 [Easy] Subset sum/challenge_text.md rename to Easy Challenges/Challenge 0313 Easy - Subset sum/challenge_text.md diff --git a/Hard Challenges/Challenge #260 [Hard] Never Ending Snake/challenge_text.md b/Hard Challenges/Challenge 0260 Hard - Never Ending Snake/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #260 [Hard] Never Ending Snake/challenge_text.md rename to Hard Challenges/Challenge 0260 Hard - Never Ending Snake/challenge_text.md diff --git a/Hard Challenges/Challenge #261 [Hard] magic square dominoes/challenge_text.md b/Hard Challenges/Challenge 0261 Hard - magic square dominoes/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #261 [Hard] magic square dominoes/challenge_text.md rename to Hard Challenges/Challenge 0261 Hard - magic square dominoes/challenge_text.md diff --git a/Hard Challenges/Challenge #262 [Hard] 4x4 puzzle swapper/challenge_text.md b/Hard Challenges/Challenge 0262 Hard - 4x4 puzzle swapper/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #262 [Hard] 4x4 puzzle swapper/challenge_text.md rename to Hard Challenges/Challenge 0262 Hard - 4x4 puzzle swapper/challenge_text.md diff --git a/Hard Challenges/Challenge #263 [Hard] Hashiwokakero/challenge_text.md b/Hard Challenges/Challenge 0263 Hard - Hashiwokakero/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #263 [Hard] Hashiwokakero/challenge_text.md rename to Hard Challenges/Challenge 0263 Hard - Hashiwokakero/challenge_text.md diff --git a/Hard Challenges/Challenge #264 [Hard] Detecting Poetry Forms/challenge_text.md b/Hard Challenges/Challenge 0264 Hard - Detecting Poetry Forms/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #264 [Hard] Detecting Poetry Forms/challenge_text.md rename to Hard Challenges/Challenge 0264 Hard - Detecting Poetry Forms/challenge_text.md diff --git a/Hard Challenges/Challenge #265 [Hard] Permutations with repeat/challenge_text.md b/Hard Challenges/Challenge 0265 Hard - Permutations with repeat/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #265 [Hard] Permutations with repeat/challenge_text.md rename to Hard Challenges/Challenge 0265 Hard - Permutations with repeat/challenge_text.md diff --git a/Hard Challenges/Challenge #266 [Hard] Finding Friends in the Social Graph/challenge_text.md b/Hard Challenges/Challenge 0266 Hard - Finding Friends in the Social Graph/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #266 [Hard] Finding Friends in the Social Graph/challenge_text.md rename to Hard Challenges/Challenge 0266 Hard - Finding Friends in the Social Graph/challenge_text.md diff --git a/Hard Challenges/[2016-05-20] Challenge #267 [Hard] IDDQD/challenge_text.md b/Hard Challenges/Challenge 0267 Hard - IDDQD/challenge_text.md similarity index 100% rename from Hard Challenges/[2016-05-20] Challenge #267 [Hard] IDDQD/challenge_text.md rename to Hard Challenges/Challenge 0267 Hard - IDDQD/challenge_text.md diff --git a/Hard Challenges/Challenge #268 [Hard] Network and Cards Part 3, The cheaters/challenge_text.md b/Hard Challenges/Challenge 0268 Hard - Network and Cards Part 3, The cheaters/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #268 [Hard] Network and Cards Part 3, The cheaters/challenge_text.md rename to Hard Challenges/Challenge 0268 Hard - Network and Cards Part 3, The cheaters/challenge_text.md diff --git a/Hard Challenges/Challenge #270 [Hard] Alien Invasion Inversion/challenge_text.md b/Hard Challenges/Challenge 0270 Hard - Alien Invasion Inversion/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #270 [Hard] Alien Invasion Inversion/challenge_text.md rename to Hard Challenges/Challenge 0270 Hard - Alien Invasion Inversion/challenge_text.md diff --git a/Hard Challenges/Challenge #271 [Hard] Formatting J code/challenge_text.md b/Hard Challenges/Challenge 0271 Hard - Formatting J code/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #271 [Hard] Formatting J code/challenge_text.md rename to Hard Challenges/Challenge 0271 Hard - Formatting J code/challenge_text.md diff --git a/Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1./challenge_text.md b/Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1./challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1./challenge_text.md rename to Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1./challenge_text.md diff --git a/Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1/challenge_text.md b/Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1/challenge_text.md rename to Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1/challenge_text.md diff --git a/Hard Challenges/Challenge #273 [Hard] Elggob - Make a Boggle Layout/challenge_text.md b/Hard Challenges/Challenge 0273 Hard - Elggob - Make a Boggle Layout/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #273 [Hard] Elggob - Make a Boggle Layout/challenge_text.md rename to Hard Challenges/Challenge 0273 Hard - Elggob - Make a Boggle Layout/challenge_text.md diff --git "a/Hard Challenges/Challenge #274 [Hard] \342\210\236 Loop solver/challenge_text.md" "b/Hard Challenges/Challenge 0274 Hard - \342\210\236 Loop solver/challenge_text.md" similarity index 100% rename from "Hard Challenges/Challenge #274 [Hard] \342\210\236 Loop solver/challenge_text.md" rename to "Hard Challenges/Challenge 0274 Hard - \342\210\236 Loop solver/challenge_text.md" diff --git "a/Hard Challenges/Challenge #276 [Hard] \342\210\236 Loop solver part 2/challenge_text.md" "b/Hard Challenges/Challenge 0276 Hard - \342\210\236 Loop solver part 2/challenge_text.md" similarity index 100% rename from "Hard Challenges/Challenge #276 [Hard] \342\210\236 Loop solver part 2/challenge_text.md" rename to "Hard Challenges/Challenge 0276 Hard - \342\210\236 Loop solver part 2/challenge_text.md" diff --git a/Hard Challenges/Challenge #277 [Hard] Trippy Julia fractals/challenge_text.md b/Hard Challenges/Challenge 0277 Hard - Trippy Julia fractals/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #277 [Hard] Trippy Julia fractals/challenge_text.md rename to Hard Challenges/Challenge 0277 Hard - Trippy Julia fractals/challenge_text.md diff --git a/Hard Challenges/Challenge #280 [Hard] Free Flow Solver/challenge_text.md b/Hard Challenges/Challenge 0280 Hard - Free Flow Solver/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #280 [Hard] Free Flow Solver/challenge_text.md rename to Hard Challenges/Challenge 0280 Hard - Free Flow Solver/challenge_text.md diff --git a/Hard Challenges/Challenge #281 [Hard] Minesweeper Solver/challenge_text.md b/Hard Challenges/Challenge 0281 Hard - Minesweeper Solver/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #281 [Hard] Minesweeper Solver/challenge_text.md rename to Hard Challenges/Challenge 0281 Hard - Minesweeper Solver/challenge_text.md diff --git a/Hard Challenges/Challenge #282 [Hard] Hidato/challenge_text.md b/Hard Challenges/Challenge 0282 Hard - Hidato/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #282 [Hard] Hidato/challenge_text.md rename to Hard Challenges/Challenge 0282 Hard - Hidato/challenge_text.md diff --git a/Hard Challenges/Challenge #283 [Hard] Guarding the Coast/challenge_text.md b/Hard Challenges/Challenge 0283 Hard - Guarding the Coast/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #283 [Hard] Guarding the Coast/challenge_text.md rename to Hard Challenges/Challenge 0283 Hard - Guarding the Coast/challenge_text.md diff --git a/Hard Challenges/Challenge #284 [Hard] Winning the Tournament/challenge_text.md b/Hard Challenges/Challenge 0284 Hard - Winning the Tournament/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #284 [Hard] Winning the Tournament/challenge_text.md rename to Hard Challenges/Challenge 0284 Hard - Winning the Tournament/challenge_text.md diff --git a/Hard Challenges/Challenge #285 [Hard] Math Proofs/challenge_text.md b/Hard Challenges/Challenge 0285 Hard - Math Proofs/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #285 [Hard] Math Proofs/challenge_text.md rename to Hard Challenges/Challenge 0285 Hard - Math Proofs/challenge_text.md diff --git a/Hard Challenges/Challenge #286 [Hard] Rush Hour Solver/challenge_text.md b/Hard Challenges/Challenge 0286 Hard - Rush Hour Solver/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #286 [Hard] Rush Hour Solver/challenge_text.md rename to Hard Challenges/Challenge 0286 Hard - Rush Hour Solver/challenge_text.md diff --git a/Hard Challenges/Challenge #287 [Hard] Word Numbers/challenge_text.md b/Hard Challenges/Challenge 0287 Hard - Word Numbers/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #287 [Hard] Word Numbers/challenge_text.md rename to Hard Challenges/Challenge 0287 Hard - Word Numbers/challenge_text.md diff --git a/Hard Challenges/Challenge #288 [Hard] Adjacent Numbers problems/challenge_text.md b/Hard Challenges/Challenge 0288 Hard - Adjacent Numbers problems/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #288 [Hard] Adjacent Numbers problems/challenge_text.md rename to Hard Challenges/Challenge 0288 Hard - Adjacent Numbers problems/challenge_text.md diff --git a/Hard Challenges/Challenge #289 [Hard] Spot it! cards generator/challenge_text.md b/Hard Challenges/Challenge 0289 Hard - Spot it! cards generator/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #289 [Hard] Spot it! cards generator/challenge_text.md rename to Hard Challenges/Challenge 0289 Hard - Spot it! cards generator/challenge_text.md diff --git a/Hard Challenges/Challenge #290 [Hard] Gophers and Robot Dogs/challenge_text.md b/Hard Challenges/Challenge 0290 Hard - Gophers and Robot Dogs/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #290 [Hard] Gophers and Robot Dogs/challenge_text.md rename to Hard Challenges/Challenge 0290 Hard - Gophers and Robot Dogs/challenge_text.md diff --git a/Hard Challenges/Challenge #291 [Hard] Spaghetti Wiring/challenge_text.md b/Hard Challenges/Challenge 0291 Hard - Spaghetti Wiring/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #291 [Hard] Spaghetti Wiring/challenge_text.md rename to Hard Challenges/Challenge 0291 Hard - Spaghetti Wiring/challenge_text.md diff --git a/Hard Challenges/Challenge #293 [Hard] Zombies 2 - Your Princess is in Another Castle!/challenge_text.md b/Hard Challenges/Challenge 0293 Hard - Zombies 2 - Your Princess is in Another Castle!/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #293 [Hard] Zombies 2 - Your Princess is in Another Castle!/challenge_text.md rename to Hard Challenges/Challenge 0293 Hard - Zombies 2 - Your Princess is in Another Castle!/challenge_text.md diff --git a/Hard Challenges/Challenge #294 [Hard] Rack management 3/challenge_text.md b/Hard Challenges/Challenge 0294 Hard - Rack management 3/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #294 [Hard] Rack management 3/challenge_text.md rename to Hard Challenges/Challenge 0294 Hard - Rack management 3/challenge_text.md diff --git a/Hard Challenges/Challenge #295 [Hard] Advanced pacman/challenge_text.md b/Hard Challenges/Challenge 0295 Hard - Advanced pacman/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #295 [Hard] Advanced pacman/challenge_text.md rename to Hard Challenges/Challenge 0295 Hard - Advanced pacman/challenge_text.md diff --git a/Hard Challenges/Challenge #296 [Hard] Flood Fill Puzzle Game/challenge_text.md b/Hard Challenges/Challenge 0296 Hard - Flood Fill Puzzle Game/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #296 [Hard] Flood Fill Puzzle Game/challenge_text.md rename to Hard Challenges/Challenge 0296 Hard - Flood Fill Puzzle Game/challenge_text.md diff --git a/Hard Challenges/Challenge #297 [Hard] Parentheses trees/challenge_text.md b/Hard Challenges/Challenge 0297 Hard - Parentheses trees/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #297 [Hard] Parentheses trees/challenge_text.md rename to Hard Challenges/Challenge 0297 Hard - Parentheses trees/challenge_text.md diff --git a/Hard Challenges/Challenge #298 [Hard] Functional Maze solving/challenge_text.md b/Hard Challenges/Challenge 0298 Hard - Functional Maze solving/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #298 [Hard] Functional Maze solving/challenge_text.md rename to Hard Challenges/Challenge 0298 Hard - Functional Maze solving/challenge_text.md diff --git a/Hard Challenges/Challenge #299 [Hard] Functional Graph solving/challenge_text.md b/Hard Challenges/Challenge 0299 Hard - Functional Graph solving/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #299 [Hard] Functional Graph solving/challenge_text.md rename to Hard Challenges/Challenge 0299 Hard - Functional Graph solving/challenge_text.md diff --git a/Hard Challenges/Challenge #300 [Hard] Let's make some noise part 3/challenge_text.md b/Hard Challenges/Challenge 0300 Hard - Let's make some noise part 3/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #300 [Hard] Let's make some noise part 3/challenge_text.md rename to Hard Challenges/Challenge 0300 Hard - Let's make some noise part 3/challenge_text.md diff --git a/Hard Challenges/Challenge #301 [Hard] Guitar Tablature/challenge_text.md b/Hard Challenges/Challenge 0301 Hard - Guitar Tablature/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #301 [Hard] Guitar Tablature/challenge_text.md rename to Hard Challenges/Challenge 0301 Hard - Guitar Tablature/challenge_text.md diff --git a/Hard Challenges/Challenge #302 [Hard] ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md b/Hard Challenges/Challenge 0302 Hard - ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #302 [Hard] ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md rename to Hard Challenges/Challenge 0302 Hard - ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md diff --git a/Hard Challenges/Challenge #303 [Hard] Escaping a dangerous maze/challenge_text.md b/Hard Challenges/Challenge 0303 Hard - Escaping a dangerous maze/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #303 [Hard] Escaping a dangerous maze/challenge_text.md rename to Hard Challenges/Challenge 0303 Hard - Escaping a dangerous maze/challenge_text.md diff --git a/Hard Challenges/Challenge #304 [Hard] Generating a fractal using affine transformation/challenge_text.md b/Hard Challenges/Challenge 0304 Hard - Generating a fractal using affine transformation/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #304 [Hard] Generating a fractal using affine transformation/challenge_text.md rename to Hard Challenges/Challenge 0304 Hard - Generating a fractal using affine transformation/challenge_text.md diff --git a/Hard Challenges/Challenge #305 [Hard] Numbers for Sale/challenge_text.md b/Hard Challenges/Challenge 0305 Hard - Numbers for Sale/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #305 [Hard] Numbers for Sale/challenge_text.md rename to Hard Challenges/Challenge 0305 Hard - Numbers for Sale/challenge_text.md diff --git a/Hard Challenges/Challenge #306 [Hard] Generate Strings to Match a Regular Expression/challenge_text.md b/Hard Challenges/Challenge 0306 Hard - Generate Strings to Match a Regular Expression/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #306 [Hard] Generate Strings to Match a Regular Expression/challenge_text.md rename to Hard Challenges/Challenge 0306 Hard - Generate Strings to Match a Regular Expression/challenge_text.md diff --git a/Hard Challenges/Challenge #308 [Hard] Slider Game Puzzle/challenge_text.md b/Hard Challenges/Challenge 0308 Hard - Slider Game Puzzle/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #308 [Hard] Slider Game Puzzle/challenge_text.md rename to Hard Challenges/Challenge 0308 Hard - Slider Game Puzzle/challenge_text.md diff --git a/Hard Challenges/Challenge #309 [Hard] Patterns overlap/challenge_text.md b/Hard Challenges/Challenge 0309 Hard - Patterns overlap/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #309 [Hard] Patterns overlap/challenge_text.md rename to Hard Challenges/Challenge 0309 Hard - Patterns overlap/challenge_text.md diff --git a/Hard Challenges/Challenge #310 [Hard] The Guards and the Mansion/challenge_text.md b/Hard Challenges/Challenge 0310 Hard - The Guards and the Mansion/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #310 [Hard] The Guards and the Mansion/challenge_text.md rename to Hard Challenges/Challenge 0310 Hard - The Guards and the Mansion/challenge_text.md diff --git a/Hard Challenges/Challenge #311 [Hard] Procedural Dungeon Generation/challenge_text.md b/Hard Challenges/Challenge 0311 Hard - Procedural Dungeon Generation/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #311 [Hard] Procedural Dungeon Generation/challenge_text.md rename to Hard Challenges/Challenge 0311 Hard - Procedural Dungeon Generation/challenge_text.md diff --git a/Hard Challenges/Challenge #312 [Hard] Text Summarizer/challenge_text.md b/Hard Challenges/Challenge 0312 Hard - Text Summarizer/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #312 [Hard] Text Summarizer/challenge_text.md rename to Hard Challenges/Challenge 0312 Hard - Text Summarizer/challenge_text.md diff --git a/Hard Challenges/Challenge #313 [Hard] Embedded word list/challenge_text.md b/Hard Challenges/Challenge 0313 Hard - Embedded word list/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #313 [Hard] Embedded word list/challenge_text.md rename to Hard Challenges/Challenge 0313 Hard - Embedded word list/challenge_text.md diff --git a/Hard Challenges/Challenge 0336 Hard - Van der Waerden numbers/challenge_text.md b/Hard Challenges/Challenge 0336 Hard - Van der Waerden numbers/challenge_text.md new file mode 100644 index 0000000..1dcef7e --- /dev/null +++ b/Hard Challenges/Challenge 0336 Hard - Van der Waerden numbers/challenge_text.md @@ -0,0 +1,43 @@ +# Description + +This one came to me via the always interesting [Data Genetics blog](http://datagenetics.com/blog/august12017/index.html). + +Van der Waerden's theorem relates to ways that collections can be colored, in order, avoiding spacing of colors that are a defined length arithmetic progression apart. They are named after the Dutch mathematician B. L. van der Waerden. _W(c,k)_ can be defined as the smallest value where c represents the number of colors in the sequence, and k represents the number of elements in the arithmetic progression. + +In mathematics, an arithmetic progression is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, 15, ... is an arithmetic progression with common difference of 2. + +[Van der Waerden numbers](https://en.wikipedia.org/wiki/Van_der_Waerden_number) (W) are defined as the smallest arrangement of _c_ different colors such that there exists an arithmetic sequence of length _k_. The simplest non-trivial example is _W(2,3)_. Consider two colors, **B** and **R**: + + B R R B B R R B + +If we add a **B** to the sequence, we a **B** at positions 1, 5 and 9 - a difference of 4. If we add an **R** to the sequence, we have an **R** at positions 3, 6 and 9 - a difference of 3. There is no way of coloring 1 through 9 without creating a three step progression of one color or another, so _W(2,3)=9_. + +Adding a color - _W(3,3)_ - causes the value to jump to 27; adding a length requirement to the arithmetic sequence - _W(2,4)_ - causes the value to increase to 35. + +Van der Waerden numbers are an open area of research, with exact values known for only a limited number of combinations. + +Your challenge today is to write a program that can calculate the Van der Waerden number for some small values. + +# Input Description + +You'll be given two integers per line indicating _c_ and _k_. Example: + + 2 3 + +# Output Description + +Your program should emit the Van der Waerden number _W(c,k)_ for that input. Example: + + W(2,3) = 9 + +# Challenge Input + + 2 6 + 4 3 + 3 4 + +# Challenge Output + + W(2,6) = 1132 + W(4,3) = 76 + W(3,4) = 293 diff --git a/Intermediate Challenges/Challenge #261 [Intermediate] rearranged magic squares/challenge_text.md b/Intermediate Challenges/Challenge 0261 Intermediate - rearranged magic squares/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #261 [Intermediate] rearranged magic squares/challenge_text.md rename to Intermediate Challenges/Challenge 0261 Intermediate - rearranged magic squares/challenge_text.md diff --git a/Intermediate Challenges/Challenge #262 [Intermediate] Base 64 compression/challenge_text.md b/Intermediate Challenges/Challenge 0262 Intermediate - Base 64 compression/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #262 [Intermediate] Base 64 compression/challenge_text.md rename to Intermediate Challenges/Challenge 0262 Intermediate - Base 64 compression/challenge_text.md diff --git a/Intermediate Challenges/Challenge #263 [Intermediate] Help Eminem win his rap battle!/challenge_text.md b/Intermediate Challenges/Challenge 0263 Intermediate - Help Eminem win his rap battle!/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #263 [Intermediate] Help Eminem win his rap battle!/challenge_text.md rename to Intermediate Challenges/Challenge 0263 Intermediate - Help Eminem win his rap battle!/challenge_text.md diff --git a/Intermediate Challenges/Challenge #264 [Intermediate] Gossiping bus drivers/challenge_text.md b/Intermediate Challenges/Challenge 0264 Intermediate - Gossiping bus drivers/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #264 [Intermediate] Gossiping bus drivers/challenge_text.md rename to Intermediate Challenges/Challenge 0264 Intermediate - Gossiping bus drivers/challenge_text.md diff --git a/Intermediate Challenges/Challenge #266 [Intermediate] Graph Radius and Diameter/challenge_text.md b/Intermediate Challenges/Challenge 0266 Intermediate - Graph Radius and Diameter/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #266 [Intermediate] Graph Radius and Diameter/challenge_text.md rename to Intermediate Challenges/Challenge 0266 Intermediate - Graph Radius and Diameter/challenge_text.md diff --git "a/Intermediate Challenges/[2016-05-18] Challenge #267 [Intermediate] Vive la r\303\251sistance!/challenge_text.md" "b/Intermediate Challenges/Challenge 0267 Intermediate - Vive la r\303\251sistance!/challenge_text.md" similarity index 100% rename from "Intermediate Challenges/[2016-05-18] Challenge #267 [Intermediate] Vive la r\303\251sistance!/challenge_text.md" rename to "Intermediate Challenges/Challenge 0267 Intermediate - Vive la r\303\251sistance!/challenge_text.md" diff --git a/Intermediate Challenges/Challenge #268 [Intermediate] Network and Cards Part 2, The cards/challenge_text.md b/Intermediate Challenges/Challenge 0268 Intermediate - Network and Cards Part 2, The cards/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #268 [Intermediate] Network and Cards Part 2, The cards/challenge_text.md rename to Intermediate Challenges/Challenge 0268 Intermediate - Network and Cards Part 2, The cards/challenge_text.md diff --git a/Intermediate Challenges/Challenge #269 [Intermediate] Mirror encryption/challenge_text.md b/Intermediate Challenges/Challenge 0269 Intermediate - Mirror encryption/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #269 [Intermediate] Mirror encryption/challenge_text.md rename to Intermediate Challenges/Challenge 0269 Intermediate - Mirror encryption/challenge_text.md diff --git a/Intermediate Challenges/Challenge #270 [Intermediate] Generating Text with Markov Processes/challenge_text.md b/Intermediate Challenges/Challenge 0270 Intermediate - Generating Text with Markov Processes/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #270 [Intermediate] Generating Text with Markov Processes/challenge_text.md rename to Intermediate Challenges/Challenge 0270 Intermediate - Generating Text with Markov Processes/challenge_text.md diff --git a/Intermediate Challenges/Challenge #271 [Intermediate] Making Waves/challenge_text.md b/Intermediate Challenges/Challenge 0271 Intermediate - Making Waves/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #271 [Intermediate] Making Waves/challenge_text.md rename to Intermediate Challenges/Challenge 0271 Intermediate - Making Waves/challenge_text.md diff --git a/Intermediate Challenges/Challenge #272 [Intermediate] Dither that image/challenge_text.md b/Intermediate Challenges/Challenge 0272 Intermediate - Dither that image/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #272 [Intermediate] Dither that image/challenge_text.md rename to Intermediate Challenges/Challenge 0272 Intermediate - Dither that image/challenge_text.md diff --git a/Intermediate Challenges/Challenge #273 [Intermediate] Twist up a message/challenge_text.md b/Intermediate Challenges/Challenge 0273 Intermediate - Twist up a message/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #273 [Intermediate] Twist up a message/challenge_text.md rename to Intermediate Challenges/Challenge 0273 Intermediate - Twist up a message/challenge_text.md diff --git a/Intermediate Challenges/Challenge #274 [Intermediate] Calculating De Bruijn sequences/challenge_text.md b/Intermediate Challenges/Challenge 0274 Intermediate - Calculating De Bruijn sequences/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #274 [Intermediate] Calculating De Bruijn sequences/challenge_text.md rename to Intermediate Challenges/Challenge 0274 Intermediate - Calculating De Bruijn sequences/challenge_text.md diff --git a/Intermediate Challenges/Challenge #275 [Intermediate] Splurthian Chemistry 102/challenge_text.md b/Intermediate Challenges/Challenge 0275 Intermediate - Splurthian Chemistry 102/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #275 [Intermediate] Splurthian Chemistry 102/challenge_text.md rename to Intermediate Challenges/Challenge 0275 Intermediate - Splurthian Chemistry 102/challenge_text.md diff --git a/Intermediate Challenges/Challenge #276 [Intermediate] Key function/challenge_text.md b/Intermediate Challenges/Challenge 0276 Intermediate - Key function/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #276 [Intermediate] Key function/challenge_text.md rename to Intermediate Challenges/Challenge 0276 Intermediate - Key function/challenge_text.md diff --git a/Intermediate Challenges/Challenge #277 [Intermediate] Fake coins/challenge_text.md b/Intermediate Challenges/Challenge 0277 Intermediate - Fake coins/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #277 [Intermediate] Fake coins/challenge_text.md rename to Intermediate Challenges/Challenge 0277 Intermediate - Fake coins/challenge_text.md diff --git a/Intermediate Challenges/Challenge #279 [Intermediate] Text Reflow/challenge_text.md b/Intermediate Challenges/Challenge 0279 Intermediate - Text Reflow/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #279 [Intermediate] Text Reflow/challenge_text.md rename to Intermediate Challenges/Challenge 0279 Intermediate - Text Reflow/challenge_text.md diff --git a/Intermediate Challenges/Challenge #280 [Intermediate] Anagram Maker/challenge_text.md b/Intermediate Challenges/Challenge 0280 Intermediate - Anagram Maker/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #280 [Intermediate] Anagram Maker/challenge_text.md rename to Intermediate Challenges/Challenge 0280 Intermediate - Anagram Maker/challenge_text.md diff --git a/Intermediate Challenges/Challenge #281 [Intermediate] Dank usernames/challenge_text.md b/Intermediate Challenges/Challenge 0281 Intermediate - Dank usernames/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #281 [Intermediate] Dank usernames/challenge_text.md rename to Intermediate Challenges/Challenge 0281 Intermediate - Dank usernames/challenge_text.md diff --git a/Intermediate Challenges/Challenge #282 [Intermediate] The final Quixo move/challenge_text.md b/Intermediate Challenges/Challenge 0282 Intermediate - The final Quixo move/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #282 [Intermediate] The final Quixo move/challenge_text.md rename to Intermediate Challenges/Challenge 0282 Intermediate - The final Quixo move/challenge_text.md diff --git a/Intermediate Challenges/Challenge #284 [Intermediate] Punch Card Creator/challenge_text.md b/Intermediate Challenges/Challenge 0284 Intermediate - Punch Card Creator/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #284 [Intermediate] Punch Card Creator/challenge_text.md rename to Intermediate Challenges/Challenge 0284 Intermediate - Punch Card Creator/challenge_text.md diff --git a/Intermediate Challenges/Challenge #285 [Intermediate] Cross PlatformLanguage Data Encoding part 2/challenge_text.md b/Intermediate Challenges/Challenge 0285 Intermediate - Cross PlatformLanguage Data Encoding part 2/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #285 [Intermediate] Cross PlatformLanguage Data Encoding part 2/challenge_text.md rename to Intermediate Challenges/Challenge 0285 Intermediate - Cross PlatformLanguage Data Encoding part 2/challenge_text.md diff --git a/Intermediate Challenges/Challenge #286 [Intermediate] Zeckendorf Representations of Positive Integers/challenge_text.md b/Intermediate Challenges/Challenge 0286 Intermediate - Zeckendorf Representations of Positive Integers/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #286 [Intermediate] Zeckendorf Representations of Positive Integers/challenge_text.md rename to Intermediate Challenges/Challenge 0286 Intermediate - Zeckendorf Representations of Positive Integers/challenge_text.md diff --git a/Intermediate Challenges/Challenge #287 [Intermediate] Mathagrams/challenge_text.md b/Intermediate Challenges/Challenge 0287 Intermediate - Mathagrams/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #287 [Intermediate] Mathagrams/challenge_text.md rename to Intermediate Challenges/Challenge 0287 Intermediate - Mathagrams/challenge_text.md diff --git a/Intermediate Challenges/Challenge #288 [Intermediate] Stars and Stripes and Vertices/challenge_text.md b/Intermediate Challenges/Challenge 0288 Intermediate - Stars and Stripes and Vertices/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #288 [Intermediate] Stars and Stripes and Vertices/challenge_text.md rename to Intermediate Challenges/Challenge 0288 Intermediate - Stars and Stripes and Vertices/challenge_text.md diff --git a/Intermediate Challenges/Challenge #289 [Intermediate] Metro trip planner/challenge_text.md b/Intermediate Challenges/Challenge 0289 Intermediate - Metro trip planner/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #289 [Intermediate] Metro trip planner/challenge_text.md rename to Intermediate Challenges/Challenge 0289 Intermediate - Metro trip planner/challenge_text.md diff --git a/Intermediate Challenges/Challenge #290 [Intermediate] Blinking LEDs/challenge_text.md b/Intermediate Challenges/Challenge 0290 Intermediate - Blinking LEDs/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #290 [Intermediate] Blinking LEDs/challenge_text.md rename to Intermediate Challenges/Challenge 0290 Intermediate - Blinking LEDs/challenge_text.md diff --git a/Intermediate Challenges/Challenge #291 [Intermediate] Reverse Polish Notation Calculator/challenge_text.md b/Intermediate Challenges/Challenge 0291 Intermediate - Reverse Polish Notation Calculator/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #291 [Intermediate] Reverse Polish Notation Calculator/challenge_text.md rename to Intermediate Challenges/Challenge 0291 Intermediate - Reverse Polish Notation Calculator/challenge_text.md diff --git a/Intermediate Challenges/Challenge #293 [Intermediate] Defusing the second bomb/challenge_text.md b/Intermediate Challenges/Challenge 0293 Intermediate - Defusing the second bomb/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #293 [Intermediate] Defusing the second bomb/challenge_text.md rename to Intermediate Challenges/Challenge 0293 Intermediate - Defusing the second bomb/challenge_text.md diff --git a/Intermediate Challenges/Challenge #294 [Intermediate] Rack management 2/challenge_text.md b/Intermediate Challenges/Challenge 0294 Intermediate - Rack management 2/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #294 [Intermediate] Rack management 2/challenge_text.md rename to Intermediate Challenges/Challenge 0294 Intermediate - Rack management 2/challenge_text.md diff --git a/Intermediate Challenges/Challenge #295 [Intermediate] Seperated Spouses/challenge_text.md b/Intermediate Challenges/Challenge 0295 Intermediate - Seperated Spouses/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #295 [Intermediate] Seperated Spouses/challenge_text.md rename to Intermediate Challenges/Challenge 0295 Intermediate - Seperated Spouses/challenge_text.md diff --git a/Intermediate Challenges/Challenge #296 [Intermediate] Intersecting Area Of Overlapping Rectangles/challenge_text.md b/Intermediate Challenges/Challenge 0296 Intermediate - Intersecting Area Of Overlapping Rectangles/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #296 [Intermediate] Intersecting Area Of Overlapping Rectangles/challenge_text.md rename to Intermediate Challenges/Challenge 0296 Intermediate - Intersecting Area Of Overlapping Rectangles/challenge_text.md diff --git a/Intermediate Challenges/Challenge #298 [Intermediate] Too many or too few Parentheses/challenge_text.md b/Intermediate Challenges/Challenge 0298 Intermediate - Too many or too few Parentheses/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #298 [Intermediate] Too many or too few Parentheses/challenge_text.md rename to Intermediate Challenges/Challenge 0298 Intermediate - Too many or too few Parentheses/challenge_text.md diff --git a/Intermediate Challenges/Challenge #299 [Intermediate] From Maze to graph/challenge_text.md b/Intermediate Challenges/Challenge 0299 Intermediate - From Maze to graph/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #299 [Intermediate] From Maze to graph/challenge_text.md rename to Intermediate Challenges/Challenge 0299 Intermediate - From Maze to graph/challenge_text.md diff --git a/Intermediate Challenges/Challenge #302 [Intermediate] ASCII Histogram Maker Part 1 - The Simple Bar Chart/challenge_text.md b/Intermediate Challenges/Challenge 0302 Intermediate - ASCII Histogram Maker Part 1 - The Simple Bar Chart/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #302 [Intermediate] ASCII Histogram Maker Part 1 - The Simple Bar Chart/challenge_text.md rename to Intermediate Challenges/Challenge 0302 Intermediate - ASCII Histogram Maker Part 1 - The Simple Bar Chart/challenge_text.md diff --git a/Intermediate Challenges/Challenge #304 [Intermediate] Horse Race Sorting/challenge_text.md b/Intermediate Challenges/Challenge 0304 Intermediate - Horse Race Sorting/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #304 [Intermediate] Horse Race Sorting/challenge_text.md rename to Intermediate Challenges/Challenge 0304 Intermediate - Horse Race Sorting/challenge_text.md diff --git a/Intermediate Challenges/Challenge #305 [Intermediate] The Best Conjunction/challenge_text.md b/Intermediate Challenges/Challenge 0305 Intermediate - The Best Conjunction/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #305 [Intermediate] The Best Conjunction/challenge_text.md rename to Intermediate Challenges/Challenge 0305 Intermediate - The Best Conjunction/challenge_text.md diff --git a/Intermediate Challenges/Challenge #306 [Intermediate] Gray Code/challenge_text.md b/Intermediate Challenges/Challenge 0306 Intermediate - Gray Code/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #306 [Intermediate] Gray Code/challenge_text.md rename to Intermediate Challenges/Challenge 0306 Intermediate - Gray Code/challenge_text.md diff --git a/Intermediate Challenges/Challenge #307 [Intermediate] Scrabble problem/challenge_text.md b/Intermediate Challenges/Challenge 0307 Intermediate - Scrabble problem/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #307 [Intermediate] Scrabble problem/challenge_text.md rename to Intermediate Challenges/Challenge 0307 Intermediate - Scrabble problem/challenge_text.md diff --git a/Intermediate Challenges/Challenge #309 [Intermediate] SequentialFinite state machines/challenge_text.md b/Intermediate Challenges/Challenge 0309 Intermediate - SequentialFinite state machines/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #309 [Intermediate] SequentialFinite state machines/challenge_text.md rename to Intermediate Challenges/Challenge 0309 Intermediate - SequentialFinite state machines/challenge_text.md diff --git a/Intermediate Challenges/Challenge #310 [Intermediate] Simplifying square roots/challenge_text.md b/Intermediate Challenges/Challenge 0310 Intermediate - Simplifying square roots/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #310 [Intermediate] Simplifying square roots/challenge_text.md rename to Intermediate Challenges/Challenge 0310 Intermediate - Simplifying square roots/challenge_text.md diff --git a/Intermediate Challenges/Challenge #311 [Intermediate] IPv4 Subnet Calculator/challenge_text.md b/Intermediate Challenges/Challenge 0311 Intermediate - IPv4 Subnet Calculator/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #311 [Intermediate] IPv4 Subnet Calculator/challenge_text.md rename to Intermediate Challenges/Challenge 0311 Intermediate - IPv4 Subnet Calculator/challenge_text.md diff --git a/Intermediate Challenges/Challenge #312 [Intermediate] Next largest number/challenge_text.md b/Intermediate Challenges/Challenge 0312 Intermediate - Next largest number/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #312 [Intermediate] Next largest number/challenge_text.md rename to Intermediate Challenges/Challenge 0312 Intermediate - Next largest number/challenge_text.md diff --git a/Intermediate Challenges/Challenge #313 [Intermediate] PGM image manipulation/challenge_text.md b/Intermediate Challenges/Challenge 0313 Intermediate - PGM image manipulation/challenge_text.md similarity index 100% rename from Intermediate Challenges/Challenge #313 [Intermediate] PGM image manipulation/challenge_text.md rename to Intermediate Challenges/Challenge 0313 Intermediate - PGM image manipulation/challenge_text.md diff --git a/transform.py b/transform.py index 6bc56e6..eea94c4 100755 --- a/transform.py +++ b/transform.py @@ -19,57 +19,50 @@ def update_challenge_dir_name(oldName, difficulty): '''Update the specified challenge dirs names. Returns original name if it suspects that it would fail a valid transformation.''' - temp = oldName.split() - - # Find the current challenge number. - - # This will match the first number in the string. - # The extra stuff on either side makes sure that it will not match strings - # longer than the specified amount in the middle. - match = regex.search(r'(?<=[^\d]|^)\d{1,5}(?=[^\d]|$)', oldName) - - # n is the number of digits in the challenge number. - # I will use this to know how many zeroes to enter. - if (match): - currNum = match.group() - n = len(currNum) - - # Handle challenges that have multiple iterations, such as 166b - if (regex.match(r'[.\S]', oldName[match.end()])): - newNum = ' ' + '0'*(4-n-1) + currNum[-n:] - newNum += oldName[match.end()] + ' ' - else: - newNum = ' ' + '0'*(4-n) + currNum[-n:] + ' ' - else: + # Find the challenge number: + # tokens, delimited by ' ' + # find the first token that has one number embedded within + # This should be the challenge number + # This should avoid other strings with multiple numbers e.g. '[2016-05-20]' + tokens = oldName.split() + + currNum = '' + n = 0 + while (len(tokens) > 0 and n == 0): + a_token = tokens.pop(0) + match = re.findall(r'(\d{1,5})', a_token) + if (match and len(match) == 1): + currNum = match[0] + n = len(currNum) + + # Clean up submissions with leading zeros + if (a_token[0] == '#' and n != 0 and currNum[0] == '0'): + currNum = currNum[1:] + n = n - 1 + + # No correct looking number found, or, it appears that the + # number returned already appears to be in canonical form + if (n == 0 or currNum[0] == '0'): return oldName - - newTitle = 'Challenge' + newNum + difficulty.capitalize() - - # Try to tease out the challenge name... - # First, remove the number we found earlier from the string... - - notName = [i for i, number in enumerate(temp) - if regex.search(currNum + r'|' + - r'challenge|' + difficulty, - number, regex.IGNORECASE)] - - # I squashed several "single" filters down to one OR'd filter. - # This is the syntax for the "single" filters. - # notName += [i for i, number in enumerate(temp) - # if re.search('challenge', number, re.IGNORECASE)] - - i = 0 - for curr in notName: - temp.pop(curr - i) - i += 1 - - if len(temp) > 0: - challengeName = " - " + " ".join(temp) - else: - challengeName = "" - - newTitle = newTitle + challengeName - return newTitle + + # Found a likely looking number + # tokens now possess' the remaining title + # a_token now has the original and possible multiple iteration number + # such as 166b + i = re.findall(r'\S*' + re.escape(currNum) + '(\S*)$', a_token) + newNum = ' ' + '0'*(4-n) + currNum + (i.pop() if (len(i) > 0) else ' ') + ' ' + + # Construct new title + newTitle = 'Challenge' + newNum + difficulty.capitalize() + ' - ' + + suffix = " ".join([w for w in tokens + if len(re.findall(r'' + + '\[' + difficulty + '|' + + currNum + '|' + + 'challenge', + w, re.IGNORECASE)) == 0]) + + return newTitle + suffix def main(): From a3d94fcfcea9291f152bb654e5710953432742e4 Mon Sep 17 00:00:00 2001 From: Colby Gutierrez-Kraybill Date: Sat, 21 Oct 2017 21:56:39 -0400 Subject: [PATCH 2/3] Update most recent challenges --- .../challenge_text.md | 33 ++ .../challenge_text.md | 68 ++++ .../challenge_text.md | 28 ++ .../challenge_text.md | 345 ++++++++++++++++++ .../challenge_text.md | 49 +++ .../challenge_text.md | 29 ++ .../challenge_text.md | 42 +++ .../challenge_text.md | 39 ++ .../challenge_text.md | 55 +++ .../challenge_text.md | 41 +++ .../challenge_text.md | 23 ++ .../challenge_text.md | 99 +++++ .../challenge_text.md | 43 +++ .../challenge_text.md | 72 ++++ .../challenge_text.md | 81 ++++ .../challenge_text.md | 50 +++ .../challenge_text.md | 65 ++++ .../challenge_text.md | 128 +++++++ .../challenge_text.md | 58 +++ .../challenge_text.md | 51 +++ .../challenge_text.md" | 0 .../challenge_text.md | 42 +++ .../challenge_text.md | 38 ++ .../challenge_text.md | 57 +++ .../challenge_text.md | 185 ++++++++++ .../challenge_text.md | 90 +++++ .../challenge_text.md | 77 ++++ .../challenge_text.md | 70 ++++ .../challenge_text.md | 40 ++ .../challenge_text.md | 28 ++ .../challenge_text.md | 34 ++ .../challenge_text.md | 36 ++ .../challenge_text.md | 47 +++ .../challenge_text.md | 15 + .../challenge_text.md | 72 ++++ .../challenge_text.md | 35 ++ .../challenge_text.md | 124 +++++++ .../challenge_text.md | 170 +++++++++ .../challenge_text.md | 28 ++ .../challenge_text.md | 173 +++++++++ .../challenge_text.md | 35 ++ .../challenge_text.md | 71 ++++ .../challenge_text.md | 55 +++ .../challenge_text.md | 32 ++ .../challenge_text.md | 113 ++++++ .../challenge_text.md | 47 +++ .../challenge_text.md | 61 ++++ .../challenge_text.md | 75 ++++ .../challenge_text.md | 39 ++ .../challenge_text.md | 59 +++ .../challenge_text.md | 54 +++ .../challenge_text.md | 67 ++++ .../challenge_text.md | 89 +++++ .../challenge_text.md | 65 ++++ .../challenge_text.md | 49 +++ .../challenge_text.md | 55 +++ .../challenge_text.md | 35 ++ .../challenge_text.md | 36 ++ .../challenge_text.md | 97 +++++ .../challenge_text.md | 51 +++ .../challenge_text.md | 41 +++ 61 files changed, 3986 insertions(+) create mode 100644 Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md create mode 100644 Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md create mode 100644 Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md create mode 100644 Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md create mode 100644 Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md create mode 100644 Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md create mode 100644 Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md create mode 100644 Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md create mode 100644 Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md create mode 100644 Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md create mode 100644 Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md create mode 100644 Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md create mode 100644 Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md create mode 100644 Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md create mode 100644 Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md create mode 100644 Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md create mode 100644 Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md create mode 100644 Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md create mode 100644 Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md create mode 100644 Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md create mode 100644 "Extra-Bonus Challenges/[Monthly Challenge #22 - September, 2017] Procedural Bacteria Fungus Virus \342\200\242 rproceduralgeneration/challenge_text.md" create mode 100644 Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md create mode 100644 Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md create mode 100644 Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md create mode 100644 Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md create mode 100644 Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md create mode 100644 Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md create mode 100644 Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md create mode 100644 Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md create mode 100644 Hard Challenges/Challenge 0323 Hard - Difference coverage/challenge_text.md create mode 100644 Hard Challenges/Challenge 0325 Hard - Generating mazes/challenge_text.md create mode 100644 Hard Challenges/Challenge 0326 Hard - Multifaceted alphabet blocks/challenge_text.md create mode 100644 Hard Challenges/Challenge 0327 Hard - Calculating Costas Arrays/challenge_text.md create mode 100644 Hard Challenges/Challenge 0328 Hard - Subset Sum Automata/challenge_text.md create mode 100644 Hard Challenges/Challenge 0329 Hard - Implementing a Templating Engine/challenge_text.md create mode 100644 Hard Challenges/Challenge 0330 Hard - Mini-Chess Positions/challenge_text.md create mode 100644 Hard Challenges/Challenge 0331 Hard - Interactive Interpreter/challenge_text.md create mode 100644 Hard Challenges/Challenge 0332 Hard - Skyscrapers and CEO's peculiar requirements/challenge_text.md create mode 100644 Hard Challenges/Challenge 0333 Hard - Build a Web API-driven Data Site/challenge_text.md create mode 100644 Hard Challenges/Challenge 0334 Hard - Dinosaurs/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0314 Intermediate - Comparing Rotated Words/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0315 Intermediate - Game of life that has a twist/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0316 Intermediate - Sydney tourist shopping cart/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0317 Intermediate - Counting Elements/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0318 Intermediate - 2020 - NBA Revolution/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0319 Intermediate - Worm Wars 1 - Basic Epidemiology/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0320 Intermediate - War (card game)/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0321 Intermediate - Affine Cipher Solver/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0322 Intermediate - Largest Palindrome/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0323 Intermediate - Parsing Postal Addresses/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0325 Intermediate - Arrow maze/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0326 Intermediate - Scrabble in Reverse/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0328 Intermediate - Pyramid sliding/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0329 Intermediate - Solve the Water Bucket Riddle/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0330 Intermediate - Check Writer/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0331 Intermediate - Sum of digits of x raised to n/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0332 Intermediate - Training for Summiting Everest/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0333 Intermediate - Beer Street and Gin Lane/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0334 Intermediate - Carpet Fractals/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0335 Intermediate - Scoring a Cribbage Hand/challenge_text.md create mode 100644 Intermediate Challenges/Challenge 0336 Intermediate - Repetitive Rubik's Cube/challenge_text.md diff --git a/Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md b/Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md new file mode 100644 index 0000000..d0d9952 --- /dev/null +++ b/Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md @@ -0,0 +1,33 @@ +# Description + +Given a list of integers separated by a single space on standard input, print out the largest and smallest values that can be obtained by concatenating the integers together on their own line. This is from [Five programming problems every Software Engineer should be able to solve in less than 1 hour](http://www.shiftedup.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour), problem 4. Leading 0s are not allowed (e.g. 01234 is not a valid entry). + +This is an easier version of [#312I](https://www.reddit.com/r/dailyprogrammer/comments/67q3s6/20170426_challenge_312_intermediate_next_largest/?utm_content=title&utm_medium=hot&utm_source=reddit&utm_name=dailyprogrammer). + +# Sample Input + +You'll be given a handful of integers per line. Example: + + 5 56 50 + +# Sample Output + +You should emit the smallest and largest integer you can make, per line. Example: + + 50556 56550 + +# Challenge Input + + 79 82 34 83 69 + 420 34 19 71 341 + 17 32 91 7 46 + +# Challenge Output + + 3469798283 8382796934 + 193413442071 714203434119 + 173246791 917463217 + +# Bonus + +**EDIT** My solution uses permutations, which is inefficient. Try and come up with a more efficient approach. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md b/Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md new file mode 100644 index 0000000..ca1018d --- /dev/null +++ b/Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md @@ -0,0 +1,68 @@ +# Description + +One way to think about bitwise *addition* (using the symbol `^`) as binary addition without carrying the extra bits: + + 101 5 + ^ 1001 9 + ---- + 1100 12 + + 5^9=12 + +So let's define XOR multiplcation (we'll use the symbol `@`) in the same way, the addition step doesn't carry: + + 1110 14 + @ 1101 13 + ----- + 1110 + 0 + 1110 + ^ 1110 + ------ + 1000110 70 + + 14@13=70 + +For this challenge you'll get two non-negative integers as input and output or print their XOR-product, using both binary and decimal notation. + +# Input Description + +You'll be given two integers per line. Example: + + 5 9 + +# Output Description + +You should emit the equation showing the XOR multiplcation result: + + 5@9=45 + +**EDIT** I had it as `12` earlier, but that was a copy-paste error. Fixed. + +# Challenge Input + + 1 2 + 9 0 + 6 1 + 3 3 + 2 5 + 7 9 + 13 11 + 5 17 + 14 13 + 19 1 + 63 63 + +# Challenge Output + + 1@2=2 + 9@0=0 + 6@1=6 + 3@3=5 + 2@5=10 + 7@9=63 + 13@11=127 + 5@17=85 + 14@13=70 + 19@1=19 + 63@63=1365 diff --git a/Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md b/Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md new file mode 100644 index 0000000..a2cb067 --- /dev/null +++ b/Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md @@ -0,0 +1,28 @@ +# Description + +A knight piece in chess can only make L-shaped moves. Specifically, it can only move x steps to the right and y steps up if (x,y) is one of: + + (-1,-2) ( 1,-2) (-1, 2) ( 1, 2) + (-2,-1) ( 2,-1) (-2, 1) ( 2, 1) + +(For this problem, assume the board extends infinitely in all directions, so a knight may always make eight moves from any starting point.) A knight starting from (0,0) can reach any square, but it may have to take a roundabout route. For instance, to reach the square (0,1) requires three steps: + + 2, 1 + -1, 2 + -1, -2 + +(Notice that the x's add up to 0, and the y's add up to 1.) Write a program, that, given a square (x,y), returns how many moves it takes a knight to reach that square starting from (0,0). + +# Example Input + + 3 7 + +# Example Output + + 4 + +Optional: also output one route the knight could take to reach this square. + +# Credit + +This challenge was suggested by /u/Cosmologicon, a well-known moderator of this sub. Many thanks! This one was hiding in the archives ... \ No newline at end of file diff --git a/Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md b/Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md new file mode 100644 index 0000000..b3d8bd4 --- /dev/null +++ b/Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md @@ -0,0 +1,345 @@ + +# Description + +Implement the [Collatz Conjecture tag system described here](https://en.wikipedia.org/wiki/Tag_system#Example:_Computation_of_Collatz_sequences) + +# Input Description + +A string of n *a*'s + +# Output Description + +Print the string at each step. The last line should be "*a*" (assuming the Collatz conjecture) + +# Challenge Input + + + aaa + aaaaa + +# Challenge Output + +aaa + + abc + cbc + caaa + aaaaa + aaabc + abcbc + cbcbc + cbcaaa + caaaaaa + aaaaaaaa + aaaaaabc + aaaabcbc + aabcbcbc + bcbcbcbc + bcbcbca + bcbcaa + bcaaa + aaaa + aabc + bcbc + bca + aa + bc + a + +aaaaaaa + + aaaaabc + aaabcbc + abcbcbc + cbcbcbc + cbcbcaaa + cbcaaaaaa + caaaaaaaaa + aaaaaaaaaaa + aaaaaaaaabc + aaaaaaabcbc + aaaaabcbcbc + aaabcbcbcbc + abcbcbcbcbc + cbcbcbcbcbc + cbcbcbcbcaaa + cbcbcbcaaaaaa + cbcbcaaaaaaaaa + cbcaaaaaaaaaaaa + caaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaabc + aaaaaaaaaaaaabcbc + aaaaaaaaaaabcbcbc + aaaaaaaaabcbcbcbc + aaaaaaabcbcbcbcbc + aaaaabcbcbcbcbcbc + aaabcbcbcbcbcbcbc + abcbcbcbcbcbcbcbc + cbcbcbcbcbcbcbcbc + cbcbcbcbcbcbcbcaaa + cbcbcbcbcbcbcaaaaaa + cbcbcbcbcbcaaaaaaaaa + cbcbcbcbcaaaaaaaaaaaa + cbcbcbcaaaaaaaaaaaaaaa + cbcbcaaaaaaaaaaaaaaaaaa + cbcaaaaaaaaaaaaaaaaaaaaa + caaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaabc + aaaaaaaaaaaaaaaaaaaaaabcbc + aaaaaaaaaaaaaaaaaaaabcbcbc + aaaaaaaaaaaaaaaaaabcbcbcbc + aaaaaaaaaaaaaaaabcbcbcbcbc + aaaaaaaaaaaaaabcbcbcbcbcbc + aaaaaaaaaaaabcbcbcbcbcbcbc + aaaaaaaaaabcbcbcbcbcbcbcbc + aaaaaaaabcbcbcbcbcbcbcbcbc + aaaaaabcbcbcbcbcbcbcbcbcbc + aaaabcbcbcbcbcbcbcbcbcbcbc + aabcbcbcbcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbcbcbcbca + bcbcbcbcbcbcbcbcbcbcbcaa + bcbcbcbcbcbcbcbcbcbcaaa + bcbcbcbcbcbcbcbcbcaaaa + bcbcbcbcbcbcbcbcaaaaa + bcbcbcbcbcbcbcaaaaaa + bcbcbcbcbcbcaaaaaaa + bcbcbcbcbcaaaaaaaa + bcbcbcbcaaaaaaaaa + bcbcbcaaaaaaaaaa + bcbcaaaaaaaaaaa + bcaaaaaaaaaaaa + aaaaaaaaaaaaa + aaaaaaaaaaabc + aaaaaaaaabcbc + aaaaaaabcbcbc + aaaaabcbcbcbc + aaabcbcbcbcbc + abcbcbcbcbcbc + cbcbcbcbcbcbc + cbcbcbcbcbcaaa + cbcbcbcbcaaaaaa + cbcbcbcaaaaaaaaa + cbcbcaaaaaaaaaaaa + cbcaaaaaaaaaaaaaaa + caaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaabc + aaaaaaaaaaaaaaaabcbc + aaaaaaaaaaaaaabcbcbc + aaaaaaaaaaaabcbcbcbc + aaaaaaaaaabcbcbcbcbc + aaaaaaaabcbcbcbcbcbc + aaaaaabcbcbcbcbcbcbc + aaaabcbcbcbcbcbcbcbc + aabcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbca + bcbcbcbcbcbcbcbcaa + bcbcbcbcbcbcbcaaa + bcbcbcbcbcbcaaaa + bcbcbcbcbcaaaaa + bcbcbcbcaaaaaa + bcbcbcaaaaaaa + bcbcaaaaaaaa + bcaaaaaaaaa + aaaaaaaaaa + aaaaaaaabc + aaaaaabcbc + aaaabcbcbc + aabcbcbcbc + bcbcbcbcbc + bcbcbcbca + bcbcbcaa + bcbcaaa + bcaaaa + aaaaa + aaabc + abcbc + cbcbc + cbcaaa + caaaaaa + aaaaaaaa + aaaaaabc + aaaabcbc + aabcbcbc + bcbcbcbc + bcbcbca + bcbcaa + bcaaa + aaaa + aabc + bcbc + bca + aa + bc + a + +# Notes/Hints + +The [Collatz Conjecture](https://en.wikipedia.org/wiki/3x_%2B_1_problem) + +If you're not familiar with tag systems, you can read the [Wikipedia article on them here](https://en.wikipedia.org/wiki/Tag_system) + + + +# Bonus + +Implement the same tag system as a cyclic tag system using the [schema described here](https://en.wikipedia.org/wiki/Tag_system#Emulation_of_tag_systems_by_cyclic_tag_systems) + +# Bonus Input + + 100100100 + +# Bonus Output + + 00100100010001 + 0100100010001 + 100100010001 + 00100010001 + 0100010001 + 100010001 + 00010001010001 + 0010001010001 + 010001010001 + 10001010001 + 0001010001 + 001010001 + 01010001 + 1010001 + 010001100100100 + 10001100100100 + 0001100100100 + 001100100100 + 01100100100 + 1100100100 + 100100100100100100 + 00100100100100100 + 0100100100100100 + 100100100100100 + 00100100100100010001 + 0100100100100010001 + 100100100100010001 + 00100100100010001 + 0100100100010001 + 100100100010001 + 00100100010001010001 + 0100100010001010001 + 100100010001010001 + 00100010001010001 + 0100010001010001 + 100010001010001 + 00010001010001010001 + 0010001010001010001 + 010001010001010001 + 10001010001010001 + 0001010001010001 + 001010001010001 + 01010001010001 + 1010001010001 + 010001010001100100100 + 10001010001100100100 + 0001010001100100100 + 001010001100100100 + 01010001100100100 + 1010001100100100 + 010001100100100100100100 + 10001100100100100100100 + 0001100100100100100100 + 001100100100100100100 + 01100100100100100100 + 1100100100100100100 + 100100100100100100100100100 + 00100100100100100100100100 + 0100100100100100100100100 + 100100100100100100100100 + 00100100100100100100100010001 + 0100100100100100100100010001 + 100100100100100100100010001 + 00100100100100100100010001 + 0100100100100100100010001 + 100100100100100100010001 + 00100100100100100010001010001 + 0100100100100100010001010001 + 100100100100100010001010001 + 00100100100100010001010001 + 0100100100100010001010001 + 100100100100010001010001 + 00100100100010001010001010001 + 0100100100010001010001010001 + 100100100010001010001010001 + 00100100010001010001010001 + 0100100010001010001010001 + 100100010001010001010001 + 00100010001010001010001010001 + 0100010001010001010001010001 + 100010001010001010001010001 + 00010001010001010001010001 + 0010001010001010001010001 + 010001010001010001010001 + 10001010001010001010001 + 0001010001010001010001100 + 001010001010001010001100 + 01010001010001010001100 + 1010001010001010001100 + 010001010001010001100 + 10001010001010001100 + 0001010001010001100100 + 001010001010001100100 + 01010001010001100100 + 1010001010001100100 + 010001010001100100 + 10001010001100100 + 0001010001100100100 + 001010001100100100 + 01010001100100100 + 1010001100100100 + 010001100100100 + 10001100100100 + 0001100100100100 + 001100100100100 + 01100100100100 + 1100100100100 + 100100100100 + 00100100100010001 + 0100100100010001 + 100100100010001 + 00100100010001 + 0100100010001 + 100100010001 + 00100010001010001 + 0100010001010001 + 100010001010001 + 00010001010001 + 0010001010001 + 010001010001 + 10001010001 + 0001010001100 + 001010001100 + 01010001100 + 1010001100 + 010001100 + 10001100 + 0001100100 + 001100100 + 01100100 + 1100100 + 100100 + 00100010001 + 0100010001 + 100010001 + 00010001 + 0010001 + 010001 + 10001 + 0001100 + 001100 + 01100 + 1100 + 100 + +# Credit + +This challenge was proposed by /u/thebutterflydefect, many thanks. If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md b/Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md new file mode 100644 index 0000000..ea52cf2 --- /dev/null +++ b/Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md @@ -0,0 +1,49 @@ +# Description + +This challenge is based off the British tv game show "Countdown". The rules are pretty simple: Given a set of numbers X1-X5, calculate using mathematical operations to solve for Y. You can use addition, subtraction, multiplication, or division. + +Unlike "real math", the standard order of operations (PEMDAS) is not applied here. Instead, the order is determined left to right. + +# Example Input + +The user should input any 6 whole numbers and the target number. E.g. + + 1 3 7 6 8 3 250 + +# Example Output + +The output should be the order of numbers and operations that will compute the target number. E.g. + + 3+8*7+6*3+1=250 + +Note that if follow PEMDAS you get: + + 3+8*7+6*3+1 = 78 + +But remember our rule - go left to right and operate. So the solution is found by: + + (((((3+8)*7)+6)*3)+1) = 250 + +If you're into functional progamming, this is essentially a *fold* to the right using the varied operators. + +# Challenge Input + + 25 100 9 7 3 7 881 + + 6 75 3 25 50 100 952 + +# Challenge Output + + 7 * 3 + 100 * 7 + 25 + 9 = 881 + + 100 + 6 * 3 * 75 - 50 / 25 = 952 + +# Notes about Countdown + +Since Countdown's debut in 1982, there have been over 6,500 televised games and 75 complete series. There have also been fourteen Champion of Champions tournaments, with the most recent starting in January 2016. + +On 5 September 2014, Countdown received a Guinness World Record at the end of its 6,000th show for the longest-running television programme of its kind during the course of its 71st series. + +# Credit + +This challenge was suggested by user /u/MoistedArnoldPalmer, many thanks. Furthermore, /u/JakDrako highlighted the difference in the order of operations that clarifies this problem significantly. Thanks to both of them. If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md b/Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md new file mode 100644 index 0000000..c68362a --- /dev/null +++ b/Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md @@ -0,0 +1,29 @@ +# Description + +Compression makes use of the fact that repeated structures are redundant, and it's more efficient to represent the pattern and the count or a reference to it. Siimilarly, we can *condense* a sentence by using the redundancy of overlapping letters from the end of one word and the start of the next. In this manner we can reduce the size of the sentence, even if we start to lose meaning. + +For instance, the phrase "live verses" can be condensed to "liverses". + +In this challenge you'll be asked to write a tool to condense sentences. + +# Input Description + +You'll be given a sentence, one per line, to condense. Condense where you can, but know that you can't condense everywhere. Example: + + I heard the pastor sing live verses easily. + +# Output Description + +Your program should emit a sentence with the appropriate parts condensed away. Our example: + + I heard the pastor sing liverses easily. + +# Challenge Input + + Deep episodes of Deep Space Nine came on the television only after the news. + Digital alarm clocks scare area children. + +# Challenge Output + + Deepisodes of Deep Space Nine came on the televisionly after the news. + Digitalarm clockscarea children. diff --git a/Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md b/Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md new file mode 100644 index 0000000..f7627fd --- /dev/null +++ b/Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md @@ -0,0 +1,42 @@ +# Description + +The user enters a number. Make a spiral that begins with 1 and starts from the top left, going towards the right, and ends with the square of that number. + +# Input description + +Let the user enter a number. + +# Output description + +Note the proper spacing in the below example. You'll need to know the number of digits in the biggest number. + +You may go for a CLI version or GUI version. + +# Challenge Input + + 5 + + 4 + +# Challenge Output + + 1 2 3 4 5 + 16 17 18 19 6 + 15 24 25 20 7 + 14 23 22 21 8 + 13 12 11 10 9 + + + + 1 2 3 4 + 12 13 14 5 + 11 16 15 6 + 10 9 8 7 + +# Bonus + +As a bonus, the code could take a parameter and make a clockwise or counter-clockwise spiral. + +# Credit + +This challenge was suggested by /u/MasterAgent47 (with a bonus suggested by /u/JakDrako), many thanks to them both. If you would like, submit to /r/dailyprogrammer_ideas if you have any challenge ideas! \ No newline at end of file diff --git a/Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md b/Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md new file mode 100644 index 0000000..8f4f1f0 --- /dev/null +++ b/Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md @@ -0,0 +1,39 @@ + +**Description** + +No more hiding from your alarm clock! You've decided you want your computer to keep you updated on the time so you're never late again. A talking clock takes a 24-hour time and translates it into words. + + +**Input Description** + +An hour (0-23) followed by a colon followed by the minute (0-59). + + +**Output Description** + +The time in words, using 12-hour format followed by am or pm. + + +**Sample Input data** + + 00:00 + 01:30 + 12:05 + 14:01 + 20:29 + 21:00 + + +**Sample Output data** + + It's twelve am + It's one thirty am + It's twelve oh five pm + It's two oh one pm + It's eight twenty nine pm + It's nine pm + + +**Extension challenges (optional)** + +Use the audio clips [found here](http://steve-audio.net/voices/) to give your clock a voice. diff --git a/Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md b/Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md new file mode 100644 index 0000000..dcb234a --- /dev/null +++ b/Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md @@ -0,0 +1,55 @@ +# Description + +In the world of software testing there is a combinatorial shortcut to exhaustive testing called "All Pairs" or "Pairwise Testing". The gist of this kind of testing is based on some old research that found for a given scenario^1 -- a web form, for example -- most errors were caused either by 1 element, or the interaction of a pair of elements. So, rather than test every single combination of possible inputs, if you carefully chose your test cases so that each possible combination of 2 elements appeared at least once in the test cases, then you'd encounter the majority of the problems. This is helpful because for a form with many inputs, the exhaustive list of combinations can be quite large, but doing all-pairs testing can reduce the list quite drastically. + + +Say on our hypothetical web form, we have a checkbox and two dropdowns. + +* The checkbox can only have two values: 0 or 1 +* The first dropdown can have three values: A B or C +* The second dropdown can have four values: D E F or G + +For this form, the total number of possible combinations is 2 x 3 x 4 = 24. But if we apply all pairs, we can reduce the number of tests to 12: + + 0 A G + 0 B G + 0 C D + 0 C E + 0 C F + 1 A D + 1 A E + 1 A F + 1 B D + 1 B E + 1 B F + 1 C G + +**Note**: Depending on how you generate the set, there can be more than one solution, but a proper answer must satisfy the conditions that **each member of the set must contain at least one pair which does not appear anywhere else in the set, and all possible pairs of inputs are represented somewhere in the set.** For example, the first member of the set above, 0AG contains the pairs '0A' and 'AG' which are not represented anywhere else in the set. The second member, '0BG' contains 'OG' and 'BG' which are not represented elsewhere. And so on and so forth. + +So, the challenge is, given a set of possible inputs, e.g. `[['0', '1'], ['A', 'B', 'C'], ['D', 'E', 'F', 'G']]` output a valid all-pairs set such that the conditions in bold above is met. + + ^1 There are some restrictions as to where this is applicable. + +# Challenge Inputs + + [['0', '1'], ['A', 'B', 'C'], ['D', 'E', 'F', 'G']] + [['0', '1', '2', '3'], ['A', 'B', 'C', 'D'], ['E', 'F', 'G', 'H', 'I']] + [['0', '1', '2', '3', '4'], ['A', 'B', 'C', 'D', 'E'], ['F', 'G', 'H', 'I'], ['J', 'K', 'L']] + +# Challenge Outputs + +(Because there are multiple valid solutions, this is the length of the output set - bonus points if you find a valid set with a lower length than one of these answers.) + + 12 + 34 + 62 + +# Additional Reading + +[Wikipedia: All-pairs testing](https://en.wikipedia.org/wiki/All-pairs_testing) + +[DevelopSense](http://www.developsense.com/pairwiseTesting.html) -- for hints on how to generate the pairs, and more info on testing, its limitations and stuff + +# Credit + +This challenge was suggested by user /u/abyssalheaven, many thanks! If you have an idea for a challenge, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md b/Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md new file mode 100644 index 0000000..cd38a47 --- /dev/null +++ b/Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md @@ -0,0 +1,41 @@ +# Description + +In computational complexity theory, the 3SUM problem asks if a given set of *n* real numbers contains three elements that sum to zero. A naive solution works in O(N^2) time, and research efforts have been exploring the lower complexity bound for some time now. + +# Input Example + +You will be given a list of integers, one set per line. Example: + + 9 -6 -5 9 8 3 -4 8 1 7 -4 9 -9 1 9 -9 9 4 -6 -8 + +# Output Example + +Your program should emit triplets of numbers that sum to 0. Example: + + -9 1 8 + -8 1 7 + -5 -4 9 + -5 1 4 + -4 1 3 + -4 -4 8 + +# Challenge Input + + 4 5 -1 -2 -7 2 -5 -3 -7 -3 1 + -1 -6 -3 -7 5 -8 2 -8 1 + -5 -1 -4 2 9 -9 -6 -1 -7 + +# Challenge Output + + -7 2 5 + -5 1 4 + -3 -2 5 + -3 -1 4 + -3 1 2 + + -7 2 5 + -6 1 5 + -3 1 2 + + -5 -4 9 + -1 -1 2 diff --git a/Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md b/Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md new file mode 100644 index 0000000..2f0bb33 --- /dev/null +++ b/Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md @@ -0,0 +1,23 @@ +Write a program that outputs the highest number that is lower or equal than the square root of the given number, with the given number of decimal fraction digits. + +Use this technique, (do not use your language's built in square root function): https://medium.com/i-math/how-to-find-square-roots-by-hand-f3f7cadf94bb + +**input format: 2 numbers:** precision-digits Number + +**sample input** + +0 7720.17 +1 7720.17 +2 7720.17 + +**sample output** + +87 +87.8 +87.86 + +**challenge inputs** + +0 12345 +8 123456 +1 12345678901234567890123456789 \ No newline at end of file diff --git a/Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md b/Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md new file mode 100644 index 0000000..f2017b0 --- /dev/null +++ b/Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md @@ -0,0 +1,99 @@ +#Description + +Today we are going to do something colorfull and amazing. Yes it is a color maze :D (you can downvote me now, it was totally worth it). + +You traverse a color by following a sequence of colors. For example [this maze](http://imgur.com/AnK1kwa) can be solved by the sequence 'orange -> green'. +Then you would have something like [this](http://imgur.com/zgciqa5) (paint skills) + +For the mazes you always pick a spot on the bottom, in the starting color and try to get to the first row. Once you reach the first row, you are out of the maze. The sequence does not have to be complete. + +You can move horizontally and vertically, but not diagonally. It is also allowed to move on the same node more then once. + +#Formal Inputs & Outputs + +##Input description + +You will recieve a line with the sequence to follow and all the lines after that are the maze. + + O G + B O R O Y + O R B G R + B O G O Y + Y G B Y G + R O R B R + +##Output description + +You can choose what you want to output: + +you could output the path: + + (1,4) + (1,3) + (1,2) + (2,2) + (3,2) + (3,1) + (3,0) + +or you could plot out the sequence + + / / / O / + / / / G / + / O G O / + / G / / / + / O / / / + +or you could create an image result or go even fancier if you want to. + + +##Challnge Input + + R O Y P O + R R B R R R B P Y G P B B B G P B P P R + B G Y P R P Y Y O R Y P P Y Y R R R P P + B P G R O P Y G R Y Y G P O R Y P B O O + R B B O R P Y O O Y R P B R G R B G P G + R P Y G G G P Y P Y O G B O R Y P B Y O + O R B G B Y B P G R P Y R O G Y G Y R P + B G O O O G B B R O Y Y Y Y P B Y Y G G + P P G B O P Y G B R O G B G R O Y R B R + Y Y P P R B Y B P O O G P Y R P P Y R Y + P O O B B B G O Y G O P B G Y R R Y R B + P P Y R B O O R O R Y B G B G O O P B Y + B B R G Y G P Y G P R R P Y G O O Y R R + O G R Y B P Y O P B R Y B G P G O O B P + R Y G P G G O R Y O O G R G P P Y P B G + P Y P R O O R O Y R P O R Y P Y B B Y R + O Y P G R P R G P O B B R B O B Y Y B P + B Y Y P O Y O Y O R B R G G Y G R G Y G + Y B Y Y G B R R O B O P P O B O R R R P + P O O O P Y G G Y P O G P O B G P R P B + R B B R R R R B B B Y O B G P G G O O Y + +#Notes/Hints + +Since the sequence can have the same color more then once, it is possible that you have to visit the same node more then once. + +#Bonus + +Read the data not from text input but from the [image](http://imgur.com/uoItN6T) + +All squares are 100 by 100 pixels with 1 pixel border + +The RGB values are + + Red: (255, 0, 0) + Green: (0,128,0) + Blue: (0, 0, 255) + Orange: (255, 165, 0) + Yellow: (255, 255, 0) + Pink: (255, 192, 203) + +#Finally + +Have a good challenge idea? + +Consider submitting it to /r/dailyprogrammer_ideas + +EDIT: Added clarifications after some questions of /u/the_droide \ No newline at end of file diff --git a/Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md b/Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md new file mode 100644 index 0000000..df5a996 --- /dev/null +++ b/Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md @@ -0,0 +1,43 @@ + +# Description + +A prime number is any integer greater than 1 which can only be evenly divided by 1 or itself. For this challenge, you will output two numbers: the nearest prime below the input, and the nearest prime above it. + +# Input Description + +The input will be a number on each line, called *n*. + +# Output Description + +The format of the output will be: +> *p1 < n < p2* + +where *p1* is the smaller prime, *p2* is the larger prime and *n* is the input. + +If *n* already is a prime, the output will be: +>*n* is prime. + +# Challenge Input + + 270 + 541 + 993 + 649 + +# Challenge Output + + 269 < 270 < 271 + 541 is prime. + 991 < 993 < 997 + 647 < 649 < 653 + +# Bonus + +Write the program to work for numbers with big gaps to the nearest primes. This requires a clever solution and cannot be efficiently bruteforced. + + 2010741 + 1425172824437700148 + +# Credit + +This challenge was suggested by user /u/tulanir, many thanks! If you have an idea for a challenge please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md b/Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md new file mode 100644 index 0000000..cd7f30a --- /dev/null +++ b/Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md @@ -0,0 +1,72 @@ +#**Description** + +A [Latin square](https://en.wikipedia.org/wiki/Latin_square) is an n × n array filled with n different symbols, each occurring exactly once in each row and exactly once in each column. + + +For example: + +>1 + +And, + +>1 2 + +>2 1 + +Another one, + +>1 2 3 + +>3 1 2 + +>2 3 1 + +In this challenge, you have to check whether a given array is a Latin square. + +#**Input Description** + +Let the user enter the length of the array followed by *n x n* numbers. Fill an array from left to right starting from above. + +#**Output Description** + +If it is a Latin square, then display true. Else, display false. + +#**Challenge Input** + +> 5 + +> 1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1 + +> 2 + +> 1 3 3 4 + +> 4 + +> 1 2 3 4 1 3 2 4 2 3 4 1 4 3 2 1 + +#**Challenge Output** + +> true + +> false + +> false + +--------- + +#**Bonus** + +A Latin square is said to be reduced if both its first row and its first column are in their natural order. + +You can reduce a Latin square by reordering the rows and columns. The example in the description can be reduced to this + +>1 2 3 + +>2 3 1 + +>3 1 2 + +If a given array turns out to be a Latin square, then your program should reduce it and display it. + +Edit: /u/tomekanco has pointed out that many solutions which have an error. I shall look into this. Meanwhile, I have added an extra challenge input-output for you to check. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md b/Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md new file mode 100644 index 0000000..e7a29b9 --- /dev/null +++ b/Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md @@ -0,0 +1,81 @@ +#Description + +A [Lucky Number](https://en.wikipedia.org/wiki/Lucky_number) is a natural number in a set which is generated by a certain "sieve". This sieve is similar to the Sieve of Eratosthenes that generates the primes, but it eliminates numbers based on their position in the remaining set, instead of their value (or position in the initial set of natural numbers). + +The set of lucky numbers can be obtained by:- + + +Begin with a list of integers starting with 1: + +>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 + +Starting with 1, remove every other element (i.e. every even number) from this set. We are left with: + +> 1 3 5 7 9 11 13 15 17 19 21 23 25 + +After 1, the next number in the set is **3**. So, remove every **3**rd number. Clearly, 5 is removed because it's the third number in the above set. Go on and keep removing every 3rd number. + +Your new set is: + +> 1 3 7 9 13 15 19 21 25... + +Here, the next remaining number you have after 3 is **7**. Now, at this point, it's obvious that there's no way 1 and 3 are ever getting eliminated. Thus, we can conclude that 1 and 3 are lucky numbers. + +Now remove every **7**th number. Clearly, 19 would be the first to be wiped out. + +You're left with: + +> 1 3 7 9 13 15 21 25 ... + +Now it's time to proceed to the next remaining number after 7, i.e., **9**. Remove every **9**th number. Note that at this point, 7 cannot be eliminated. 7 is a lucky number too. + +Keep proceeding in a similar fashion in order to get a list of lucky numbers. + +Numbers remaining after this procedure has been carried out completely are called lucky numbers. The first few are + +> 1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, ... + +Today's challenge is to find the nearest lucky number. This might remind you of [Challenge #326](https://redd.it/6s70oh). In fact, this has been inspired from it. Bruteforcing is the most obvious option, but it's certainly not the most efficient. + +#Input Description + +The input will be a positive integer. + +#Output Description + +The output will be + +> previous lucky number < n < next lucky number + +where *n* is your input. + +If *n* is a lucky number, then display +> n is a lucky number. + +#Challenge Input + +> 103 + +> 225 + +> 997 + +#Challenge Output + +> 99 < 103 < 105 + +> 223 < 225 < 231 + +> 997 is a lucky number + +#Bonus + +Find every lucky number all the way up to ~~5000~~10,000,000 and post your the time it took to run. This is so that you can compete amongst everyone else to see who has the most efficient one. + +----- + +If you have any cool challenges, feel free to submit it to /r/dailyprogrammer_ideas! + +Edit: /u/nuri0 and /u/mattieshoes pointed out some errors. Corrected the post. + +Edit: Limit for bonus increased because it was becoming difficult to measure the time taken. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md b/Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md new file mode 100644 index 0000000..9fcc341 --- /dev/null +++ b/Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md @@ -0,0 +1,50 @@ +# Description + +In this challenge, you will be given a set of circles, defined by their centers and radii. Your goal is to find the bounding rectangle which will contain all of the circles completely. + +Write a program that determines the vertices of the bounding rectangle with sides parallel to the axes. + +# Input Description + +Each line will contain a comma separated center and radius for a circle. + +# Output Description + +The format of the output will be comma separated coordinates, rounded to 3 decimal places. + +# Challenge Input + + 1,1,2 + 2,2,0.5 + -1,-3,2 + 5,2,1 + +[input picture](https://i.imgur.com/uz6Bxqb.png) + +# Challenge Output + + (-3.000, -5.000), (-3.000, 3.000), (6.000, 3.000), (6.000, -5.000) + +[output picture](http://i.imgur.com/GAxlE8O.png) + +# Bonus + +For the bonus, we will rotate the axis for the bounding rectangle. The first line of input will now be a vector determining the direction of one edge of the bounding rectangle. + +# Bonus Input + + 1,1 + 1,1,2 + 2,2,0.5 + -1,-3,2 + 5,2,1 + +# Bonus Output + + (-4.828, -2.000), (2.793, 5.621), (6.621, 1.793), (-1.000, -5.828) + +[bonus output picture](http://i.imgur.com/5IMZWPp.png) + +# Credit + +This challenge was suggested by user /u/Preferencesoft, many thanks! If you have an idea for a challenge please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md b/Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md new file mode 100644 index 0000000..7ff847e --- /dev/null +++ b/Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md @@ -0,0 +1,65 @@ +#**Description** + +Make a calculator that lets the user add, subtract, multiply and divide integers. It should allow exponents too. The user can only enter integers and must expect the result to be integers. The twist is that YOU, the programmer, can only let the program calculate expressions using addition. Only addition. The user can enter 3*2 however you cannot calculate it using multiplication. + +Basically, the programmer is not allowed to multiply, divide and subtract using the operations provided by a programming language. To the programmer, the only accessible *direct* operation is addition. + +Your calculator should be able to handle addition, subtraction, division, multiplication and exponents. No modulo operation (to obtain the remainder for two given operands) too. + +Please note that + ++ You are not allowed to use any functions (other than user-defined functions) to work with exponents. Basically, don't cheat by allowing pre-defined functions from a library for the dirty work. + ++ You can use logical operators. + ++ The only binary arithmetic operator that you can use is \+ (addition). + ++ The only unary operator that you can use is \+\+ (increment operator). + ++ No bitwise operations are allowed. + +#**Input description** + +Allow the user to enter two integers and the operation symbol. + +Let's use \^ for exponents i.e. 2\^3 = 2^3 = 8 + +#**Output description** + +If the answer is an integer, display the answer. If the answer is not an integer, display a warning message. Handle errors like 1/0 appropriately. + +#**Challenge Inputs and Outputs** + +Input | Output +:--| --: +12 + 25 | 37 +-30 + 100 | 70 +100 - 30 | 70 +100 - -30 | 130 +-25 - 29 | -54 +-41 - -10 | -31 +9 * 3 | 27 +9 * -4 | -36 +-4 * 8 | -32 +-12 * -9 | 108 +100 / 2 | 50 +75 / -3 | -25 +-75 / 3 | -25 +7 / 3 | Non-integral answer +0 / 0 | Not-defined +5 ^ 3 | 125 +-5 ^ 3 | -125 +-8 ^ 3 | -512 +-1 ^ 1 | -1 +1 ^ 1 | 1 +0 ^ 5 | 0 +5 ^ 0 | 1 +10 ^ -3 | Non-integral answer + +#**Bonus** + +Modify your program such that it works with decimals (except for \^ operation) with a minimum precision of 1 decimal place. + +---- + +Submit to /r/dailyprogrammer_ideas if you have any cool ideas! \ No newline at end of file diff --git a/Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md b/Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md new file mode 100644 index 0000000..767ebcc --- /dev/null +++ b/Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md @@ -0,0 +1,128 @@ +#Description + +When a message is transmitted over the internet, it is split into multiple packets, each packet is transferred individually, and the packets are reassembled into the original message by the receiver. Because the internet exists in the real world, and because the real world can be messy, packets do not always arrive in the order in which they are sent. For today's challenge, your program must collect packets from stdin, assemble them in the correct order, and print the completed messages to stdout. + +The point of reading from stdin is to simulate incoming packets. For the purposes of this challenge, assume there is a potentially unlimited number of packets. Your program should not depend on knowing how many packets there are in total. Simply sorting the input in its entirety would technically work, but defeats the purpose of this exercise. + +#Input description + +Each line of input represents a single packet. Each line will be formatted as `X Y Z some_text`, where X Y and Z are positive integer and some_text is an arbitrary string. X represents the message ID (ie which message this packet is a part of). Y represents the packet ID (ie the index of this packet in the message) (packets are zero-indexed, so the first packet in a message will have Y=0, the last packet in a message will have Y=Z-1). Z represents the total number of packets in the message. + +It is guaranteed that there will be no duplicate packets or message IDs. + +##Example input + + 6220 1 10 Because he's the hero Gotham deserves, + 6220 9 10 + 5181 5 7 in time, like tears in rain. Time to die. + 6220 3 10 So we'll hunt him. + 6220 5 10 Because he's not a hero. + 5181 6 7 + 5181 2 7 shoulder of Orion. I watched C-beams + 5181 4 7 Gate. All those moments will be lost + 6220 6 10 He's a silent guardian. + 5181 3 7 glitter in the dark near the Tannhäuser + 6220 7 10 A watchful protector. + 5181 1 7 believe. Attack ships on fire off the + 6220 0 10 We have to chase him. + 5181 0 7 I've seen things you people wouldn't + 6220 4 10 Because he can take it. + 6220 2 10 but not the one it needs right now. + 6220 8 10 A Dark Knight. + +#Output description + +Output each completed message, one line per packet. Messages should be outputted in the order in which they are completed. + +##Example output + + 5181 0 7 I've seen things you people wouldn't + 5181 1 7 believe. Attack ships on fire off the + 5181 2 7 shoulder of Orion. I watched C-beams + 5181 3 7 glitter in the dark near the Tannhäuser + 5181 4 7 Gate. All those moments will be lost + 5181 5 7 in time, like tears in rain. Time to die. + 5181 6 7 + 6220 0 10 We have to chase him. + 6220 1 10 Because he's the hero Gotham deserves, + 6220 2 10 but not the one it needs right now. + 6220 3 10 So we'll hunt him. + 6220 4 10 Because he can take it. + 6220 5 10 Because he's not a hero. + 6220 6 10 He's a silent guardian. + 6220 7 10 A watchful protector. + 6220 8 10 A Dark Knight. + 6220 9 10 + +#Challenge input + + 7469 1 7 believe. Attack ships on fire off the + 9949 6 10 He's a silent guardian. + 2997 9 19 Force is a pathway to many abilities some + 6450 2 11 is a vestige of the vox populi, now vacant, vanished. However, this valorous + 6450 10 11 + 6450 8 11 veers most verbose, so let me simply add that it's my very good honour to meet + 6450 5 11 and voracious violation of volition! The only verdict is vengeance; a vendetta + 9949 1 10 Because he's the hero Gotham deserves, + 6450 1 11 and villain by the vicissitudes of fate. This visage, no mere veneer of vanity, + 2997 13 19 he did. Unfortunately, he taught his + 9949 8 10 A Dark Knight. + 1938 4 17 by the iniquities of the selfish and the + 1938 0 17 You read the Bible, Brett? Well there's + 2997 0 19 Did you ever hear the tragedy of Darth + 2997 1 19 Plagueis the Wise? I thought not. It's not a + 1938 8 17 of darkness, for he is truly is brother's + 2997 14 19 apprentice everything he knew, then his + 6450 3 11 visitation of a bygone vexation stands vivified, and has vowed to vanquish these + 1938 12 17 who attempt to poison and destroy my + 6450 9 11 you and you may call me V. + 7469 2 7 shoulder of Orion. I watched C-beams + 2997 10 19 consider to be unnatural. He became so + 1938 1 17 this passage I got memorized, sorta fits + 2997 5 19 Force to influence the midichlorians to + 1938 6 17 in the name of charity and good will, + 7469 0 7 I've seen things you people wouldn't + 9949 4 10 Because he can take it. + 6450 7 11 vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage + 9949 0 10 We have to chase him. + 9949 7 10 A watchful protector. + 2997 3 19 legend. Darth Plagueis was a Dark Lord of the + 6450 6 11 held as a votive, not in vain, for the value and veracity of such shall one day + 2997 8 19 cared about from dying. The dark side of the + 1938 10 17 And I will strike down upon thee with + 1938 11 17 great vengeance and furious anger those + 1938 7 17 shepherds the weak through the valley + 1938 2 17 this occasion. Ezekiel 25:17? "The path + 2997 18 19 + 9949 9 10 + 1938 14 17 the Lord when I lay my vengeance upon + 1938 15 17 thee." + 1938 9 17 keeper and the finder of lost children. + 1938 13 17 brothers. And you will know my name is + 9949 2 10 but not the one it needs right now. + 2997 16 19 he could have others from death, but not + 2997 7 19 dark side that he could even keep the once he + 1938 5 17 tyranny of evil men. Blessed is he who, + 2997 17 19 himself. + 2997 6 19 create life...He had such a knowledge of the + 2997 12 19 losing his power. Which eventually, of course, + 7469 4 7 Gate. All those moments will be lost + 2997 2 19 story the Jedi would tell you. It's a Sith + 1938 16 17 + 2997 4 19 Sith so powerful and so wise, he could use the + 1938 3 17 of the righteous man is beset on all sides + 2997 11 19 powerful...The only thing he was afraid of was + 7469 6 7 + 2997 15 19 apprentice killed him in his sleep. Ironic, + 7469 5 7 in time, like tears in rain. Time to die. + 9949 3 10 So we'll hunt him. + 7469 3 7 glitter in the dark near the Tannhäuser + 6450 4 11 venal and virulent vermin vanguarding vice and vouchsafing the violently vicious + 6450 0 11 Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim + 9949 5 10 Because he's not a hero. + +#Finally + +Have a good challenge idea? + +Consider submitting it to /r/dailyprogrammer_ideas \ No newline at end of file diff --git a/Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md b/Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md new file mode 100644 index 0000000..753fc6e --- /dev/null +++ b/Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md @@ -0,0 +1,58 @@ + + +# Description + +We'll call the consecutive distance rating of an integer sequence the sum of the distances between consecutive integers. Consider the sequence `1 7 2 11 8 34 3`. `1` and `2` are consecutive integers, but their distance apart in the sequence is 2. `2` and `3` are consecutive integers, and their distance is 4. The distance between `7` and `8` is 3. The sum of these distances is 9. + +Your task is to find and display the consecutive distance rating of a number of integer sequences. + +# Input description + +You'll be given two integers `a` and `b` on the first line denoting the number of sequences that follow and the length of those sequences, respectively. You'll then be given `a` integer sequences of length `b`, one per line. The integers will always be unique and range from 1 to 100 inclusive. + +## Example input + + 6 11 + 31 63 53 56 96 62 73 25 54 55 64 + 77 39 35 38 41 42 76 73 40 31 10 + 30 63 57 87 37 31 58 83 34 76 38 + 18 62 55 92 88 57 90 10 11 96 12 + 26 8 7 25 52 17 45 64 11 35 12 + 89 57 21 55 56 81 54 100 22 62 50 + +# Output description + +Output each consecutive distance rating, one per line. + +## Example output + + 26 + 20 + 15 + 3 + 6 + 13 + +# Challenge input + + 6 20 + 76 74 45 48 13 75 16 14 79 58 78 82 46 89 81 88 27 64 21 63 + 37 35 88 57 55 29 96 11 25 42 24 81 82 58 15 2 3 41 43 36 + 54 64 52 39 36 98 32 87 95 12 40 79 41 13 53 35 48 42 33 75 + 21 87 89 26 85 59 54 2 24 25 41 46 88 60 63 23 91 62 61 6 + 94 66 18 57 58 54 93 53 19 16 55 22 51 8 67 20 17 56 21 59 + 6 19 45 46 7 70 36 2 56 47 33 75 94 50 34 35 73 72 39 5 + +# Notes / hints + +Be careful that your program doesn't double up the distances. Consider the sequence `1 2`. An incorrect algorithm might see 1 -> 2 and 2 -> 1 as two separate distances, resulting in a (wrong) consecutive distance rating of 2. Visually, you should think of distances like [this](https://i.imgur.com/MsFLgjW.png) and not like [that](https://i.imgur.com/2V6GMQg.png). + +#Bonus + +Modify your program to work with any size gap between integers. For instance, we might want to find the distance rating of integers with a gap of 2, such as `1` and `3` or `7 ` and `9` rather than consecutive integers with a gap of 1. + +# Credit + +This challenge was authored by /u/chunes, many thanks! + +Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md b/Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md new file mode 100644 index 0000000..444157e --- /dev/null +++ b/Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md @@ -0,0 +1,51 @@ +# Description + +Imagine a given set of numbers wherein some are cannibals. We define a cannibal as a larger number can eat a smaller number and **increase its value by 1**. There are no restrictions on how many numbers any given number can consume. A number which has been consumed is **no longer available**. + +Your task is to determine the number of numbers which can have a value equal to or greater than a specified value. + +#Input Description + +You'll be given two integers, _i_ and _j_, on the first line. _i_ indicates how many values you'll be given, and _j_ indicates the number of queries. + +Example: + + 7 2 + 21 9 5 8 10 1 3 + 10 15 + + +Based on the above description, 7 is number of values that you will be given. 2 is the number of queries. + +That means - +* Query 1 - How many numbers can have the value of at least 10 +* Query 2 - How many numbers can have the value of at least 15 + +#Output Description + +Your program should calculate and show the number of numbers which are equal to or greater than the desired number. For the sample input given, this will be - + + 4 2 + +##Explanation + +For Query 1 - + +The number 9 can consume the numbers 5 to raise its value to 10 + +The number 8 can consume the numbers 1 and 3 to raise its value to 10. + +So including 21 and 10, we can get **four** numbers which have a value of at least 10. + + + + +For Query 2 - + +The number 10 can consume the numbers 9,8,5,3, and 1 to raise its value to 15. + +So including 21, we can get **two** numbers which have a value of at least 15. + +# Credit + +This challenge was suggested by user /u/Lemvig42, many thanks! If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it \ No newline at end of file diff --git "a/Extra-Bonus Challenges/[Monthly Challenge #22 - September, 2017] Procedural Bacteria Fungus Virus \342\200\242 rproceduralgeneration/challenge_text.md" "b/Extra-Bonus Challenges/[Monthly Challenge #22 - September, 2017] Procedural Bacteria Fungus Virus \342\200\242 rproceduralgeneration/challenge_text.md" new file mode 100644 index 0000000..e69de29 diff --git a/Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md b/Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md new file mode 100644 index 0000000..b567f08 --- /dev/null +++ b/Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md @@ -0,0 +1,42 @@ +# Description + +What point on the world's oceans is furthest from any land? On Earth, it's slightly more than 1450 nautical miles from Ducie Island, Motu Nui, and Maher Island. The geographic coordinates of the real [Point Nemo](http://factinator.com/point-nemo/) are: s48:52:31.748 w123:23:33.069. The point was named after Jules Verne’s submarine Captain Nemo, a Latin name that also happens to mean “no one.” + +Your task today is given an ASCII art map, calculate the location of Point Nemo. The map will use ASCII symbols to shade land - mountains, grassland, desert, etc. The blank spaces are ocean. Find the spot in the ocean that is furthest away from any land. + +# Input Descripton + +You'll be given a two integers on a line telling you how wide (in characters) the map is at its maximum and how many lines to read. Then you'll be given the ASCII art map with the land filled in. Assume the blank space is ocean. The world wraps around, too, just like a real map. Unlike the real world, however, assume this world is a cylinder - it makes the geometry a lot easier. + +# Output Description + +Your progam should emit the location of Point Nemo as a grid coordinate in x-y (e.g. 40,25). Count the upper left corner as 0,0. Calculate the Euclidean distance and report the closest whole number position (e.g. round to the nearest x,y coordinate). + +# Challenge Input + + 80 25 + ## # # # # # # ## ### + #### ###### ######## ###### ##### ######### #### ####### + ########## ## ##### #### # ##################### + ####################### ## ### ## #### #### ## + ######### ######### ### ## # ### ## ## + # # ##### ####### ### # # + # ### ## ####### + # ### ########### # + ### ## ############## # + # ### ############## # + ## ############# + ##### ########### ## + ######### ########## ## + ############ ######### ## + ############### ####### + ############## ##### ######### + ############### ## ### ########### + ############### # ############ + ############ ### #### + ######### # + # ##### + + ######## ###### ####### + ###################### ########################### ############## + ############################################################################## diff --git a/Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md b/Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md new file mode 100644 index 0000000..44b5c84 --- /dev/null +++ b/Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md @@ -0,0 +1,38 @@ +# Description + +The longest uncrossed (or nonintersecting) knight's path is a mathematical problem involving a knight on the standard 8×8 chessboard or, more generally, on a square *n×n* board. The problem is to find the longest path the knight can take on the given board, such that the path does not intersect itself. When calculating the path length, you count the *moves* you make and not the number of squares you touch. + +A further distinction can be made between a closed path, which ends on the same field as where it begins, and an open path, which ends on a different field from where it begins. + +For this challenge, assume the following: + +* You can make an open path +* You can start (and end) on any legal square +* Just like real chess, you're bounded by legal squares on the board +* The path is constructed from line segments between the start and end points of any of the knight's moves; intermediate squares it jumps over don't matter + +This problem is intimately related to the knight's tour, a self-intersecting knight's path visiting all fields of the board. The key difference with this challenge is that the path may not intersect itself. Variants use fairy chess pieces like the camel ((3,1)-leaper), giraffe ((4,1)-leaper) and zebra ((3,2)-leaper) lead to problems of comparable complexity. + +# Input Description + +You'll be given the size *n* of the board representing the number of squares per side - it's a square board. Example: + + 5 + +# Output Description + +Your program should emit the length of the longest open tour, measured in line segments (e.g. moves). Example: + + 10 + +# Challenge Input + + 4 + 7 + 8 + +# Challenge Output + + 5 + 24 + 35 diff --git a/Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md b/Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md new file mode 100644 index 0000000..37dced2 --- /dev/null +++ b/Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md @@ -0,0 +1,57 @@ +#DESCRIPTION + +Playing Texas Hold'em is a game about weighing odds. Every player is given two cards that only they can see. Then five cards are turned up on the table that everybody sees. The winner is the player with the best hand composed of five cards out of the seven available (the 5 on the table, and the two personal cards). + +Your job is, given four hands of two cards, and the "flop" (three of the five cards that will be flipped up), calculate the odds every player has of getting the best hand. + +#INPUT + +You will be given 5 lines, the first line contains the three cards on the flop, the next four with the two-card hands of every player. written as \[CardValue]\[CardSuit], with the values being, in order, A, 2, 3, 4, 5, 6, 7, 8, 9, 0, J, Q, K, A (Aces `A` may be high or low, just like real poker). The suits' corresponding symbols are the first letter of the suit name; Clubs = C; Spades = S; Diamonds = D; Hearts = H. + +#OUTPUT + +Four lines of text, writing... + + [PlayerNum] : [Odds of Winning (rounded to 1 decimal point)] % + +#SAMPLE INPUT + + 3D5C9C + 3C7H + AS0S + 9S2D + KCJC + +#SAMPLE OUTPUT + + 1: 15.4% + 2: 8.8% + 3: 26.2% + 4: 49.6% + +# NOTES + +For those unfamiliar, here is the order of hand win priority, from best up top to worst at the bottom; + +* Straight Flush (5 cards of consecutive value, all the same suit; ie: 3D4D5D6D7D) +* Four of a Kind (4 of your five cards are the same value; ie: AC4DAHASAD) +* Full House (Contains a three-of-a-kind and a pair; ie: AHADAS5C5H) +* Flush (All five cards are of the same suit; ie: AH4H9H3H2H) +* Straight (All five cards are of consecutive value; ie: 3D4S5H6H7C) +* Three-of-a-kind (Three cards are of identical value; ie: AS3C3D4H7S) +* Two Pairs (Contains two pairs; ie: AH3H4D4S2C) +* Pair (Contains two cards of identical value; ie: AHAC2S6D9D) +* High-Card (If none of the above, your hand is composed of "this is my highest card", ie; JHKD0S3H4D becomes "High Card King".) + +In the event that two people have the same hand value, whichever has the *highest card that qualifies of that rank.* ie; If you get a pair, the value of the pair is counted first, followed by high-card. If you have a full house, the value of the triplet is tallied first, the the pair. + * Per se; two hands of 77820 and 83J77 both have pairs, of sevens, but then Person 2 has the higher "high card" outside the ranking, a J beats a 0. + + * If the high cards are the same, you go to the second-highest card, etc. + +If there is a chance of a tie, you can print that separately, but for this challenge, only print out the chance of them *winning by themselves*. + +ALSO REMEMBER; There are 52 cards in a deck, there can't be two identical cards in play simultaneously. + +# Credit + +This challenge was suggested by /u/Mathgeek007, many thanks. If you have a suggestion for a challenge, please share it at /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md b/Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md new file mode 100644 index 0000000..5a604aa --- /dev/null +++ b/Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md @@ -0,0 +1,185 @@ +#Description +Most industrial equipment is ran on Programmable Logic Controllers (PLCs). To this day, the most common programming language for these systems (in the US) is a graphical language called "Ladder Logic". +Based on traditional circuit relay systems, it is called Ladder Logic because the code resembles a ladder, with statements organized into "rungs" with "power" flowing from left to right through the logic. Any statement that evaluates to true allows power to pass, and more statements to be evaluated in an "AND" configuration. If power is blocked, power flows top-bottom, in an "OR" configuration (if so programmed). This is described below with diagrams. +This language excels at displaying boolean logic in a way that is incredibly intuitive for electricians and industrial maintenance personnel to read and troubleshoot without advanced programming knowledge or skills. Statements that evaluate to true are highlighted, so any logic with a highlighted path from left to right is true. + +As the programs are controlling real world equipment, there is a series of hardwired inputs and outputs. These are labeled sequentially with a prefix that corresponds to the (I)nput or (O)utput. For example I0 may be hooked up to a switch and O4 may be hooked up to a horn. Additionally, internal system memory can be accessed with different prefixes for different data types (B for bools, N for integers, T for timers, etc.) + +The rungs are always flanked by vertical rails - the left representing the "power" supply and the right representing the "power" return or ground. A EOR signifies the end of one rung and SOR the start of the next. The rails must travel the entire length of the program. + +There are a number of instructions used but we will focus on the most common: + + Representation Instruction Mnemonic Description + + |- SOR Start Of Rung + + -| |- XIC True if 1 (eXamine If Closed) + + -|/|- XIO True if 0 (eXamine If Open) + + -+-?-+- BST Or Start (Branch STart) + | | NXB Or Entry (NeXt Branch) + +-?-+ BND Or End (Branch eND) + + -( )- OTE Set to result of logic (OuTput Energize) + + -(L)- OTL Set to True if logic is true (OuTput Latch) + + -(U)- OTU Set to False if logic is true (OuTput Unlatch) + + -| EOR End Of Rung + +Your task is to convert a series of mnemonics and data points (inputs, outputs, memory locations) into the graphical representation. Each rung should be numbered. The number of dashes between items does not matter but it should be readable and reasonably aligned. It is common for all input logic to be aligned to the left and for all output logic to be aligned to the right side of the screen, but this is not requied. I have provided some pseudo code with each example that more or less matches what is going on in the ladder logic for reference. Instead of a text representation, feel free to do a graphical representation instead. + + +#Formal Inputs & Outputs + + +##Example 1 - Motor Starter (Traditional Ladder Style) + +I1 = stop button, I2 = Start Button, O1 = Motor. + +Start the motor when the start button is pressed. + +If the stop button is pressed, the motor needs to stop. + +###Traditional Programming Equivalent: + + If I1 AND (I2 OR O1){ + O1 = 1 + }Else{ + O1 = 0 + } + +###Input: + + SOR XIC I1 BST XIC I2 NXB XIC O1 BND OTE O1 EOR + +Output: + + | I1 I2 O1 | + 01 |--| |--+--| |--+--( )--| + | | O1 | | + | +--| |--+ | + + +##Example 2 - Motor Starter (Non-Traditional Ladder Style) + +I1 = stop button, I2 = Start Button, O1 = Motor. + +Start the motor when the start button is pressed. + +If the stop button is pressed, the motor needs to stop. + +Note that this is generally considered a bad practice in ladder logic - Typically you want to only ever change the state of an output in one instruction to avoid race conditions. This is a simple example so a race is unlikely, but for more complicated systems it is a definite possibility. + +###Traditional Programming Equivalent: + + If I1 AND I2{ + O1 = 1 + } + If NOT I2{ + O1 = 0 + } + +###Input: + + SOR XIC I1 XIO I2 OTL O1 EOR SOR XIC I2 OTU 01 EOR + +###Output: + + | I1 I2 O1 | + 01 |--| |--|/|------------------(L)--| + | | + | I2 O1 | + 02 |--| |-----------------------(U)--| + + +##Example 3 - Motor Starter With Light + +I1 = Stop button, I2 = Start Button, O1 = Motor, O2 = Light + +Start the motor when the start button is pressed. + +If the stop button is pressed, the motor needs to stop. + +A light should indicate that the motor is not running. + +Traditional Programming Equivalent: + + If I1 AND (I2 OR O1){ + O1 = 1 + }Else{ + O1 = 0 + } + If NOT O1{ + O2 = 1 + }Else{ + O2 = 0 + } + +###Input: + + SOR XIC I1 BST XIC I2 NXB XIC O1 BND OTE O1 EOR SOR XIO O1 OTE O2 EOR + +###Output: + + | I1 I2 O1 | + 01 |--| |--+--| |--+--( )--| + | | O1 | | + | +--| |--+ | + | O1 O2 | + 02 |-|/|--------------( )--| + + +##Example 4 Motor Starter With Local/Remote Select + +I1 = Stop, I2 = Local Start, I3 & I4 = Remote Start buttons, I5 = Local/Remote Toggle Switch, O1 = Motor + +If the system is in local mode, start the motor when the local start button is pressed. + +If not in local, start the motor when either remote start is pressed. + +If the stop button is pressed, the motor needs to stop. + +###Traditional Programming Equivalent: + + If I1 AND ((I2 AND I5) OR ((I3 OR I4) AND NOT I5) OR O1){ + O1 = 1 + }Else{ + O1 = 0 + } + +###Input: + + SOR XIC I1 BST XIC I2 XIC I5 NXB BST XIC I3 NXB XIC I4 BND XIO I5 NXB XIC O1 BND OTE O1 EOR + +###Output: + + | I1 I2 I5 O1 | + 01 |--| |--+--| |-------| |--+--( )--| + | | I3 I5 | | + | +--+-| |--+--|/|--+ | + | | | I4 | | | + | | +-| |--+ | | + | | O1 | | + | +--| |------------+ | + + + + +#Notes/Hints + +Here are some resources on the language itself: + +https://en.wikipedia.org/wiki/Ladder_logic + +http://library.automationdirect.com/understanding-ladder-logic/ + +The actual mnemonics and representations used for each instruction varies by PLC brand / manufacturer, but the core functionality is the same. For example, in popular German PLCs, xic becomes A (for and), xio becomes AN (for and not), branch becomes A(O ? O ?...) (for and (or or or)). The Germans don't typically use the ladder representation at all though - it's all done directly with the mnemonics. + +Modern PLCs support many more languages than ladder (https://en.wikipedia.org/wiki/IEC_61131-3) and many now have some basic memory management allowing memory and IO addresses to be referenced by name rather than address. + +# Credit + +This challenge was suggested by user /u/unitconversion, many thanks. If you have a challenge idea, please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. diff --git a/Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md b/Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md new file mode 100644 index 0000000..d0d7314 --- /dev/null +++ b/Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md @@ -0,0 +1,90 @@ +# Description + +This one builds on the previous challenge: malware propagation. But now we add a twist - network topology, specifically connectivity and congestion. + +Real world network malware can't attack a host it can't connect to. That connection may be blocked due to a lack of connectivity between the host (e.g. not directly connected networks), or a congested pipe. Network connections get congested when they're flooded with traffic, forcing packet loss. + +For today's challenge, you're being asked to model a small network in which some malware has been introduced. Unlike the previous challenge, you have to traverse the network to reach all nodes. This more realistically mimics propagation where contact is required to propagate. Work with these assumptions: + +- To spread the malware has to send a single packet of size B and takes 1 time step +- The network has fixed capacity between subnets +- The only thing passing over the network is malware propagation traffic, there is no background utilization +- If you try and send a packet over a pipe at 95% utilization or above it gets dropped +- Propagation between two hosts can only occur if they can directly connect from network to network or are in the same network +- To determine _where_ to send the next packet of infection, take the sum of all reachable nodes and pick a random number in that range; if that's local or remote (and which subnet) then determines where the packet is headed +- Patches (to move a node to the R state) doesn't require direct connectivity, assume an out-of-band mechanism +- An infected host can only send one packet at a time +- Assume the standard SIR model from last time + +# Challenge Input + +You'll be given a lot of information for this one. First an integer on one line telling you how many networks to read. For each network specification you'll have a line telling you the network ID (a letter), the number of hosts in it (N), the number of infected hosts at time 0 (I). Then another integer telling you how many links to read. Then that many lines telling you what two networks connect and with what capacity in bytes per second (assume symmetric connections). Finally for the malware you'll be given some values on a line telling you the transition rates for S to I, I to R and S to R. Finally a line with a single integer, B, telling you the size of the malware propagation packet (assume UDP, so a single packet to infect). Example: + + 10 + A 1000 1 + B 1000 0 + C 1000 3 + D 1000 0 + E 1000 0 + F 1000 1 + G 1000 10 + H 1000 0 + I 1000 0 + J 1000 90 + 10 + A B 10000 + B C 1000 + C D 2000 + D E 2000 + D F 2000 + D G 5000 + D H 9000 + D I 1000 + D A 8000 + D J 10000 + 0.01 0.01 0.015 + 256 + +# Challenge Input 2 + + 15 + A 4412 0 + B 12035 5 + C 11537 9 + D 10873 15 + E 7269 12 + F 10989 19 + G 9680 3 + H 8016 14 + I 5373 10 + H 10738 18 + J 1329 9 + K 12168 0 + L 9436 2 + M 1769 0 + N 7564 8 + 14 + A B 1000 + B C 1000 + C D 1000 + D E 1000 + E F 1000 + F J 1000 + F G 1000 + G K 1000 + G H 1000 + H I 1000 + H L 1000 + I E 1000 + I M 1000 + I N 1000 + 0.01 0.01 0.015 + 256 + +# Output Description + +Your program can emit answers in a number of different ways: + +- Graphical - show S I and R populations over time (as total or fractions) +- Textual - a huuuuge list of numbers +- Other - be creative diff --git a/Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md b/Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md new file mode 100644 index 0000000..70c004c --- /dev/null +++ b/Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md @@ -0,0 +1,77 @@ +#Description + +Clicking on the first link in the main text of a Wikipedia article not in parentheses, and then repeating the process for subsequent articles, usually eventually gets you to the Philosophy article. As of May 26, 2011, 94.52% of all articles in Wikipedia lead eventually to the article Philosophy. The rest lead to an article with no wikilinks or with links to pages that do not exist, or get stuck in loops. +[Here's a youtube video demonstrating this phenomenon.](http://www.youtube.com/watch?v=vehDe2lSptU) + +Your goal is to write a program that will find the path from a given article to the Philosophy article by following the first link (not in parentheses) in the main text of the given article. + +#Formal Inputs & Outputs + +##Input description + +The program should take in a string containing a valid title of a Wikipedia article. + +##Output description + +Your program must print out each article in the path from the given article to [Philosophy](http://en.wikipedia.org/wiki/Philosophy). + +##Sample Inputs & Outputs + +**Input** + + Molecule + +**Output** + + Molecule + Atom + Matter + Invariant mass + Energy + Kinetic energy + Physics + Natural philosophy + Philosophy + + +## Challenge Input + + Telephone +**Solution to challenge input** + + Telephone + Telecommunication + Transmission (telecommunications) + Analog signal + Continuous function + Mathematics + Quantity + Property (philosophy) + Logic + Reason + Consciousness + Subjectivity + Subject (philosophy) + Philosophy + +#Notes/Hints + +To start you can go to the url `http://en.wikipedia.org/wiki/{subject}`. + +The title of the page that you are on can be found in the element `firstHeading` and the content of the page can be found in `bodyContent`. + +#Bonus 1 + +Cycle detection: Detect when you visit an already visited page. + +#Bonus 2 + +Shortest path detection: Visit, preferably in parallel, all the links in the content to find the shortest path to Philosophy + +#Finally + +Have a good challenge idea, like /u/nagasgura did? + +Consider submitting it to /r/dailyprogrammer_ideas. + +Oh and please don't go trolling and changing the wiki pages just for this challenge \ No newline at end of file diff --git a/Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md b/Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md new file mode 100644 index 0000000..cd15c4d --- /dev/null +++ b/Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md @@ -0,0 +1,70 @@ +# [](#HardIcon) _(Hard)_: Circle Splitter + +*(sorry for submitting this so late! currently away from home and apparently the internet hasn't arrived in a lot of places in Wales yet.)* + +Imagine you've got a square in 2D space, with axis values between 0 and 1, like [this diagram](http://i.imgur.com/5K0HZEk.png). The challenge today is conceptually simple: can you place a circle within the square such that exactly half of the points in the square lie within the circle and half lie outside the circle, like [here](http://i.imgur.com/n7BDeyg.png)? You're going to write a program which does this - but you also need to find the *smallest* circle which solves the challenge, ie. has the minimum area of any circle containing exactly half the points in the square. + +This is a hard challenge so we have a few constraints: + +* Your circle must lie entirely within the square (the circle may touch the edge of the square, but no point within the circle may lie outside of the square). +* Points on the edge of the circle count as being inside it. +* There will always be an even number of points. + +There are some inputs which cannot be solved. If there is no solution to this challenge then your solver must indicate this - for example, in [this scenaro](http://i.imgur.com/fDGPvX3.png), there's no "dividing sphere" which lies entirely within the square. + +# Input & Output Description + +## Input + +On the first line, enter a number **N**. Then enter **N** further lines of the format `x y` which is the (x, y) coordinate of one point in the square. Both x and y should be between 0 and 1 inclusive. This describes a set of **N** points within the square. The coordinate space is **R**^2 (ie. x and y need not be whole numbers). + +As mentioned previously, **N** should be an even number of points. + +## Output + +Output the centre of the circle (x, y) and the radius r, in the format: + + x y + r + +If there's no solution, just output: + + No solution + +# Challenge Data + +There's a number of valid solutions for these challenges so I've written an input generator and visualiser in lieu of a comprehensive solution list, which can be found [here](https://jsfiddle.net/gjkdc8hL/). This can visualuse inputs and outputs, and also generate inputs. It can tell you whether a solution contains exactly half of the points or not, but it can't tell you whether it's the smallest possible solution - that's up to you guys to work out between yourselves. ;) + +## Input 1 + + 4 + 0.4 0.5 + 0.6 0.5 + 0.5 0.3 + 0.5 0.7 + +## Potential Output + + 0.5 0.5 + 0.1 + +## Input 2 + + 4 + 0.1 0.1 + 0.1 0.9 + 0.9 0.1 + 0.9 0.9 + +*This has no valid solutions.* + +Due to the nature of the challenge, and the mod team being very busy right now, we can't handcraft challenge inputs for you - but do make use of the generator and visualiser provided above to validate your own solution. And, as always, validate each other's solutions in the DailyProgrammer community. + +# Bonus + +* Extend your solution to work in higher dimensions! +* Add visualisation into your own solution. If you do the first bonus point, you might want to consider using OpenGL or something similar for visualisations, unless you're a mad lad/lass and want to write your own 3D renderer for the challenge. + +# We need more moderators! + +We're all pretty busy with real life right now and could do with some assistance writing quality challenges. Check out [jnazario's post](https://www.reddit.com/r/dailyprogrammer/comments/6fm3yy/announce_seeking_moderators/) for more information if you're interested in joining the team. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md b/Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md new file mode 100644 index 0000000..3870f21 --- /dev/null +++ b/Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md @@ -0,0 +1,40 @@ +# Description + +I'm willing to bet most of you are familiar with HTTP, you're using it right now to read this content. If you've ever done any web programming you probably interacted with someone else's HTTP server stack - Flask, Apache, Nginx, Rack, etc. + +For today's challenge, the task is to implement your own HTTP server. No borrowing your language's built in server (e.g. no, you can't just use Python's SimpleHTTPServer). The rules, requirements, and constraints: + +- Your program will implement the bare basics of HTTP 1.0: GET requests required, any other methods (POST, HEAD, etc) are optional (see the bonus below). +- You have to write your own network listening code (e.g. `socket()`) and handle listening on a TCP port. Most languages support this, you have to start this low. Yep, learn some socket programming. `socket() ... bind() ... listen() ... accept() ...` and the like. +- Your server should handle static content only (e.g. static HTML pages or images), no need to support dynamic pages or even cgi-bin executables. +- Your server should support a document root which contains pages (and paths) served by the web server. +- Your server should correctly serve content it finds and can read, and yield the appropriate errors when it can't: 500 for a server error, 404 for a resource not found, and 403 for permission denied (e.g. exists but it can't read it). +- For it to display properly in a browser, you'll need to set the correct content type header in the response. +- You'll have to test this in a browser and verify it works as expected: content displays right (e.g. HTML as HTML, text as text, images as images), errors get handled properly, etc. + +A basic, bare bones [HTTP/1.0 request](https://www.w3.org/Protocols/HTTP/1.0/spec.html#Request) looks like this; + + GET /index.html HTTP/1.0 + +That's it, no Host header required etc., and all other headers like user-agent and such are optional. (HTTP/1.1 requires a host header, in contrast.) + +A basic, bare bones [HTTP/1.0 response](https://www.w3.org/Protocols/HTTP/1.0/spec.html#Response) looks like this: + + HTTP/1.0 200 OK + Content-type: text/html + +

Success!

+ +The first line indicates the protocol (HTTP/1.0), the resulting status code (200 in this case means "you got it"), and the text of the status. The next line sets the content type for the browser to know how to display the content. Then a blank line, then the actual content. Date, server, etc headers are all optional. + +Here's some basics on HTTP/1.0: http://tecfa.unige.ch/moo/book2/node93.html + +Once you have this in your stash, you'll not only understand what more fully-featured servers like Apache or Nginx are doing, you'll have one you can customize. For example, I'm looking at extending my solution in C with an embedded [Lua](https://www.lua.org/) interpreter. + +# Bonus + +Support threading for multiple connections at once. + +Support [HEAD](https://www.w3.org/Protocols/HTTP/1.0/spec.html#HEAD) requests. + +Support [POST](https://www.w3.org/Protocols/HTTP/1.0/spec.html#POST) requests. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0323 Hard - Difference coverage/challenge_text.md b/Hard Challenges/Challenge 0323 Hard - Difference coverage/challenge_text.md new file mode 100644 index 0000000..23e28c4 --- /dev/null +++ b/Hard Challenges/Challenge 0323 Hard - Difference coverage/challenge_text.md @@ -0,0 +1,28 @@ +# Description + +Given a positive integer N, return a set of integers between 0 and N such that every integer is equal to difference of two in the set, [modulo N](https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/congruence-modulo). Make the set as small as you can. + +For example, given N = 26, you might return the set `{ 0, 3, 9, 11, 21, 22 }`, (which has a size of 6). Every integer is the difference between two (not necessarily unique) integers in this set, modulo 26. For instance, 7 = 3 - 22 (mod 26). + +It's not good enough to write a program that will eventually complete. You must be able to actually run your program to completion for five-digit values of N. Post (or link to) your output for N = 12345 along with your solution. + +As far as I know, the size of the optimal (smallest) set is an open question, so your program does not have to be optimal. But it needs to be pretty close. The best I've found for N = 12345 is a set of size 179, so aim for that. + +# Challenge + +When this post is seven days old, +1 gold medal flair will be awarded to the submitter who posts the smallest valid output for N = 123456. Smallest here refers to the size of the set of integers in the output. + +If this turns out to be easier than I anticipate, there may be a tie. In that case, as a tiebreaker, also post your output for N = 1234567. If there's still a tie, post for 12345678, 123456789, 1234567890, 12345678901, etc. I'll also look at time of posting to break a tie if necessary. + +# Inspiration + +This problem was inspired by me trying to make a minimal set of rows for a [Caesar shift cipher](https://learncryptography.com/classical-encryption/caesar-cipher) key. The set `{ 0, 3, 9, 11, 21, 22 }` corresponds to the rows: + + ABCDEFGHIJKLMNOPQRSTUVWXYZ + XYZABCDEFGHIJKLMNOPQRSTUVW + RSTUVWXYZABCDEFGHIJKLMNOPQ + PQRSTUVWXYZABCDEFGHIJKLMNO + FGHIJKLMNOPQRSTUVWXYZABCDE + EFGHIJKLMNOPQRSTUVWXYZABCD + +Now I have a key for any Caesar cipher by comparing two rows. For instance, the shift A->H (shifting by 7 places) corresponds to mapping the 2nd row to the 6th row, because 7 = 3 - 22 (mod 26). You didn't need to know this in order to solve the problem, but I thought I'd mention it. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0325 Hard - Generating mazes/challenge_text.md b/Hard Challenges/Challenge 0325 Hard - Generating mazes/challenge_text.md new file mode 100644 index 0000000..7b14249 --- /dev/null +++ b/Hard Challenges/Challenge 0325 Hard - Generating mazes/challenge_text.md @@ -0,0 +1,34 @@ +#Description + +Now we are going generate the inputs for this week challenges [Color maze](https://www.reddit.com/r/dailyprogrammer/comments/6qutez/20170801_challenge_325_easy_color_maze/) and [Arrow maze](https://www.reddit.com/r/dailyprogrammer/comments/6rb98p/20170803_challenge_325_intermediate_arrow_maze/). + +The mazes should always be solvable, other then that it should be random + +#Formal Inputs & Outputs + +##Input description + +You'll recieve the type of the wanted maze and the size + + color 50 50 + + + arrow 125 125 + +##Output description + +The input for previous challenges + + - Color maze: The sequence to follow, followed by the maze + - Arrow maze: The starting point, followed by the maze + + +#Bonus + +Make a visual representation like I did in the challenges + +#Finally + +Have a good challenge idea? + +Consider submitting it to /r/dailyprogrammer_ideas \ No newline at end of file diff --git a/Hard Challenges/Challenge 0326 Hard - Multifaceted alphabet blocks/challenge_text.md b/Hard Challenges/Challenge 0326 Hard - Multifaceted alphabet blocks/challenge_text.md new file mode 100644 index 0000000..b3cc5c1 --- /dev/null +++ b/Hard Challenges/Challenge 0326 Hard - Multifaceted alphabet blocks/challenge_text.md @@ -0,0 +1,36 @@ +# Description + +You are constructing a set of N alphabet blocks. The first block has 1 face. The second block has 2 faces, and so on up to the Nth block, which has N faces. Each face contains a letter. + +Given a word list, return a set of blocks that can spell every word on the word list, making N as small as possible. A word can be spelled with the blocks if you can take some subset of the blocks, take one face from each block you chose, put them in some order, and spell the word. + +# Example input + + zero + one + two + three + four + five + six + seven + +# Example output + +The smallest possible N in this case is N = 5: + + e + eo + fhs + rvwx + intuz + +This output represents five blocks. Block #1 has one face that contains `e`, block #2 has two faces, `e` and `o`, and so on up to block #5, which has the faces `i`, `n`, `t`, `u`, and `z`. + +For example, `four` can be formed by using blocks #3, #2, #5, and #4 in order. Note that `ten` could not be formed from these blocks even though all the letters are there, because the only `t` and the only `n` both appear on block #5, and you can only use at most one face from each block. + +# Challenge input + +[This list of 10,000 12-letter words](https://pastebin.com/trMz6nWQ). + +I'll award +1 gold medal flair for the best (lowest number of blocks) solution to the challenge input after 7 days. I will break ties by concatenating the blocks in order of number of faces (`eeofhsrvwxintuz` for the example), and take the lexicographically first solution. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0327 Hard - Calculating Costas Arrays/challenge_text.md b/Hard Challenges/Challenge 0327 Hard - Calculating Costas Arrays/challenge_text.md new file mode 100644 index 0000000..4474e90 --- /dev/null +++ b/Hard Challenges/Challenge 0327 Hard - Calculating Costas Arrays/challenge_text.md @@ -0,0 +1,47 @@ +# Description + +[Costas arrays](https://en.wikipedia.org/wiki/Costas_array) are special permutation matrices. A permutation matrix contains 0s and 1s such that each row and each column contains only a single 1. The identity matrix is a trivial example of a permutation matrix: + + 1 0 0 + 0 1 0 + 0 0 1 + +The special property of Costas arrays are that the [displacement vector](https://en.wikipedia.org/wiki/Displacement_(vector\)) (distance) between any pair of ones in the matrix is not repeated for another pair of ones. This means that the identity matrix is _not_ a valid Costas array because each closest pair of 1s is the same distance apart. + +Costas arrays are named after John P. Costas, who first wrote about them in a 1965 technical report. + +Costas arrays have a number of applications. This property was originally defined to make the permutation matrix an optimal scheme for setting frequencies in a multiple-tone sonar waveform because it means that unless the receiver is locked on the signal in both frequency and time, no more than one tone will be where it is expected. This property also makes Costas arrays ideal for one of the techniques in sophisticated communications and radar waveforms. + +Furthermore, Costas arrays are an active area of research in computer graphics. + +Costas arrays have an order _N_ which describes the length of one of their sides; they are squares. + +Today's challenge is to calculate the number of distinct Costas arrays given an order. + +# Input Description + +You'll be given a number _N_, one integer per line, telling you the order of the Costas array. Example: + + 3 + 5 + +# Output Description + +Your program should emit the number of distinct Costas arrays for that order. From our example: + + 3 -> 4 + 5 -> 40 + +# Challenge Input + + 6 + 7 + 13 + +# Challenge Output + + 6 -> 116 + 7 -> 200 + 13 -> 12828 + +Orders 13-18 should test the efficiency of your solution pretty well. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0328 Hard - Subset Sum Automata/challenge_text.md b/Hard Challenges/Challenge 0328 Hard - Subset Sum Automata/challenge_text.md new file mode 100644 index 0000000..54b9fb3 --- /dev/null +++ b/Hard Challenges/Challenge 0328 Hard - Subset Sum Automata/challenge_text.md @@ -0,0 +1,15 @@ +# Description + +Earlier this year we did the [subset sum](https://www.reddit.com/r/dailyprogrammer/comments/68oda5/20170501_challenge_313_easy_subset_sum/) problem wherein given a sequence of integers, can you find any subset that sums to 0. Today, inspired by [this post](https://thquinn.github.io/projects/automaton.html) let's play subset sum automata. It marries the subset sum problem with [Conway's Game of Life](https://www.reddit.com/r/dailyprogrammer/comments/271xyp/622014_challenge_165_easy_ascii_game_of_life/). + +You begin with a board full of random integers in each cell. Cells will increment or decrement based on a simple application of the subset sum problem: if any subset of the 8 neighboring cells can sum to the target value, you increment the cell's sum by some value; if not, you decrement the cell by that value. Automata are defined with three integers `x/y/z`, where `x` is the target value, `y` is the reward value, and `z` is the penalty value. + +Your challenge today is to implement the subset automata: + +- Create a 2 dimensional board starting with random numbers +- Color the board based on the value of the cell (I suggest some sort of rainbow effect if you can) +- Parse the definition as described above +- Increment or decrement the cell according to the rules described above +- Redraw the board at each iteration + +You'll probably want to explore various definitions and see what sorts of interesting patterns emerge. diff --git a/Hard Challenges/Challenge 0329 Hard - Implementing a Templating Engine/challenge_text.md b/Hard Challenges/Challenge 0329 Hard - Implementing a Templating Engine/challenge_text.md new file mode 100644 index 0000000..13c80ad --- /dev/null +++ b/Hard Challenges/Challenge 0329 Hard - Implementing a Templating Engine/challenge_text.md @@ -0,0 +1,72 @@ +# Description + +I'm sure many of you in web application development are familiar with templating engines. At some level you can think of it as a huge string interpolation exercise, but with much more: looping and conditionals, for instance. Template engines exist in a variety of languages and styles, and seem to appear like rafts of fire ants after a flood, mostly focusing on speed. + +Many immediately associate template engines with HTML output, but they can support any output, including text, configuration files (for instance Chef templates), and more. + +For today's challenge, let's implement a subset of the [Erb](https://docs.puppet.com/puppet/5.1/lang_template_erb.html) templating language: + +- `<% %>` - Denotes tag start and end. +- `<%= EXPRESSION %>` — Inserts the value of an expression. +- `<% CODE %>`— Executes code, but does not insert a value. This code may include loops and conditionals, and pair with an `<% end %>` tag. + +Everything else is output without modification. + +(Please note that Erb uses Ruby, and I'm not a Ruby programmer so if I messed up some syntax please let me know. Thanks.) + +# Example Input + +You'll be given a simple template and a JSON data structure to use. + +The JSON to use: + + {"foo": "bar", "fizz": "buzz", "a": 1, "b": [1,2,3]} + +And the example template, calling the above `data`: + + Hello <%= @data["foo"] %>! + +# Example Output + +The above should yield: + + Hello bar! + +# Challenge Input + +The JSON to use (and reference as `data`): + + { + "store_name": "Barry's Farmer's Market", + "foods": { + "apple": "5.91", + "peach": "1.84", + "carrot": "6.44", + "beans": "3.05", + "orange": "5.75", + "cucumber": "6.42" + }, + "store_location": "Corner of Elm Tree Hill and 158th Street" + } + +And the template to use: + + + Local Farmer's Market: <%= data["store_name"] %> + + + + + + + + + <% data["foods"].each do |k,v| %> + + + + + <% end %> + +
FoodPrice (10 lbs)
<%= k %><%= v %>
+ \ No newline at end of file diff --git a/Hard Challenges/Challenge 0330 Hard - Mini-Chess Positions/challenge_text.md b/Hard Challenges/Challenge 0330 Hard - Mini-Chess Positions/challenge_text.md new file mode 100644 index 0000000..746b7f0 --- /dev/null +++ b/Hard Challenges/Challenge 0330 Hard - Mini-Chess Positions/challenge_text.md @@ -0,0 +1,35 @@ +# Description + +> The motivation for these variants is to make the game simpler and shorter than the standard chess. + +The objective is to count the number of legal positions on a [4x4 chess board](https://en.wikipedia.org/wiki/Minichess). + +For the purposes of this challenge, use the 'Silverman 4x4' layout provided in the link above. This means 1 row of pawns per color, 2 rooks per color, 1 queen per color, and 1 king per color. + +# Input (Bonus only) + +There will only be input for the bonus challenge, where you can choose the dimensions of the board. + +# Output + +Print the number of ways of placing chess pieces on a 4x4 board such that: + +1. Both kings must be on the board (and there can only be one of each color). +2. Not both kings can be in check. +3. ~~Pawns may only occupy the first two ranks of their respective sides.~~ + +# Bonus + +Extend your solution to accommodate different boards. Can your program handle 3x4, 4x3 or 4x4 boards? See the wikipedia article below for layouts. + +# Information + +There is a [Wikipedia article](https://en.wikipedia.org/wiki/Minichess) on minichess variants. + +Thanks to /u/mn-haskell-guy for the idea for this challenge. + +Please feel free to provide feedback. I'm a decent chess player myself, however I have never played mini-chess and am not 100% versed in its rules and variations. + +# Edit + +Grammar and links. I have limited the parameters of this challenge from the original posting, because as /u/J354 rightly pointed out, the original problem is being pursued by professionals and may have over a quadrillion possible solutions. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0331 Hard - Interactive Interpreter/challenge_text.md b/Hard Challenges/Challenge 0331 Hard - Interactive Interpreter/challenge_text.md new file mode 100644 index 0000000..6f8faf6 --- /dev/null +++ b/Hard Challenges/Challenge 0331 Hard - Interactive Interpreter/challenge_text.md @@ -0,0 +1,124 @@ +#Description +Make an interactive interpreter with 2 different capabilities + +1. It should be able to take a mathematical string (fx "5 + 2") and return the result of it + +2. It should be capable of assigning variables (fx "x = 5 + 2") store the value for the variable for later use and return the value + +3. Using assigned variables instead of numbers (fx "y = x * 2") + +Variable names must start with a character a-z and can be continued by any alphanumeric character. + +All variables will be numerical (can be either floats or integers), feel free to support arbitrarily large numbers. + +The mathematical evaluator shall be capable of adding, subtracting, multiplying, dividing, exponents and handling nested parenthesis. + +exponents will be using ^ as symbol. + +The usual order of mathematics apply, so PEMDAS shall be applied in evaluations. + +**PLEASE** refrain from using your languages built in evaluators. + +#Input description +A list of strings such as (divided by \n): + + 5 + 5 + (2 * 5 + 1) / 10 + x = 1 / 2 + y = x * 2 + +Assume all inputs to be written properly, i.e. no undefined variables or wrong placed parenthesis + +Assume all whitespace as negligible so "1 2" and "12" can be assumed the same + +#Output description +Output for each input line, fx from above would be: + + 10 + 1.1 + 0.5 + 1 + +#Challenge input + + 9 + 10 + (2 * 5 + 1) / 10 + x = 1 / 2 + y = x * 2 + (x + 2) * (y * (5 - 100)) + z = 5*-3.14 + 2.6^(2 + 3/2) * (2-z) + +#Challenge output + + 19 + 1.1 + 0.5 + 1 + -237.5 + -15.7 + 501.625937332 + +#Bonus + +##Bonus 1 - Functions + +Variables are nice, but it's all quite limited until we got functions + +functions doesnt eval on declaration, so just make a newline as output from a funtion declaration + +functions and variables can exist with the same name. + +functions either look like 'func()' or 'func(arg1, arg2, arg3)' with any number of arguments needed + +arguments given for functions are only used within the function themself and overwrites any variable with the given name. + + a = 2 + func(a) = a + func(1) will return 1 + func(1) + a will return 3 + + +if the function requires no arguments + + +###Bonus input + + a = 10 + a() = 2 + a() + a + avg(a, b) = (a + b) / 2 + x = avg(69, 96) + avg(x, avg(a(), a)) + a + +###Bonus output + + 10 + + 12 + + 82.5 + 54.25 + +##Bonus 2 - Errors +Handle errors 'gracefully' + +Errors include but are likely not limited to: + +1. Undefined variables (fx "pi * 2", pi has never been defined) + +2. Wrong variable naming + +3. parenthesis placed wrongly (too many open, too many closing, closing when none open etc) + +4. dividing by 0 + +5. Functions calling itself or calling functions that end up calling itself + +Return error description as output if an error occurred + +#Extra + +If you have any challenges, please share it at /r/dailyprogrammer_ideas! + + diff --git a/Hard Challenges/Challenge 0332 Hard - Skyscrapers and CEO's peculiar requirements/challenge_text.md b/Hard Challenges/Challenge 0332 Hard - Skyscrapers and CEO's peculiar requirements/challenge_text.md new file mode 100644 index 0000000..6be94a6 --- /dev/null +++ b/Hard Challenges/Challenge 0332 Hard - Skyscrapers and CEO's peculiar requirements/challenge_text.md @@ -0,0 +1,170 @@ +#Description +Skyscraper is a logic puzzle similar to Sudoku. + +You have an NxN grid that you'll fill such that every row and column contains 1...N + +fx: + + 1 2 3 4 + 2 3 4 1 + 3 4 1 2 + 4 1 2 3 + +There is however a catch, since we're working with a grid of Skyscrapers we cant just place them willy nilly. + +The Mayor sits in his office and demands that you can only see so many skyscrapers from different directions (only looking across columns and rows) + +To solve this issue we have to abuse that each skyscraper is only as high as its number, and can hide lower skyscrapers behind it. + +For example looking either from the left or right in this row: + + 1 4 3 2 + +From the left can 2 skyscrapers be seen, 1, and 4. + +From the right can 3 skyscrapers be seen, 2, 3, and 4. + +#Input example + +First we will get an N telling us how big the grid is in NxN. (10 > N > 0) + +N will only be different from 4 in the bonus, so you can assume N is always 4 outside of the bonus + +Secondly we get all the view demands in a single array (N >= X_i >= 0) + +The array is always of length N * 4 + +0's mean that there are no demands for the view of the given row/column + +0's means no constraint in number of buildings in view + +You must be able to see EXACTLY the amount that is told, no more, no less + +The array should be read as such: + +Going clockwise around the grid starting at the top-left + + 3 + 0 1 0 2 1 3 2 0 1 0 2 2 + + - 0 1 0 - + 2 ? ? ? 2 + 2 ? ? ? 1 + 0 ? ? ? 3 + - 1 0 2 - + +Or as displayed with indexes + + -- 0 1 2 - + 11 ? ? ? 3 + 10 ? ? ? 4 + 09 ? ? ? 5 + -- 8 7 6 - + +Where each number is looking inwards at their respective column/row + +#Output example + +The output is the filled out city grid + +For the input above we get: + + 1 3 2 + 2 1 3 + 3 2 1 + +#Challenge input + +##Challenge 1 + + 4 + 3 1 2 2 2 2 1 3 2 2 3 1 1 2 3 2 + +##Challenge 2 + + 4 + 0 0 0 0 0 2 0 0 3 0 0 0 1 3 0 3 + +#Challenge output + +##Challenge 1 + + 2 4 1 3 + 1 3 4 2 + 3 1 2 4 + 4 2 3 1 + +##Challenge 2 + + 2 1 3 4 + 3 4 1 2 + 1 2 4 3 + 4 3 2 1 + +#Bonus +Make it solve for an n by n game + +Some tiles may already be filled in + +After the array of ints there will be an NxN 2D array of ints with some prefilled tiles + +all 0 tiles are empty ones your solver need to fill out + +## Bonus input + +### Bonus 1 + + 8 + 1 3 2 5 4 2 2 3 3 2 5 2 3 1 3 3 3 4 2 2 1 2 3 3 3 4 2 2 3 3 4 1 + 0 6 0 0 5 0 1 0 + 0 2 1 0 0 0 0 0 + 2 0 0 0 6 0 3 0 + 0 0 0 0 0 8 0 0 + 0 0 6 0 0 3 7 0 + 0 0 5 0 0 0 0 0 + 0 0 0 0 0 0 0 3 + 0 0 0 0 3 0 0 0 + +### Bonus 2 + + 6 + 4 3 0 3 2 2 0 0 0 3 0 0 0 2 0 2 0 0 2 3 0 0 0 0 + 2 0 0 0 0 0 + 0 0 0 0 4 0 + 0 0 0 0 0 0 + 0 2 0 0 0 0 + 0 0 0 0 0 0 + 0 0 0 0 0 0 + +## Bonus output + +### Bonus 1 + + 8 6 2 3 5 7 1 4 + 3 2 1 5 4 6 8 7 + 2 7 8 4 6 5 3 1 + 5 4 3 1 7 8 2 6 + 4 8 6 2 1 3 7 5 + 7 3 5 6 2 1 4 8 + 1 5 4 7 8 2 6 3 + 6 1 7 8 3 4 5 2 + +### Bonus 2 + + 2 3 6 4 5 1 + 3 5 1 2 4 6 + 5 1 2 3 6 4 + 6 2 4 5 1 3 + 1 4 3 6 2 5 + 4 6 5 1 3 2 + +#Hint + +A better explanation than I ever could do and some helpful hints can be found here: +https://www.brainbashers.com/skyscrapershelp.asp + +#Extra + +If you have any challenges, please share it at /r/dailyprogrammer_ideas! + +And remember to upvote challenges you like :) \ No newline at end of file diff --git a/Hard Challenges/Challenge 0333 Hard - Build a Web API-driven Data Site/challenge_text.md b/Hard Challenges/Challenge 0333 Hard - Build a Web API-driven Data Site/challenge_text.md new file mode 100644 index 0000000..c18bab9 --- /dev/null +++ b/Hard Challenges/Challenge 0333 Hard - Build a Web API-driven Data Site/challenge_text.md @@ -0,0 +1,28 @@ +# Description + +A common theme in present-day programming are web APIs. We've had a previous challenge where you had to _consume_ an API, today's challenge is to _implement_ one. Today's is relatively simple: a single CSV file as input that can probably be represented by a single database table. + +Your solution may use whatever technologies you wish to build on: + +* Web server software, e.g. Flask, Rails, Play!, etc +* Database software, e.g. MySQL, MongoDB, etc - or none, using a database is optional +* Database interaction layer, e.g. SQLAlchemy, ActiveRecord, Ecto, etc + +This challenge focuses less on the guts of the server and more on routing requests, transforming a request into a data extraction method, and returning those results. + +Today's challenge will utilize the State of Iowa - Monthly Voter Registration Totals by County data set: + + https://data.iowa.gov/Communities-People/State-of-Iowa-Monthly-Voter-Registration-Totals-by/cp55-uurs + +Download the JSON, CSV or other and use that as your input. It contains 19 columns and over 20,000 rows. Now expose the data via a web API. + +Your solution **must** implement the following API behaviors: + +* A "get_voters_where" endpoint that takes the following optional arguments: county, month, party affiliation, active_status, and limit (the max number of results to return). The endpoint must return a JSON-formatted output, but the schema is up to you. +* All APIs must be RESTful (see [The REST API in five minutes](https://developer.marklogic.com/try/rest/index) for some background if you need it). + +This challenge extends Wednesday's idea of practicality and real world scenarios. Wednesday was some basic data science, today is some basic application development. It's open ended. + +# Bonus + +Ensure your API is immune to attack vectors like SQL injection. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0334 Hard - Dinosaurs/challenge_text.md b/Hard Challenges/Challenge 0334 Hard - Dinosaurs/challenge_text.md new file mode 100644 index 0000000..0875895 --- /dev/null +++ b/Hard Challenges/Challenge 0334 Hard - Dinosaurs/challenge_text.md @@ -0,0 +1,173 @@ +#Description + +After a failed genetic engineering experiment a lot of dinosaurs escaped into the lab, devouring most of the staff. Jeff, a scientist that worked on the project, managed to survive by hiding in the southwest corner of the rectangular lab. Now that all dinosaurs are asleep, he tries to leave the lab. + +The exit of the lab is located at its northeast corner. Jeff knows that if any of the +dinosaurs wakes up, he does not stand a chance. Thus, he wants to follow a path that maximizes the minimum distance from him to the dinosaurs along the path. The length of the path is of no interest to him. + +In this problem we assume that Jeff and the dinosaurs are points on the plane and that Jeff’s path is a continuous curve connecting the southwest and northeast corners of the lab. As we mentioned, Jeff wants to maximize the minimum distance between this curve and the position of any dinosaur. You can find an example solution for the third test case +in the sample input [here](http://imgur.com/duotSll). + +# Formal Inputs & Outputs + +## Input Description + +The input contains several test cases, each consisting of several lines. The first line of +each test case contains three integers `N`, `W`, and `H` separated by single spaces. The value `N` is the number of dinosaurs in the lab. The values `W` (width) +and `H` (height) are the size of the lab. Jeff starts at `(0, 0)`, while the exit of the +lab is located at `(W, H)`. + +Each of the next `N` lines contains two integers `X` and `Y` separated by a single space, representing the coordinates of a dinosaur (`1 ≤ X ≤ W − 1, 1 ≤ Y ≤ H − 1`). Note that no dinosaur is located on the border of the lab. + +## Output Description + +For each test case print a single line with the maximum possible distance to the +closest dinosaur rounded to three decimal digits. + +# Sample Inputs & Outputs + +## Input + + 1 2 2 + 1 1 + 3 5 4 + 1 3 + 4 1 + 1 2 + 2 5 4 + 1 3 + 4 1 + +## Output + + 1.000 + 1.581 + 1.803 + +# Challenge Input + +## Input + + 1 9941 25450 + 6409 21339 + 10 24024 9155 + 2540 8736 + 16858 3291 + 9647 7441 + 1293 1441 + 4993 4404 + 466 8971 + 16447 4216 + 20130 6159 + 673 2951 + 945 2509 + 100 27408 715 + 5032 102 + 16413 326 + 14286 454 + 10579 623 + 16994 320 + 4027 384 + 26867 483 + 22304 416 + 2078 633 + 19969 205 + 262 275 + 17725 113 + 8781 655 + 3343 89 + 4982 154 + 248 92 + 3745 467 + 8449 94 + 1788 98 + 14947 338 + 20464 87 + 12432 529 + 20144 11 + 8918 236 + 4633 215 + 13619 418 + 560 461 + 23402 29 + 15130 55 + 23126 28 + 2684 131 + 2160 690 + 17990 464 + 988 415 + 11740 461 + 3112 569 + 12758 378 + 4311 97 + 2297 178 + 3576 294 + 4453 268 + 27326 314 + 21007 604 + 10478 625 + 12402 33 + 15347 560 + 11906 343 + 16774 143 + 17634 421 + 19842 434 + 11606 625 + 10228 350 + 12667 209 + 12658 99 + 20918 254 + 25007 361 + 22634 674 + 5196 434 + 11630 90 + 6128 451 + 4783 245 + 13210 407 + 2928 477 + 5686 478 + 14826 336 + 25711 172 + 10835 276 + 22725 42 + 4408 596 + 10719 462 + 1743 493 + 11042 590 + 7568 456 + 23426 538 + 13890 565 + 22168 174 + 612 358 + 23541 142 + 20782 417 + 24759 51 + 19912 704 + 24410 483 + 682 168 + 22992 311 + 9122 8 + 16851 109 + 10796 484 + 15226 395 + 4144 456 + 763 98 + 18293 230 + 22287 691 + 462 350 + 21420 44 + 21413 245 + 21552 610 + 3298 265 + 730 16 + 25714 231 + 16189 298 + +# Notes/Hints + + - Here is a somewhat larger example (it is still quite small): [Input](http://pastebin.com/gpwsTWg0), +[Output](http://pastebin.com/y3siBQvC) that I need ~0.2s for. + + - I [visualized](http://www.scribd.com/doc/236927238) all of the given samples if it helps you debug. (Best download the pdf and do not use the raster images.) + + - My best solution takes `O(N^2*log(W+H))` time and `O(N)` space in the worst case. I don't know whether there is a better solution. diff --git a/Intermediate Challenges/Challenge 0314 Intermediate - Comparing Rotated Words/challenge_text.md b/Intermediate Challenges/Challenge 0314 Intermediate - Comparing Rotated Words/challenge_text.md new file mode 100644 index 0000000..e6ff616 --- /dev/null +++ b/Intermediate Challenges/Challenge 0314 Intermediate - Comparing Rotated Words/challenge_text.md @@ -0,0 +1,35 @@ +# Description + +We've explored the concept of string rotations before as [garland words](https://www.reddit.com/r/dailyprogrammer/comments/3d4fwj/20150713_challenge_223_easy_garland_words/?ref=search_posts). Mathematically we can define them as a string *s* = *uv* is said to be a rotation of *t* if *t* = *vu*. For example, the string 0011001 is a rotation of 0100110, where *u* = 00110 and *v* = 01. + +Today we're interested in *lexicographically minimal string rotation* or lexicographically least circular substring, the problem of finding the rotation of a string possessing the lowest lexicographical order of all such rotations. Finding the lexicographically minimal rotation is useful as a way of normalizing strings. + +# Input Description + +You'll be given strings, one per line. Example: + + aabbccddbbaabb + +# Output Description + +Your program should solve the lexicographically minimal string rotation and produce the size of the substring to move and the resulting string. Example: + + 10 aabbaabbccddbb + +Which is, in Python parlance, `"aabbccddbbaabb"[10:] + "aabbccddbbaabb"[:10]`. + +# Challenge Input + + onion + bbaaccaadd + alfalfa + weugweougewoiheew + pneumonoultramicroscopicsilicovolcanoconiosis + +# Challenge Output + + 2 ionon + 2 aaccaaddbb + 6 aalfalf + 14 eewweugweougewoih + 12 amicroscopicsilicovolcanoconiosispneumonoultr diff --git a/Intermediate Challenges/Challenge 0315 Intermediate - Game of life that has a twist/challenge_text.md b/Intermediate Challenges/Challenge 0315 Intermediate - Game of life that has a twist/challenge_text.md new file mode 100644 index 0000000..b1184fe --- /dev/null +++ b/Intermediate Challenges/Challenge 0315 Intermediate - Game of life that has a twist/challenge_text.md @@ -0,0 +1,71 @@ +So for the first part of the description I am borrowing /u/Elite6809 challenge of a while ago [link](https://www.reddit.com/r/dailyprogrammer/comments/271xyp/622014_challenge_165_easy_ascii_game_of_life/) + +This challenge is based on a game (the mathematical variety - not quite as fun!) called [Conway's Game of Life](http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life). This is called a cellular automaton. This means it is based on a 'playing field' of sorts, made up of lots of little cells or spaces. For Conway's game of life, the grid is square - but other shapes like hexagonal ones could potentially exist too. Each cell can have a value - in this case, on or off - and for each 'iteration' or loop of the game, the value of each cell will change depending on the other cells around it. This might sound confusing at first, but looks easier when you break it down a bit. + +* A cell's "neighbours" are the 8 cells around it. + +* If a cell is 'off' but exactly 3 of its neighbours are on, that cell will also turn on - like reproduction. + +* If a cell is 'on' but less than two of its neighbours are on, it will die out - like underpopulation. + +* If a cell is 'on' but more than three of its neighbours are on, it will die out - like overcrowding. + +Fairly simple, right? This might sound boring, but it can generate fairly complex patterns - [this one, for example](http://upload.wikimedia.org/wikipedia/commons/e/e5/Gospers_glider_gun.gif), is called the Gosper Glider Gun and is designed in such a way that it generates little patterns that fly away from it. There are other examples of such patterns, like ones which grow indefinitely. + +We are going to extend this by giving it some additional rules: + +There are two parties on the grid, say red and blue. + +When a cell only has neighbours that are of his own color, nothing changes and it will folow the rules as explained before. + +When a cell has neighbours that are not of his own 1 of two things can happen: + + - The total amount of cells in his neighbourhood of his color (including himself) is greater then the amount of cells not in his color in his neighbourhood + -> apply normal rules, meaning that you have to count in the cells of other colors as alive cells + - If the amout of the other colors is greater then amount of that cell's own color then it just changes color. + +Last if a cell is 'off' and has 3 neighbour cells that are alive it will be the color that is the most represented. + +Your challenge is, given a width and heigth to create a grid and a number of turns to simulate this variant + +# Formal Inputs and Outputs + +## Input Description + +You will be given three numbers **W** and **H** and **N**. These will present the width and heigth of the grid. With this you can create a grid where on the grid, a period or full-stop `.` will represent 'off', and a hash sign `#`/`*` will represent 'on' (for each color). +These states you can generate at random. + +The grid that you are using must 'wrap around'. That means, if something goes off the bottom of the playing field, then it will wrap around to the top, like this: http://upload.wikimedia.org/wikipedia/en/d/d1/Long_gun.gif See how those cells act like the top and bottom, and the left and right of the field are joined up? In other words, the neighbours of a cell can look like this - where the lines coming out are the neighbours: + + #-...- ...... ../|\. + |\.../ ...... ...... + ...... |/...\ ...... + ...... #-...- ...... + ...... |\.../ ..\|/. + |/...\ ...... ..-#-. + + +## Output Description + +Using that starting state, simulate **N** iterations of Conway's Game of Life. Print the final state in the same format as above - `.` is off and `#` is on. + +# Sample Inputs & Output + +## Sample Input + + 10 10 7 + +# Challenge + +## Challenge Input + + 32 17 17 + + 50 50 21 + + +## note + +For the initial state I would give it a 45% procent chance of being alive with dividing the red and blue ones to be 50/50 + +Also look what happens if you change up these numbers \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0316 Intermediate - Sydney tourist shopping cart/challenge_text.md b/Intermediate Challenges/Challenge 0316 Intermediate - Sydney tourist shopping cart/challenge_text.md new file mode 100644 index 0000000..bb9984e --- /dev/null +++ b/Intermediate Challenges/Challenge 0316 Intermediate - Sydney tourist shopping cart/challenge_text.md @@ -0,0 +1,55 @@ +# Description + +This challenge is to build a tourist booking engine where customers can book tours and activities around the Sydney. +Specially, you're task today is to build the shopping cart system. We will start with the following tours in our database. + +| Id | Name | Price | +|:---|------|-------| +| OH | Opera house tour | $300.00 | +| BC | Sydney Bridge Climb | $110.00 | +| SK | Sydney Sky Tower | $30.00 | + +As we want to attract attention, we intend to have a few weekly specials. + +* We are going to have a 3 for 2 deal on opera house ticket. For example, if you buy 3 tickets, you will pay the price of 2 only getting another one completely free of charge. +* We are going to give a free Sky Tower tour for with every Opera House tour sold +* The Sydney Bridge Climb will have a bulk discount applied, where the price will drop $20, if someone buys more than 4 + +These promotional rules have to be as flexible as possible as they will change in the future. Items can be added in any order. + +An object oriented interface could look like: + + ShoppingCart sp = new ShopingCart(promotionalRules); + sp.add(tour1); + sp.add(tour2); + sp.total(); + +Your task is to implement the shopping cart system described above. You'll have to figure out the `promotionalRules` structure, for example. + +# Input Description + +You'll be given an order, one order per line, using the IDs above. Example: + + OH OH OH BC + OH SK + BC BC BC BC BC OH + +# Output Description + +Using the weekly specials described above, your program should emit the total price for the tour group. Example: + + Items Total + OH, OH, OH, BC = 710.00 + OH, SK = 300.00 + BC, BC, BC, BC, BC, OH = 750 + +# Challenge Input + + OH OH OH BC SK + OH BC BC SK SK + BC BC BC BC BC BC OH OH + SK SK BC + +# Credit + +This challenge [was posted](https://www.reddit.com/r/dailyprogrammer_ideas/comments/42n3zu/sydney_tourist_shopping_cart/) by /u/peterbarberconsult in /r/dailyprogrammer_ideas quite a while ago, many thanks! If you have an idea please feel free to share it, there's a chance we'll use it. \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0317 Intermediate - Counting Elements/challenge_text.md b/Intermediate Challenges/Challenge 0317 Intermediate - Counting Elements/challenge_text.md new file mode 100644 index 0000000..a897220 --- /dev/null +++ b/Intermediate Challenges/Challenge 0317 Intermediate - Counting Elements/challenge_text.md @@ -0,0 +1,32 @@ +#Description + +Chemical formulas describe which elements and how many atoms comprise a molecule. Probably the most well known chemical formula, H2O, tells us that there are 2 H atoms and one O atom in a molecule of water (Normally numbers are subscripted but reddit doesnt allow for that). More complicated chemical formulas can include brackets that indicate that there are multiple copies of the molecule within the brackets attached to the main one. For example, Iron (III) Sulfate's formula is Fe2(SO4)3 this means that there are 2 Fe, 3 S, and 12 O atoms since the formula inside the brackets is multiplied by 3. + +All atomic symbols (e.g. Na or I) must be either one or two letters long. The first letter is always capitalized and the second letter is always lowercase. This can make things a bit more complicated if you got two different elements that have the same first letter like C and Cl. + +Your job will be to write a program that takes a chemical formula as an input and outputs the number of each element's atoms. + +#Input Description + +The input will be a chemical formula: + + C6H12O6 + +#Output Description + +The output will be the number of atoms of each element in the molecule. You can print the output in any format you want. You can use the example format below: + + C: 6 + H: 12 + O: 6 + +#Challenge Input + + CCl2F2 + NaHCO3 + C4H8(OH)2 + PbCl(NH3)2(COOH)2 + +# Credit + +This challenge was suggested by user /u/quakcduck, many thanks. If you have a challenge idea, please share it using the /r/dailyprogrammer_ideas forum and there's a good chance we'll use it. diff --git a/Intermediate Challenges/Challenge 0318 Intermediate - 2020 - NBA Revolution/challenge_text.md b/Intermediate Challenges/Challenge 0318 Intermediate - 2020 - NBA Revolution/challenge_text.md new file mode 100644 index 0000000..ab05220 --- /dev/null +++ b/Intermediate Challenges/Challenge 0318 Intermediate - 2020 - NBA Revolution/challenge_text.md @@ -0,0 +1,113 @@ +# Description + +We are in June 2020 and the [NBA](https://en.wikipedia.org/wiki/National_Basketball_Association) just decided to change the format of their regular season from the [divisions/conferences system](https://en.wikipedia.org/wiki/National_Basketball_Association#Regular_season) to one single round robin tournament. + +You are in charge of writing the program that will generate the regular season schedule every year from now on. The NBA executive committee wants the competition to be as fair as possible, so the round robin tournament has to conform with the below rules: + +1 - The number of teams engaged is maintained to 30. + +2 - The schedule is composed of 58 rounds of 15 games. Each team plays 2 games against the other teams - one at home and the other away - for a total of 58 games. All teams are playing on the same day within a round. + +3 - After the first half of the regular season (29 rounds), each team must have played exactly once against all other teams. + +4 - Each team cannot play more than 2 consecutive home games, and playing 2 consecutive home games cannot occur more than once during the whole season. + +5 - Rule 4 also applies to away games. + +6 - The schedule generated must be different every time the program is launched. + +# Input description + +The list of teams engaged (one line per team), you may add the number of teams before the list if it makes the input parsing easier for you. + +# Output description + +The complete list of games scheduled for each round, conforming to the 6 rules set out above. For each game, the team playing at home is named first. + +Use your preferred file sharing tool to post your answer if the output is too big to post it locally. + +# Sample input + + Cleveland Cavaliers + Golden State Warriors + San Antonio Spurs + Toronto raptors + +# Sample output + + Round 1 + + San Antonio Spurs - Toronto Raptors + Golden State Warriors - Cleveland Cavaliers + + Round 2 + + San Antonio Spurs - Golden State Warriors + Toronto Raptors - Cleveland Cavaliers + + Round 3 + + Golden State Warriors - Toronto Raptors + Cleveland Cavaliers - San Antonio Spurs + + Round 4 + + Golden State Warriors - San Antonio Spurs + Cleveland Cavaliers - Toronto Raptors + + Round 5 + + Toronto Raptors - Golden State Warriors + San Antonio Spurs - Cleveland Cavaliers + + Round 6 + + Toronto Raptors - San Antonio Spurs + Cleveland Cavaliers - Golden State Warriors + +# Challenge input + + Atlanta Hawks + Boston Celtics + Brooklyn Nets + Charlotte Hornets + Chicago Bulls + Cleveland Cavaliers + Dallas Mavericks + Denver Nuggets + Detroit Pistons + Golden State Warriors + Houston Rockets + Indiana Pacers + Los Angeles Clippers + Los Angeles Lakers + Memphis Grizzlies + Miami Heat + Milwaukee Bucks + Minnesota Timberwolves + New Orleans Pelicans + New York Knicks + Oklahoma City Thunder + Orlando Magic + Philadelphia 76ers + Phoenix Suns + Portland Trail Blazers + Sacramento Kings + San Antonio Spurs + Toronto Raptors + Utah Jazz + Washington Wizards + +# Bonus + +Add the scheduled date besides each round number in your output (using format MM/DD/YYYY), given that: + +- The competition cannot start before October 1st, 2020 and cannot end after April 30th, 2021. + +- There cannot be less than 2 full days between each round (it means that if one round occurs on October 1st, the next round cannot occur before October 4th). + +- The number of rounds taking place over the weekends (on Saturdays or Sundays) must be maximized, to increase audience incomes. + +# Credit + +This challenge was suggested by user /u/gabyjunior, many thanks. If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. diff --git a/Intermediate Challenges/Challenge 0319 Intermediate - Worm Wars 1 - Basic Epidemiology/challenge_text.md b/Intermediate Challenges/Challenge 0319 Intermediate - Worm Wars 1 - Basic Epidemiology/challenge_text.md new file mode 100644 index 0000000..ee3fe6d --- /dev/null +++ b/Intermediate Challenges/Challenge 0319 Intermediate - Worm Wars 1 - Basic Epidemiology/challenge_text.md @@ -0,0 +1,47 @@ +# Description + +This is inspired in part by recent WannaCry malware propagation as well as some work I did a long time ago into worm propagation models. I figured it would make a fun pair of challenges. This was further influenced by a recent 2D Game of Life challenge. + +For basic computer worm propagation models, a lot of focus historically has been on the standard SIR model from epidemiology. Using mathematical models and treating the computer worm as a pathogen, basic simulations ignore a lot of complexities to begin to answer some fundamental questions using mathematical epidemiology to model the establishment and spread of those pathogens. + +As part of this approach, populations are tracked in multiple buckets to track their states. The SIR model, a fundamental model in such systems, labels these three compartments S = number susceptible, I =number infectious (those capable of spreading the pathogen), and R =number recovered (immune): + +- S - able to be infected by the pathogen +- I - currently infected and spreading the pathogen +- R - immune from the pathogen (e.g. recovered) + +The population is therefore the sum of these three buckets, which change over time. In theory for a new pathogen everyone starts out in state *S*, and either becomes *I* if they get hit with the pathogen first or *R* if they get immunized (patched). Alternatively once infected they can recover. Each transition - S -> I, I -> R, and S -> R - have their transition rates. You can assume no back transitions - you won't see I -> S or R -> I, for example. + +Your challenge today is to model a basic epidemiological system. Given a population and some transition rates, model some number N of generations. + +# Input Description + +You'll be given some values on a line telling you the total population size (N), the initial population seed of infected systems (I), and then transition rates for S to I, I to R and S to R. Example: + + 10000 10 0.01 0.01 0.015 + +You have 10000 systems to track, 10 of which are infected, and S -> I is 0.01, I -> R is 0.01, and S -> R (those that get patched first) is 0.015. + +# Output Description + +Your program can emit answers in a number of different ways: + +- Graphical - show S I and R populations over time (as total or fractions) +- Textual - a huuuuge list of numbers +- Other - be creative + +# Challenge Input + + 10758 21 0.051 0.930 0.178 + 18450 12 0.320 0.969 0.306 + 9337 15 0.512 0.513 0.984 + +# Bonus + +Additional lines will tell you new timepoints at which the parameters change. For instance a more virulant strain of the malware becomes available, or a patch gets released. These lines will contain the format of timestep T, then updated transition rates for S to I, I to R and S to R. From the above example: + + 10000 10 0.01 0.01 0.015 + 100 0.02 0.01 0.015 + 200 0.02 0.03 0.03 + +This model can allow you to test the effects of various changes on malware propagation - faster patching, more virulent worms, larger seed populations, etc. \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0320 Intermediate - War (card game)/challenge_text.md b/Intermediate Challenges/Challenge 0320 Intermediate - War (card game)/challenge_text.md new file mode 100644 index 0000000..e64352d --- /dev/null +++ b/Intermediate Challenges/Challenge 0320 Intermediate - War (card game)/challenge_text.md @@ -0,0 +1,61 @@ +# Description +You will be implementing the classic card game [War](https://en.wikipedia.org/wiki/War_(card_game\)). + +### Gameplay +This two player game is played using a standard 52-card deck. The objective of the game is to win all the cards. The deck is divided evenly among the players, giving each a deck of face-down cards. In unison, each player reveals the top card of their deck – this is a battle – and the player with the higher card adds both cards to the bottom of their deck. If the cards are of equal value, it's war! + +This process is repeated until one player runs out of cards, at which point the other player is declared the winner. + +### War +Both players place their next three cards face down, then a card face-up. The owner of the higher face-up card wins the war and adds all cards on the table to the bottom of their deck. If the face-up cards are again equal then the war repeats with another set of face-down/up cards, until one player's face-up card is higher than their opponent's, or both players run out of cards + +If, when a war begins + +* either player does not have enough cards for the war, both players reduce the number of cards to allow the war to complete (e.g. if P2 has only three cards remaining, both players play two cards down and one card up. If P2 has only one card remaining, no cards are played face-down and each player only plays one card up). +* either player has no cards remaining, the other player wins. +* both players have no cards remaining, the game is a draw (this is exceptionally rare in random games). + + +### Post-battle/war +For consistency (so we all end up with the same result for the same input), cards used in a battle or war should be added to the bottom of the winner's deck in a particular order. + +After a battle, the winner's card is added to the bottom the winner's deck first, then the loser's card. + +After a war or wars, cards used in the war(s) are added to the deck first, followed by the two tying cards. "Cards used in the war(s)" is defined as follows: + +0. Cards from any sub-wars (recursive, using this ordering) +1. Winner's face-down cards (in the order they were drawn, first card draw is first added to bottom, etc) +2. Winner's face-up card +3. Loser's face-down cards (in the order they were drawn, first card draw is first added to bottom, etc) +4. Loser's face-up card + +# Input +Input will consist of two lines of space-separated integers in [1..13]. In a standard game, the two lines will each contain 26 numbers, and will be composed of four of each integer in [1..13]. However, your program should be able to handle decks of any size and composition. The first number on a line represents the top card in the deck, last number is the bottom. + +### Challenge inputs + + 5 1 13 10 11 3 2 10 4 12 5 11 10 5 7 6 6 11 9 6 3 13 6 1 8 1 + 9 12 8 3 11 10 1 4 2 4 7 9 13 8 2 13 7 4 2 8 9 12 3 12 7 5 +# + 3 11 6 12 2 13 5 7 10 3 10 4 12 11 1 13 12 2 1 7 10 6 12 5 8 1 + 9 10 7 9 5 2 6 1 11 11 7 9 3 4 8 3 4 8 8 4 6 9 13 2 13 5 +# + 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 7 8 9 10 11 12 13 + 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 7 8 9 10 11 12 13 + +# Output +Output "1" if P1 wins, "2" if P2 wins, and "0" if P1 and P2 tied. + +### Challenge outputs + + 1 +# + 2 +# + 0 + +#Finally + +Have a good challenge idea, like /u/lpreams did? + +Consider submitting it to /r/dailyprogrammer_ideas \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0321 Intermediate - Affine Cipher Solver/challenge_text.md b/Intermediate Challenges/Challenge 0321 Intermediate - Affine Cipher Solver/challenge_text.md new file mode 100644 index 0000000..40fb50b --- /dev/null +++ b/Intermediate Challenges/Challenge 0321 Intermediate - Affine Cipher Solver/challenge_text.md @@ -0,0 +1,75 @@ +#Description + +You are to output what you think is the solution to a given [Affine Cipher](https://en.wikipedia.org/wiki/Affine_cipher). In short, Affine ciphers are encoded by the following formula for each character in the plaintext: `C ≡ aP + b (mod 26)` where `a` and `b` are constants, `C` is the ciphertext letter, and `P` is the plaintext letter. In this case, the letter "a" has the value of 0, "b" 1, and so on and so forth. If you want a hint as to how to decode: + + Decoding is done in the same fashion as encoding: P ≡ aC + b + +In order to rank your decodings in terms of accuracy, I recommend you use a dictionary of some sort (builtin, or the popular [enable1.txt](http://norvig.com/ngrams/enable1.txt) -- note that enable1 lacks "i" and "a" as words). You can choose to not use a dictionary, but it will likely be harder. + +Here's a sample of encoding, done with simple numbers (`a = 3, b = 2`) **N.B. This is done with the letters a-z mapped to 1-26 (26≡0) instead of 0-25. This still is correct, just not the exact result you'd expect from following the method I've established previously.** + +`foobar` + +First, we express our input numerically + +`6, 15, 15, 2, 0, 18` + +Then we multiply by `a` + +`18, 45, 45, 12, 0, 54` + +Optionally reduce to least positive residue + +`18, 19, 19, 12, 0, 2` + +Add `b` + +`20, 21, 21, 18, 2, 4` + +Now we change this to text again + +`tyyrbd` + +#Formal Inputs & Outputs + +##Input description + +Input will be words separated by spaces or newlines. Input will be in uppercase if need be (i.e. if you can't figure out a way to handle mixed cases), but if not, it will be provided in regular text (e.g. `Lorum ipsum ... word`). Expect only alphabetical characters. With reference to my previous equation, `a` will *only* be a number coprime with 26. Hint: + + that is, a will be one of the following: 3, 5, 7, 11, 15, 17, 19, 21, 23, or 25 + + +##Output description + +What your program thinks is the correct decoding, in lowercase if you only took uppercase input, else in the same case as you were given. You may give multiple outputs if there is a "tie" in your scoring, that is, if your program deemed two or more decodings to be correct. + + +#Test Cases + +**Test Case 1:** NLWC WC M NECN + + this is a test + +**Test Case 2:** YEQ LKCV BDK XCGK EZ BDK UEXLVM QPLQGWSKMB + + you lead the race of the worlds unluckiest + +**Test Case 2 Bonus:** Yeq lkcv bdk xcgk ez bdk uexlv'm qplqgwskmb. + + You lead the race of the world's unluckiest. + +**Test Case 3:** NH WRTEQ TFWRX TGY T YEZVXH GJNMGRXX STPGX NH XRGXR TX QWZJDW ZK WRNUZFB P WTY YEJGB ZE RNSQPRY XZNR YJUU ZSPTQR QZ QWR YETPGX ZGR NPGJQR STXQ TGY URQWR VTEYX WTY XJGB + + my heart aches and a drowsy numbness pains my sense as though of hemlock i had drunk or emptied some dull opiate to the drains one minute past and lethe wards had sunk + +**Test Case 3 Bonus:** Nh wrteq tfwrx, tgy t yezvxh gjnmgrxx stpgx / Nh xrgxr, tx qwzjdw zk wrnuzfb p wty yejgb, / Ze rnsqpry xznr yjuu zsptqr qz qwr yetpgx / Zgr npgjqr stxq, tgy Urqwr-vteyx wty xjgb. + + My heart aches, and a drowsy numbness pains / My sense, as though of hemlock I had drunk, / Or emptied some dull opiate to the drains / One minute past, and Lethe-wards had sunk. + +#Bonus + +Make your solver work for all forms of input, not just alphabetical and make your output match the input. I think it goes without saying that this challenge is for the English language, but if you want to, make this program for another language or compatible with English and another. If you want another challenge, optimize your code for run-time (I'd be interested to see submissions in this category). + +# Credit + +This challenge was submitted by /u/Cole_from_SE, many thanks! Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas diff --git a/Intermediate Challenges/Challenge 0322 Intermediate - Largest Palindrome/challenge_text.md b/Intermediate Challenges/Challenge 0322 Intermediate - Largest Palindrome/challenge_text.md new file mode 100644 index 0000000..73b7b3e --- /dev/null +++ b/Intermediate Challenges/Challenge 0322 Intermediate - Largest Palindrome/challenge_text.md @@ -0,0 +1,39 @@ +# Description + +Write a program that, given an integer input n, prints the largest integer that is a palindrome and has two factors both of string length n. + +# Input Description + +An integer + +# Output Description + +The largest integer palindrome who has factors each with string length of the input. + +# Sample Input: + + 1 + + 2 + +# Sample Output: + + 9 + + 9009 + +(9 has factors 3 and 3. 9009 has factors 99 and 91) + +# Challenge inputs/outputs + + 3 => 906609 + + 4 => 99000099 + + 5 => 9966006699 + + 6 => ? + +# Credit + +This challenge was suggested by /u/ruby-solve, many thanks! If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0323 Intermediate - Parsing Postal Addresses/challenge_text.md b/Intermediate Challenges/Challenge 0323 Intermediate - Parsing Postal Addresses/challenge_text.md new file mode 100644 index 0000000..aa79627 --- /dev/null +++ b/Intermediate Challenges/Challenge 0323 Intermediate - Parsing Postal Addresses/challenge_text.md @@ -0,0 +1,59 @@ +# Description + +Nealy everyone is familiar with mailing addresses - typically a person, optionally an organization, a street address or a postal box, a city, state or province, country, and a postal code. A practical bit of code to have is something that parses addresses, perhaps for validation or for shipping cost calculations. + +Today's challenge is to parse addresses into some sort of data structure - an object (if you're using an OOP language), a record, a struct, etc. You should label the fields as correctly or appropriately as possible, and map them into a reasonable structure. Not all fields will be present, so you'll want to look over the challenge input first and design your data structure appropriately. Note that these include international addresses. + +# Input Description + +You'll be given an address, one per multi-line block. Example: + + Tudor City Greens + 24-38 Tudor City Pl + New York, NY + 10017 + USA + +# Output Description + +Your program should emit a labeled data structure representing the address. From the above example: + + business=Tudor City Greens + address=24-38 + street=Tudor City Pl + city=New York + state=NY + postal_code=10017 + country=USA + +Your field names may differ but you get the idea. + +# Challenge Input + + Docks + 633 3rd Ave + New York, NY + 10017 + USA + (212) 986-8080 + + Hotel Hans Egede + Aqqusinersuaq + Nuuk 3900 + Greenland + +299 32 42 22 + + Alex Bergman + Wilhelmgalerie + Platz der Einheit 14 + 14467 Potsdam + Germany + +49 331 200900 + + Dr KS Krishnan Marg + South Patel Nagar + Pusa + New Delhi, Delhi + 110012 + India + diff --git a/Intermediate Challenges/Challenge 0325 Intermediate - Arrow maze/challenge_text.md b/Intermediate Challenges/Challenge 0325 Intermediate - Arrow maze/challenge_text.md new file mode 100644 index 0000000..551cabe --- /dev/null +++ b/Intermediate Challenges/Challenge 0325 Intermediate - Arrow maze/challenge_text.md @@ -0,0 +1,54 @@ +#Description + +We want to return home, but we have to go trough an [arrow maze](http://imgur.com/TjYhSB4). + +We start at [a certain point](http://imgur.com/QTxERGr) an in a arrow maze you can only follow [the direction of the arrow](http://imgur.com/a097dDJ). + +At each node in the maze we can decide to change direction (depending on the new node) or follow the direction we where going. + +When done right, we should have a path to [home](http://imgur.com/UqD5Brf) + +#Formal Inputs & Outputs + +##Input description + +You recieve on the first line the coordinates of the node where you will start and after that the maze. +`n ne e se s sw w nw` are the direction you can travel to and `h` is your target in the maze. + + (2,0) + e se se sw s + s nw nw n w + ne s h e sw + se n w ne sw + ne nw nw n n + +I have added extra whitespace for formatting reasons + +##Output description + +You need to output the path to the center. + + (2,0) + (3,1) + (3,0) + (1,2) + (1,3) + (1,1) + (0,0) + (4,0) + (4,1) + (0,1) + (0,4) + (2,2) + +you can get creative and use acii art or even better + +#Notes/Hints + +If you have a hard time starting from the beginning, then backtracking might be a good option. + +#Finally + +Have a good challenge idea? + +Consider submitting it to /r/dailyprogrammer_ideas \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0326 Intermediate - Scrabble in Reverse/challenge_text.md b/Intermediate Challenges/Challenge 0326 Intermediate - Scrabble in Reverse/challenge_text.md new file mode 100644 index 0000000..3bd6a70 --- /dev/null +++ b/Intermediate Challenges/Challenge 0326 Intermediate - Scrabble in Reverse/challenge_text.md @@ -0,0 +1,67 @@ +# Description + +Many of us have played Scrabble, the game where you lay down tiles of letters on a board to form interlocking valid English language words. Players get points depending on the tiles they play and the bonus squares they use per word. + +Now, can you reverse a Scrabble game? That is, given a board can you infer what words were played and in what order? + +Given some basic rules of Scrabble: + +- The first word should be as centered as possible on the middle square (horizontal and vertical centering) +- Each play must build off the previous word +- Each play must yield valid English language words (one or more) +- Words may be extended (e.g. "can" can become "cans", either by adding a single letter or by playing a new word that intersects to form a second valid word) + +For your dictionary, use any standard English language dictionary (or [enable1.txt](https://github.com/dolph/dictionary/blob/master/enable1.txt)). + +# Example Input + +You'll be given two integers on a line telling you how many rows and columns to read, then a board (with those dimensions) with words filled out, with blank spaces using a period `.`. Example: + + 7 8 + ...cite + .tilt.. + ...e... + .planes + ...n... + ....... + ....... + +# Example Output + +Your program should emit one or more words, in the order in which they were played (first to last). Example: + + planes + clean + cite + tilt + +An alternative could be: + + planes + clean + tilt + cite + +# Challenge Input + + + 9 10 + ......... + ......... + .ferries. + .l.....t. + .o..an.a. + .e...e.f. + .short.f. + .......e. + ..called. + +# Challenge Output + + an + net + short + floes + ferries + staffed + called diff --git a/Intermediate Challenges/Challenge 0328 Intermediate - Pyramid sliding/challenge_text.md b/Intermediate Challenges/Challenge 0328 Intermediate - Pyramid sliding/challenge_text.md new file mode 100644 index 0000000..13ae83d --- /dev/null +++ b/Intermediate Challenges/Challenge 0328 Intermediate - Pyramid sliding/challenge_text.md @@ -0,0 +1,89 @@ +#Description + +Pyramid sliding is a fun sport, but you have to be fast or you'll get burned + +In this challenge you have to find the quickest path down the pyramid + +A pyramid is represented as such: + + 1 + 2 3 + 4 5 6 + +Where you always start from the top and have to find your way to the bottom + +You can only slide downwards and you can only slide to the 2 adjecent field downward + +fx 1 -> [2, 3], 2 -> [4, 5] and 3 -> [5, 6] as their only possible moves + +#Input description + +Input will have an *N* telling how many layers the pyramid is made of + +afterward there will be *N* arrays given, each 1 longer than the previous + +The first array is always of size 1 + +fx: + + 4 + 1 + 2 3 + 4 5 6 + 7 8 9 10 + +#Output description + +Output is simply the sum of the shortest path down + +from previous example this would be: + + 14 + +from the path 1 -> 2 -> 4 -> 7 + +#Hint +The 2 possible moves from a position in a layer to the one below it is: + +pyramid[i + 1][j] + +pyramid[i + 1][j + 1] + +#Challenge input + +##Challenge 1 + 4 + 3 + 7 4 + 2 4 6 + 8 5 9 3 +##Challenge 2 + 15 + 75 + 95 64 + 17 47 82 + 18 35 87 10 + 20 4 82 47 65 + 19 1 23 75 3 34 + 88 2 77 73 7 63 67 + 99 65 4 28 6 16 70 92 + 41 41 26 56 83 40 80 70 33 + 41 48 72 33 47 32 37 16 94 29 + 53 71 44 65 25 43 91 52 97 51 14 + 70 11 33 28 77 73 17 78 39 68 17 57 + 91 71 52 38 17 14 91 43 58 50 27 29 48 + 63 66 4 68 89 53 67 30 73 16 69 87 40 31 + 4 62 98 27 23 9 70 98 73 93 38 53 60 4 23 + +## Challenge 3 +https://pastebin.com/1A9u3epn + +#Challenge output +##Challenge 1 + 16 +##Challenge 2 + 447 +##Challenge 3 + 130572 +#Bonus +Make your solution solve the challenges quickly (<1 sec) \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0329 Intermediate - Solve the Water Bucket Riddle/challenge_text.md b/Intermediate Challenges/Challenge 0329 Intermediate - Solve the Water Bucket Riddle/challenge_text.md new file mode 100644 index 0000000..915594b --- /dev/null +++ b/Intermediate Challenges/Challenge 0329 Intermediate - Solve the Water Bucket Riddle/challenge_text.md @@ -0,0 +1,65 @@ + +# Description + +You are handed two buckets, one can hold 3 liters and the other 5 liters of water. You are allowed to + +* fill a bucket with water until it is full +* empty a bucket +* transfer water from one bucket into the other until the target bucket is full + +In the original riddle, you are to describe the actions that need to be done in order to get exactly 4 liters of water. +Example solution: + + Two buckets (3L, 5L): + Fill 5L -> (0,5) + 5L to 3L -> (3,2) + Empty 3L -> (0,2) + 5L to 3L -> (2,0) + Fill 5L -> (2,5) + 5L to 3L -> (3,4) + +Another solution: + + Fill 3L -> (3,0) + 3L to 5L -> (0,3) + Fill 3L -> (3,3) + 3L to 5L -> (1,5) + Empty 5L -> (1,0) + 3L to 5L -> (0,1) + Fill 3L -> (3,1) + 3L to 5L -> (0,4) + + +Your task is to find a path of actions to obtain a target volume *l* <= max(*m*, *n*) liters of water, given two buckets of size *m*, *n*, where *m* and *n* are coprime. + +# Input Description + +The input will be three numbers representing *m*, *n*, and *l* respectively. + +# Output Description + +The format of the output will be a list of pairs representing the contents of the buckets *m* and *n* at each step: +> [(0, 0), (3, 0), (0, 3), (3, 3), (1, 5), (1, 0), (0, 1), (3, 1), (0, 4)] + +If there is no solution, print "no solution". + +# Challenge Input + + 3 5 4 + 6 16 7 + 101 317 64 + 571 317 420 + 1699 1409 1334 + +# Challenge Output + + [(0, 0), (3, 0), (0, 3), (3, 3), (1, 5), (1, 0), (0, 1), (3, 1), (0, 4)] + no solution + [(0, 0), (101, 0), (0, 101), ... (0, 280), (101, 280), (64, 317)] + [(0, 0), (571, 0), (254, 317), ... (571, 166), (420, 317)] + [(0, 0), (1699, 0), (290, 1409), ... (0, 1044), (1699, 1044), (1334, 1409)] + + +# Credit + +This challenge was suggested by user /u/itah! If you have an idea for a challenge please share it on /r/dailyprogrammer_ideas. \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0330 Intermediate - Check Writer/challenge_text.md b/Intermediate Challenges/Challenge 0330 Intermediate - Check Writer/challenge_text.md new file mode 100644 index 0000000..39d8d81 --- /dev/null +++ b/Intermediate Challenges/Challenge 0330 Intermediate - Check Writer/challenge_text.md @@ -0,0 +1,49 @@ +# Description: + +Given a dollar amount between 0.00 and 999,999.00, create a program that will provide a worded representation of a dollar amount on a check. + +# Input: + +You will be given one line, the dollar amount as a float or integer. It can be as follows: + + 400120.0 + 400120.00 + 400120 + +# Output: + +This will be what you would write on a check for the dollar amount. + + Four hundred thousand, one hundred twenty dollars and zero cents. + +edit: There is no and between hundred and twenty, thank you /u/AllanBz + +# Challenge Inputs: + + 333.88 + 742388.15 + 919616.12 + 12.11 + 2.0 + +# Challenge Outputs: + + Three hundred thirty three dollars and eighty eight cents. + Seven hundred forty two thousand, three hundred eighty eight dollars and fifteen cents. + Nine hundred nineteen thousand, six hundred sixteen dollars and twelve cents. + Twelve dollars and eleven cents. + Two dollars and zero cents. + +# Bonus: + +While I had a difficult time finding an official listing of the world's total wealth, many sources estimate it to be in the trillions of dollars. Extend this program to handle sums up to 999,999,999,999,999.99 + +# Challenge Credit: + +In part due to Dave Jones at Spokane Community College, one of the coolest programming instructors I ever had. + +# Notes: + +This is my first submission to /r/dailyprogrammer, feedback is welcome. + +edit: formatting \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0331 Intermediate - Sum of digits of x raised to n/challenge_text.md b/Intermediate Challenges/Challenge 0331 Intermediate - Sum of digits of x raised to n/challenge_text.md new file mode 100644 index 0000000..7fcbf43 --- /dev/null +++ b/Intermediate Challenges/Challenge 0331 Intermediate - Sum of digits of x raised to n/challenge_text.md @@ -0,0 +1,55 @@ +#Description + +For some x^n, find the sum of its digits. The solution to this problem is extremely simple. Say, I give you 3^4. You could calculate 3^n and add the digits. + +However things might get a bit complex for 5^100. It's a 70-digit number. You could come up with a larger data type that could handle the product of that number and then you could add each number... but where's the fun in that? + +This is today's challenge. Find the sum of the digits of some x^n without directly calculating the number and adding the digits. + +Some simple examples with values that you're familiar with: + +2^5 = 32 = 3 + 2 = 5 + +5^3 = 125 = 1 + 2 + 5 = 8 + +2^7 = 1 + 2 + 8 = 11 + +Note that I have not summed the digits of 11. + +We'll work with powers and bases greater than zero. + +# Input Description + +> Base Power + +means base^power + +> 2 ^ 1000 + +means 2^1000 + +# Output Description + +Display the sum of the digits of base^power. + +# Challenge Input + +> 2 1234 + +> 11 4000 + +> 50 3000 + +# Challenge Output + +>1636 + +>18313 + +> 9208 + +---------------------------- + +If you have any challenges, please share it at /r/dailyprogrammer_ideas! + +Edit : If you're unable to come up with an idea, like the one is Project eulers 16, then feel free to solve it using your own data types (if required). Please consider it as the last option. \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0332 Intermediate - Training for Summiting Everest/challenge_text.md b/Intermediate Challenges/Challenge 0332 Intermediate - Training for Summiting Everest/challenge_text.md new file mode 100644 index 0000000..1538a16 --- /dev/null +++ b/Intermediate Challenges/Challenge 0332 Intermediate - Training for Summiting Everest/challenge_text.md @@ -0,0 +1,35 @@ +# Description + +You and your friend wish to summit Mount Everest the highest peak in the world. One problem: you live at sea level and despite being in great shape haven't been at altitude very long. So you propose a series of stays on mountaintops around the world using increasing elevations to prepare your body for the extremes you'll encounter. + +You and your friend gather a list of mountain peaks that you'd like to visit on your way there. You can't deviate from your path but you can choose to go up the mountain or not. But you have to pick ones that go higher than the previous one. If you go _down_ your body will suffer and your trip to the summit of Everest will be in peril. + +Your friend has done the job of lining up the route to get you from home to basecamp. She looks to you to devise an algorithm to pick the peaks to summit along the way maximizing your summits but always going higher and higher never lower than you did before. + +Can you devise such an algorithm such that you find the list of peaks to summit along the way? Remember - each has to be higher than the last you want to hit as many such peaks as possible and there's no turning back to visit a previously passed peak. + +# Input Description + +You'll be given a series of integers on a line representing the peak height (in thousands of feet) that you'll pass on your way to Everest. Example: + + 0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15 + +# Output Description + +Your program should emit the peak heights you should summit in order that are always higher than the previous peak. In some cases multiple solutions of the same length may be possible. Example: + + 0 2 6 9 11 15 + +# Challenge Inputs + + 1 2 2 5 9 5 4 4 1 6 + 4 9 4 9 9 8 2 9 0 1 + 0 5 4 6 9 1 7 6 7 8 + 1 2 20 13 6 15 16 0 7 9 4 0 4 6 7 8 10 18 14 10 17 15 19 0 4 2 12 6 10 5 12 2 1 7 12 12 10 8 9 2 20 19 20 17 5 19 0 11 5 20 + +# Challenge Output + + 1 2 4 6 + 4 8 9 + 0 1 6 7 8 + 1 2 4 6 7 8 10 14 15 17 19 20 diff --git a/Intermediate Challenges/Challenge 0333 Intermediate - Beer Street and Gin Lane/challenge_text.md b/Intermediate Challenges/Challenge 0333 Intermediate - Beer Street and Gin Lane/challenge_text.md new file mode 100644 index 0000000..4fe4081 --- /dev/null +++ b/Intermediate Challenges/Challenge 0333 Intermediate - Beer Street and Gin Lane/challenge_text.md @@ -0,0 +1,36 @@ +# Description + +The US state of Iowa has relesed over a year's worth of liquor sales data, great for data mining. In this practical exercise we'll be asking you to do some large scale data analysis. Hopefully this data set is big enough that you have to make some decisions about data structures and algorithms and don't just `sort | uniq`. + +This particular challenge differs from many we do because I anticipate you'll use languages and tools such as SQL, LINQ, and similar, although if you feel like using a more conventional programming language please do. My objective with this particular challenge is to explore a data science type of a challenge, inspired by some comments earlier this year seeking more practical challenges. + +The title of this challenge refers to [artwork by William Hogarth](https://en.wikipedia.org/wiki/Beer_Street_and_Gin_Lane). + +# Questions to Answer + +**EDIT** After reading [this comment](https://www.reddit.com/r/dailyprogrammer/comments/72s7xp/20170927_challenge_333_intermediate_beer_street/dnkzeff/?utm_content=permalink&utm_medium=front&utm_source=reddit&utm_name=dailyprogrammer) that does a great job explaining the data set (I had misinterpreted it when I wrote this up), i edited the questions. Also I don't think Iowa tracks beer sales in this category. + +* ~~For beer sales across Iowa (e.g. where someone buys beer, not just any alcohol), what is the most popular street name across all cities?~~ +* What's the most popular non-beer beverage bought in 2016? +* What store has made the most profit (the difference between the state cost per bottle and the sales price per bottle times the quantity of all bottles sold)? +* ~~What are the top types of alcohol commonly bought together? (e.g. "wine and tequila")~~ +* What day of the week sees the most vodka sales? +* Which streets in Iowa are really Beer Street and Gin Lane? +* **NEW** Where in the world is all of that root beer schnapps going? + +Challenges for you to consider include runtime analysis and performance. + +Feel free to highlight any insights you find and how you found them - that's in scope for this challenge. + +# Get the Data + +You can get [the data](https://data.iowa.gov/Economy/Iowa-Liquor-Sales/m3tr-qhgy) on the Iowa data website. Export it to get it into a format (e.g. CSV) suitable for coding - don't bother trying to scrape it! + +# Notes + +Some links that may be useful + +* [Harvard CS 229r: Algorithms for Big Data](http://people.seas.harvard.edu/~minilek/cs229r/) +* [Data Structures and Algorithms for Big Databases presentation](http://www.slideshare.net/omnidba/data-structures-and-algorithms-for-big-databases) +* [SQL Introduction](https://www.w3schools.com/sql/sql_intro.asp) +* [LINQ Introduction](http://csharp-station.com/Tutorial/Linq/Lesson01) \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0334 Intermediate - Carpet Fractals/challenge_text.md b/Intermediate Challenges/Challenge 0334 Intermediate - Carpet Fractals/challenge_text.md new file mode 100644 index 0000000..431e5c7 --- /dev/null +++ b/Intermediate Challenges/Challenge 0334 Intermediate - Carpet Fractals/challenge_text.md @@ -0,0 +1,97 @@ +# Description + +A [Sierpinski carpet](https://en.wikipedia.org/wiki/Sierpinski_carpet) +is a fractal generated by subdividing a shape into smaller copies of +itself. + +For this challenge we will generalize the process to generate carpet +fractals based on a set of rules. Each pixel expands to 9 other pixels +depending on its current color. There's a set of rules that defines +those 9 new pixels for each color. For example, the ruleset for the +Sierpinski carpet looks like this: + +https://i.imgur.com/5Rf14GH.png + +The process starts with a single white pixel. After [one iteration it's +3x3 with one black pixel in the middle](https://en.wikipedia.org/wiki/Sierpinski_carpet#Process). After four iterations it looks +like this: + +https://i.imgur.com/7mX9xbR.png + +## Input: + +To define a ruleset for your program, each of the possible colors will have one line defining its 9 next +colors. Before listing these rules, there will be one line defining the +number of colors and the number of iterations to produce: + + + + +For example, the input to produce a Sierpinski carpet at 4 iterations +(as in the image above): + + 2 4 + 0 0 0 0 1 0 0 0 0 + 1 1 1 1 1 1 1 1 1 + +The number of colors may be greater than two. + +## Output: + +Your program should output the given fractal using whatever means is +convenient. You may want to consider using a [Netpbm +PGM](https://en.wikipedia.org/wiki/Netpbm_format) (P2/P5), with `maxval` +set to the number of colors in the fractal. + +## Challenge Input: + + 3 4 + 2 0 2 0 1 0 2 0 2 + 1 1 1 1 2 1 1 1 1 + 2 1 2 0 0 0 2 1 2 + +## Challenge Output: + +https://i.imgur.com/1piawqY.png + +## Bonus Input: + +The bonus output will contain a secret message. + + 32 4 + 30 31 5 4 13 11 22 26 21 + 0 0 0 0 0 0 21 24 19 + 31 28 26 30 31 31 31 30 30 + 18 14 2 1 2 3 1 3 3 + 28 16 10 3 23 31 9 6 2 + 30 15 17 7 13 13 30 20 30 + 17 30 30 2 30 30 2 14 25 + 8 23 3 12 20 18 30 17 9 + 1 20 29 2 2 17 4 3 3 + 31 1 8 29 9 6 30 9 8 + 17 28 24 18 18 20 20 30 30 + 26 28 16 27 25 28 12 30 4 + 16 13 2 31 30 30 30 30 30 + 20 20 20 15 30 14 23 30 25 + 30 30 30 29 31 28 14 24 18 + 2 2 30 25 17 17 1 16 4 + 2 2 2 3 4 14 12 16 8 + 31 30 30 30 31 30 27 30 30 + 0 0 0 5 0 0 0 13 31 + 2 20 1 17 30 17 23 23 23 + 1 1 1 17 30 30 31 31 29 + 30 14 23 28 23 30 30 30 30 + 25 27 30 30 25 16 30 30 30 + 3 26 30 1 2 17 2 2 2 + 18 18 1 15 17 2 6 2 2 + 31 26 23 30 31 24 30 29 2 + 15 6 14 19 20 8 2 20 12 + 30 30 17 22 30 30 15 6 17 + 30 17 15 27 28 3 24 18 6 + 30 30 31 30 30 30 30 27 27 + 30 30 30 30 30 30 30 30 30 + 30 30 27 30 31 24 29 28 27 + +## Credits: + +This idea originated from /u/Swadqq; more at [The Pi Fractal](https://friendlyfieldsandopenmaps.com/2017/09/18/the-pi-fractal/). diff --git a/Intermediate Challenges/Challenge 0335 Intermediate - Scoring a Cribbage Hand/challenge_text.md b/Intermediate Challenges/Challenge 0335 Intermediate - Scoring a Cribbage Hand/challenge_text.md new file mode 100644 index 0000000..f707042 --- /dev/null +++ b/Intermediate Challenges/Challenge 0335 Intermediate - Scoring a Cribbage Hand/challenge_text.md @@ -0,0 +1,51 @@ +# Description + + +Cribbage is a game played with a standard deck of 52 cards. There are several phases or rounds to playing cribbage: deal, discard, play and show. Players can earn points during the play and show rounds. This challenge is specific to the **show** phase of gameplay only. Each player's hand consists of 4 cards and an additional face up card. During the show round, each player scores points based on the content in their hand (plus the face up card). Points are awarded for the following: + + +* Any number of cards that add up to 15 (regardless of suit) – 2 points +* Runs of 3, 4, or 5 cards – 3, 4 and 5 points respectively +* Pairs: 2, 3, or 4 of a kind – 2, 6 and 12 points respectively +* Flushes: 4 or 5 cards of the same suit (note, the additional face up card is not counted for a 4 card flush) – 4 and 5 points respectively +* Nobs: A Jack of the same suit as the additional face up card – 1 point + +Note: cards can be used more than once, for each combo + + +# Input Description + + +Your program should take an array of 5 cards, each card will be designated by a rank: 1 (Ace) – 10 and Q-K as well as a suit: Hearts, Clubs, Spades and Diamonds. The first 4 cards are the cards in your hand and the final card is the additional face up card. + + +# Output Description + + +Your program should output the score of the hand + + +# Sample Input data + + +* 5D,QS,JC,KH,AC +* 8C,AD,10C,6H,7S +* AC,6D,5C,10C,8C + + +# Sample Output data + + +* 10 points (3 fifteens - 6, a run of 3 - 3, and a nob – 1) +* 7 points (2 fifteens – 4, a run of 3 – 3) +* 4 points (2 fifteens – 4) + + +# Notes and Further Reading + + +* [Rules of Cribbage](http://en.wikipedia.org/wiki/Rules_of_cribbage) + +# Credit + +This challenge was suggested by user /u/codeman869, many thanks! If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it \ No newline at end of file diff --git a/Intermediate Challenges/Challenge 0336 Intermediate - Repetitive Rubik's Cube/challenge_text.md b/Intermediate Challenges/Challenge 0336 Intermediate - Repetitive Rubik's Cube/challenge_text.md new file mode 100644 index 0000000..6245399 --- /dev/null +++ b/Intermediate Challenges/Challenge 0336 Intermediate - Repetitive Rubik's Cube/challenge_text.md @@ -0,0 +1,41 @@ +# Description + +The Rubik's Cube is a pleasant and challenging pastime. In this exercise however, we don't want to solve the cube. We want to (mindlessly) execute the same sequence over and over again. We would like to know how long it will take us to go back to the original starting position. + +Write a program which, given a series of moves, outputs the number of times that sequence must be executed to reach the original state again. + +# Input Description + +A space separated series of movies in the official [WCA Notation](https://www.worldcubeassociation.org/regulations/#article-12-notation) will be given. + +Summary (from [Challenge #157](https://www.reddit.com/r/dailyprogrammer/comments/22k8hu/492014_challenge_157_intermediate_puzzle_cube/?st=j8kfmdyb&sh=9f0157fe)) +* There are 6 faces. U (up, the top face). D (down, the bottom face). L (left). R (right). F (front). B (back). +* Each face is turned like you were looking at it from the front. +* A notation such as X means you turn the X face clockwise 90'. So R L means turn the right face clockwise 90' (from its perspective), then the left face clockwise 90' (from its perspective). +* A notation such as X' (pronounced prime) means you turn the X face anticlockwise 90'. So R U' means turn the right face clockwise 90', then the top face anticlockwise 90'. +* notation such as X2 means you turn the X face 180'. + +Example (each line is a separate challenge): + + R F2 L' U D B2 + +# Output Description + +The output should be the number of times you have to execute the input sequence to arrive at the original state. + +# Challenge Inputs + + R + R F2 L' U D B2 + R' F2 B F B F2 L' U F2 D R2 L R' B L B2 R U + +# Challenge Outputs + + 4 + 18 + 36 + + +# Credit + +This challenge was suggested by user /u/snow_in_march, many thanks! If you have an idea for a challenge please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file From 0a0effa67d5d1d5c3297c2c158c04412ff470d2b Mon Sep 17 00:00:00 2001 From: Colby Gutierrez-Kraybill Date: Sat, 21 Oct 2017 22:07:36 -0400 Subject: [PATCH 3/3] Update config, dev files, and docs --- README.md | 43 ++++++++++++++++++++++++++++++++++--------- etc/praw.ini.example | 12 ++++++++++++ transform.py | 16 ++++++++-------- 3 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 etc/praw.ini.example diff --git a/README.md b/README.md index d3502ee..49ea517 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,43 @@ This repo contains all of the challenges from [**r/dailyprogrammer**](http://reddit.com/r/dailyprogrammer) and also scripts used to pull challenges from the subreddit 3 times per week and to cleanup directories & remove unnecessary posts. -## How to use -The script can also be run via the command line by running `./post_challenges ` +## Requirements + +- Python 3 + - praw + - pprint -### Required Modules: -- praw -- subprocess -- re -- os -- pprint +## Installation -**post-challenges.py runs on Python 3.x** + ```bash + $ pip3 install -r etc/requirements.txt + ``` + +## How to use +The script can also be run via the command line by running `./post-challenges.py ` +It will look for a copy of `praw.ini`, an example is in `etc/praw.ini.example` + +You may wish to run this in a temporary directory, to avoid adding folders directly to the top directory of the repo. Move the various levels of challenges into their respective end points. + +### Example full run + + ```bash + $ cd DailyProgrammerChallenges + $ mkdir tmp + $ cp etc/praw.ini.example tmp/praw.ini + $ cd tmp + # Edit praw.ini with the correct info + $ ../post-challenges.py + # Take a look at what was downloaded for any 'problems' + $ mv *Easy* "Easy Challenges/." + $ mv *Intermediate* "Intermediate Challenges/." + $ mv *Hard* "Hard Challenges/." + $ cd .. + $ ./transform.py + ``` + + Examine the changes that `transform.py` performed and check that they seem okay. ## Challenges & Solutions diff --git a/etc/praw.ini.example b/etc/praw.ini.example new file mode 100644 index 0000000..142990d --- /dev/null +++ b/etc/praw.ini.example @@ -0,0 +1,12 @@ +[DEFAULT] +client_id=CHANGE ME +client_secret=CHANGE ME +password=CHANGE ME +username=CHANGE ME + +# The URL prefix for OAuth-related requests. +oauth_url=https://oauth.reddit.com + +# The URL prefix for regular requests. +reddit_url=https://www.reddit.com + diff --git a/transform.py b/transform.py index eea94c4..bdd4db7 100755 --- a/transform.py +++ b/transform.py @@ -20,10 +20,10 @@ def update_challenge_dir_name(oldName, difficulty): suspects that it would fail a valid transformation.''' # Find the challenge number: - # tokens, delimited by ' ' - # find the first token that has one number embedded within - # This should be the challenge number - # This should avoid other strings with multiple numbers e.g. '[2016-05-20]' + # tokens, delimited by ' ' + # find the first token that has one number embedded within + # This should be the challenge number + # This should avoid other strings with multiple numbers e.g. '[2016-05-20]' tokens = oldName.split() currNum = '' @@ -41,14 +41,14 @@ def update_challenge_dir_name(oldName, difficulty): n = n - 1 # No correct looking number found, or, it appears that the - # number returned already appears to be in canonical form + # number returned already appears to be in canonical form if (n == 0 or currNum[0] == '0'): return oldName # Found a likely looking number - # tokens now possess' the remaining title - # a_token now has the original and possible multiple iteration number - # such as 166b + # tokens now possess' the remaining title + # a_token now has the original and possible multiple iteration number + # such as 166b i = re.findall(r'\S*' + re.escape(currNum) + '(\S*)$', a_token) newNum = ' ' + '0'*(4-n) + currNum + (i.pop() if (len(i) > 0) else ' ') + ' '