Ruby Challenges
Whether you're just starting out, or whether you want to take a break from the monotony of making the same program over and over again, a challenge might be just what you're looking for. The following are a series of challenges designed to both teach you Ruby and exercise your skills.
- A Sequence of Integers - A challenge: Given an integer, write a method that takes an integer and must return an array containing all the integers from 1 to that integer. While this at first sound simple, there are a few things to consider. And those new to Ruby may be surprised at the answers.
- Asterisk Banner - Back in the dark ages of home computing and programming BASIC was the language of choice. It was often the only language available on a microcomputer and also served as the operating system the computer booted into. Imagine that, a computer that boots right into a programming language. It would be unheard of today but there was a time when you actually had to learn a thing or two in order to use a computer. If a program did have an interface those days it was likely a text-based interface and used the asterisk character liberally to make pretty looking headers.
- The Fizz Buzz Test - The fizz buzz test is a basic programming task designed to weed out unqualified applicants to programming jobs. Never mind qualifications, job history or education, just see if the applicant can compose a simple program. Surprisingly, a large percentage of applicants can't complete this task and this makes the interviewer's job much easier. So what are you in for taking this test? The answer is: not much.
- Number Guessing Game: Part 1 - What was the first program you ever wrote? I don't mean the first program you ever copied out of a tutorial or out of a magazine, the first thing you ever wrote by yourself. My first program was a number guessing game on the Commodore 64 (if memory serves), the computer would think of a number, keep it hidden, and you'd need to give it guesses. The computer would tell you if you were too high and too low. It's not exactly a complex game, but it does serve as an excellent example of how to put together simple text-based games in Ruby.
- Number Guessing Game Part 2 - Here we continue the number guessing game by finishing off with random numbers and the game loop itself.
Source...