  # ErUs

Member

203

## Community Reputation

136 Neutral

• Rank
Member
1. cheers Kambiz :) finished function: Color BlendColor( Color base, Color blend, float factor ) { return Color( (base.r()*(1.0f-factor)) + (blend.r()*factor), (base.g()*(1.0f-factor)) + (blend.g()*factor), (base.b()*(1.0f-factor)) + (blend.b()*factor), (base.a()*(1.0f-factor)) + (blend.a()*factor) ); }
2. I am trying to write a function that blends two colors together. like this: Color BlendColor( Color base, Color blend, float factor ); the factor can be a float from 0 to 1. if its 0 then the returned color will be the same as base , if its 1 the returned color will be the same as blend. *Color is a class with members A,R,G,B i know i have to blend each color (A,R,G,B) seperatly but how do i do it? please help me. if you dont understand the question i can try and be a bit clearer. thanks :)
3. HERE is a version that works fairly well for me. After about 200 entries it gets %20 of my random numbers and it get 35-40% when spazzing out on the number keys.  fixed a silly counting problem :)
4. it appears that you only have to set the color-key (to pink) and it should not draw the pink pixels when you draw the image/sprite
5. here is the problem. I am making a (single digit) random number Guesser, it tries to guess the next number based on the preveous numbers and how many numbers have been entered since the start of the session. random numbers are entered one after the other, like 93659163. (when training) I store all the numbers in a format like this: typedef struct { char thenumber; //number entered int freq; //times this pattern has happened before int history; //count of guesses in the session before this arose char lastno; // the number before this char lastno2; // the number before that above char lastno3; // the number before that above } numentry; I need to devise a scoring system for the most likly next number based on a database of previous examples. at first i thought points = (for each matching param +=5) (+frequency), but a numentry with a high frequency will win even if it is totaly unrelated to the previous numbers. DO you have any suggestions?
6. thanks Kylotan, the language is 'Boo' i dont really wanna go down the 'propper' NLP route because i think its a bit over-kill for the simple question / statement info-bot i am trying to write. Some good tips here thanks :)
7. Made the two earlyer functions a bit better: def IsQuestion( message as string ) as bool: # Based on the idea that a question is "* wh* [is [the]] %s" strlist = self.Tokenize(message) i = 0 while( i < (strlist.Length -1) ): #-1 because we need more that "whats" word = strlist.GetValue(i) as string word = word.ToLower() if( word.Length < 2 ): i++ continue # what and variants ALLWAYS have more than 2 chars if( word.Substring(0,2) == "wh" or word.Substring(0,2) == "wa" ): if( (i+1) < word.Length): #make sure there is space for subject return true # it still may not be question but IndexOfSubject will return -1 if so else: return false i++ return false def IndexOfSubject( strings as (string) ) as int: # Based on the idea that a question is "* wh* [is [the]] %s" i = 0 while( i < (strings.Length -1) ): #-1 because we need more that "whats" word = strings.GetValue(i) as string word = word.ToLower() if( word.Length < 2 ): i++ continue # what and variants ALLWAYS have more than 2 chars if( word.Substring(0,2) == "wh" or word.Substring(0,2) == "wh" ): j = 1 while( (i+j) != word.Length and j < 4): #make sure there is space for subject word = strings.GetValue(i+j) as string word = word.ToLower() if( IsRestrictedWord( word ) or word == "" ): break return (i+j) j++ i++ but i still dont know how to check for a statement, like "tom is human"
8. def IsQuestion( message as string ) as bool: strlist = self.Tokenize(message) if( strlist.Length &lt; 2 ): return false word = strlist.GetValue(0) as string word = word.ToLower() if( word == "whats" or word == "what's" or word == "wats" ): return true if( word == "what" or word == "wat" ): word = strlist.GetValue(1) as string word = word.ToLower() if( word == "is" or word == "are" ): return true return false def IndexOfSubject( strings as (string) ) as int: i = 0 while( i &lt; strings.Length ): tstr = strings.GetValue(i) as string tstr = tstr.ToLower() j = 0 if( tstr.Length &lt; 2 ): return -1 if( tstr.Substring(0,2) == "wh" or tstr.Substring(0,2) == "wa" ): j = 1 if( (i+j) == strings.Length ): return -1 tstr = strings.GetValue(i+j) as string tstr = tstr.ToLower() if( tstr == "is" ): if( (i+j+1) == strings.Length ): return -1 tstr = strings.GetValue(i+j+1) as string tstr = tstr.ToLower() if( tstr == "a" or tstr == "an" or tstr == "the" or tstr == "teh" ): if( (i+j+2) == strings.Length ): return -1 return i+j+2; if( tstr == "a" or tstr == "an" or tstr == "the" or tstr == "teh" ): if( (i+j+1) == strings.Length ): return -1 return i+j+1; return (i+j) return -1 I am trying to build a system that can check if an array of words is a question, and if so, get the subject of the question. My current method is way to hacky, i am looking for some documentation on the subject but i cannot find anything that isnt really broad on the whole subject of NLP. Please help out :) [Edited by - ErUs on July 10, 2006 8:35:53 AM]
9. amazing work :) I hope you make this technology available to others. Once again great stuff.
10. First of all shame on you for making me download libpng13.dll and zlib1.dll secondly ... nice work
11. I am trying to draw faster with boo (GDI+) and i came across this self.Setstyle(OptimizedDoubleBuffer, true) self.Setstyle(UserPaint, true) self.Setstyle(AllPaintingInWmPaint, true) self.Updatestyles() But i cant use it :| I have tried putting in constructor, in the Load event, in other places. But i allways get this error "Unexpected token:self" self.Setstyle(OptimizedDoubleBuffer, true) self.Setstyle(UserPaint, true) <-- this line self.Setstyle(AllPaintingInWmPaint, true) self.Updatestyles() and before you ask i have imported System.Windows.Forms.Controlstyles aswell as forms etc please help :(
12. nice one cheers. one more though - i cant identify the event for when someone closes the form. It isnt deactivate is it? i thought that makes it grey [EDIT] forget that - i thought this.Created was only set once. but it seems it changes to false when windows closes. poor naming imho