Azure Jane Lunatic (azurelunatic) wrote,
Azure Jane Lunatic

  • Mood:
  • Music:


So we're doing a tic-tac-toe board for our final in C++; yesterday we worked on displaying the board and the element numbers for each square.

I worked out an alternate way of calling the vertical and horizontal line functions than the teacher showed us. The VB teacher taught us that we ought to feel badly when rewriting code over and over, that we should do things differently -- so I worked out a bit of code that I think I could work into a reusable code, the function that I will work up as "Alternate" -- very very simple.

Using Alternate, I did some for-loop indicator black magic and got the element numbers to display without use of static variables that get reset each pass through.

Ron's way works too, of course, but mine is slightly less comprehensible, and more elegant -- mine does it automatically.

Of course, there's probably a reason his needs to work, but I'll still keep that one line in there that's my original thought, and test it each run through to see where it fails.
Comments for this post were disabled by the author