Jump to content

  • Log In with Google      Sign In   
  • Create Account

TheUnbeliever

Member Since 19 Mar 2005
Offline Last Active Feb 13 2014 05:32 PM

#4949110 Understanding the D* lite whitepaper

Posted by TheUnbeliever on 14 June 2012 - 04:58 AM

Three affirmatives. :-) (I hadn't even noticed the dot first time!)


#4949014 Understanding the D* lite whitepaper

Posted by TheUnbeliever on 13 June 2012 - 07:57 PM

the minimum s' in predecessors of u, as calculated by ( g(s') + c (s', u) ).


Not quite. That would be written 'argmin', whereas we just have 'min'. This is the minimum value of g(s') + c(s',u) for any predecessor s', not the predecessor itself.

When comparing: U.TopKey < calculateKeys, ie: (X1, Y1) < (X2, Y2), is this (X1 < X2) AND (Y1 < Y2), or (X1 < X2) OR (Y1 < Y2), or something else entirely?


Explained from around the middle of the first paragraph on page 478, starting at 'keys are compared according to a lexicographic ordering.'


#4948981 Understanding the D* lite whitepaper

Posted by TheUnbeliever on 13 June 2012 - 05:37 PM

Does the function return two values?


It returns a pair or 2D vector; the authors have opted for [a;b] over (a,b) to improve legibility.

The other line I had trouble with was this one: min s' (is element of) pred(s) (g(s'), c(s', s)). I don't get that one at all. The s' in pred() with the smallest g or c?


I don't see this line. I do see min s' (is element of) pred(s) (g(s') + c(s', s)) - i.e. the minimum of the expression on the right over all predecessors of s.

EDIT: slightly clearer wording.


#4943613 using "this" within a shared_ptr<>

Posted by TheUnbeliever on 26 May 2012 - 08:48 PM

Derive CNode from enable_shared_from_this, do pChild->OnAttach(shared_from_this());


#4939248 How are APIs made, and how do they work with programming languages?

Posted by TheUnbeliever on 11 May 2012 - 03:47 AM

It's a fairly vague term. They're often, but not always, libraries, and the level of abstraction depends on what they're doing. e.g. Something like the Twitter API might just be a normal HTTP request for a JSON object, whilst something like Direct3D is a set of headers and compiled libraries that interact closely with the driver. In between, an API for another piece of desktop software (Word or Excel) might just be a library exposing its plotting functionality or file format. I don't know SDL in detail, but since it's cross-platform, I'd expect it's written on top of OpenGL and some library like GTK+, possibly using conditional compilation to port between platforms.


#4935061 Weird simple CSharp math issue.

Posted by TheUnbeliever on 26 April 2012 - 07:16 AM

Since nobody's explicitly said: you're looking for Math.Pow.


#4931712 Shiny new FAQ, Round... N.

Posted by TheUnbeliever on 16 April 2012 - 06:20 AM

C++ FAQ. I like the SGI STL Programmer's Guide.


#4931630 What Graphics Library works with Windows 7?

Posted by TheUnbeliever on 15 April 2012 - 10:40 PM

Figuring out how to get started in graphic programming is harder than understanding physical chemistry! Is this mind blowingly frustrating process what everyone else has to go through?


If you mean dependency management, then pretty much. It does help if you understand, in principle, and how to configure your IDE's settings for:
  • the overall build process: preprocess, compile, link
  • include search paths: any headers you directly or indirectly #include must be in these
  • difference between static and dynamic linking: static, code used from the .lib is included directly into your binary; dynamic, it's loaded at runtime
  • library search paths: there are separate arrangements for static and dynamic libraries
  • linker dependencies: outside a small set of defaults, you must explicitly direct the linker which libraries to search for

To this end, here are some links to MSDN that help get started:
C/C++ Building Reference
VC++ Directories Property Page
Linker Property Pages
Linking Implicitly (to a DLL)

None of this is OpenGL specific, not least because I don't have much experience setting it up, but it's important to know anyway and should at least help give you an idea of a) what you're looking for and b) what specific questions to ask. It does seem that if you have the Windows SDK installed - in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A for me - that the necessary OpenGL lib and headers are in there. If you want to use libraries on top of these like GLUT or GLEW, they will probably need downloaded separately. But, again, I have only built against OpenGL once and that was on Ubuntu.


#4931238 mvc and c++

Posted by TheUnbeliever on 14 April 2012 - 12:48 PM

Model-View-Controller predates the web by a decade. There are alternatives, but this is hardly a square peg in a round hole. OP, I think the observer pattern makes this easier: have the view callbacks go directly to the controller (or via a thin wrapper if this avoids dragging Qt into otherwise-unrelated code) and the view subscribe to relevant updates from the model.


#4926193 Tool (c/c++) for parsing/evaluating a c header file?

Posted by TheUnbeliever on 28 March 2012 - 09:40 PM

I haven't used it, so take this with a huge pinch of salt, but I believe this is one of the main use-cases for LLVM. See, for example, Writing an LLVM Pass.


#4925193 Upload system specs

Posted by TheUnbeliever on 25 March 2012 - 03:43 PM

Not to throw water on your fire, but if your assigned task is to create a website, I strongly suspect that any work on something which is not a website is irrelevant. If you really like the idea, I would just have a stub which pretends to do what you describe. Obviously you can do whatever you like with your own time, but since this is towards an assessed exercise, I would personally check the scope of your solution with whoever set it.


#4922273 Outputting data to a log file

Posted by TheUnbeliever on 15 March 2012 - 08:09 AM

As above, if you just use stdout and friends then the person running your program can decide where they want the output to go by redirecting output as described in the link above. Alternatively, if you make sure to always use e.g. std::clog where appropriate, then you can do something like:

class ScopedStreamRedirect
{
  std::ostream& os;
  std::streambuf* old_rdbuf;

  public:
  ScopedStreamRedirect(std::ostream& os, std::streambuf* rdbuf)
	: os(os), old_rdbuf(os.rdbuf())
  { os.rdbuf(rdbuf); }

  ~ScopedStreamRedirect()
  { os.rdbuf(old_rdbuf); }
};

// ...

int main()
{
  // ...
  std::ofstream log_file("debug.log");
  ScopedStreamRedirect(std::clog, log_file.rdbuf());

  // writes to std::clog now end up in file 'debug.log'
}

These redirections also nest, albeit not concurrently, if that was useful for any reason.


#4919768 C++ Font Colors

Posted by TheUnbeliever on 06 March 2012 - 08:08 AM

This isn't something which C++ natively supports. You would have to use a platform-specific solution and/or an external library. For example, the WINAPI way to do this is SetConsoleTextAttribute.


#4918034 How much C is enough to start programming games?

Posted by TheUnbeliever on 29 February 2012 - 06:39 PM

C itself is a pretty small language. Knowledge of it probably isn't going to be your limiting factor, but your knowledge of - as you say - algorithms and data structures, as well as experience of completing (or at least significantly progressing with) projects.


#4917250 Questions about inheritance

Posted by TheUnbeliever on 27 February 2012 - 07:46 PM

GridIterator, I have no intention of having a cursor you can move around within the map, so I'll be skiping that one I think, unless I'm missinterpretting something there.


I think you are misinterpreting - my expectation would be that e.g. MapRenderer would use a GridIterator to iterate over and draw each MapTile in turn. The cursor concept needn't actually be exposed to the user, if that's what you mean.

This I don't quite understand, what I'm thinking would work is like, a Map class that contains a Grid object or soemthing? but I don't quite think that's what your saying.


typedef Grid<MapTile> Map;

also the map factory, I don't understand what it is, I think I have a general Idea of what it's supposed to do, but some enlightenment would be nice.


Factory is just a function (possibly a member function, in which case we might call the class a factory too) which creates objects for us. So in this case it might be as simple as Map map_from_file(const char* path) or Map random_map(int seed).

The MapRenderer, is this like, a class or function that's sole purpose is to Render the map? Doesn't sound very polymorphic to me, and I'm a big fan of polymorphism.


What do you mean?




PARTNERS