dartoscoder's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
304 (0.16 per day)
Joined:
15-May 09
Profile Views:
6,498
Last Active:
User is offline Oct 31 2012 01:26 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Jeep
Dream Kudos:
0

Latest Visitors

Icon   dartoscoder has not set their status

Posts I've Made

  1. In Topic: Computer Science or Game Design in Digipen

    Posted 31 Oct 2012

    The game design degree does teach a good amount of computer science (It is still a Bachelor of Science degree). But I don't want to spend all this time and money getting a game specific degree just to find out that I can't make it in the game industry.

    I just want to know if I can have some other job choices with this degree.
  2. In Topic: Anyone want to review my QTree?

    Posted 6 Aug 2012

    Besides the properties I think I got the whole thing working. All the tests say it is running fine so.. Here is my code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework;
    
    namespace MassDestructionTop
    {
        public class QTreeNode
        {
            QTreeNode[] childNodes = new QTreeNode[4];
            private List<Sprite> sprites = new List<Sprite>();
            private int quad = -1;
            private int generation = 0;
            private QTreeNode parent = null;
            private Rectangle areaRect;
            private bool hasChild
            {
                get { return childNodes[0] != null; }
            }
    
            public QTreeNode(int x, int y, int w, int h, QTreeNode parent = null, int generation = 0, int quad = -1)
            {
                areaRect = new Rectangle(x, y, w, h);
    
                this.generation = generation;
                this.parent = parent;
                this.quad = quad;
            }
    
            private void createChildren()
            {
                childNodes[0] = new QTreeNode(0, 0, this.areaRect.Width / 2, this.areaRect.Height / 2, this, this.generation + 1, 1);
                childNodes[1] = new QTreeNode(this.areaRect.Width / 2, 0, this.areaRect.Width, this.areaRect.Height / 2, this, this.generation + 1, 2);
                childNodes[2] = new QTreeNode(this.areaRect.Width / 2, this.areaRect.Height / 2, this.areaRect.Width, this.areaRect.Height, this, this.generation + 1, 3);
                childNodes[3] = new QTreeNode(0, this.areaRect.Height / 2, this.areaRect.Width, this.areaRect.Height, this, this.generation + 1, 4);
    
                List<Sprite> toDestroy = new List<Sprite>();
    
                for (int i = 0; i < 3; ++i)
                {
                    foreach (Sprite s in sprites)
                    {
                        if (s.collisionRect.Intersects(childNodes[i].areaRect))
                        {
                            childNodes[i].sprites.Add(s);
                            toDestroy.Add(s);
                        }
                    }
                }
    
                foreach (Sprite s in toDestroy)
                {
                    this.sprites.Remove(s);
                }
            }
    
            public void update()
            {
                nodeSpriteCheck();
                if(sprites.Count == 2)
                {
                    detectCollision();
                }
                else if(sprites.Count > 2 && generation < 4)
                {
                    createChildren();
                }
                else if (generation > 4)
                {
                    detectCollision();
                }
    
                updateChildren();
    
            }
    
            private void nodeSpriteCheck()
            {
                foreach (Sprite s in Globals.globalAllSprites)
                {
    
                    if (!this.sprites.Contains(s))
                    {
                        this.sprites.Add(s);
                    }
    
                    if (childNodes[0] != null)
                    {
                        childNodes[0].childNodeSpriteCheck(s);
                        childNodes[1].childNodeSpriteCheck(s);
                        childNodes[2].childNodeSpriteCheck(s);
                        childNodes[3].childNodeSpriteCheck(s);
                    }
                }
                
            }
    
            private void childNodeSpriteCheck(Sprite s)
            {
    
                if (childNodes[0] != null)
                {
                    childNodes[0].nodeSpriteCheck();
                    childNodes[1].nodeSpriteCheck();
                    childNodes[2].nodeSpriteCheck();
                    childNodes[3].nodeSpriteCheck();
                }
            }
    
            private void deleteEmptyChildren()
            {
                if (hasChild)
                {
                    if (childNodes[0].sprites.Count == 0 && childNodes[1].sprites.Count == 0 && childNodes[2].sprites.Count == 0 && childNodes[3].sprites.Count == 0)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            childNodes[i] = null;
                        }
                    }
                }
            }
    
            private bool detectCollision()
            {
                if (sprites[0] == null || sprites[1] == null || !sprites[0].moved || !sprites[1].moved)
                {
                    return false;
                }
                else if (Globals.isCollide(sprites[0], sprites[1]))
                {
                    sprites[0].react(sprites[1]);
                    sprites[1].react(sprites[0]);
                    return true;
                }
                else if (!Globals.isCollide(sprites[0], sprites[1]))
                {
                    return false;
                }
                else
                {
                    Exception ex = new Exception("QTree Error: Collission Detect failed");
                    throw ex;
                }
            }
    
            private void updateChildren()
            {
                foreach(QTreeNode child in childNodes)
                {
                    if (child != null)
                    {
                        child.update();
                    }
                }
            }
    
        }
    }
    
    


    Thank you all so much.

    View PostSkydiver, on 04 August 2012 - 12:36 PM, said:

    You know that your code doesn't even compile, right? createChildren() takes one parameter, yet you call it without passing a parameter.

    Yeah I posted the wrong code and tried to fix it in the post text editor and made that mistake.
  3. In Topic: Anyone want to review my QTree?

    Posted 4 Aug 2012

    View Postbaavgai, on 04 August 2012 - 05:23 AM, said:

    You know, createChild only creates a child for the top left quad?


    In the first code I put in it generated all the quads. When I moved all the code to a separate function I forgot to make the other quads. And I forgot about generation, thanks.

    Here is the new code. Still didn't put properties in there yet. I want to make sure it works 100% first.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework;
    
    namespace MassDestructionTop
    {
        public class QTreeNode
        {
            QTreeNode[] childNodes = new QTreeNode[4];
            private List<Sprite> sprites = new List<Sprite>();
            private int quad = -1;
            private int generation = 0;
            private QTreeNode parent = null;
            private Rectangle areaRect;
    
            public QTreeNode(int x, int y, int w, int h, QTreeNode parent = null, int generation = 0, int quad = -1)
            {
                areaRect = new Rectangle(x, y, w, h);
    
                this.generation = generation;
                this.parent = parent;
                this.quad = quad;
            }
    
            private void createChildren(int i)
            {
                childNodes[0] = new QTreeNode(0, 0, this.areaRect.Width / 2, this.areaRect.Height / 2, this, this.generation + 1, 1);
                childNodes[1] = new QTreeNode(this.areaRect.Width / 2, 0, this.areaRect.Width, this.areaRect.Height / 2, this, this.generation + 1, 2);
                childNodes[2] = new QTreeNode(this.areaRect.Width / 2, this.areaRect.Height / 2, this.areaRect.Width, this.areaRect.Height, this, this.generation + 1, 3);
                childNodes[3] = new QTreeNode(0, this.areaRect.Height / 2, this.areaRect.Width, this.areaRect.Height, this, this.generation + 1, 4);
    
                List<Sprite> toDestroy = new List<Sprite>();
    
                foreach (Sprite s in sprites)
                {
                    if(s.collisionRect.Intersects(childNodes[i].areaRect))
                    {
                        childNodes[i].sprites.Add(s);
                        toDestroy.Add(s);
                    }
                }
    
                foreach (Sprite s in toDestroy)
                {
                    this.sprites.Remove(s);
                }
            }
    
            public void update()
            {
                nodeSpriteCheck();
                if(sprites.Count == 2)
                {
                    detectCollision();
                }
                else if(sprites.Count > 2 && generation < 4)
                {
                    createChildren();
                }
                else if (generation > 4)
                {
                    detectCollision();
                }
    
                updateChildren();
    
            }
    
            private void nodeSpriteCheck()
            {
                foreach (Sprite s in Globals.globalAllSprites)
                {
    
                    if (!this.sprites.Contains(s))
                    {
                        this.sprites.Add(s);
                    }
    
                    if (childNodes[0] != null)
                    {
                        childNodes[0].childNodeSpriteCheck(s);
                        childNodes[1].childNodeSpriteCheck(s);
                        childNodes[2].childNodeSpriteCheck(s);
                        childNodes[3].childNodeSpriteCheck(s);
                    }
                }
                
            }
    
            private void childNodeSpriteCheck(Sprite s)
            {
    
                if (childNodes[0] != null)
                {
                    childNodes[0].nodeSpriteCheck();
                    childNodes[1].nodeSpriteCheck();
                    childNodes[2].nodeSpriteCheck();
                    childNodes[3].nodeSpriteCheck();
                }
            }
    
            private void deleteEmptyChildren()
            {
                if (hasChild())
                {
                    if (childNodes[0].sprites.Count == 0 && childNodes[1].sprites.Count == 0 && childNodes[2].sprites.Count == 0 && childNodes[3].sprites.Count == 0)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            childNodes[i] = null;
                        }
                    }
                }
            }
    
            public bool hasChild()
            {
                return childNodes[0] != null;
            }
    
            private bool detectCollision()
            {
                if (sprites[0] == null || sprites[1] == null || !sprites[0].moved || !sprites[1].moved)
                {
                    return false;
                }
                else if (sprites[0].collisionRect.Intersects(sprites[1].collisionRect))
                {
                    sprites[0].react(sprites[1]);
                    sprites[1].react(sprites[0]);
                    return true;
                }
                else if (!sprites[0].collisionRect.Intersects(sprites[1].collisionRect))
                {
                    return false;
                }
                else
                {
                    Exception ex = new Exception("QTree Error: Collission Detect failed");
                    throw ex;
                }
            }
    
            private void updateChildren()
            {
                foreach(QTreeNode child in childNodes)
                {
                    if (child != null)
                    {
                        child.update();
                    }
                }
            }
    
        }
    }
    
    
  4. In Topic: Programmer Jungian personality types.

    Posted 4 Aug 2012

    View PostLemur, on 04 August 2012 - 01:52 AM, said:

    I don't need a test or a quiz to put an unnecessary label on me. I'd like to believe that I'm not so easily categorized as to fall into one of 16 little squares.


    These categories just tell you what you tend to do. They are not 100% accurate.

    View PostBenignDesign, on 04 August 2012 - 05:57 AM, said:

    I remember this! Yes, I am INTP. If I remember the last one correctly, it said I'm an impatient asshole who makes others uncomfortable. Scary accurate that.



    I know, aren't we amazing :devil2:

    View Postcreativecoding, on 03 August 2012 - 11:03 PM, said:

    I think INTJ's just make really good programmers. We're smart and socially awkward.


    INTJs and INTPs make the best programmers.

    INTJs because they are very good at planning every detail ahead of time (while any type that ends with a P has trouble with) and INTPs (me) because of their ability to quickly recognize patterns that solve problems (INTJs can find patterns faster than all other types except for INTP because that is all INTPs do).

    View Postbaavgai, on 04 August 2012 - 11:49 AM, said:

    The offered definition for "intuition" seems bazaar to me. Generally, intuition is the opposite of rational thought, yet here it's synonymous. The other duality is just as strange. Sounding a lot more like actual intuition, as you've disallowed the use of brain.


    I think they mean intuition as the ability to put 1 and 1 together (for lack of a better phrase).
    My brother, who is ESFP, has trouble with anything that is abstract such as.. programming algebra (the variables) and theories. So I think that is the difference between the I and the S
    Typelogic is another site with definitions.
  5. In Topic: Anyone want to review my QTree?

    Posted 3 Aug 2012

    I don't really understand what you mean by immutability.

    Aside from encasing the variables in propertys I have made some good changes.

    It seems to work in testing now. But for some reason it said that childNodes[3] is never initialized. Probably something wront with the for loop. I'll fix it but here is the code right now

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.Framework;
    
    namespace MassDestructionTop
    {
        public class QTreeNode
        {
            QTreeNode[] childNodes = new QTreeNode[4];
            public List<Sprite> sprites = new List<Sprite>();
            int quad = -1;
            int generation = 0;
            public QTreeNode parent = null;
            public Rectangle areaRect;
    
            public QTreeNode(int x, int y, int w, int h, QTreeNode parent = null, int generation = 0, int quad = -1)
            {
                areaRect = new Rectangle(x, y, w, h);
                
                this.parent = parent;
                this.quad = quad;
            }
    
            private void createChild(int i)
            {
                childNodes[i] = new QTreeNode(0, 0, this.areaRect.Width / 2, this.areaRect.Height / 2, this, this.generation + 1, 1);
    
                List<Sprite> toDestroy = new List<Sprite>();
    
                foreach (Sprite s in sprites)
                {
                    if(s.collisionRect.Intersects(childNodes[i].areaRect))
                    {
                        childNodes[i].sprites.Add(s);
                        toDestroy.Add(s);
                    }
                }
    
                foreach (Sprite s in toDestroy)
                {
                    this.sprites.Remove(s);
                }
            }
    
            public void update()
            {
                QTreeManager.reloadAllNodes();
                if(sprites.Count == 2)
                {
                    detectCollision();
                }
                else if(sprites.Count > 2 && generation <= 4)
                {
                    while (sprites.Count > 2)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            switch (i)
                            {
                                case 0:
    
                                    createChild(i);
    
                                    break;
                                case 1:
                                    createChild(i);
    
                                    break;
                                case 2:
                                    createChild(i);
    
                                    break;
                                case 3:
                                    createChild(i);
    
                                    break;
                            }
                        }
                    }
                }
                else if (generation > 4)
                {
                    detectCollision();
                }
            }
    
            public void nodeSpriteCheck(Sprite s)
            {
                if (s.collisionRect.Intersects(this.areaRect))
                {
                    for (int i = 0; i < 3; ++i)
                    {
                        if (s.interGrid[i] == null)
                        {
                            s.interGrid[i] = this;
    
                            if (!this.sprites.Contains(s))
                            {
                                this.sprites.Add(s);
                            }
                            
                            break;
                        }
                    }
    
                    if (childNodes[0] != null)
                    {
                        childNodes[0].nodeSpriteCheck(s);
                        childNodes[1].nodeSpriteCheck(s);
                        childNodes[2].nodeSpriteCheck(s);
                        childNodes[3].nodeSpriteCheck(s);
                    }
                }
            }
    
            private void deleteEmptyChildren()
            {
                if (hasChild())
                {
                    if (childNodes[1].sprites.Count == 0 && childNodes[2].sprites.Count == 0 && childNodes[3].sprites.Count == 0 && childNodes[4].sprites.Count == 0)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            childNodes[i] = null;
                        }
                    }
                }
            }
    
            public bool hasChild()
            {
                return childNodes[0] != null;
            }
    
            public bool detectCollision()
            {
                if (sprites[0] == null || sprites[1] == null)
                {
                    return false;
                }
                else if (sprites[0].collisionRect.Intersects(sprites[1].collisionRect))
                {
                    sprites[0].react(sprites[1]);
                    sprites[1].react(sprites[0]);
                    return true;
                }
                else if (!sprites[0].collisionRect.Intersects(sprites[1].collisionRect))
                {
                    return false;
                }
                else
                {
                    Exception ex = new Exception("QTree Error: Collission Detect failed");
                    throw ex;
                }
            }
        }
    }
    
    


    Fixed it. I am stupid with for loop logic.

My Information

Member Title:
D.I.C Regular
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
5
Programming Languages:
C++, C#, javascript, HTML, and i'm learning VB

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Friends

dartoscoder hasn't added any friends yet.

Comments

dartoscoder has no profile comments yet. Why not say hello?