Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


MarkS

Member Since 09 Jan 2001
Offline Last Active Dec 20 2014 12:11 AM

Topics I've Started

Looking for a path finding algorithm, with some caveats...

14 December 2014 - 10:03 PM

There is a game called "Flow Free". I found it to be highly addictive, and thought it would be fun to remake it in 3D. To do so requires the ability to generate the levels automatically and check the generated levels to ensure that it is possible to solve. To start, I want to create a 2D solver. This poses quite a challenge. It appears simple, but the requirements of the game make this quite difficult. All cells must be visited and no two paths can cross.

Here is a 9x9 cell level and its solution:

game.png

 

The solution would break most path finding algorithms, and I'm not sure this really is a problem that a path finding algorithm would be best suited for anyway. While playing the game slowly and consciously thinking out the moves, I came to realize that I was actually solving for each different path while actively working on a single path. This leads me to think it is more of an AI issue than a simple path finding issue.

 

Take the magenta path as an example. The correct solution is not one that would be found via any path finding algorithm. A shorter path would be selected, but any other path would block out the red, brown and green paths. This means that while solving for the magenta, the algorithm must also be solving for the other paths. Even so, it is possibly to solve some levels without visiting all of the cells. This requires some rather highly serpentine routes that wouldn't be obvious from an algorithmic standpoint.

 

I haven't started coding, but I'm not sure how to begin. How would I go about this? The logic to code this escapes me at the moment.


Question about dereferencing syntax in C/C++...

13 August 2013 - 04:31 PM

I have always accepted how C/C++ dreferences structs and pointers to structs until a recent thread on a new language, C-UP. The developer stated that the language doesn't use the '->' operator to dereference pointers.

This makes a lot of sense. I'm curious why the C++ standard still requires the use of '->' and '*'?
 
struct foo{
int i;
int *j;
};
 
foo foo1,*foo2;
int temp;

// These next lines do the exact same thing...
foo1.i = 1;
foo2->i = 1;
temp = foo1.i;
temp = foo2->i;
temp = *foo1.j;
temp = *foo2->j;
The only reason I can see for the disparity is that '->' and '*' informs the reader that a pointer is being dereferenced. Does it truly matter? All that is being done is accessing a member of a class or struct.

List of C++11 compliant compilers?

01 August 2013 - 10:33 AM

I'm getting fed up with Visual Studio Express 2012. There are so many new language features that I can only look at in code samples.

 

Are there any *free* Windows-based C++11 compilers? What are some recommendations?


Question about an example of The Rule of Two.

28 July 2013 - 08:31 AM

L. Spiro posted this in another thread: http://www.artima.com/cppsource/bigtwo3.html

I find the concept fascinating, but I have a some questions about two of the RAII class member functions.

1.) What does the reset function do? What I see happening is it deleting the member pointer and then assigning the pointer passed into the function to the deleted pointer. How does that work? Is that legal C++?

2.) What purpose is there for the swap function? Apart from sorting pointers, is there any other reason for its existence?

How to tell if a context has been created?

08 July 2013 - 10:06 PM

I'm working on an OpenGL-based library that does not do context creation. I need a way for the library to test that an OpenGL context has been created, so that it can exit gracefully if not.

 

How do I do this?


PARTNERS