Jump to content

  • Log In with Google      Sign In   
  • Create Account


musafir2007

Member Since 23 Feb 2007
Offline Last Active Sep 18 2014 12:14 AM

#5142484 got an interview with EA

Posted by musafir2007 on 27 March 2014 - 12:16 AM

guys, I got the job! I really appreciate all the feedback, and I have to say part the reason was gamedev. Just by browsing the forums I learn so much.. we have a great community and contributors on here! :)




#5106043 help with python - write class similar to defaultdict

Posted by musafir2007 on 31 October 2013 - 02:17 PM

http://docs.python.org/2/library/collections.html#collections.defaultdict

 

Hi, I am new to python and trying to write a class similar to to the defaultdict class.

I am little stuck on the constructor. On the python website example they first create a the defaultdict object with type as parameter, and then fill it. Example d = defaultdict(list) and then input "key,value"

 

If I directly pass "s" when creating object, it seems to be fine, but how can I make it similar to how it's really implemented. Thanks for help!

class MyDictionary(dict): #Parent class is "dict"
    'This is a derived class from python dict'
 
    def __init__(self, default_factory=None): # implement the parameters correctly
        dict.__init__(self, default_factory)
        #self.default_factory = default_factory
 
    #def anotherMethod-ToDo-forexmaple-d[10],handle if key doesn't exist
        
s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]
d = MyDictionary(list)
 
for k, v in s:
    d[k].append(v)
    
print (d.items())



#5073046 simple char array, please help

Posted by musafir2007 on 26 June 2013 - 02:13 PM

Hi, I am trying to simple return a string but I get this error:

In function 'getNetworkAtPriority':

warning: function returns address of local variable
In function 'main':
error: incompatible types in assignment

 

Please help what I am doing wrong? thanks

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char * getNetworkAtPriority( )
{
    char returnValue[14];
    sprintf( returnValue, "mcc-mnc-umts");
    return returnValue;
}

int main()
{
    char entry1[14];
    entry1 = getNetworkAtPriority( "1" );

    return 0;
}



#4927860 Getting my friends to play my game.

Posted by musafir2007 on 03 April 2012 - 07:29 AM

another thing that works is to manually change the extension to something else (like .txt) and send it over the email. Tell your friends to change the extension back from .txt to .exe. There is no data loss and is quick.


#4874366 Simple bit masking operations

Posted by musafir2007 on 19 October 2011 - 10:28 AM

Hi all,
So i am a little weak in all this bits stuff..

So far I realized that if I want to see if a particular bit is set...
for variable n, to see if kth bit is set, I will
unsigned n = ...
if ((1 << k) & n)
bit set...
else
not set...

Now for example I have a variable n, and I want to set its 10th bit to 1, how do I do that? Will I need to check first, or can I just force it to be 1 in a single expression?

thanks


#4843432 Am I Ready?

Posted by musafir2007 on 01 August 2011 - 10:57 PM

One of my favorites:

XXXXXXXX
AAAXXXXX
XXAAAXXX
XXXXAXXX
XXAAAXXX
XXAXXXXX
XXAAAAAA
XXXXXXXX

Put the above 8x8 matrix in the text file. Starting at the first A, write a generic program to find a way from the the A in the first column to the A in the last column. Of course, you'll have to assume that there are no loops and first and last row only has one A each to keep it simple. At the end you must print out the number of A's to get to the end. Recursion is a very important concept and I think this is a very good exercise for that.


PARTNERS