EL3300 Assignment 2020/21 Appendix A Referencing and using the supplied dll.

EL3300 Assignment 2020/21

Appendix A

Referencing and using the supplied dll.

 

Referencing.

Step 1. Download the dll from blackboard to an appropriate location.

Step 2. Load Visual Studio.

Step 3. Create new C# windows form application.

Step 4. In the solution explorer window right click on the references, select add reference.

Step 5. Browse to the place where you saved the dll.

Step 6. Select dll and click OK.

Step 7. At the top of the project add the line :

using cwk2021;

 

Using the fitness function.

The library contains one fitness function (evalFunc) in a single class (FitFunc).

As described in the coursework the fitness function expects to receive a 100 character long string and will return an integer.  If the string it receives is the wrong length it will return the value -999999.

An example of accessing the function and writing the result into a textbox is given below :

 

FitFunc test = new FitFunc();

string runSettings = “1011111110101010101010101010101010101010101110101010101010101010111110101010101010101010101010101010”;

int value = test.evalFunc(runSettings);

textBox1.Text = “Fitness rank = ” + value;

 

The highest and lowest valid grading ranks are unknown at this time.