[C++] Assignment 7: Pipe Attack
13 11 2012This is a trace back of older assignment. May be I was too tired to blog this at that time? I do not know.
I intended to make this assignment a test of the logic I planed for my own other project. It is a pipe connecting game which a player can tap and rotate a pipe tile to connect them into a complete water way. The logic is not limited by the platform, if I can test it out and make that an assignment, why not? Smart hah!
We need to start with a flow chart this time. I have that every time so no worry. I have a brief lecture from my professor and he told me I can save many work if I replace the array with a class and make use of function with the class. I should have learn that when I was learning Java and I sort of need that for Actionsript 3.0 seven years ago. But at that time this was not covered in the course and I was into something else so I terminated my progress in learning programming. I know that I need to learn that some point in my life and this is the chance.
The product is a simplified pipe attack with just one row. I am testing out the logic so rows number does not matter. Everything is going smoothly until I am parsing a class into a function. I admit that my foundation is not good. This code simply don’t work:
output(a[]);
But at this moment I need to move on, so I went to plan B. Using switch can solve the issue. The logic still remain the same. But I am not making the process into a neat and tidy function. If I am making more rows I may have to copy and paste the logic to infinity. This is how it became:
The game runs like this: first input the row which the rotating tile belongs to. In here we have just one row, so A. Then the column. If they are all horizontal, you win.










