Computer Science, programming languages discussion
Moderator: English moderators
Forum rules
Please keep the forum rules and guidelines in mind when creating or replying to a topic.
Please keep the forum rules and guidelines in mind when creating or replying to a topic.
-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
My first thought was that C++ isn't a very good language to learn programming with (don't get me wrong, it's awesome, but I'd usually recommend a higher-level, strongly-typed, multi-paradigm, curly-bracket programming language to start with), but if you're looking to create GameBoy games then C and assembly might be of more (direct) interest to you.

-
Master

- Posts: 50143
- Joined: Sun Aug 21, 2011 10:14 am
- Location: Somewhere specific, I'd assume.
- Tings: 404084
Re: Computer Science, programming languages discussion
Wow, this is old. I haven't touched Visual Basic in ages. I've been using C and C# for the most part in Uni, though not with the greatest depth, C is what we use for programming embedded ARM chips, while C# is what we use for basic desktop applications that interface with said chips. I'd like to expand on both in time, there's a lot yet for me to learn.
I've also used some basic Python just to interface with some graphing APIs is all. It does seem to be fairly popular with robotics, from what I've heard, which isn't necessarily the field I expect myself to end up in, but there's a potential overlap.
I've also used some basic Python just to interface with some graphing APIs is all. It does seem to be fairly popular with robotics, from what I've heard, which isn't necessarily the field I expect myself to end up in, but there's a potential overlap.

-
Ambidextroid

- Posts: 12809
- Joined: Tue Mar 19, 2013 1:04 am
- Location: Jaffa Castle
- Tings: 675
Re: Computer Science, programming languages discussion
Well I did get to grips with Python and I've used a lot of basic before, so I'm somewhat confident that I understand the general logic and themes of coding. I'm planning to indeed learn assembly and eventually C (as I've heard it's the most popular/supported choice for Gameboy programming) but that's a little way down the line for me, I think C++ isn't a bad choice for the stage I'm at now.Hunchman801 wrote:My first thought was that C++ isn't a very good language to learn programming with (don't get me wrong, it's awesome, but I'd usually recommend a higher-level, strongly-typed, multi-paradigm, curly-bracket programming language to start with), but if you're looking to create GameBoy games then C and assembly might be of more (direct) interest to you.
Still, I'd like to know what languages you'd recommend that fit the criteria you mentioned!

-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
For a beginner not looking to specialize anytime soon? C# or Java.Ambidextroid wrote:Still, I'd like to know what languages you'd recommend that fit the criteria you mentioned!

-
Serza5

- Posts: 48329
- Joined: Sat Jul 26, 2008 7:51 pm
- Location: MOTHER FUCKING SCOTLAND OH YEAH BABY
- Contact:
- Tings: 486315
Re: Computer Science, programming languages discussion
Thinking about uni I think c++ was the language I learned first there granted it was an optional module, and I didn't have too much trouble learning the language given that true basic was my only other experience with coding before that.
Needless to say I don't think c++ is that bad to start off with. He'll I think I had more issue with c since I found the language to be frustrating with how little functions it has in comparison to c++.
C# (and Java?) are a lot more higher levelled than those sonic not sure if they'd be good for ambi to look into.
Needless to say I don't think c++ is that bad to start off with. He'll I think I had more issue with c since I found the language to be frustrating with how little functions it has in comparison to c++.
C# (and Java?) are a lot more higher levelled than those sonic not sure if they'd be good for ambi to look into.
-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
Well yeah, I said C and assembly would be a better choice.Serza5 wrote:C# (and Java?) are a lot more higher levelled than those sonic not sure if they'd be good for ambi to look into.

-
PluMGMK

- Posts: 37009
- Joined: Fri Jul 31, 2009 9:00 pm
- Location: https://www.youtube.com/watch?v=cErgMJSgpv0
- Contact:
- Tings: 102740
Re: Computer Science, programming languages discussion
While I dislike Python, my father hates Java.
He's had bad experiences in the past with needing to install the entire JVM just to run a program or two. It's something that's probably got better down through the years, but the constant badgering about Java updates on Windows is still somewhat annoying. (Of course with Linux+IcedTea that's not a problem, but that's neither here nor there, ahem…)
I started programming in Visual Basic 6. Were it not for the nostalgia factor, I would probably dislike VBA even more than I do Python. The bloody thing doesn't even short-circuit the "And" and "Or" operators for crying out loud.
That caused me to waste ages one day wondering why a macro I had written kept erroring… Oh yeah, and the debugging's terrible too!
Hmm, maybe some other time I'll be in the mood to talk about what I like.
I started programming in Visual Basic 6. Were it not for the nostalgia factor, I would probably dislike VBA even more than I do Python. The bloody thing doesn't even short-circuit the "And" and "Or" operators for crying out loud.
Hmm, maybe some other time I'll be in the mood to talk about what I like.

Sig with Dora made by R4Y_ANC3L; others made by me
Android: How to block an image you don't like
It's good to learn from the past: read the Pirate-Community Documentary!
Other things you should know about this site
Re: Computer Science, programming languages discussion
This whole discussion reminds me that I still have to code my posting bot for the upcoming Record Day.
Learning to code with a high level and not very rigorous language then switching to C might be a good decision. I started with a simplified version of BASIC for the kiddos, then I switched to C, and I learned a lot from that change. With BASIC I understood what programmation was about, and with very wordy language it wasn't a big issue, and then I forked other people's codes to understand all the things I could get from it. Finally, with C I learnt the low level part, and most of all the rigor every coder needs to have.
And regarding high level languages such as C#, the big advantage is that once you learnt one of them, and you are comfortable with, then you can use any of them without any trouble. I started learning Java with a book to develop Android apps, then when I switched to C# I only had to read some code snippets on MSDN and that was it.
I don't think I get the point to start off with assembly, assuming you want to learn programmation in a broad way. Of course if you want to have some fun with a 68k you found in your attic, that's another story.Hunchman801 wrote:Well yeah, I said C and assembly would be a better choice.Serza5 wrote:C# (and Java?) are a lot more higher levelled than those sonic not sure if they'd be good for ambi to look into.
Learning to code with a high level and not very rigorous language then switching to C might be a good decision. I started with a simplified version of BASIC for the kiddos, then I switched to C, and I learned a lot from that change. With BASIC I understood what programmation was about, and with very wordy language it wasn't a big issue, and then I forked other people's codes to understand all the things I could get from it. Finally, with C I learnt the low level part, and most of all the rigor every coder needs to have.
And regarding high level languages such as C#, the big advantage is that once you learnt one of them, and you are comfortable with, then you can use any of them without any trouble. I started learning Java with a book to develop Android apps, then when I switched to C# I only had to read some code snippets on MSDN and that was it.
What do you call integer math?Hunchman801 wrote:So, having found that .NET lacks native support for integer math
-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
Ambi wants to program for the Game Boy, that's pretty much the same.LoveMetal wrote:I don't think I get the point to start off with assembly, assuming you want to learn programmation in a broad way. Of course if you want to have some fun with a 68k you found in your attic, that's another story.
Operations on integers, i.e. Math.Pow(int, int).LoveMetal wrote:What do you call integer math?

Re: Computer Science, programming languages discussion
Well then you are right, the Z80 being even less powerful than a 68k.Hunchman801 wrote:Ambi wants to program for the Game Boy, that's pretty much the same.![]()
The reason seems to be that an implementation of pow(double, double) is at least as efficient than pow(int, int), regardless of the values. It's because a^b = exp(b*ln(a)). And as you can imagine, exp and ln are not evaluated each time you call them, these functions are already pre calculated and tabulated in memory.Hunchman801 wrote:Operations on integers, i.e. Math.Pow(int, int).LoveMetal wrote:What do you call integer math?
Then, the pow function can be computated very quickly (and it's probably why your attempts to create your own implementation are slower, even though you are using ints) :
Code: Select all
public static double Pow(double x, double y) {
return Math.Exp(y * Math.Log(x)); // only a multiplication and 2 look ups on tables to do
}Then, you can decompose xy in x2x2... x2 if y is even, and in x x2... x2 if y is odd, and repeat recursively.
-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
You misunderstood my message, it's the C++ bindings that are (slightly) slower than than using Math.Pow(double, double) and casting it to and int. My own C# implementation, using bit shits, is almost three times as fast.LoveMetal wrote:The reason seems to be that an implementation of pow(double, double) is at least as efficient than pow(int, int), regardless of the values. It's because a^b = exp(b*ln(a)). And as you can imagine, exp and ln are not evaluated each time you call them, these functions are already pre calculated and tabulated in memory.
Then, the pow function can be computated very quickly (and it's probably why your attempts to create your own implementation are slower, even though you are using ints) :Code: Select all
public static double Pow(double x, double y) { return Math.Exp(y * Math.Log(x)); // only a multiplication and 2 look ups on tables to do }
Well no, c = a << n = a * 2n, not a2n (let aside overflows). As for the recursive algorithm you mentioned, it's just exponentiation by squaring and as far as I know it doesn't require bit shifts.LoveMetal wrote:If you still want to create your own pow(int, int) method, for instance if you don't want any floating point errors, and if you still want a quick computation, then you can consider the fact that a power of 2 can be computated with a bitwise shift. Because (b1b2 ... bn)binary = bn*20 + bn-1*21 + ... + b1*2n in decimal, then c = a2*n is equivalent to c = a << n, assuming n > 0.
Then, you can decompose xy in x2x2... x2 is y is even, and in x x2... x2 if y is odd, and repeat recursively.

Re: Computer Science, programming languages discussion
I was just trying to explain is why Math.Pow has been implemented natively as (double, double) and not (int, int).Hunchman801 wrote:You misunderstood my message, it's the C++ bindings that are (slightly) slower than than using Math.Pow(double, double) and casting it to and int. My own C# implementation, using bit shits, is almost three times as fast.
Sorry for the mistake you are obviously right, and yes that algorithm can't use bit shifts, since I had mistaken x2n with x*2n. Else it could and should have.LoveMetal wrote:Well no, c = a << n = a * 2n, not a2n (let aside overflows). As for the recursive algorithm you mentioned, it's just exponentiation by squaring and as far as I know it doesn't require bit shifts.
Re: Computer Science, programming languages discussion
Hunchman801 wrote:using bit shits
MandM81 wrote:YYYYYYYRRRHLHLPYYYYYYPDPPPYYYYYYYYYYYYRRRRRR
-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
I know, and that's why I showed you that you were wrong, since my integer implementation is much faster than .NET's double implementation.LoveMetal wrote:I was just trying to explain is why Math.Pow has been implemented natively as (double, double) and not (int, int).
This one's too good to be corrected.Matyuv wrote:Hunchman801 wrote:using bit shits

Re: Computer Science, programming languages discussion
Well, that's unfortunate, I remember reading that a while ago on stackoverflow. 
Edit: Found a thread about this method, this guy is not using look up tables but some fancy approximations for exp and log.
Edit: Found a thread about this method, this guy is not using look up tables but some fancy approximations for exp and log.
-
Hunchman801

- Posts: 83840
- Joined: Thu Aug 07, 2003 6:50 pm
- Location: Paris, France
- Contact:
- Tings: 609979
Re: Computer Science, programming languages discussion
Interesting! But for now I'll stick to integer calculations, there's enough algorithms like this already.LoveMetal wrote:Found a thread about this method, this guy is not using look up tables but some fancy approximations for exp and log.

-
Ambidextroid

- Posts: 12809
- Joined: Tue Mar 19, 2013 1:04 am
- Location: Jaffa Castle
- Tings: 675
Re: Computer Science, programming languages discussion
Does anyone here have experience in 3D rendering? I'm trying to get my head around how texture depth calculation works but there don't seem to be any good explanations online other than long equations you can plug into your program...

Re: Computer Science, programming languages discussion
By texture depth calculation, do you mean shadow mapping or something else?
-
Ambidextroid

- Posts: 12809
- Joined: Tue Mar 19, 2013 1:04 am
- Location: Jaffa Castle
- Tings: 675
Re: Computer Science, programming languages discussion
I'm talking about how to avoid affine texture mapping, like you'd see on a PS1, and actually apply textures to polygons with depth so that the texture is more compressed the more distant the polygon's face is. Not that I'm really likely to use the information, I've just always been interested in graphics rendering

-
The Jonster

- Posts: 34040
- Joined: Sat Mar 24, 2018 6:15 am
- Location: The realm of Mario Karting
- Tings: 78140
Re: Computer Science, programming languages discussion
Bump. I wonder if I can use this topic to ask questions if I ever have any programming errors I'd like to ask about? Hmm..
Well currently, after finishing my web developer class, I've come to add HTML, CSS, Javascript, Jquery, and other web developer languages to my repertoire of languages that I do know which involve Java and C (which I'm both pretty ok with, C more than Java). What I hated more than anything when I was learning programming in Uni was that in my first class we learned Java, then in the next few classes we were learning in mostly C and then in the last few classes we switched back to Java. As a result my knowledge is spotty in some areas in both languages. I also remember some things about Python and SQL but not enough in the former to be able to code accurately as of yet. I'd love to list all the langauges here that I can program/have knowledge in but I'm not sure what all of them are since there are some that I've probably forgotten in time.
Well currently, after finishing my web developer class, I've come to add HTML, CSS, Javascript, Jquery, and other web developer languages to my repertoire of languages that I do know which involve Java and C (which I'm both pretty ok with, C more than Java). What I hated more than anything when I was learning programming in Uni was that in my first class we learned Java, then in the next few classes we were learning in mostly C and then in the last few classes we switched back to Java. As a result my knowledge is spotty in some areas in both languages. I also remember some things about Python and SQL but not enough in the former to be able to code accurately as of yet. I'd love to list all the langauges here that I can program/have knowledge in but I'm not sure what all of them are since there are some that I've probably forgotten in time.
Always be true to yourself.

Sigs by Steo and R4Y_ANC3L

Sigs by Steo and R4Y_ANC3L


