The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Off-Topic (https://www.pokecommunity.com/forumdisplay.php?f=23)
-   -   Programming Thread (https://www.pokecommunity.com/showthread.php?t=226202)

twocows July 18th, 2010 10:10 PM

Programming Thread
 
This thread is for any discussion of programming or programming languages. Feel free to ask questions or share code or ideas with others here (though please put any code into Pastebin and link to it instead of simply pasting within the thread). If you want to recruit someone to work on a project, please ask them with a private message or visitor message and not here, as this thread is for discussion purposes only. Also, this thread does not include discussion of web-based languages such as HTML, PHP, etc., as discussion of these belongs in the Webmaster Discussion subforum.

I'll start off with a few recommendations for new programmers. Python and C# are two great languages that can help you understand concepts used in many languages. Python is relatively simple and should help you begin to think like a programmer. You can download Python here and find the documentation here. You should follow the documentation to get it set up, as it is a rather complex process. As for C#, it is a powerful and relatively simple language that uses syntax similar to many very popular languages. You can download it here and find documentation here. I recommend C# over Visual Basic, which many cite as an introductory language, because it uses syntax far more common in the programming world while maintaining all of the same functionality. Here are two additional documents (here and here) for C# programming, these ones documenting suggested programming style.

I also recommend that any programmer, regardless of experience, read through Structure and Interpretation of Computer Programs. It is especially useful for aspiring programmers, but anyone will benefit from reading it.

Finally, for those of you looking for a good editor, my favorite is Notepad++. It's lightweight and has syntax highlighting for all of the major languages and also has plugin functionality. For those looking for a full IDE, Eclipse may be more to your liking.

Captain Fabio July 20th, 2010 9:50 AM

Only just noticed this thread.

The editor I am using is Visual Studio 2008, as I am using it for XNA Games Studios. It is a great editor, but can throw you off sometimes with the debugging, as it will say there is a problem in this place, but it is somewhere else.

I use C#, C++ and XNA (Much like C#) mostly.

Rosecross July 21st, 2010 10:39 PM

My main editor is Visual Studio 2010, but I currently am more interested in using free and open technology so I am using Code::Blocks for my C++ development.

I highly recommend to learn C++ first for those interested in programming. It's a great multipurpose language, with low-level abilities when needed. Sure it has it's difficulties, but you can go over them easily. The tools would be the Code::Blocks IDE or the Visual C++ Express. Both are free and include a compiler so you don't have to do a big hassle to get your programs running.

Quote:

Originally Posted by Captain Fabio
I use C#, C++ and XNA (Much like C#) mostly.

What exactly do you mean? XNA is just a Framework for C#, so it's supposed to be 'like' C#. =P

I program in C++, C#, PHP (sadly, my strong field. Everyone is learning PHP this days >_>), I'm sure there is no need to mention I know HTML, CSS, and JS very well.

Anyways, I really know my way around programming so if anyone has questions I will be glad to help.

Captain Fabio July 22nd, 2010 2:09 AM

Quote:

Originally Posted by Rosecross (Post 5992147)
What exactly do you mean? XNA is just a Framework for C#, so it's supposed to be 'like' C#. =P

Well there you go =P
That explanation was more for people who didn't know what XNA was =]

wakachamo July 22nd, 2010 6:32 AM

Because I'm an enormous Macfag, I use the Xcode toolchain with Objective-C as the primary language. That said, every once in a while I play around with Java/Ruby/Python, etc.

If anybody has any questions regarding Mac OS X/iOS development, or their related frameworks (Foundation, Cocoa and Cocoa Touch), I'm your man.

Captain Fabio July 22nd, 2010 7:42 AM

Quote:

Originally Posted by wakachamo (Post 5992842)
Because I'm an enormous Macfag, I use the Xcode toolchain with Objective-C as the primary language. That said, every once in a while I play around with Java/Ruby/Python, etc.

If anybody has any questions regarding Mac OS X/iOS development, or their related frameworks (Foundation, Cocoa and Cocoa Touch), I'm your man.

Actually, I might pick your brains at some point for the Objective-C. I am converting over to the macbook pro and I would like to get a knowledge of Objective-C for app dev.

mr. ck July 22nd, 2010 7:46 AM

I am in love with Visual Studio 2010 (& 2008 for XNA)! :)
On Ubuntu I use gedit, that's all I need.

Currently programming in C# (Only for XNA) and C++ (My favourite). Even with C++, it's mostly OpenGL programming :P
I'm trying to teach myself Python, I already know Ruby and PHP and a few other languages for scripting.

At school we have to use Turbo C++ 3.0, it's so freaking old, that it doesn't even have container classes, std::cout fails, NO string class! Man!!!

twocows July 22nd, 2010 9:45 AM

Quote:

Originally Posted by Rosecross (Post 5992147)
My main editor is Visual Studio 2010, but I currently am more interested in using free and open technology so I am using Code::Blocks for my C++ development.

I highly recommend to learn C++ first for those interested in programming. It's a great multipurpose language, with low-level abilities when needed. Sure it has it's difficulties, but you can go over them easily. The tools would be the Code::Blocks IDE or the Visual C++ Express. Both are free and include a compiler so you don't have to do a big hassle to get your programs running.



What exactly do you mean? XNA is just a Framework for C#, so it's supposed to be 'like' C#. =P

I program in C++, C#, PHP (sadly, my strong field. Everyone is learning PHP this days >_>), I'm sure there is no need to mention I know HTML, CSS, and JS very well.

Anyways, I really know my way around programming so if anyone has questions I will be glad to help.

If you're going to recommend a low level language for beginners, C is a much better choice than C++. With C, you have to learn a lot more about how the computer actually does things. Also, it's easier later on to learn C++ than it is to go back and learn C after learning C++.

Rosecross July 22nd, 2010 11:21 AM

I would recommend Assembler for real low-level programming. ;P
C++ is not exactly low level, but it gives you that ability in case you really need it. I have never toyed with C personally, I just know it has some differences like the method it uses for dynamic memory allocation and it has no classes (main addition to C++).

wakachamo July 22nd, 2010 11:41 AM

Quote:

Originally Posted by Captain Fabio (Post 5993073)
Actually, I might pick your brains at some point for the Objective-C. I am converting over to the macbook pro and I would like to get a knowledge of Objective-C for app dev.

Sure. The language itself isn't hard to learn at all (it's a direct superset of C that adds objects), it's the frameworks themselves and the way of thinking behind them that'll get your mind working, IMO. :P Apple's got amazing docs throughout, though.

twocows July 22nd, 2010 3:09 PM

Quote:

Originally Posted by Rosecross (Post 5993622)
I would recommend Assembler for real low-level programming. ;P
C++ is not exactly low level, but it gives you that ability in case you really need it. I have never toyed with C personally, I just know it has some differences like the method it uses for dynamic memory allocation and it has no classes (main addition to C++).

C and C++ are quite a bit different. Learning C requires you to learn some aspects of assembly (mainly, bitwise operation and stack/heap operations), plus, as you said, it doesn't have classes.

prateek203 July 23rd, 2010 8:55 PM

Is nobody interested in VB now a days? I didn't do VB.Net, but VB is cool! Yeah I know you can do it all in C# too.

mr. ck July 24th, 2010 5:19 AM

Quote:

Originally Posted by prateek203 (Post 5997570)
Is nobody interested in VB now a days? I didn't do VB.Net, but VB is cool! Yeah I know you can do it all in C# too.

VB is well... It's really, a lame excuse for a programming language...

Good for beginners; that's all, but it's easy to switch to C#... And well, C / C++ really out-perform either and provide more possibilities.
There are other languages too, Java etc.

Besides C# is a GOOD language, why would you stick to VB.

prateek203 July 24th, 2010 9:46 AM

I'm not sticking to VB, infact I'm not actually programming in any language now. Very busy due to studies. And yeah I programmed a little on C# using Visual Studio 2008, it was cool. Very much like VB. Programming very much like JAVA. But I have great memories with VB, and that is very cool too. It's a great language of its time.

mr. ck July 24th, 2010 10:31 AM

Not really... VB was nothing more than a beginner's language:
BASIC: Beginner's All-purpose Symbolic Instruction Code

Even at it's time, C/++ and Java were still better...

They teach VB at universities to science students to teach them logic, but it has no value beyond that. When programming in languages like C++, you spend more time solving technical issues with the code than logic related problems...

twocows July 24th, 2010 5:10 PM

Quote:

Originally Posted by prateek203 (Post 5997570)
Is nobody interested in VB now a days? I didn't do VB.Net, but VB is cool! Yeah I know you can do it all in C# too.

Compared to C#, there's no reason to use VB. Learning C# introduces you to syntax used by a vast number of languages. It prepares you to become a better programmer. VB uses its own weird syntax that tries to be simple. If you really want simplified syntax, Python's a better choice.

Quote:

Originally Posted by mr. ck (Post 5998198)
If you'd need accurate calculations, the integer part will be huge. Let's say we use long longs instead.
Multiply something like (2^37, -11) * (2^40, -13) (I know, there are better ways to do this, just a random example)... And it's already not going to work. And it is cases like this where accuracy really messes up...

But I get the idea, you could do something like this and make it work with how we store large numbers like 100! in C++ / C.

EDIT: Let's carry on our discussion in the programming thread :)

If you do it that way, then yes, but there are algorithms and such that make it less problematic. I'm not an expert on the subject, but I recognize its importance. And having to spend the time making workarounds is still infinitely better than, say, letting a SCUD missile get through your Patriot defense systems due to inaccurate timing.

mr. ck July 25th, 2010 7:00 AM

"Oh ****!"

I hate how there are containers for dynamic arrays, strings, just nothing for floating point numbers or integers.

Would be interesting to create a class like that :)

twocows July 25th, 2010 12:28 PM

Quote:

Originally Posted by mr. ck (Post 6001511)
"Oh ****!"

I hate how there are containers for dynamic arrays, strings, just nothing for floating point numbers or integers.

Would be interesting to create a class like that :)

Well, I do most of my programming in C where there aren't any classes at all.

I would love to see some sort of nice solution for the floating point problem, though.

mr. ck July 25th, 2010 7:27 PM

I've programmed in C most of my life... Then a mix of C and C++ (I know, horrible!) Now as I'm being introduced to new things in C++, I'm liking it more...
Even though I'm moving to C#, but it's there for nothing more than XNA, for me.

If not a class, a library maybe :)

twocows July 25th, 2010 9:00 PM

There may already be good solutions out there. I'd be interested in seeing if there are any open source projects that make it so the programmer doesn't have to worry about it as much.

mr. ck July 25th, 2010 10:14 PM

Can GNU MP library do it?

I still don't understand what they mean by multi-precision...

twocows July 25th, 2010 11:12 PM

Quote:

Originally Posted by mr. ck (Post 6004123)
Can GNU MP library do it?

I still don't understand what they mean by multi-precision...

It means it can hold as many decimal places as you want it to.

I'm not sure if it would work, it's certainly something I'll look into. This page (linked from the Wikipedia page about GNU MP) also looks promising.

mr. ck July 26th, 2010 12:01 AM

Quote:

Originally Posted by twocows (Post 6004206)
It means it can hold as many decimal places as you want it to.

I'm not sure if it would work, it's certainly something I'll look into. This page (linked from the Wikipedia page about GNU MP) also looks promising.

Seems promising :)
I'll check it out too and try to make it work...

It's just that, implementing such things on your own is an interesting task, that's why I was interesting in trying it out :P

EDIT:
We had this competition at a school, and the questions were horribly ripped off from SPOJ... There was one to calculate 100! and display it accurately. I remember seeing so many people defining their factorial functions to return long long long long long long long ...
Those were some really weird questions (4 programs) for high school level to be done in 1.5 hours...

Gardenia101 July 26th, 2010 1:54 PM

Do any of you have a basic code template for a style switcher? I haven't been able to make one for some reason...
Please reply with a VM/PM, though

twocows July 26th, 2010 5:29 PM

Quote:

Originally Posted by Gardenia101 (Post 6006379)
Do any of you have a basic code template for a style switcher? I haven't been able to make one for some reason...
Please reply with a VM/PM, though

If you mean for the forums or something, you should ask in the Web subforum. If you mean like for an OS, I think that's a bit more complicated, you'd be better off looking for open source projects.


All times are GMT -8. The time now is 11:16 PM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.