

Ask HN: What programs to write? - klrr

Hi, I'm trying to learn programming, the language which I've studied is C and now I want to start write simple programs. I've written FizzBuzz, simple parsers and a very simple text RPG. I want to write a bit bigger but still simpler project that takes more than 2 hours at least, any ideas?<p>Thanks in advanced.
======
michaeldwp
I remember a fun program from school. Pretty much, it was a maze solver.

Say you have a maze, and a mouse. The mouse, denoted by an uppercase 'M'
character, starts out somewhere in the maze. The mouse has to find his way
through the maze, to the end.

To add a bit of spice, say there's a piece of cheese at the end of the maze,
denoted by the letter 'C'.

A maze would be stored in a file on disk, called something like "maze.dat."
The file would be a normal text file, with a maze drawn out in simple
characters.

Here's an example: <http://pastie.org/5721807>

(You can create a more simple / complex maze if you'd like, or maybe find one
online.)

So, you've gotta figure out an algorithm that the mouse can use to find its
way out.

Tip: be sure to handle the case where the mouse can't find a way out (yet) ..
i.e. the infinite loop case.

I hope this helps. Have fun!

Edit: switched to pastie.org link since hn didn't format the maze properly.

~~~
klrr
Thanks!

~~~
michaeldwp
No problem. :)

I remember having some fun with this one. I think the prof gave us a pretty
simple maze, and a fairly complex one to test with. You may want to try the
same, and start by solving the simple maze.

Other than that, the advice to try and solve a real-life problem is good.

Since you're currently working in the console, it may be a bit tougher to find
some problems to solve. But here's a few ideas:

1) Write a program that can download a given webpage

2) Expand #1 by writing a library that allows you to parse the different HTML
nodes on the page, searching for things like "a div with an id of 'content'"

3) Write a console based file uploader. I.e. so you can have a file in the
root of a directory that you're working on, say "uploader.dat", which has the
ftp (or ssh/S3?) server and username, and the files to upload / exclude. When
you run your app, it will check that file, prompt you for a password, connect,
and upload the specified files to the server. You can have settings in the
file for whether to overwrite files or not, or prompt the user to decide
whether to overwrite a file. You can add a bit of smarts in by checking the
"last modified" date on each file, and compare it to a stored setting of when
you last uploaded files (or each individual file). Perhaps display the files
that were uploaded / modified after the upload is complete.

Anyway, just some thoughts. If you can find an app / problem that you'd be
truly passionate about building / solving, I'd say go with that one.

I hope this helps.

------
ScottWhigham
Why not just write/design a company you want to do right now whatever the idea
instead of waiting for someone to give you an idea? Find something you'd like
to learn how to create and get to work figuring it out.

Sorry - not trying to be rude but you've asked a silly question IMO. It's like
someone picking up a guitar and then going around asking their friends, "What
songs should I learn?" Hell, learn the songs you like and want to learn. You
shouldn't need other people to tell you what you want to do.

~~~
klrr
Okey, well... I guess I ask because I don't know what I want to write(or
learn). I don't have such ideas anymore.

~~~
speeder
Make a simple employee database that you can not only store and read, but also
edit :)

When I made that, it resulted into great progress.

------
honu
<http://rosettacode.org/wiki/Category:Programming_Tasks>

This site has a lot of interesting tasks in many languages. "100 doors" and
"24 game" are good starters. "Minesweeper" (text-based) is a little more
involved, but it might be what you are interested in. Sudoku games and solvers
are lots of fun.

Making a text-based chess or go game (no ai) could also be an interesting
challenge.

<https://github.com/alexch/learn_ruby> has some good challenges for Ruby, but
I'm sure they can be done in other languages.

------
dragos2
I used to enjoy creating simple animations for basic algorithms.

You can try writing a program that displays animations of different sorting
algorithms (a nice way to compare the sorting algorithms). You can make the
animations something like this:
<http://en.wikipedia.org/wiki/File:Bubble_sort_animation.gif>

Also, you could display an animation for the Tower of Hanoi problem
(<http://en.wikipedia.org/wiki/Tower_of_Hanoi>)

Try exporting the output as .gif and have fun.

------
stevenameyer
I'd say figure out some projects that let you get familiar with different
basic data structures(stacks, queues, linked lists, trees, graphs, hash tables
etc), what they're useful for, and some of the basic algorithms that are
useful to know for each.

A decent one for getting comfortable with graphs off the top of my head would
be something along the lines of a peg board. Users can attach each peg to any
other peg, and once you create a closed shape it fills the shape in. It would
give you a good understanding of graphs, detecting cycle etc, and is not a
trivial thing to do.

------
andyjdavis
Consider participating in <http://onegameamonth.com/> It doesnt matter if
you're new at it. We're all learning as we go. I'm an experienced programmer
but I'm doing it in a language I didn't know previously and I've never made a
game before.

------
radio4fan
I got a great deal of fun and benefit from an old copy of Dietel's "C: How to
program" (seems that recent editions have C++ in it too now, so it may have
changed a lot).

Takes you through writing an interpreter and then a compiler for a toy basic-
like language.

------
codegeek
Do this program in C:

<https://bsd7.cs.sunysb.edu/~cse219/Handouts/homework_1.html>

------
nonamegiven
Write a program to find all duplicate files on a set of hard drives.
"Duplicate" could mean same file name, or same contents (prolly a hash), or
both.

------
Proleps
A sudoku solver, implement some basic data structures(linked list, vector,
binary tree), replicate some basic unix programs like ls and cat.

