Jump to content
  • Advertisement

ErUs

Member
  • Content Count

    203
  • Joined

  • Last visited

Everything posted by ErUs

  1. ErUs

    color blending

    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. ErUs

    color blending

    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. ErUs

    random number guessage problems

    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. [edit] fixed a silly counting problem :)
  4. 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?
  5. ErUs

    random number guessage problems

    ah thankyou, i think i get it :)
  6. 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
  7. 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 :)
  8. def IsQuestion( message as string ) as bool: strlist = self.Tokenize(message) if( strlist.Length < 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 < strings.Length ): tstr = strings.GetValue(i) as string tstr = tstr.ToLower() j = 0 if( tstr.Length < 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. 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"
  10. amazing work :) I hope you make this technology available to others. Once again great stuff.
  11. First of all shame on you for making me download libpng13.dll and zlib1.dll secondly ... nice work
  12. 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 :(
  13. turns out i had a couple of spaces instead of tabs :|
  14. ErUs

    how to ... C#

    maximize a window programaticly in C# ?
  15. ErUs

    how to ... C#

    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
  16. You CAN NOT use the windows mobile SDK with the express version of 2005. :(
  17. i am trying to play a midi from a dll i am writing in masm. ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« .486 ; create 32 bit code .model flat, stdcall ; 32 bit memory model option casemap :none ; case sensitive .data Openseq db "open sequencer",0 Loadseq db "open YellowSubmarine.mid alias mymidifile" Playseq db "play mymidifile",0 Errormsg db "Cant find midi :(",0 .code ; include files ; ~~~~~~~~~~~~~ include \masm32\include\windows.inc include \masm32\include\masm32.inc include \masm32\include\gdi32.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\Comctl32.inc include \masm32\include\comdlg32.inc include \masm32\include\shell32.inc include \masm32\include\oleaut32.inc include \masm32\include\dialogs.inc include \masm32\include\winmm.inc include \masm32\macros\macros.asm ; the macro file ; libraries ; ~~~~~~~~~ includelib \masm32\lib\masm32.lib includelib \masm32\lib\gdi32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\Comctl32.lib includelib \masm32\lib\comdlg32.lib includelib \masm32\lib\shell32.lib includelib \masm32\lib\oleaut32.lib includelib \masm32\lib\winmm.lib ; ---------------------------------------- ; prototypes for local procedures go here ; ---------------------------------------- .data? hInstance dd ? .code ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« LibMain proc instance:DWORD,reason:DWORD,unused:DWORD .if reason == DLL_PROCESS_ATTACH push instance pop hInstance mov eax, TRUE .elseif reason == DLL_PROCESS_DETACH .elseif reason == DLL_THREAD_ATTACH .elseif reason == DLL_THREAD_DETACH .endif ret LibMain endp TestFunction proc invoke mciSendString,addr Openseq,0,0,0 invoke mciSendString,addr Loadseq,0,0,0 invoke mciSendString,addr Playseq,0,0,0 invoke MessageBox,NULL,addr Errormsg,0,MB_OK ret TestFunction endp ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« comment * ----------------------------------------------------- You should add the procedures your DLL requires AFTER the LibMain procedure. For each procedure that you wish to EXPORT you must place its name in the "dll.def" file so that the linker will know which procedures to put in the EXPORT table in the DLL. Use the following syntax AFTER the LIBRARY name on the 1st line. LIBRARY dll EXPORTS YourProcName EXPORTS AnotherProcName ------------------------------------------------------- * ; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« end LibMain i see the message box, but i dont hear my midi :(. i know the midi works and its in the right place. please help
  18. ErUs

    AI and Self Modifying Code

    You should check out CoreWars :) There is a windows Interpretter called WinCore
  19. im trying to implement a fixed point type like a float: typedef struct { long actual; long operator == (void) { return (actual>>1024); } } fint; have i got totaly the wrong idea? also im not too sure how todo the other operators. thanks
  20. ErUs

    fixed point as a type

    im trying to implement a very simple 3d engine on the Ipod with ipodlinux www.ipodlinux.com the ipod uses an arm cpu which cant do natvie floating point stuff. I think i am going to write the engine completely in C now and use MACROs to do the switching between fixed point. thanks all
  21. hello, I am about to start work on a single and multiplayer game and i would like some advice on how to work this out. I figured i would need a like 2 seperate base classes - client and server. So the client would start and if needed, create an instance of server? is this the propper way todo it? and any other advice you can give?
  22. ErUs

    single + multiplayer game

    thanks toxic, i am planning to use raknet, i find it good and easy to use. i would like to know a bit more about how a client can play single player without having to start a seprate server program and connecting to it. what methods are used for this?
  23. Quote: Your there to code not play around with all those crazy IDE functions that probably don't work correctly anyhow. im sorry m8, but your a first grade fool.
  24. ErUs

    any HL2 modders?

    hello, i am working on a new mod for hl2 now. so i may be able to help with any questions.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!