[University - C++ Programming] Help With Assignment (Very Basic Stuff)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sickufully
    Sir Krisk
    • Dec 2007
    • 930

    #1

    [University - C++ Programming] Help With Assignment (Very Basic Stuff)

    Alright so let me begin with saying that I've been studying C++ for about the past 6 weeks (only just started my course) and the assignment I've been slapped with is comparable to learning Ancient Latin in French (that's how I see it anyway). I literally don't even know where to start.

    Since I'm not allowed to just ask for answers, I'll be asking for the next closest thing that won't get this thread locked. Any help or advice will aid me! And if you can give advice/help, please explain it like you we're talking to a dummy (cause I kinda feel that way atm). I'm also willing to talk on Skype or anything other chatting thingy cause I'm getting desperate at this stage. I spent 4 hours the other night trying to figure out the first question (which is 'What is the data type GUI_BUFFER?') and I'm pretty sure my answer is wrong.

    Alright so here's the code that I've been supplied with. I will ask questions at the bottom of this post. Most of them will probably be simple to anyone with reasonable knowledge of C++. I guess I'll just post a few questions now and if people can help, I'll ask more questions that I get stuck on.

    Also, sorry about the poor quality of the code layout, it's not as pretty as it looks in Visual Studio.

    Code:
    /******************************************************************************
    * Program Description
    * File: tilemap.cpp
    * Application demonstrating the use of 2D arrays to represent tile-based game
    * environments. Also demonstrates limited use of the Windows Console API.
    ******************************************************************************
    */
    
    
    #include "tilemap.h"
    
    // Declare map height and width parameters
    const unsigned int MAP_HEIGHT = 20;
    const unsigned int MAP_WIDTH = 30;
    
    // Declare map elements using an enumeration
    enum entity_labels	{
    	EMPTY = 0,
    	WALL
    };
    typedef entity_labels	ENTITY;
    
    // Define an array of ASCII codes to use for visualising the map
    const int TOKEN[2] = {
    	32,		// EMPTY
    	178		// WALL
    };
    
    // create type aliases for console and map array buffers
    using GUI_BUFFER = CHAR_INFO[MAP_HEIGHT][MAP_WIDTH];
    using MAP_BUFFER = ENTITY[MAP_HEIGHT][MAP_WIDTH];
    
    
    //Declare application subroutines
    void InitConsole(unsigned int, unsigned int);
    void ClearConsole(HANDLE hStdOut);
    WORD GetKey();
    void DrawMap(MAP_BUFFER & rMap);
    
    
    
    /** Function: main
      * Description:
      *		 Application entry point
      */
    int main()
    {
    
    	/**************************************************************************
    	  * Initialise the standard output console
    	  */		
    	HANDLE	hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    	if (hStdOut != INVALID_HANDLE_VALUE)
    	{
    		ClearConsole(hStdOut);
    
    		// Set window title
    		SetConsoleTitle(TEXT("Tile Map Demo"));
    
    		// Set window size
    		SMALL_RECT srWindowRect;
    		srWindowRect.Left = 0;
    		srWindowRect.Top = 0;
    		srWindowRect.Bottom = srWindowRect.Top + MAP_HEIGHT;
    		srWindowRect.Right = srWindowRect.Left + MAP_WIDTH;
    
    		SetConsoleWindowInfo(hStdOut, true, &srWindowRect);
    
    		// Set screen buffer size
    		COORD cWindowSize = { MAP_WIDTH, MAP_HEIGHT };
    		SetConsoleScreenBufferSize(hStdOut, cWindowSize);
    	}
    	/*************************************************************************/
    
    
    	/*************************************************************************
    	* Initialise the tile map with appropriate ENTITY values
    	*/
    	MAP_BUFFER		tileMap;
    	
    	for (unsigned int row = 0; row < MAP_HEIGHT; row++)
    	{
    		for (unsigned int col = 0; col < MAP_WIDTH; col++)
    		{
    			tileMap[row][col] = EMPTY;
    		}
    	}
    	/*************************************************************************/
    
    
    
    	/***************************************************************************
    	* Execute the main application loop
    	*/
    	bool bExit = false;
    
    	do
    	{
    		// Get user input (non-blocking) if it exists
    		WORD wKeyCode = GetKey();
    
    		// Process input to update application state
    		switch (wKeyCode)
    		{
    			case VK_ESCAPE:
    				bExit = true;
    		};
    
    		// Render the map state to the console
    		DrawMap(tileMap);
    
    	} while (!bExit);
    
    
    	return 0;
    }
    
    
    /******************************************************************************
      *                        Define application subroutines                     *
      *****************************************************************************/
    
    /** Function: ClearConsole
      * Inputs:
      *		hConsole : HANDLE	- handle to console to be cleared 
      * Description:
      *     Fill console internal buffer with blank characters
      */
    void ClearConsole(HANDLE hConsole)
    {
    	CONSOLE_SCREEN_BUFFER_INFO csbiConsoleInfo;
    	GetConsoleScreenBufferInfo(hConsole, &csbiConsoleInfo);
    	SMALL_RECT srcWindow = csbiConsoleInfo.srWindow;
    	DWORD dNumChars = (srcWindow.Right - srcWindow.Left + 1)*(srcWindow.Bottom - srcWindow.Top + 1);
    	COORD cStart;
    	cStart.X = srcWindow.Left;
    	cStart.Y = srcWindow.Top;
    	FillConsoleOutputCharacter(hConsole, ' ', dNumChars, cStart, &dNumChars);
    }
    
    
    /** Function: DrawMap
      * Inputs:
      *		rMap : MAP_BUFFER	- array of ENTITY map elements
      * Description:
      *		Use the ENTITY values in rMap to determine ASCII characters to be drawn to standard output console
      */
    void	DrawMap(MAP_BUFFER & rMap)
    {
    	static GUI_BUFFER	rScreenBuffer = {};
    
    	// Set the ScreenBuffer characters and attributes given the ENTITY values in rMap
    	for (unsigned int row = 0; row < MAP_HEIGHT; row++)
    	{
    		for (unsigned int col = 0; col < MAP_WIDTH; col++)
    		{
    			ENTITY & rTile = rMap[row][col];
    			rScreenBuffer[row][col].Char.AsciiChar = (char)TOKEN[rTile];
    			switch (rTile)
    			{
    			case EMPTY:
    				rScreenBuffer[row][col].Attributes = 0;
    				break;
    
    			case WALL:
    				rScreenBuffer[row][col].Attributes = FOREGROUND_WHITE;
    				break;
    			};
    		}
    	}
    
    	// Copy the ScreenBuffer content to the standard output console 
    	HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    	if (hStdOut != INVALID_HANDLE_VALUE)
    	{
    		COORD pos = { 0, 0 };
    		COORD size = { MAP_WIDTH, MAP_HEIGHT };
    
    		SMALL_RECT srDrawRegion;
    		srDrawRegion.Left = 0;
    		srDrawRegion.Top = 0;
    		srDrawRegion.Bottom = srDrawRegion.Top + MAP_HEIGHT;
    		srDrawRegion.Right = srDrawRegion.Left + MAP_WIDTH;
    
    		WriteConsoleOutput(hStdOut, (CHAR_INFO *)rScreenBuffer, size, pos, &srDrawRegion);
    	}
    }
    
    
    /** Function: GetKey
      * Description:
      *		Check console event buffer for keydown events and return keycode of first event found
      *		Does not block - i.e., will return if no events in console event buffer
      */
    WORD GetKey()
    {
    	bool bExit = false;
    	WORD wKeyCode = 0;
    	HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
    	const unsigned int MAX_INPUTS = 128;
    	if (hStdIn != INVALID_HANDLE_VALUE)
    	{
    		INPUT_RECORD irInBuf[MAX_INPUTS];
    		DWORD dNumRead = 0;
    
    		ReadConsoleInput(hStdIn, irInBuf, (DWORD)MAX_INPUTS, &dNumRead);
    		for (DWORD i = 0; i < dNumRead; i++)
    		{
    			// Only consider events that are key-down events
    			if (irInBuf[i].EventType == KEY_EVENT && irInBuf[i].Event.KeyEvent.bKeyDown)
    			{
    				// return the keycode of the first key-down event
    				wKeyCode = irInBuf[i].Event.KeyEvent.wVirtualKeyCode;
    				bExit = true;
    				break;
    			}
    		}
    	}
    	return wKeyCode;
    }
    Questions
    I'll try and break down to the best of my knowledge each question with what I think the answer is. If I'm close, please tell me and same if I'm completely wrong. You don't have to point out the answer, just point me in the right direction. Any help is appreciated. Willing to give credits to people who give decent help. Many thanks in advance.

    Consider the first statement within the definition of the function DrawMap:
    static GUI_BUFFER rScreenBuffer = {};

    a) What is the data type GUI_BUFFER? Identify where this type is declared and determine the underlying data type. Explain the meaning of the declaration of this type in the context of the using keyword. How is this different to the use of the typedef keyword, as in the declaration of the ENTITY data type?

    MY ANSWER - COMPLETED THIS QUESTION. The first 6 words are already confusing me. I thought the data type of GUI_BUFFER was static but I'm really second guessing myself now. I think the answer is void. As for where the type is declared, I'm guessing it's mentioned in the declaration near the top? No idea what the underlying data type is. The rest of the question is just a shamble to me.

    b) What is the effect of the keyword static upon the scope and lifetime of the variable rScreenBuffer? Within which memory region would you expect to find this variable allocated? What performance benefit is obtained by making this buffer a static variable?

    MY ANSWER - COMPLETED THIS QUESTION. I'm pretty sure static means that variable stays stored in the same location for the entire during of execution, but it's value can change. As for the rest of the question, memory region and performance benefits, I'm completely stumped.

    c) What is the data type underlying the MAP_BUFFER array? What are the possible values that this data type can take (and hence the possible values stored in the map)?

    MY ANSWER - I've written down so far that it's ENTITY[MAP_HEIGHT][MAP_WIDTH], only because it seems like a repeat of question one. Although I'm not sure of the possible values that this data type can take. I'm assuming that the data type is ints and because of this, they can only hold numerical values. Can someone clarify if I'm heading in the right direction?

    d) Within the function DrawMap the MAP_BUFFER parameter is used to determine the values written into the GUI_BUFFER local variable. Discuss briefly the relationship between these data structures by explaining how the contents of an element of the MAP_BUFFER array determines the contents of the GUI_BUFFER array.

    MY ANSWER - Don't have one yet.
    Last edited by sickufully; 09-2-2015, 01:42 AM.
  • Scruffman
    FFR Player
    • Feb 2013
    • 1

    #2
    Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

    You're sort of on the right track.

    a) The answer is not void. GUI_BUFFER has been defined as a type alias which means it refers to a previously defined type in the code, acting like a legend for complex types so your code is more understandable. If you find where GUI_BUFFER has been assigned with the using keyword, the value is the data type assigned. typedef is also very similar to using, you may want to review this Stack Overflow post for a better breakdown between the two:
    Code:
    http://stackoverflow.com/questions/10747810/what-is-the-difference-between-typedef-and-using-in-c11
    b) You are along the right track, you might want to review this link which gives a broad overview:
    Code:
    http://www.learncpp.com/cpp-tutorial/43-static-duration-variables/
    Regarding performance, static variables are initialized only once which can have a major benefit over say a function which needs to keep initializing a variable (such as an integer array) each time it is run. You should also review where static values are stored (Heap or Stack) and that can help you get a better idea regarding performance.

    Comment

    • sickufully
      Sir Krisk
      • Dec 2007
      • 930

      #3
      Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

      Cheers for the reply. Gotta hit the hay for now but I'll have a look at these tomorrow and leave some feedback to see if I'm any closer with the answer. Thanks.

      p.s would be great if you could drop by the thread again. You seem to have a decent understanding of this stuff.
      Last edited by sickufully; 08-31-2015, 06:43 AM.

      Comment

      • Reincarnate
        x'); DROP TABLE FFR;--
        • Nov 2010
        • 6332

        #4
        Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

        Personally, I think using aliases like that is bad practice, but that's another story.

        Comment

        • sickufully
          Sir Krisk
          • Dec 2007
          • 930

          #5
          Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

          Alright so since I'm up at this ungodly hour, I'm gonna try and smash as much of this out as I can.

          a) So for the GUI_BUFFER data type, the answer would be const unsigned int? The only way I got this was the fact that [MAP_HEIGHT] & [MAP_WIDTH] are integers and they're the attributes of CHAR_INFO. Or is the answer CHAR_INFO? Or am I still completely wrong? Gahhh this is so confusing. As for where it's declared, I'm going to go with in the initialization list. I still don't understand what is meant by underlying data type? This is what I have for the second half of the question: The keyword using helps improve readability and structure of the code and is also useful when creating templates as typedef cannot be used in templates. Is there anything else worth mentioning about the difference between the keywords using and typedef cause I can't seem to find much.

          b) working on it.

          Originally posted by Reincarnate
          Personally, I think using aliases like that is bad practice, but that's another story.
          You should take it up with my teacher
          Last edited by sickufully; 08-31-2015, 05:01 PM.

          Comment

          • Reincarnate
            x'); DROP TABLE FFR;--
            • Nov 2010
            • 6332

            #6
            Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

            Speaking broadly, a data type is the thing that describes the data.

            For example:

            int x = 5;

            Here, the variable x holds the value 5. The data type is int -- or more generally, an integer.

            float x = 5.0;

            Same idea. x is a float datatype.

            vector<int> x(10);

            Now we've declared a vector of 10 ints -- as you can guess, the data type is vector<int>.

            The underlying datatype of GUI_BUFFER is just CHAR_INFO (although I guess the answer to this may depend on how "deep" they want you to go with the answer -- for example CHAR_INFO[MAP_HEIGHT][MAP_WIDTH] to show that you're aliasing a multi-dimensional data type, etc)

            As for typedef vs. using, they are the same thing -- they're just phrased a little differently.

            For instance:

            typedef long long ll;

            allows the coder to use the shorthand "ll" to refer to the "long long" datatype.
            Last edited by Reincarnate; 08-31-2015, 07:07 PM.

            Comment

            • sickufully
              Sir Krisk
              • Dec 2007
              • 930

              #7
              Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

              Hmm yeah that mostly seems to make sense to me. If the underlying multi-dimensional data type is CHAR_INFO[MAP_HEIGHT][MAP_WIDTH], does that mean the data type GUI_BUFFER is int int?

              I can only assume the teacher wants a basic description of the underlying data type as this is only the first assignment and we haven't covered much of what's being asked on the assignment, hence why I'm finding this so difficult.

              Comment

              • Reincarnate
                x'); DROP TABLE FFR;--
                • Nov 2010
                • 6332

                #8
                Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                Originally posted by sickufully
                Hmm yeah that mostly seems to make sense to me. If the underlying multi-dimensional data type is CHAR_INFO[MAP_HEIGHT][MAP_WIDTH], does that mean the data type GUI_BUFFER is int int?

                I can only assume the teacher wants a basic description of the underlying data type as this is only the first assignment and we haven't covered much of what's being asked on the assignment, hence why I'm finding this so difficult.
                The size parameters are integers (specifically, constant unsigned ints), but that doesn't necessarily mean that the underlying datatype is. For example you could have a two-dimensional array of strings, ints, floats, etc.

                If you want more detail on that piece:


                In this case, note that "rScreenBuffer" is declared in your code, of type GUI_BUFFER (and therefore of type CHAR_INFO), and we see how it gets used elsewhere:

                rScreenBuffer[row][col].Char.AsciiChar = (char)TOKEN[rTile];

                rScreenBuffer[row][col].Attributes = 0;

                So the CHAR_INFO multidimensional array doesn't contain ints -- it contain some sort of object that has "Char" and "Attributes" members. So it's probably a multidimensional array of structs, but I imagine this is more than what your teacher is asking for so I put this in spoiler tags.


                In this case, I would say the data type is "CHAR_INFO[][]" to show that it's a two-dimensional datatype being used.
                Last edited by Reincarnate; 08-31-2015, 08:04 PM.

                Comment

                • sickufully
                  Sir Krisk
                  • Dec 2007
                  • 930

                  #9
                  Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                  Thanks for the breakdown, I'm pretty sure I've got an answer for the first question now. Although I'm a little unsure as to whether my explanation is correct or not. But never mind, we got an answer after 2 days...

                  For the second question, I'm 99% sure that the memory region that rScreenBufferfer is stored in is Static Memory because it's a global variable and won't be de-allocated for the entirety of the program. Please correct me if I'm wrong (which it probably is :P).

                  Also on the second question, I've read that there isn't really many or any performance benefits to static variables compared to non-static variables. Has it got something to do with storing memory or faster execution of the program?
                  Last edited by sickufully; 08-31-2015, 09:16 PM.

                  Comment

                  • AutotelicBrown
                    Under the scarlet moon
                    FFR Simfile Author
                    • Jan 2014
                    • 923

                    #10
                    Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                    A non-static variable is (ignoring compiler optimizations) always allocated (including calling it's constructor which may be a costy operation for some types) and deallocated from stack memory during the duration of its scope. e.g. everytime the function where it is declared is called.

                    Compare to a static variable where the variable, simply put, 'stays there' through the lifetime of the process after its first use.
                    Play my files

                    Comment

                    • sickufully
                      Sir Krisk
                      • Dec 2007
                      • 930

                      #11
                      Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                      Thanks man, that was simple and straight to the point, enough for a newbie like me to understand (I think so anyway). Completed question 2 now.

                      Moving on, question 3 asks for the underlying data type of the MAP_BUFFER array. I've written down so far that it's ENTITY[MAP_HEIGHT][MAP_WIDTH], only because it seems like a repeat of question one. Although I'm not sure of the possible values that this data type can take. I'm assuming that the data type is ints and because of this, they can only hold numerical values. Can someone clarify if I'm heading in the right direction?
                      Last edited by sickufully; 08-31-2015, 11:04 PM.

                      Comment

                      • FoJaR
                        The Worst
                        • Nov 2005
                        • 2816

                        #12
                        Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                        using is similar to typedef. MAP_BUFFER is a 2D array(with specific dimensions) of type ENTITY.

                        ENTITY is a typedef of entity_labels.

                        so really MAP_BUFFER is a 20x30 array of entity_labels.

                        Comment

                        • sickufully
                          Sir Krisk
                          • Dec 2007
                          • 930

                          #13
                          Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                          So what you're saying FoJaR, is that the underlying data type of MAP_BUFFER is a 2D array of 20x30 ints?
                          I'm confused by what you mean here:
                          Originally posted by FoJaR
                          MAP_BUFFER is a 2D array(with specific dimensions) of type ENTITY.
                          What is ENTITY? Is it the name of the array or the name of the MAP_BUFFER or...? And while on this, what exactly is MAP_BUFFER? Is that just a name for something or does it have some meaning behind it?
                          Code:
                          typedef entity_labels	ENTITY;
                          Basically, the question above can be answered if you can explain to me what each word in this line of code means (except using)
                          Code:
                          using MAP_BUFFER = ENTITY[MAP_HEIGHT][MAP_WIDTH];
                          This is my answer to question c) so far:
                          a. The underlying data type of MAP_BUFFER is ENTITY[MAP_HEIGHT][MAP_WIDTH] which shows that it is a two-dimensional array of ints.

                          Is this correct? If not, please guide me. I'm feeling quite dim-witted about all of this.

                          Also if someone could clear this up too.
                          Originally posted by sickufully
                          Although I'm not sure of the possible values that this data type can take. I'm assuming that the data type is ints and because of this, they can only hold numerical values. Can someone clarify if I'm heading in the right direction?
                          Last edited by sickufully; 09-2-2015, 02:05 AM.

                          Comment

                          • Xayphon
                            sausage
                            FFR Simfile Author
                            • Nov 2008
                            • 1630

                            #14
                            Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                            I wish I could help you more with this stuff, but I only know Java and Python, and I can't pinpoint how datatypes work in C++ yet myself without reading into it more. So this'll be an attempt to help you without knowing C++.

                            Concerning your last question, I think I can safely tell you that, even though "MAP_HEIGHT" and "MAP_WIDTH" are ints, they do not necessarily mean that two integers are used within the Array ENTITY[MAP_HEIGHT][MAP_WIDTH]. They only declare the size of the Array, which is MAP_HEIGHT x MAP_WIDTH, so 20x30. The Array can thus hold 20x30 elements of a certain Datatype.

                            Now the Array itself is literally empty, as in all 20x30 elements are Null, so now you have to look more into the code and find out where this array is filled with actual elements that replace the Nulls in the array. Those elements that are being put into the array are probably the datatype you are looking for.

                            This piece of code struck the most for me:

                            Code:
                            /*************************************************************************
                            	* Initialise the tile map with appropriate ENTITY values
                            	*/
                            	MAP_BUFFER		tileMap;
                            	
                            	for (unsigned int row = 0; row < MAP_HEIGHT; row++)
                            	{
                            		for (unsigned int col = 0; col < MAP_WIDTH; col++)
                            		{
                            			tileMap[row][col] = EMPTY;
                            		}
                            	}
                            	/*************************************************************************/
                            To me it seems like that what is saved in MAP_BUFFER (which is ENTITY[MAP_HEIGHT][MAP_WIDTH] ?) is now renamed to "tileMap", so the value "tileMap" becomes the ENTITY[][] Array. Thanks to the for-loop, "tileMap" aka ENTITY[][] is now being completely filled with a value called EMPTY, which is, according to this little comment before the for-loop, an "appropriate ENTITY value" (be aware that just because it is called EMPTY it does not mean the Array's elements are Null i.e. literally empty anymore, it actually contains something now). Doing 1+1, I'd then conclude that the Array holds elements of type ENTITY, which would indeed make the Array and as such MAP_BUFFER a datatype of ENTITY.

                            Take this advice with a grain of salt, though. I don't know if this is what's even asked for or if this is actually correct given that C++ might work completely different than Java. "tileMap" being ENTITY[][] all of sudden just because it says MAP_BUFFER was something I simply concluded without doing some read ups, but I thought this seems the most reasonable to go with. Someone might be able to provide a better or correct explanation, but I'd be glad if this helps.
                            Last edited by Xayphon; 09-2-2015, 07:12 AM.

                            Comment

                            • sickufully
                              Sir Krisk
                              • Dec 2007
                              • 930

                              #15
                              Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)

                              Wow thanks man, that was a huge help. The whole array part of this is slowly starting to click into place in my head now and I think I have a better understanding of how this array works (providing that your non-existent c++ knowledge is correct but since you sound like you know what you're taking about, I'm assuming it is correct :P). Also, sorry for the late reply, been at work for the past 10 hours.

                              So basically what you're saying is that the Array called ENTITY[MAP_HEIGHT][MAP_WIDTH] is empty, even though map height & width are ints, it doesn't mean that the 20x30 'boxes' in the array are filled with ints, until the value called EMPTY fills each 'box' in the array?

                              When I say boxes (of an array), this is what I mean. Also, each of these boxes are empty until the value EMPTY is used.
                              ______________________________________
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|

                              From what I gather, EMPTY is a value that equals 0.
                              Code:
                              enum entity_labels	{
                              	EMPTY = 0,
                              	WALL
                              };
                              So, when initialising the tilemap array with data elements, each time it moves to the next box, consecutive numbers are entered. This is what I mean:
                              ______________________________________________
                              |__0__|__1__|__2__|__3__|__4__|__5__|__6__|__7__|
                              |__8__|__9__|__etc__|__etc__|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|
                              |____|____|____|____|____|____|____|____|

                              The only way I came to this conclusion is by these lines and the increment signs (row++ & col++). This also leads me to believe that the data type in the array is int because if EMPTY = 0, then increments can only be 1, 2, 3, 4, 5, etc.. Actually, just re-reading over that last sentence, that doesn't even make sense to me. It's surely wrong.
                              Code:
                              for (unsigned int row = 0; row < MAP_HEIGHT; row++)
                              
                              		for (unsigned int col = 0; col < MAP_WIDTH; col++)
                              I'm not sure how close I am to figuring this out but this seemed like a logical answer.
                              Last edited by sickufully; 09-3-2015, 05:38 AM.

                              Comment

                              Working...