Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


D.Chhetri

Member Since 16 Oct 2009
Offline Last Active May 10 2014 06:46 PM

#5059071 Is there anything faster than A* pathing?

Posted by D.Chhetri on 03 May 2013 - 08:41 PM

Check this http://qiao.github.io/PathFinding.js/visual/ out. Check out the jump point search, with preprocessing and future information that algorithm is very fast. So it all depends on the context. But A* is a good starting point in most scenarios. 




#4994627 A class that contains an instance of itself

Posted by D.Chhetri on 27 October 2012 - 09:34 PM

[source lang="cpp"]class Menu{private: Menu * subMenu;.....};[/source]

is this possible?


Did you try to compile this? Simple question like this could just be tested. Learn to be more independent.


#4901421 is there a container for this or write my own?

Posted by D.Chhetri on 10 January 2012 - 04:14 PM

Yes you are looking for http://www.cplusplus.com/reference/stl/map/


#4891726 Any hint or ideas on how to full-justify a given text

Posted by D.Chhetri on 08 December 2011 - 12:53 AM







That's a non sequitur. You can write compilers in any language, not only in C. It sounds like an arbitrary restriction to me.

Of course it's an arbitrary restriction. But when the professor says 'you may only use C', you bloody well only use C... It's just how the world works.


Though I'm curious what sort of compiler class gives a rat's ass about the justification of text output...


We are supposed to create a partial latex compiler, that takes a subset of latex commands and outputs properly to a file.


Your professor is a dumbass. There are hundreds of languages one could use to write a latex compiler. He's probably just incapable of marking work in any other language.
But sadly, if thats in the requirements you have no choice.


sadly to say, my friends and I reached to that conclusion the third day of classes. For example checkout couple of the snippet from his code:
int   check_done_page(){
	if (lines_so_far < LINES_PER_PAGE) 
		return 1;
	else
		return 0;
}
int   inc_page_no()
{
DST.page_no_counter++;
return (DST.page_no_counter - 1);
}
void  set_page_no(p)char  p;{
	DST.page_no_counter = p - '0';
}
and as you can see from the previous code, we are using outdated C. We're still questioning how he became a professor. True that professor aren't necessarily meant to write code or teach but come onnnnn,


I don't think your professor is dumb just lazy he probably wrote this years ago and still uses it today. That happens a lot in Universities/Colleges, if you need to keep up with each new trend in coding then you wouldn't get any work done. Remember that professors do more than just teach, they have their own research to do and some of them actually work for outside projects that your CS department took on to make some money.


Having said that he could have updated it slightly to a newer compiler version or taken the version from a student who took the time to update it so he could work with a newer C version.

Most of the games written in the games industry barely uses very advanced features of C++, and most older developers want you to actually just write C with classes C++ for performance sake.


Good point but I still doubt his programming skills. Even if the code is 20 years old it should still have some kind of good structure. The full code is all over the place with global variables and multiple files accessing
the globals and a lot of bugs. Of course my professor isn't dumb, else he wouldn't be a professor. I just believe isn't a decent coder, which sadly to say is normal


#4884248 Templates

Posted by D.Chhetri on 15 November 2011 - 12:51 PM

Best explained in code:

I have this.

template<class T>
class OcTreeOptimized
{
public:
	template<class T>
	class Node
	{
		Node ();
	}
};

But I can't do this!
template<class T>
OcTreeOptimized<T>::Node<T>::Node ()
{
	; // do stuff
}

I get the compiler error "error C3860: template argument list following class template name must list parameters in the order used in template parameter list".
Is there any way around this?

Thanks as usual!



If you want Node to be of type T, then upon creating OcTreeOptimized, the type of T will be known, thus you can simply do this :
template<typename T>
class Foo{
   class Bar{
       T val;
        Bar() : {}
   }
};

else you can take SiCrane's suggestion


#4878288 Software keys for sale

Posted by D.Chhetri on 29 October 2011 - 11:26 AM

I'm a college student. Being an engineer student, I have all these software product keys available for downloads and it has already been incorporated into my fee bill. This is (sadly) my last semester so all these product keys will go to waste. If anyone wants to buy these product keys for very cheap let me know. Some examples are microsoft visual studio 2010 professional or XNA game studio 4 or microsoft visio studio 2010 and much more. If anyone is interested post or pm me. Thanks and take care.


regards, D.Chhetri


#4852081 Javascript - Memory allocation

Posted by D.Chhetri on 21 August 2011 - 07:24 PM

I'm guessing that in javascript, it has garbage collection based on reference counting. Usually memory leaks in these systems in javascript are caused by circular references, in which the system fails to identify. The delete keyword in javascript is not really meant to free and object, but rather something like remove a property from an object. Anyways, I'm not detailed in javascript so I can't provide you with a complete answer, but maybe my though is worth something.


#4843374 Why is there more christianity than others?

Posted by D.Chhetri on 01 August 2011 - 06:37 PM

What a DUMB subject! We should limit religious discussion to one active topic at a time.

1) Because it's 2000 years old, and it's everywhere.
2) Get out more, and prove yourself wrong.

Really!


In defense on why I ask the question, I asked question 1 because surely other religion have been around since Christianity has been around, so I wondered why it got so wide spread than others. As for the second question, I ask because of personal experience, but I realize how 'local' that question is. Anyways, sorry for the trouble guys.

And btw, if one is tired of threads like these, then why not just ignore it and carry on with your business? It isn't mandatory to stop by 'threads like these' and comment on it. Sorry for the trouble again.


#4842559 C++ typedef confusion

Posted by D.Chhetri on 30 July 2011 - 10:50 AM

I need to create new types for specific case functions class templates. However, the compiler gets confused between the difference between typedefs that are based on the same type. This is because it considers the two typedefs to be the same thing, but to me, they are functionally different.

The compiler spits out errors about redefinitions of specialized class member functions if the following is attempted:

typedef float f1;
typedef float f32;
template < typename AA > class datamap;
typedef datamap<f1> f1_dm;
typedef datamap<f32> f32_dm;

This is because, to the compiler, both of these typedef'd datamaps are equivalent to datamap<float>. Any attempts to make specialized case functions for both f1 and f32 results in the compiler getting confused.

Essentially, typedefs don't "make" new types. And making new types is what I need to do, I am assuming. Specifically, I will probably need to declare a new f1 class and spend a long time making it work exactly the same as a float, and I have no idea how much trouble I will be getting into by doing that.

Are there any solutions to my problem?


Since datamap<f1> and datamap<f32> are same type you just have different alias for them you can do this:
typedef float f1;
typedef float f32;
template < typename AA > class datamap;
typedef datamap<f1> f1_dm;
typedef f1_dm f32_dm



#4839297 Closer to a number without hitting it

Posted by D.Chhetri on 23 July 2011 - 09:46 AM

How about using arctan(x), it has an asyptote at pi/2 so if you want to cap it off at 50, you can scale it,
f(x) = 50 * 2 / pi * arctan(x) ;

But the problem with that is that it will converge fast, so you can further scale it like so:
f(x) = 50 * 2 / pi * arctan(x / RATE ) ;  //higher the rate slower it converges to 50, lower the rate faster it converges.

Here is a gaph.
Posted Image

The following are the equations for the above colored graph.
f(x) = 50 * 2 / pi * atan(x / 1 ); //black
f(x) = 50 * 2 / pi * atan(x / 10 ) //red
f(x) = 50 * 2 / pi * atan(x / 20 ) //blue
f(x) = 50 * 2 / pi * atan(x / 40 ) //green
f(x) = 50 * 2 / pi * atan(x / 100 ) //orange

You can do something similar off that line.

You can see, for example looking at the blue graph, at level 30 your armor resistance will be a little above 30, and at level 50, it will be a little less than 40, and so on.


#4838748 Post pictures of YUO!

Posted by D.Chhetri on 21 July 2011 - 08:06 PM

Here's a picture of me I took by my pool :rolleyes:




For some reason I feel like this is just a evil trick, posting a hot girls picture in a land of 'geeks' is not a good idea!!


- pic in avatar


#4837769 My friend is starting to like Java (help!)

Posted by D.Chhetri on 19 July 2011 - 09:06 PM



My programmer is starting to like java more then c++! What should I do?


This is quite natural, Java only starts to look bad when you compare it to C#, compared to C++ its pretty darn nice to work with.


I came here to say essentially this.


I came here to say essentially this also!!!


#4836641 Relationships

Posted by D.Chhetri on 17 July 2011 - 10:50 PM

Daniel Radcliffe

I actually had to google that name to see who it was. I think I earned a cookie.


#4834121 How do people stand Java?

Posted by D.Chhetri on 11 July 2011 - 09:42 PM

I don't get why people kill on java so much. I could make a whole portable application done in java in a few days, where as in C++ it would take much much longer. This is mainly because everything you need is provided already. Java isn't slow, even compared to C++, in fact it boils down to the programmer. I started learning C++ 2 years ago, then I had to learn java for my school as its the primary language they use. And in reality its a lot easier to program in java than C++. I don't have to worry about any corner or weird edge cases. Although I don't care for java template mechanism. If I had a choice to develop an application that would be shipped in 3 months, in C++ or java, I would for sure pick java; especially if my ass is on the line. So stop bashing java, yea I know people said C# is better( idk never used it), but I have a feeling one of the main reason why you guys like C++ better than java is because you got use to it before you got use to java.


#4832304 Will leaking memory be freed eventually once VS2010 shuts down?

Posted by D.Chhetri on 07 July 2011 - 09:40 AM

I think the memory should be freed after you exit your console program, without the need to close visual studio. Someone might correct me on this though.




PARTNERS