• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Projects For Beginning Programmers (any language)

http://projecteuler.net/

Going to work on this over summer :toast:

I used to solve a lot of project euler puzles earlier. Definitely some great puzzles, but keep in mind that most of these won't challenge you as a programmer, but rather as a mathematician.

Most of the puzzles at euler are fairly simple to code if you just brute force them, but the real challenge is in getting to run them as fast as possible, which more often than not, requires mathematical optimizations on paper before you get down to coding.
 
I used to solve a lot of project euler puzles earlier. Definitely some great puzzles, but keep in mind that most of these won't challenge you as a programmer, but rather as a mathematician.

Most of the puzzles at euler are fairly simple to code if you just brute force them, but the real challenge is in getting to run them as fast as possible, which more often than not, requires mathematical optimizations on paper before you get down to coding.

My tutor once said that if you can do maths and code for it, you will be able to find employment everywhere :toast:
 
Most of those puzzles use maths in a logical manner. Programming is 99% applying logic to your problem, and 1% writing the correct syntax.

I like this Euler thingy :) Much more interesting than my boring job...
 
Most of the puzzles at euler are fairly simple to code if you just brute force them, but the real challenge is in getting to run them as fast as possible, which more often than not, requires mathematical optimizations on paper before you get down to coding.
There's a non-trivial tradeoff with simplicity and performance. I can't remember how it goes precisely, but there's a programming adage about how the performance of code is inversely proportionate to it's readability. Since my brain don't work none too good I tend to program for legibility unless the performance penalty is serious (ie. O(n) >> O(log(n)) when n>>1). In the really dense parts of my code I put a comment on every line :laugh:.

Programming is 99% applying logic to your problem, and 1% writing the correct syntax.
That 1% can be a real pickle. In fact you can waste a lot of time not knowing that there was an API/library that'd do it. :laugh:
 
There's a non-trivial tradeoff with simplicity and performance. I can't remember how it goes precisely, but there's a programming adage about how the performance of code is inversely proportionate to it's readability. Since my brain don't work none too good I tend to program for legibility unless the performance penalty is serious (ie. O(n) >> O(log(n)) when n>>1). In the really dense parts of my code I put a comment on every line :laugh:.


That 1% can be a real pickle. In fact you can waste a lot of time not knowing that there was an API/library that'd do it. :laugh:

So true :rolleyes: Basically step 1 is learning to write code, and step 2 *should* be learning to properly search documentation :D

EDIT: currently cracking my head on Euler problem 9...
 
Anyone feel like trying something easier? How about Mandelbrot?

If memory serves me correctly it's only a few lines of math function but then it was a pain trying to render it using Pascal.
 
Finally had some time to write out a maze dungeon of pain and despair generator.

Dungeon-Map.png


Next up the hero, enemies, movement, attack, etc, logic.
 
To this day I still have a lot of fun with error handling in the apps I write.
If a user is supposed to enter a number and they enter a string (or whatever) the messages will usually be something like "Whoa Hoss, can you take a moment to give me an input that is actually useful?"

The users actually like it that way. Breaks up a boring day of data entry with a little humor.

I prefere a different approach to data validation now adays....I never give the user the option to enter the wrong data

snippet of code i wrote for a physics program several months ago that will only allow numeric...
Code:
    Private Sub txtMagnitude_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMagnitude.TextChanged

        Dim sTempString As String
        Dim iLength As Integer
        sTempString = sTempString + txtMagnitude.Text
        If Not IsNumeric(txtMagnitude.Text) And bVectorFlag = False And txtMagnitude.Text <> "-" Then
            iLength = sTempString.Length()
            If iLength > 0 Then
                sTempString = sTempString.Substring(0, iLength - 1)
                txtMagnitude.Text = sTempString
                txtMagnitude.SelectionStart = iLength
            End If
        End If

and some code I borrowed from the net... this code is a snippet from a game I was writting that allowed only the characters A-Z to be entered.. Odly enough the code above could NOT be modified to do this.. I tried and tried but it never worked 100% of the time like it should of

Code:
 Private Sub txtName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtName.KeyPress

        If Char.IsLetter(e.KeyChar) Then
        Else
            e.Handled = True
        End If

    End Sub
 
I do that on occasion too.
For numbers, I usually use;
try
{
Convert.ToInt32(string);
}
catch (FormatException) {}

In C# if a Textbox is bound to a database column of type integer it won't let you type in anything but numbers automagically.

I usually use humorous errors messages when the user enters the correct type, but the data is meaningless or logically wrong (like from-to dates where the from date is cronologically later than the to date).
 
Back
Top