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

Projects For Beginning Programmers (any language)

xbonez

New Member
Joined
Nov 29, 2010
Messages
1,182 (0.24/day)
Location
Philly, PA (US)
System Name Winter
Processor AMD Phenom II x4 965 BE @ 4.0Ghz
Motherboard MSI 790FX-GD70
Cooling Corsair H50 Liquid Cooling
Memory 2 x 2Gb Gskill Ripjaws 1600Mhz (7-7-7-24@1.6V)
Video Card(s) Asus GTX 470 @ Stock (Zalman VF3000 cooler)
Storage 2 x Samsung Spinpoint F3 500GB (RAID 0)
Display(s) Hanns G 28" @ 1920x1200
Case Antec 1200
Audio Device(s) Onboard -- TosLink --> Z5500
Power Supply Corsair 850TX 850W PSU
Software Win 7 64-bit Ultimate
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.
 

Fourstaff

Moderator
Staff member
Joined
Nov 29, 2009
Messages
10,020 (1.91/day)
Location
Home
System Name Orange! // ItchyHands
Processor 3570K // 10400F
Motherboard ASRock z77 Extreme4 // TUF Gaming B460M-Plus
Cooling Stock // Stock
Memory 2x4Gb 1600Mhz CL9 Corsair XMS3 // 2x8Gb 3200 Mhz XPG D41
Video Card(s) Sapphire Nitro+ RX 570 // Asus TUF RTX 2070
Storage Samsung 840 250Gb // SX8200 480GB
Display(s) LG 22EA53VQ // Philips 275M QHD
Case NZXT Phantom 410 Black/Orange // Tecware Forge M
Power Supply Corsair CXM500w // CM MWE 600w
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:
 
Joined
Oct 10, 2008
Messages
3,471 (0.61/day)
System Name Acer Aspire V3-771G-53218G75Maii
Processor Core i5 3210M (2,5-3,1Ghz)
Memory 8GB DDR3 SODIMM
Video Card(s) Geforce GT650M
Storage Samsung 830 256GB - 750GB Toshiba drive
Software Windows 7 x64 Home Premium (non-acer-bloatware)
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...
 

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
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:
 
Joined
Oct 10, 2008
Messages
3,471 (0.61/day)
System Name Acer Aspire V3-771G-53218G75Maii
Processor Core i5 3210M (2,5-3,1Ghz)
Memory 8GB DDR3 SODIMM
Video Card(s) Geforce GT650M
Storage Samsung 830 256GB - 750GB Toshiba drive
Software Windows 7 x64 Home Premium (non-acer-bloatware)
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...
 

Zyon

New Member
Joined
Mar 18, 2011
Messages
264 (0.06/day)
Location
Australia
System Name Computernamehere/Computernamehere2/Computernamehere3
Processor i5-2500/Athlon 6000+/C2D Q6700
Motherboard P67A-UD3R/M2N-SLI Deluxe/P5K-Deluxe
Cooling Stock/Hyper212+/Unknown Coolermaster
Memory Patriot PC3-10666 2x2/A-Data PC2-6400 4x1/OCZ PC2-8500 4x1
Video Card(s) MSI GTX580 Lightning/2x Gigabyte GTS450 OC 1GB/2x HIS HD4870 512MB
Storage Seagate 1TB/Samsung 500GB/Seagate 1TB
Display(s) Samsung BX2440
Case V4 Black/Mystique 631 Silver/Soprano VX
Audio Device(s) WTF is a sound card?
Power Supply Corsair HX650/Antec Earthwatts 650W Green/None
Software Windows 7 Home/Professional/Professional
Benchmark Scores TBA
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.
 
Joined
Aug 10, 2007
Messages
4,267 (0.70/day)
Location
Sanford, FL, USA
Processor Intel i5-6600
Motherboard ASRock H170M-ITX
Cooling Cooler Master Geminii S524
Memory G.Skill DDR4-2133 16GB (8GB x 2)
Video Card(s) Gigabyte R9-380X 4GB
Storage Samsung 950 EVO 250GB (mSATA)
Display(s) LG 29UM69G-B 2560x1080 IPS
Case Lian Li PC-Q25
Audio Device(s) Realtek ALC892
Power Supply Seasonic SS-460FL2
Mouse Logitech G700s
Keyboard Logitech G110
Software Windows 10 Pro
Finally had some time to write out a maze dungeon of pain and despair generator.



Next up the hero, enemies, movement, attack, etc, logic.
 
Joined
Feb 13, 2011
Messages
226 (0.05/day)
Location
AUSTIN,TEXAS
System Name ALIENWARE R8
Processor INTEL I5 9500 @3.9Ghz
Motherboard ALIENWARE 02XRCM
Cooling ALIENWAR Liqid Cooler
Memory DDR4 16GB @2.8Ghz
Video Card(s) NVIDIA GForce RTX 2070 8GB
Storage 512 MB M.2, KINGSTON 480 GB SSD,SEAGATE 3 TB
Display(s) VIZIO E-241 25" TV
Case ALIENWARE R8
Power Supply 850 WATTS
Mouse ROSWILL NEON M60
Keyboard ALIENWARE
Software WIN 10
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
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
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).
 
Top