[Browse] [Tag cloud]

Log on:
Powered by Elgg

Melissa Katie Brennan :: Blog

May 03, 2007

At first I was going to attempt the Chatbot program, as I had absolutely no clue how to do the Mastermind version. After a few days of thinking, the Mastermind idea suddenly became much, much clearer than the Chatbot, and so I eventually decided to do the Mastermind one.

The initial idea was to use an array to store the code sequence, but was quickly changed to vectors as they were easier to extract and compare information from.

When the main body of the code had been finished, dynamic validation was started, and instantly ran into a problem. Instead of taking the first value of the user-created vector and checking it against the computer-generated vector, it instead did it the other way around, giving out sixteen lines of guidance instead of four. This was eventually resolved.

Another error was that if, in the computer-generated code, there was a repeat element generated by a random number generator, the program would count it twice. For example, if the code generated was v, c, y, c and the code the user inputted was h, c, t, k the program would indicate two correct elements in the incorrect place. This was resolved by changing the number generator from generating a number which was associated with an element, and instead associated it with a vector.

I learned a number of things while doing this program, most specifically how to use vectors in more detail and to not get so frustrated when using code which I think should work, and doesn't.

Posted by Melissa Katie Brennan | 0 comment(s) | Share

October 20, 2006

Learned how to use "if...else" statements in C with a bit of help, got part 2B working (although it is the same four questions asked rather than using random numbers to create four different ones each time).

Part 2A was pretty easy, it was mainly a rejig of the exercise in the tutorial yesterday.

 

Keywords: Programming, SE1SA5

Posted by Melissa Katie Brennan | 1 comment(s) | Share

/