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!


Prot

Member Since 05 Jul 2013
Offline Last Active Jul 04 2015 04:59 PM

Posts I've Made

In Topic: The Week of Awesome III - The third annual unofficial gamedev.net competition...

09 June 2015 - 01:34 AM

Also can somebody please point me to the judging threads of the last two 'WoA'. I'd love to see how that ended, who won.


In Topic: The Week of Awesome III - The third annual unofficial gamedev.net competition...

08 June 2015 - 02:39 AM

We would love to participate:

 

Team: '581eGliese'
Members: Prot , topkek
Website/Blog/Twitter handle: Twitter


In Topic: How to pass DeviceContext to other classes?

08 April 2015 - 12:51 AM

Pass a pointer to the device in the Texture constructor and/or the "create" function (depending on your design). This makes the dependency on the device clear and explicit.

 

I know this is kind of lazy, but would you please show me how I would do this?


In Topic: What is the ideal solution for a repository in my case?

08 January 2015 - 07:36 AM

Words = new HashSet<string>(File.ReadLines("words.txt"), StringComparer.OrdinalIgnoreCase);

// later (do not load the file once per word lookup, obviously)

var wordIsValid = Words.Contains("whatever");
Ship it.

 

 

This also sounds plausible!


In Topic: What is the ideal solution for a repository in my case?

08 January 2015 - 12:31 AM

I don't understand... do you need more functionality than just looking up words to see if they exist? If not, why are you looking for a more complex solution?

 

 

Here's the C# code to read a text file of words into a HashSet. Lookup performance is constant time. It will be extremely fast.

            HashSet<string> wordList = new HashSet<string>();
            using (StreamReader wordlistFile = new StreamReader("wordlist.txt"))
            {
                string line;
                while ((line = wordlistFile.ReadLine()) != null)
                {
                    wordList.Add(line);
                }
            }

Here's a word list:

 

http://www-personal.umich.edu/~jlawler/wordlist.html

 

 

Thanks a lot I think I will go with your approach, sounds reasonable!


PARTNERS