• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Programmers Cafe

Falco&Victory

Smash Champion
Joined
Apr 28, 2006
Messages
2,544
Location
South Hill, Washinton
recursion is weird.... it's like when you create a functions definition and then use that definition to create more definitions in the same function
i don't use it that much
 

Eight Sage

Smash Lord
Joined
Nov 2, 2006
Messages
1,144
Location
in the range of 0.0.0.0 to 255.255.255.255
Velox: yes, website programming is boring. That's why I'm not a professional programmer despite the degree :) (I'm going to be a teacher). I only code stuff that interests me -- like running tournaments, for example, and getting the results online. Hence the site.
Yeah, website programming is really boring, but really useful. I prefer to program systems rather than web sites.

lol I like creating programs that translate one language into another, though it's REALLY hard(unless i'm converting stuff to HTML or VB lol)
No way that seems extremely hard. If you have done one you can sell it at a company for a lot of bucks!
 

snoblo

Smash Journeyman
Joined
Jul 25, 2007
Messages
361
recursion is weird.... it's like when you create a functions definition and then use that definition to create more definitions in the same function
i don't use it that much
kind of like calling the same function while in that function.

here's a java example

Code:
public int fun(int n){
     if (n == 1)
          return 1;
     return n *[B] fun(n-1)[/B]; // <--- here's where it calls itself
}
simple recursion way of doing a factorial.
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
recursion is exceptionally useful. but after about 5 assignments using it last year, i need a break, lol
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
I'm a Computer Scientist. I can pretty much code in any language.

PS: Recursion is cool and all, but in industry it isn't often used. In fact, for both internship's I've had, the use of recursion was specifically forbidden (except is extreme circumstances). It's because it's inherently more confusing than iteration. And code readability and maintainability is more important than efficiency.
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
I'm a Computer Scientist. I can pretty much code in any language.

PS: Recursion is cool and all, but in industry it isn't often used. In fact, for both internship's I've had, the use of recursion was specifically forbidden (except is extreme circumstances). It's because it's inherently more confusing than iteration. And code readability and maintainability is more important than efficiency.
thats good to know. i now have something to tell my professors, lol
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
It just depends on where you go and what you do. If you work for a place like Google, or some other company that does a lot of theoretical work, you likely will be using recursion. But it's safe to say the majority (dare I say vast majority) doesn't use it.
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
graphics cards can cost anything. high end ones are probably the most expensive PC part if you want them to be, and cheaper ones are doable depending on what your doing.

try newegg.com just to search around, and once you find one, go to yahoo shopping or froogle and search the exact model to compare prices. they usually yield a lot cheaper results.
 

snoblo

Smash Journeyman
Joined
Jul 25, 2007
Messages
361
PS: Recursion is cool and all, but in industry it isn't often used. In fact, for both internship's I've had, the use of recursion was specifically forbidden (except is extreme circumstances). It's because it's inherently more confusing than iteration. And code readability and maintainability is more important than efficiency.
Usually recursion is best used for traversing things, such as a search engine bot recursively searching through web pages or a program that recursively searches through all directories and such. Some logic problems (like 8 queens, sudoku) are also often done recursively.
 

Jammer

Smash Lord
Joined
Oct 9, 2007
Messages
1,568
Location
Blarg.
Oh yeah, recursion is the best.

Artificial intelligence things use it a lot. Well, the more basic "search the solution space" kind of artificial intelligence, like chess-playing programs. I wrote a chess program on my calculator that beat almost everyone. It was all recursion, folks.
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
I know what recursion is used for, I'm saying that when you go out into the actual working world the vast majority of companies won't use it. Just like they probably told you that everyone uses the metric system in engineering... guess what... they don't. (Even though they should)
 

Jammer

Smash Lord
Joined
Oct 9, 2007
Messages
1,568
Location
Blarg.
Yeah, we know. We weren't saying you were wrong, AltF4. We were just pointing out that recursion is mad useful for a lot of stuff.

And while you can turn any recursion into iteration, I would definitely say that doing so does not always make it easier to understand. It can, of course. But it's not like it's impossible to wrap your mind around recursion. I guess I think that rule at your workplace is kinda silly, AltF4.

For example, I can think of about 20 perfect uses for recursion in an FPS game, most dealing with the graphics and AI. I would be very surprised if they used iteration instead for some of these things because speed is so important for game engines.

But you know, compilers are getting to the point where they can see what you're doing and optimize it to the point that there is very little performance difference between iteration and recursion. Compiler design has got to be one of the coolest things ever, by the way.
 

Velox

Smash Ace
Joined
Feb 14, 2007
Messages
866
Location
Texas (UoH)
Recursion is the most useful concept in computer science to me, the perfect use for the power of computers. Not to mention a smart resursion algorithm that doesn't blindly go through every possiblity that would obviously be wrong can save you LOADS of time when your program runs. I solved a 9-piece classic frog puzzle (you know, the puzzle where there is 4 sides to each of the 9 pieces, and on each side there is a half of the frog) one time both ways, the standard way took days, where as recursion took like... 0.16 seconds or something? Most problems I consider totally unsolvable for all intents and purposes without recursion. Even if you do not use it often, I highly highly recommend at least learning it, but once you learn it trust me, you will recursively start recursively finding the TV remote to change the channel... ... <<

You need to go no further than to see the famous recursive maze traversal to see how useful recursion can be.


BTW, does anyone know of a good developers environment for LIST? Notepad is gay. Come to think of it command line is gay as well.
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
Yeah, we know. We weren't saying you were wrong, AltF4. We were just pointing out that recursion is mad useful for a lot of stuff.

And while you can turn any recursion into iteration, I would definitely say that doing so does not always make it easier to understand. It can, of course. But it's not like it's impossible to wrap your mind around recursion. I guess I think that rule at your workplace is kinda silly, AltF4.

For example, I can think of about 20 perfect uses for recursion in an FPS game, most dealing with the graphics and AI. I would be very surprised if they used iteration instead for some of these things because speed is so important for game engines.

But you know, compilers are getting to the point where they can see what you're doing and optimize it to the point that there is very little performance difference between iteration and recursion. Compiler design has got to be one of the coolest things ever, by the way.
There's no such thing as recursion at the machine level. Recursion is just an abstraction used by high level languages. Recursion is just an illusion.

Just like there's no such thing as C++. Compilers (I don't want to say ALL, but most at worst) first translate your C++ code into C, then to machine code.

And yes... there are plenty of AI uses, 3D graphics uses, etc... But only a very small minority of programmers will ever have a situation where the recursive solution is significantly more human understandable.

It's not a silly restriction. It's an FAA restriction. I do work in the avionics field and there's lots of very specific code requirements that the FAA imposes. Like no recursion, all loops must be not conceivably infinite (always terminated by a constant), etc...
 

MattDel

Smash Apprentice
Joined
Oct 14, 2007
Messages
187
Location
Cleveland, Ohio (who actually puts this here?)
ok...

im a senior in high school, and so far i've worked with C++ and java...

i think im going to be starting an internship in a few months where i'll be using C#...

can anyone tell me how similar C# is to either C++ or java?

thanks ahead of time...
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
can anyone tell me how similar C# is to either C++ or java?
C# is very very very similar to C++. you should have no problem with the switch, except for little quirks here and there.

java is very similar in theory but objects are named differently, there are different guidelines, etc. not too far off though as well.
 

Falco&Victory

Smash Champion
Joined
Apr 28, 2006
Messages
2,544
Location
South Hill, Washinton
ahhh C# is making me mad
I want to make a form that moves an object up and left if i hold the left and down keys down, but you can't program those keys to a keypress event, only a key down event >_<

why C#, WHY!!?!?!?!??!?!
PS: I hardly ever work with key inputs, helpz ploxz?
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
C# is amazingly beautiful.

KeyPress is for character keys. It's a special function. I do believe that arrow keys won't send KeyDown/Up events, either, along with Page Down, Page Up, and other special keys -- at least, they don't send these events from within user controls. I forget the specifics. I do know, though that...

...you can override Control.IsInputKey() to return true for Keys.Left or Keys.Right. Something like

protected override bool IsInputKey(Keys k) { return k == Keys.Left || k == Keys.Right || base.IsInputKey(k); }

This will forward messages for those keys to your KeyDown/Up event instead of being consumed by Windows Forms.
 

Falco&Victory

Smash Champion
Joined
Apr 28, 2006
Messages
2,544
Location
South Hill, Washinton
thnx, i'll have to try that. I just used some if's then's and else's along with a keyup function for now, but your method does look more efficient.

Game engine is under way
 

Eight Sage

Smash Lord
Joined
Nov 2, 2006
Messages
1,144
Location
in the range of 0.0.0.0 to 255.255.255.255
Wow quoting war!!

It just depends on where you go and what you do. If you work for a place like Google, or some other company that does a lot of theoretical work, you likely will be using recursion. But it's safe to say the majority (dare I say vast majority) doesn't use it.
I'm having a class about Data Base Management, I can assure you that Google does an extremely (i mean EXTREMELY) hard-to-implement-or-understand way of searching. My professor told us that any kind of search engine must implement recursion, and they do actually.

There's no such thing as recursion at the machine level. Recursion is just an abstraction used by high level languages. Recursion is just an illusion.
It's a way to have less lines on the code, but it makes an illusion of unlimited functions while you're stating only one.

can anyone tell me how similar C# is to either C++ or java?
I'll try to make it clear: C# is a lot similar to C++, but the difference is obvious. C# give support to Objects? Yes, but C++ have more deep support. C++ is an updated version of C#, expanding the object capability.

C# and C++ runs in some platforms, but Java (an entirely Object Oriented Language) runs in any platform because everyone have in his PC a Java interpreter. Did you pay attention to the Java's update your Browser asks? that's because your interpreter is obsolete (old) with the new mechanics and upgrades that Java constantly has.

Resuming:
C# --> supports objects, but not entirely oriented on them. Runs in some platforms.
C++ --> expands the supporting capabilities on objects, but it isn't entirely oriented on them. Runs in some platforms.
Java --> It's restricted to Object programming only, and runs in every platform (simply cause it's a standard to have a Virtual Java machine on your PC)

Hope it helps.

C# is amazingly beautiful.

...you can override Control.IsInputKey() to return true for Keys.Left or Keys.Right. Something like

protected override bool IsInputKey(Keys k) { return k == Keys.Left || k == Keys.Right || base.IsInputKey(k); }

This will forward messages for those keys to your KeyDown/Up event instead of being consumed by Windows Forms.
Long time ago I made the pong game introducing those lines. It was my first game... ah! memories.
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
C# is fully OO. I don't know where you're getting your information, Sage. There's nothing that C++'s object model supports which C#'s does not, speaking strictly in terms of object oriented design. Sure you can mess around with virtual function tables in C++ and other goofy stuff like that, but you never (?) *need* to.
 

Eight Sage

Smash Lord
Joined
Nov 2, 2006
Messages
1,144
Location
in the range of 0.0.0.0 to 255.255.255.255
Sure you can mess around with virtual function tables in C++ and other goofy stuff like that, but you never (?) *need* to.
Yeah! That's what I'm trying to say... C++ is fully OO, but you can do things without using a single object, something that Java don't (it won't even let you start a main if it isn't inside an object). That's what I mean.
 

Junpappy

Smash Lord
Joined
Sep 18, 2006
Messages
1,439
Location
aZ
I recently reinstalled Eclipse on my computer, and I keep encountering the following error message after running something, even if it's as simple as displaying "Hello, world"

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


I have Eclipse for Java EE, with JRE 1.6.0_01

Does anyone have any idea at all what this error means?
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
The error message is telling you that the problem isn't with your code, it's with your environment. It can't find the "JNI 1.2 Environment". Likely means:
-You don't have the right environment, or no environment at all.
or
-The path pointing to the environment is incorrect

I'm not terribly familiar with Eclipse in particular, but maybe that'll point you in the right direction.
 

Junpappy

Smash Lord
Joined
Sep 18, 2006
Messages
1,439
Location
aZ
Actually, after thinking about it, I think I know what the problem is. I found two different versions of JRE when I looked in my Java directory. I think I'm just going to clear out everything and try following that link.
 

Junpappy

Smash Lord
Joined
Sep 18, 2006
Messages
1,439
Location
aZ
Is it safe to just flat out delete the JRE folders or is there a proper method of removal?
 

snoblo

Smash Journeyman
Joined
Jul 25, 2007
Messages
361
You can remove previous versions of JRE simply from the Add/Remove programs from the control panel.
 

Chi's Finest

Smash Lord
Joined
Dec 18, 2005
Messages
1,988
Location
Chicago
On my website, I have an "include" folder that has my css file and 2 include files that I use on every one of my pages. This include folder is located in the main directory.

also in the main directory, I have some other folders that contain pages that I want to use this same "include" folder.

How do I use the include folder from the main directory, inside a file from another folder?

If it's a little confusing, here's a little layout:

MAIN DIRECTORY:
- random file
- random file
- Include Folder
----Contents of Include Folder I want to use
- FOLDER
-----File that i want to use the include Folder in.
 

Falco&Victory

Smash Champion
Joined
Apr 28, 2006
Messages
2,544
Location
South Hill, Washinton
Ooooh.... Now I'm interested, Falco.

Some kind of 2d game engine? Could you tell us a little bit more?
well here's a sc, but in spirit of title I had to substitute in a fake char sprite and BG



hope to have the battle system operational by early '08, hope to have other features complete by late '08/early '09

basically instead of just hp and mp you have a certain amount of ability points that you can use, different moves take different amounts. You regain 2-7 every turn, and can use as many a turn as you like until you run out yeahz
 

Falco&Victory

Smash Champion
Joined
Apr 28, 2006
Messages
2,544
Location
South Hill, Washinton
well i've only programmed in like... attack and use magic
i haven't programmed hp loss yet or anything

i am using C#, starting from scratch. This is pretty much how I learn new programming languages, by attempting things i can't do lol
 

SmashMac

Smash Lord
Joined
Aug 24, 2005
Messages
1,388
Location
Naples, FL.
Guys I'm looking for a good free Java compiler (lolz is anything good that's free..?). Anyone know of one or can give advice as to how to pick one? When I was in High School a while ago we used Code Warrior.
 

Eight Sage

Smash Lord
Joined
Nov 2, 2006
Messages
1,144
Location
in the range of 0.0.0.0 to 255.255.255.255
sure...

eclipse is one of the bests, very user friendly and makes your programming easier (colors, on code warnings, etc.)

Just click the "Download Eclipse" button.

http://www.eclipse.org/

Edit:

i am using C#, starting from scratch.
You're using C#? that's awesome. It's one of the most (if not the most) appropriated languages for gaming.

This is pretty much how I learn new programming languages, by attempting things i can't do lol
lol, everyone learns languages attempting something new. I hope your game finish well.
 
Top Bottom