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

Projects For Beginning Programmers (any language)

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
Projects For Beginning Programmers (any language)

Since I don't have any programming projects that I am working on at the moment, I allowed myself to slip back into the nostalgic moments of the days when I was first writing code.
It was a lot of fun as everything was new and it was exciting to see the results of your coding play out on the screen in what usually turned out to be either disastrous, humorous or both.
Here are a few of ideas I put into code. These are just the descriptions as it's up to the new coders to make them work ... for better or worse. They are all text based console programs (no GUIs).

Who, What, Where
This is a fun little exercise that involves random numbers and string arrays. The basic concept is to have one array that represents who, one that represents what and the last one where.
You enter strings in the arrays, and then a random number generator pick one entry from each array and make a sentence from it. For instance, you could have one of the "who" entries be "My roommate", the what could be "chewed on his soiled underwear", and the where could be "in the women's restroom at Walmart.
The more strings you add the weirder the results become. Just remember that the random numbers generated must fall within the bounds of the array they are accessing.
Great for parties.

Text Archery
The concept here is that you are at location 0. The program generates a random object (bear, lion, your girlfriend, etc.) at some random distance. You then have to input the power behind your archery pull and the angle of trajectory. A simple calculation gives you where it lands. If you hit the object you win.
Beware, the first time I wrote this it was calculating to 5 decimal point precision. You may want to have the program calculate that if it is within a range, it is a hit.

Text Dungeon
This is the famous NSEW type of text dungeon. It's done with two-dimensional arrays which include the description of where you are at, and the directions which you can go as well as any other things you want to include (like picking things up or solving a puzzle).
This is an exceptionally good exercise to learn a lot of programming basics.

Text Lunar Lander
You are in a space capsule that is x feet from the ground. Gravity is pulling it down. You must fire the retro rockets to slow it down and meet the ground at a safe speed to land successfully.
This is a good exercise in minor physics calculations. Watch out! Just like "Text Archery", this one will bite you in the butt if you do not reduce or compensate for high precision floating point calculations.

Anyway ... have fun learning to program, and if any other coders want to get nostalgic and offer some of the fun little exercises they did when first starting, feel free.
 

Polaris573

Senior Moderator
Joined
Feb 26, 2005
Messages
4,268 (0.61/day)
Location
Little Rock, USA
Processor LGA 775 Intel Q9550 2.8 Ghz
Motherboard MSI P7N Diamond - 780i Chipset
Cooling Arctic Freezer
Memory 6GB G.Skill DDRII 800 4-4-3-5
Video Card(s) Sapphire HD 7850 2 GB PCI-E
Storage 1 TB Seagate 32MB Cache, 250 GB Seagate 16MB Cache
Display(s) Acer X203w
Case Coolermaster Centurion 5
Audio Device(s) Creative Sound Blaster X-Fi Xtreme Music
Power Supply OCZ StealthXStream 600 Watt
Software Windows 7 Ultimate x64
I just wrote my first "program" this week using ruby. I'm an environmental scientist so it's a little rough around the edges and probably pretty hysterical to real programmers. It calculates the sample duration in minutes using the start and stop time for a sampling device we use (or anything really).

For example a sample that was started at 12:25 and ended 21:26 would have run for 541 minutes.

It enforces a few QAQC checks and allows the time to be entered with or without a colon.

Yes a SQL query or excel spreadhseet would be an easier way of doing it, but this I can just hand out anybody with any level of knowledge and no math or computer skills (some temp employees were bad about that this summer.)

Code:
####################
#DEFs and Constants#
####################

def format
	line_width = 75
	puts ' '
	puts('----------------------------------------------------------------'.center(line_width))
	puts ' '
end

def cls
	system 'cls'
end

cont = 0
line_width = 75

#####################
#Time Entry and QAQC#
#####################

while cont == 0
	puts 'Enter Start-Time'.center(line_width)
		starttime = gets.chomp
	puts 'Enter Stop-Time'.center(line_width)
		stoptime = gets.chomp
		
	if (stoptime.length <= 3 || starttime.length <= 3 || stoptime.length > 5 || starttime.length > 5)
		qaqc = 0
	else 
		qaqc = 1
	end
	
	if (starttime.length == 5)
		start = starttime.split(':')
	elsif (qaqc == 1)
		start = []
		start[0] = starttime.slice(0..1)
		start[1] = starttime.slice(2..3)
	end
	
	if (stoptime.length == 5)
		stop = stoptime.split(':')
	elsif (qaqc == 1)
		stop = []
		stop[0] = stoptime.slice(0..1)
		stop[1] = stoptime.slice(2..3)
	end
	
	cls
	
	if (qaqc == 0 || start[0].to_i >= 24 || stop[0].to_i >= 24 || start[1].to_i > 59 || stop[1].to_i > 59)
		format
		puts('--->INVALID TIME<---'.center(line_width))
		format
		qaqc = 'no'
	else
		puts('Are These the Correct Start and Stop Times?'.center(line_width))
		puts '(Press "Y" for Yes or "N" for No)'.center(line_width)
		puts ' '
		puts(('Start-Time: ' + start[0] + ':' + start[1]).center(line_width))
		puts(('Stop-Time: ' + stop[0] + ':' + stop[1]).center(line_width))
		qaqc = gets.chomp.downcase
		cls
	end
	
############
#Calculator#
############
	
	if qaqc == 'y'
		if (stop[0].to_i <= start[0].to_i)
			format
			puts(('Badge Duration Is ' + ((((stop[0].to_i + 24)*60) + start[1].to_i) - ((start[0].to_i*60) + start[1].to_i)).to_s + ' Minutes').center(line_width))
			format
		else
			format
			puts(('Badge Duration Is ' + (((stop[0].to_i*60) + stop[1].to_i) - ((start[0].to_i*60) + start[1].to_i)).to_s + ' Minutes').center(line_width))
			format
		end
	end
	
################
#Continue Loop?#
################

	while (cont != 'y')
		puts('Would You Like to Calculate Another?'.center(line_width))
		puts '(Press "Y" for Yes or "N" for No)'.center(line_width)
			cont = gets.chomp.downcase
		if (cont == 'n')
			break
		end				
	end
	
	if (cont == 'n')
		cls
		break
	end		
	
	cont = 0
	cls
	
end
 
Last edited:

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
it's a little rough around the edges and probably pretty hysterical to real programmers

There is no such thing as a "real" programmer. There are only non-programmers and programmers.
At some point in the future, as you work more with code, you may look back at it and say "Why did I do it that way" or "I could have made it more efficient", but if it works as designed and is useful to the target audience, it's sucessful code.

Well done. :toast:
 

Completely Bonkers

New Member
Joined
Feb 6, 2007
Messages
2,576 (0.41/day)
Processor Mysterious Engineering Prototype
Motherboard Intel 865
Cooling Custom block made in workshop
Memory Corsair XMS 2GB
Video Card(s) FireGL X3-256
Display(s) 1600x1200 SyncMaster x 2 = 3200x1200
Software Windows 2003
Code:
10 PRINT "Hello World!"
20 GOTO 10

Old skool skillz! ;)
 

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
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
"Above picture said:
No, and the requirements have changed.

:roll: ... that is so true.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
So did anyone try their hand at the little exercises in the OP?

If so, post the executable. I would love to try them out. :D
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
So did anyone try their hand at the little exercises in the OP?

If so, post the executable. I would love to try them out. :D
If I had a ton of time and nothing better to do, they sound like fun/challenging programs to create.

Most of my early programs, like those I make today, are to perform a very specific task. The only one similar to the examples you gave was to find solutions to how to make a knight hit every square on a chess board. It was heavily multithreaded and basically tried random route after random route until it found a way that worked. The fastest time, I think, was about 0.13 seconds. It was an interesting program.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
They are beginner exercises that familiarize people with the use of various type of variables and simple calculations.
I think you are a little beyond that Ford. :laugh:

If anyone else has simple exercises for starting coders, please post them !!
 

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
The only one similar to the examples you gave was to find solutions to how to make a knight hit every square on a chess board. It was heavily multithreaded and basically tried random route after random route until it found a way that worked. The fastest time, I think, was about 0.13 seconds. It was an interesting program.
Just in case anyone else wants to give that a whirl it's known as the Knight's Tour and it's quite popular in programming courses. There are a few methods for solving it in linear time [O(n)], but brute force is always more fun. ;)
 
Joined
Sep 24, 2008
Messages
2,665 (0.47/day)
System Name Dire Wolf IV
Processor Intel Core i9 14900K
Motherboard Asus ROG STRIX Z790-I GAMING WIFI
Cooling Arctic Liquid Freezer II 280
Memory 2x24GB Corsair DDR5 6667
Video Card(s) NVIDIA RTX4080 FE
Storage AORUS Gen4 7300 1TB + Western Digital SN750 500GB
Display(s) Alienware AW3423DWF (QD-OLED, 3440x1440, 165hz)
Case Corsair Airflow 2000D
Power Supply Corsair SF1000L
Mouse Razer Deathadder Essential
Keyboard Chuangquan CQ84
Software Windows 11 Professional

robn

New Member
Joined
Mar 9, 2010
Messages
180 (0.03/day)
Location
UK
Processor i7 920 @ 3520MHz locked on 1.04V, all features on
Motherboard Biostar T-Power x58 + ASUS U3S6 + Broadcom WiFi
Cooling Akasa Nero S on the i7 + 2 Akasa Apache case fans
Memory 24Gig Kingston HyperX DDR3
Video Card(s) XFX GTX260 216 XT
Storage 240Gig SanDisk SSD, 750Gig Spinpoint F1
Display(s) BenQ E2200HD
Case Coolermaster Elite 334
Audio Device(s) Realtek(!) with M-Audio AV40 + Wharfedale SW150
Power Supply Antec EarthWatts 650
Software Win7 64 Pro / Fedora KDE
Benchmark Scores wPrime 32M 7.265sec - 3DMark2001 57673 - Intel Linpack 50.6237 GFlops
My favourite little graphical practice project is to code a block bouncing around inside a square area. Use the arrow keys to start it moving, then it rebounds on it's own. Add "gravity" in one direction, and it looks surprisingly realistic.

As for that flowchart posted by Zyon... yeah doing some CS course work right now, and the lecturer has updated to the 3rd version of his web service we have to code to! Fixed requirements? Maybe he is trying to simulate "industry" for us, so we know what to expect :D
 
Joined
Sep 24, 2008
Messages
2,665 (0.47/day)
System Name Dire Wolf IV
Processor Intel Core i9 14900K
Motherboard Asus ROG STRIX Z790-I GAMING WIFI
Cooling Arctic Liquid Freezer II 280
Memory 2x24GB Corsair DDR5 6667
Video Card(s) NVIDIA RTX4080 FE
Storage AORUS Gen4 7300 1TB + Western Digital SN750 500GB
Display(s) Alienware AW3423DWF (QD-OLED, 3440x1440, 165hz)
Case Corsair Airflow 2000D
Power Supply Corsair SF1000L
Mouse Razer Deathadder Essential
Keyboard Chuangquan CQ84
Software Windows 11 Professional
Fixed requirements? Maybe he is trying to simulate "industry" for us, so we know what to expect :D

"Walking on water and developing software from a specification are easy if both are frozen."
- Edward V. Berard.

People have no idea just how true this is. I write Firmware for a living: The requirements change, the HW specification changes, the timing requirements change, and they keep on changing, and changing, and changing...
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Just in case anyone else wants to give that a whirl it's known as the Knight's Tour and it's quite popular in programming courses. There are a few methods for solving it in linear time [O(n)], but brute force is always more fun. ;)
Algorithms other than the simple brute-force search to find knight's tour solutions are discussed below. It is important to note that an exhaustive brute force approach (one which iterates through all possible move sequences) can never be applied to the Knight's Tour problem (except for very small board sizes). For a regular 8x8 chess board, there are approximately 4×1051 possible move sequences,[9] and it would take an unfathomable amount of time to iterate through such a large number of moves.
Lies. If memory serves, my server was doing 13,000,000 attempts per 1.6 GHz core (has 8) so about 104 million attempts per second total. Only one of those 104 million attempts has to be correct.

4*1051=4204 Even a 486D could probably make that many attempts in well under a second. :rolleyes:
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
@ Ford : It's not 4x1051, it's supposed to be 4 * 10^51
 
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)
My favourite little graphical practice project is to code a block bouncing around inside a square area. Use the arrow keys to start it moving, then it rebounds on it's own. Add "gravity" in one direction, and it looks surprisingly realistic.

Bouncing balls, I did those on the C64 :D That must have been one of the first things I "made" that wasn't simply printing text.

One of the most widely used starting examples is building a calculator. In school, we've used that same example a couple of times: when learning to make objects, functions and the likes, and when moving from clientside to server-side programming. It's really basic, but you can do a lot with it.

Most of my pre-school progs were simple macro's. In the C64 age, I was just a little too young to make "actual" programs unfortunately.
 

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
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)
Nice one, I might take up that challenge.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
I think might give it a shot also. :toast:
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
@ Ford : It's not 4x1051, it's supposed to be 4 * 10^51
Oh, well still, their claim that it is impossible is false. I think the absolute longest it took my server to find a solution was 13 seconds. How long it takes is depend on how good the random seeds are.
 

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
I recently wrote a graphing application and I wanted a way of dividing the Y axis of the graphing region into 10 regions (which requires 11 lines). Since the graph can be resized it means that there could be one or more regions that are one pixel larger than the others. If all of the wider/smaller regions are grouped close together and the size of the graph is small then the discrepancy is very apparent. Here's my solution (in C with some pseudocode):
PHP:
	#define G_LINES_Y	10 //number of lines minus one
	
	//bottom = bottom of graph region (bottom is a higher number than top because this uses win32 screen coordinates with origin at the upper left corner)
	//top = top of graph region
	int yBumps = ((bottom-top) - G_LINES_Y) % G_LINES_Y; //lines drawn with uneven spacing
	int ySkip = ((bottom-top) - G_LINES_Y) / G_LINES_Y + 1; //spacing between between lines
	int yBumpSplit = yBumps/2;  //attempt to evenly distribute the uneven and even spacings
	int yAt = top;
	Draw Horizontal Line at "yAt" //pseudocode
	for (int i=0; i < G_LINES_Y; i++) {
		if ( (yBumps > 0) && ((yBumps > yBumpSplit) || (yBumps + i == G_LINES_Y)) ) //add uneven spacing at top or bottom
		{
			yAt += ySkip+1;
			yBumps--;
		}
		else
		{
			yAt+=ySkip; //even spacing
		}
		Draw Horizontal Line at "yAt" //pseudocode
	}
This creates the same effect that you see on the Y axis of the MSI Afterburner graph window when you detach and resize it. :)

The knights tour would appear to be a problem that is well suited to quantum computing. There could come a time when brute forcing an nxm board when n>>1 and m>>1 is trivial (assuming there is a solution).

Also, "on an 8 × 8 board, there are exactly 26,534,728,821,064 directed closed tours" (wikipedia). Using a bit of math we can determine that a single brute force attempt has a 6.6*10^-37% chance of success. Good odds for any Spartan. :D
 
Last edited:

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Just for the hell of it, I ran the app on my Core i7 920 at stock and got:

Attempts before success: 108155
Time to find a solution: 10.6806109 seconds
Successful random seed: 1253801390
Solution:
Code:
+----+----+----+----+----+----+----+----+
|  0 | 47 | 58 | 49 |  2 | 43 | 14 | 29 |
+----+----+----+----+----+----+----+----+
| 59 | 50 |  1 | 44 | 13 | 30 |  3 | 42 |
+----+----+----+----+----+----+----+----+
| 46 | 57 | 48 | 51 | 22 | 41 | 28 | 15 |
+----+----+----+----+----+----+----+----+
| 63 | 60 | 45 | 12 | 31 | 16 | 23 |  4 |
+----+----+----+----+----+----+----+----+
| 56 | 11 | 62 | 21 | 52 |  5 | 40 | 27 |
+----+----+----+----+----+----+----+----+
| 61 | 20 | 55 | 32 | 17 | 24 | 37 |  6 |
+----+----+----+----+----+----+----+----+
| 10 | 33 | 18 | 53 |  8 | 35 | 26 | 39 |
+----+----+----+----+----+----+----+----+
| 19 | 54 |  9 | 34 | 25 | 38 |  7 | 36 |
+----+----+----+----+----+----+----+----+
Move list:
RightDown
RightUp
RightDown
DownRight
LeftDown
RightDown
DownLeft
LeftUp
LeftDown
LeftUp
UpRight
RightUp
UpRight
RightUp
DownRight
LeftDown
DownLeft
LeftDown
LeftDown
UpRight
RightUp
UpRight
RightDown
DownLeft
DownLeft
RightUp
UpRight
UpLeft
UpRight
LeftDown
DownLeft
DownLeft
LeftDown
RightDown
RightUp
RightDown
UpLeft
DownLeft
RightUp
UpLeft
UpLeft
RightUp
LeftUp
LeftDown
DownLeft
LeftUp
UpRight
DownRight
UpRight
LeftDown
RightDown
DownRight
DownLeft
LeftDown
UpRight
LeftUp
UpRight
UpRight
LeftDown
DownRight
DownLeft
RightUp
LeftUp
Invalid
My code must be exceptionally good. XD

It wouldn't be hard to increase the board size. It'll just cause a (potentially) exponential growth in time it takes to solve.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
http://projecteuler.net/

Going to work on this over summer :toast:

I had to troubleshoot database update problems all day and had the shipping computer (which manages all our UPS information) take a complete crap on me ... still managed to successfully code three of these. :rockout:
(okay, they weren't that hard, but I was crazy busy. lol)
Taking a break from running around like a madman and taking a few minutes to code something like these challenges is quite relaxing. Well for me anyway. :p

This already has my little hampster wheel spinning like crazy for a coding contest. ;)

More nostalgia ...
When I was working a GE doing computer maintenance on the MV4000 minis that ran the MRI scanners, there was one technician who would come in everyday and type in "Hello Computer" at the command prompt.
He would then laugh when the computer responded with "Command not found, 'Hello'" and comment on how stupid computers where.
So ... I wrote a little script named "Hello". (insert evil laughter)
If there were no arguments, it would simply reply "Hello".
If the argument was "Computer", it would response with, "I am not a computer, I am an MV4000".
If the argument was "MV4000", it responded with "Hello Human".
Needless to say the morning after I put the script on his computer, he just about shit a brick when he completely fell for it.
Users are so predictable. :laugh:
 
Last edited:

Polaris573

Senior Moderator
Joined
Feb 26, 2005
Messages
4,268 (0.61/day)
Location
Little Rock, USA
Processor LGA 775 Intel Q9550 2.8 Ghz
Motherboard MSI P7N Diamond - 780i Chipset
Cooling Arctic Freezer
Memory 6GB G.Skill DDRII 800 4-4-3-5
Video Card(s) Sapphire HD 7850 2 GB PCI-E
Storage 1 TB Seagate 32MB Cache, 250 GB Seagate 16MB Cache
Display(s) Acer X203w
Case Coolermaster Centurion 5
Audio Device(s) Creative Sound Blaster X-Fi Xtreme Music
Power Supply OCZ StealthXStream 600 Watt
Software Windows 7 Ultimate x64
That's hilarious.
 

Kreij

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