Update
This commit is contained in:
parent
910eefc063
commit
c6e3d45699
11 changed files with 2156 additions and 2070 deletions
13
exercises.md
13
exercises.md
|
@ -53,9 +53,10 @@ This place is for suggesting programming [projects](project.md) that will in fir
|
|||
9. **[bytebeat](bytebeat.md)**: Make at least three cool sounding bytebeat songs.
|
||||
10. **Lorem ipsum [markdown](md.md) generator**: Create a program that generates gibberish text in markdown format that looks like normal human text. Each time it is run, it will generate generally a different text that consists of 3 to 5 sections, each section starts with a heading which starts with `# ` after which 3 to 5 words follow, then there are two newlines and then 3 to 5 paragraphs follow; each paragraph ends with two newlines, except for the last one in the document which only ends with one newline. Paragraph consists of 5 to 10 sentences; each sentence consists of 3 to 10 words, starts with capital letter (other letters are lowercase) and ends with period. About 1 in 20 words in paragraphs are highlighted -- highlight is either italic (the word is between `*`s) or bold (the word is between `**`s). After period there is space except when it's the last period in a paragraph (then there is no space). Words are selected randomly from some set of words that you define (have at least 10 different words). Thumbs up for also generating lists etc.
|
||||
11. **Caesar cipher**: Make a program that encrypts/decrypts text with the simple cipher known as Caesar cipher, i.e. by offsetting each letter by certain fixed number *N* (e.g. with *N = 2* the letter *A* will become *C*, *B* will become *D* etc.). Assume just ASCII characters on input (encrypted output can be non-ASCII). You can just choose and hardcode some specific *N* but thumbs up for allowing to set any *N*. You can input/output text from/to standard input/output or files -- it's up to you -- also you can either make one program that does both encoding and decoding (e.g. depending on CLI flag) or make two programs, one for each task.
|
||||
12. **simple website generator**: All static site generators suck ass, make your own. Make a simple markup language and a program that will turn this markup into [HTML](html.md) file -- this will allow you to write HTML websites very easily. The program will read the input file on standard input (i.e. NOT from a file, though you can optionally support this too) and output the HTML on standard output (again, output to file is optional), so that the program can be used like this: `cat myfile.mymarkup | ./mymarkupprocessor > mywebpage.html`. The markup language may be super simple: let's say `_` and `;_` could mark the start and end of bold text (translating to `<b>` and `</b>` respectively) , `#` and `;#` start and end of heading (translating to `<h1>` and `</h1>` respectively) and so on (you can make your own tags, this is just an example). Basically you'll be mostly just translating your tags into HTML tags. You don't have to implement escape sequences for special characters (i.e. it's fine if it's impossible to have let's say the `#` character in your output), but thumbs up if you do. You HAVE TO output a correct HTML, i.e. you have to output a prologue (something like `<html> <head> </head> <body> ...`) and epilogue (something like `</body> </html>`) and somehow deal with possible HTML special characters in the input text: for example if the input contains `<`, you have to translate it to `<` etc., but it is allowed to handle non-trivial cases (like weird Unicode stuff or something) by e.g. just replacing problematic input with `???`. [Unicode](unicode.md) doesn't have to be supported on output, you can output plain [ASCII](ascii.md). You have to support at least normal text, 2 levels of headings and bold text, thumbs up for additional things like images, links, lists etc. Thumbs up for additional features like allowing to set website title with a CLI flag, choose from several hardcoded [CSS](css.md) styles or adding extra output formats like [Markdown](md.md), LaTeX and so on. Test that you generate correct HTML with some HTML validator.
|
||||
13. **filetype guesser**: Create a program that reads a file and guesses its file type. You can NOT use the file name, only the file content. First look at the [magic number](magic_number.md) (file signature) -- check at least PDF, JPEG, PNG, MP3, GIF and TAR. If this doesn't succeed, then see if 90% of bytes are printable ASCII characters: if so, then guess the file to be TXT, otherwise you may report unknown type (or optionally you can try some extra checks if you want).
|
||||
14. **[brainfuck](brainfuck.md) interpreter**: Make a program that interprets brainfuck. You may choose to read the input program either from standard input or from a file (the file may have some hardcoded name, e.g. your program will just look for a file named `program.bf` in the same directory). If the brainfuck program is invalid or runtime error occurs in it, you may just write out `error` and halt your interpreter. Thumbs up for making the interpreter nicer, e.g. allowing to pass input file name as a CLI argument, reporting more details about errors (e.g. its position in source code) and so on.
|
||||
12. **Roman numeral converter**: make a program that will convert between Roman numerals and our traditional decimal numerals (only positive whole numbers, at least up to the limit of unsigned integer range), both ways. The program will read the numeral on its input (you can choose: either read it from standard input or take it from program arguments, this isn't that important), then recognize if it's Roman numeral or decimal number, then convert it to the other representation and print it out. Handle errors only on a basic level (e.g. write out if the input value is in wrong format).
|
||||
13. **simple website generator**: All static site generators suck ass, make your own. Make a simple markup language and a program that will turn this markup into [HTML](html.md) file -- this will allow you to write HTML websites very easily. The program will read the input file on standard input (i.e. NOT from a file, though you can optionally support this too) and output the HTML on standard output (again, output to file is optional), so that the program can be used like this: `cat myfile.mymarkup | ./mymarkupprocessor > mywebpage.html`. The markup language may be super simple: let's say `_` and `;_` could mark the start and end of bold text (translating to `<b>` and `</b>` respectively) , `#` and `;#` start and end of heading (translating to `<h1>` and `</h1>` respectively) and so on (you can make your own tags, this is just an example). Basically you'll be mostly just translating your tags into HTML tags. You don't have to implement escape sequences for special characters (i.e. it's fine if it's impossible to have let's say the `#` character in your output), but thumbs up if you do. You HAVE TO output a correct HTML, i.e. you have to output a prologue (something like `<html> <head> </head> <body> ...`) and epilogue (something like `</body> </html>`) and somehow deal with possible HTML special characters in the input text: for example if the input contains `<`, you have to translate it to `<` etc., but it is allowed to handle non-trivial cases (like weird Unicode stuff or something) by e.g. just replacing problematic input with `???`. [Unicode](unicode.md) doesn't have to be supported on output, you can output plain [ASCII](ascii.md). You have to support at least normal text, 2 levels of headings and bold text, thumbs up for additional things like images, links, lists etc. Thumbs up for additional features like allowing to set website title with a CLI flag, choose from several hardcoded [CSS](css.md) styles or adding extra output formats like [Markdown](md.md), LaTeX and so on. Test that you generate correct HTML with some HTML validator.
|
||||
14. **filetype guesser**: Create a program that reads a file and guesses its file type. You can NOT use the file name, only the file content. First look at the [magic number](magic_number.md) (file signature) -- check at least PDF, JPEG, PNG, MP3, GIF and TAR. If this doesn't succeed, then see if 90% of bytes are printable ASCII characters: if so, then guess the file to be TXT, otherwise you may report unknown type (or optionally you can try some extra checks if you want).
|
||||
15. **[brainfuck](brainfuck.md) interpreter**: Make a program that interprets brainfuck. You may choose to read the input program either from standard input or from a file (the file may have some hardcoded name, e.g. your program will just look for a file named `program.bf` in the same directory). If the brainfuck program is invalid or runtime error occurs in it, you may just write out `error` and halt your interpreter. Thumbs up for making the interpreter nicer, e.g. allowing to pass input file name as a CLI argument, reporting more details about errors (e.g. its position in source code) and so on.
|
||||
|
||||
### Level 2: Mid, *Hurt Me Plenty*
|
||||
|
||||
|
@ -541,7 +542,8 @@ Bear in mind this is not a school test that's supposed to decide if you get to a
|
|||
130. Two [women](woman.md) [kill themselves](suicide.md) at the same time, one is a midget weighting 30 kg, the other one an [American](usa.md) weighting 300 kg. They jump simultaneously from a bridge that's 50 meters above ground. Which one, and by how many seconds, hits the ground first? Ignore air resistance etc.
|
||||
131. In which [science](science.md) is multiplication the same thing as division?
|
||||
132. Create a fraction ([rational number](rational_number.md) that [approximates](approximation.md) [pi](pi.md) at least to 8 fractional digits, i.e. the approximation must start with 3.14159265.
|
||||
133. Did you enjoy this quiz?
|
||||
133. You have 7 [fat](body_shaming.md), horribly smelling [transsexual](transsexual.md) [reddit](reddit.md) admins who all stink exactly the same except for one, which smells yet a little worse. You have a smell comparator with two chambers: you can put any number of people into the chambers and the machine will tell you if the total smell in one chamber is worse, better or equal to than in the other chamber. You can only afford to perform two measurements. How do you identify the worst smelling redditor?
|
||||
134. Did you enjoy this quiz?
|
||||
|
||||
### Answers
|
||||
|
||||
|
@ -678,7 +680,8 @@ sin(x) / cos(x) - log2(2) = tg(x) - 1*, so we get *tg(x) >= 1*. So that will hol
|
|||
130. Both hit the ground at the same time, weight doesn't matter.
|
||||
131. Biology.
|
||||
132. Do it like this: 3.14159265 = 314159265 / 100000000 = 62831853 / 20000000.
|
||||
133. yes
|
||||
133. Put three and three into the two comparator chambers, leave one outside. If the smells are equal, the one outside is the worst smelling. Otherwise take the three people out of the worse smelling chamber and do the same: put one in one chamber, another in the other chamber and leave one outside. If the smells are equal, the one outside is the worst smelling, otherwise it's the one in the worse smelling chamber.
|
||||
134. yes
|
||||
|
||||
## Other
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue