Code center > Darwinbots3
Helping
havingphun:
Ok Numsgil. What do you mean by test cases? Would they require programming to create? If not I could try to help with those.
Botsareus:
It is not really creating, it's viewing an algorithm, understanding what it does, and sending the test idea to Numsgil.
example:
--- Code: ---cond
*.nrg 1000 >
start
10 .up store
stop
end
--- End code ---
A good test for that will be "Does the robot go up when energy is being set over 1000?"
Obviously c# is more complex then darwin bot code, but you should get an idea.
--- Quote ---Also this forum is a 'little' dead
--- End quote ---
I am the only one (as I understand) who is actively working on changes to the program, but I am slow and impulsive so I guess the form is kinda dead...
Numsgil:
--- Quote from: havingphun on May 11, 2012, 03:45:23 PM ---Ok Numsgil. What do you mean by test cases? Would they require programming to create? If not I could try to help with those.
--- End quote ---
If you can figure out the coding, great. If not, I can do the coding myself and it'd still save some time. But you still probably need a basic idea of what I'm doing to help build the tests.
Right now I'm working on something called a Straight skeleton. I have a few test cases I'm failing right now, and I'm working on fixing those. But there's probably quite a few cases I'm missing.
The input would be a simple polygon (possibly with holes), which would be a list of vertex positions in 2D. The output is a list of edges (that is, connections between two of the vertices). If you come up with test cases yourself that would be great, but it's actually pretty difficult. If you could find a working implementation of a straight skeleton online and feed in the input, and get back the output, and parse it in a way I can use for my own tests, that could be quite helpful. I think there's a Java implementation floating around the internet, for instance.
I have the easy ones right now (triangle, square, rectangle). But I'm missing any complicated convex polygon test cases. That would be a good place to start. Imagine the silhouette a potato would make, for instance. Also, regular polygons, (triangles, squares, octahedrons, etc.) are tricky problems because all the edges meet at a single interior point. I only have a up to something that looks like a prism or pencil shape right now. A full octahedron would be a good test case. A hybrid between a potato and a regular polygon would also be a good test case.
Check out this file. Look for the second "public void Triangle()"
It looks like this:
--- Code: ---public void Triangle()
{
var vertices = new PerforatedPolygon(new SimplePolygon(new Vector[]
{
new Vector(0, 0),
new Vector(1, 0),
new Vector(0.5, Math.Sqrt(3)/2),
}));
var expectedStraightSkeleton_AdditionalVerts = new Vector[]
{
new Vector(0.5, Math.Sqrt(3)/6),
};
var expectedStraightSkeleton_AdditionalEdges = new int[]
{
0, 3,
3, 1,
3, 2,
};
var straightSkeleton = StraightSkeleton.BuildStraightSkeleton(vertices);
CheckSimilarity(straightSkeleton,
vertices,
expectedStraightSkeleton_AdditionalVerts,
expectedStraightSkeleton_AdditionalEdges);
}
--- End code ---
The "vertices" are the vertices in the initial polygon. The "_AdditionalVertices" are vertices created by the straight skeleton. The "_AdditionalEdges" are edges created by the straight skeleton. The first integer is the index of the first vertex, and the second integer is the index of the second vertex, assuming counting starts at 0, and the additional vertices get added to the end of the original vertices.
...
If you can write me some new tests using the above as a template, that would be great! If not, don't worry about it. There are some other areas that need tests, too, that might be a bit easier to do (things like testing rays for collision, that sort of thing).
Botsareus:
I thought we are going with only 4 sided polygons :blink:
Numsgil:
This is for the graphics engine, actually.
And I'll probably use it for shapes in the simulation, so that bots can tunnel in to them and form ant nests.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version