Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Jun 2008
Offline Last Active Oct 16 2013 11:54 AM

Posts I've Made

In Topic: Using genetic algorithms to 'train' my AI

09 August 2013 - 10:51 AM

Interesting project; I like GAs.  I didn't see it mentioned in your blog, but are you using elitism?  That is, letting your best performer(s) through to the next generation unaltered?  It's a good way to ensure you don't lose your best candiates to a bad crossover.

In Topic: 2D array and pointers

07 August 2013 - 11:29 AM

When arrays are passed to functions they decay to pointers to their first element.  big_matrix is an array of 10 arrays of 10 doubles, so when it's passed to reset_2D_dbl_array it decays to a pointer to an array of 10 doubles (i.e. double [10][10] decays to double(*)[10], not double**).


In your second example, big_matrix[0] is an array of 10 doubles, so it would decay to a pointer to a double (i.e. double[10] decays to double*).

In Topic: Unix/Mac equivalent to GetKeyboardLayoutName?

20 February 2013 - 07:53 PM

A bummer that Linux does not make it easy.  I will continue to look into it and report back if I figure it out.  Thanks for the reply.

In Topic: Unix/Mac equivalent to GetKeyboardLayoutName?

19 February 2013 - 09:03 PM

I don't really think that Mac/Linux have the concept of an input locale that is separate from the system locale, but I could be mistaken.


If you just want the current system locale, something like this should be sufficient:



#include <locale>
int main()
    std::locale current;
    std::cout << current.name() << std::endl;


You could also call getenv("LANG") to query the shell's locale.


I'm not sure the system locale is what I'm looking for.  I need a way to determine what the keyboard's layout is (i.e. qwerty or dvorak).  So far it looks like XkbLayout might have this information.  Does anyone know if that is the case?

In Topic: Integrating SFML into cross-platform engine with CMake

09 February 2013 - 02:24 PM

Well for anyone curious, I found a good tutorial and was able to figure it out.  There were a few additional things I had to do that the tutorial didn't really cover.


I placed a copy of the Windows SFML 2.0 release client in my project directoy.  I also placed lib files from the Unix version of SFML into the lib folder of my SFML copy.


Before calling, find_package(SFML..., I had to set the directory for where SFML was located:

    set(SFMLDIR "${CMAKE_SOURCE_DIR}/../SFML-2.0-rc")


I couldn't find a way to get the SFML dlls to copy to where the executable is generated, so I just statically linked them (which is probably what I should be doing anyways):