Tuesday, March 23, 2010

Test coverage, 4:30AM and Spaghetti Breakfast

I woke up today at 4:30 AM and started to write code. I think I fixed the issues I mentioned in my last post regarding excessive abstraction. I also installed EclEmma and got that working. I already feel a little bit better, knowing that I don't have to waste time making sure I'm testing all my public methods. I just run EclEmma and it highlights tested code green, and untested code ends up being red. I can tell already that I'm going to like it. I think it will take me a few more days before I have a working color display using all the tested code that I've been writing, as long as using interfaces and such with easily-interchangeable renderers and such. (one renderer will handle the standard color-char displays, while another will deal with formatted text)

Question: On rec.roguelike.dev, I've seen some talk about using Dictionaries and the keyword/value pairs as a container for display or whatever. This intrigues me because I've been using this object quite a bit at work, and I'd like for the size of my display object to be able to dynamically size. (I wouldn't necessarily need to clear out unused key-value pairs, unless it was a memory issue). Basically, the display would have key value pairs for each character that had been added to the display, and it would also have a range of what to display, if a user were to zoom in, the range would shrink, the individual cells would enlarge, and fewer of the key-value pairs would need to be updated each refresh. If a user zoomed out, the cells would shrink and the range would expand, and more key-value pairs would need to be added/refreshed.

I suppose the same thing could be accomplished by just creating a 2d array with the maximum size that would be used if the level were zoomed all the way out, and still use the min/max range values to control what is getting updated and displayed; mostly I was just intrigued by key-value pairs.

Also, I ate spaghetti for breakfast.

1 comment:

Tom Balog said...

I didn't follow a thing except for the spaghetti.