# Random digit analysis & 4th level analysis for MC Questions.

Hello OpenSesame community,

I need some help regarding some programming in OpenSesame because what is required I do not think that it may be done with the loop table. The experiment is about remembering random digits, and the area that I have difficulty is the following:

Random Digits Analysis

The five random digits that my experiment is already producing should be independent from one another. For example, the random digit 54321 is not Fifty-Four-Thousand-And-Three-Hundred-And-Twenty one, but is Five Four Three Two One. Should another random number such as 12345 be removed from 54321 the result should not be 41975, but it should be 4 2 0 -8 -6, like so:

54321 -

12345

41975 (not right)

5 4 3 2 1 -

1 2 3 4 5

4 2 0 -8 -6 (right).

So OpenSesame should calculate how many zeros there are when the provided random digits are removed from the presented ones. The greater the number of zeros the more accurately they remembered the presented random digits that I am measuring. The digits are provided from OpenSesame with the following inline script:

import random

randnr = random.randint(10000,99999)

exp.set("randnum",randnr)

The other issue is about level four calculations in multiple choice questions. Here is what I mean:

Level one

Correct_Answer = 1

Incorrect_Answer = 0

Level two

Yes = 1

No = 0.5

Level Three

Yes + Correct_Answer = 2

No + Correct_Answer = 1.5

Yes + Incorrect_Answer = 1

No + Incorrect_Answer = 0.5

Level 4

If 2 then = Happy

If 1.5 then = Meltdown

If 1 then = Fabulous

If 0.5 then = Reality

So OpenSesame should calculate how many Happy-ies, Meltdown-s, Fabulous-s, and Reality-s a participant scored while providing their random digits after viewing the presented ones. I know a bit of programming, I know that it should be a simple if/then issue, but I do not know what exactly should be typed where in order to get what I want in OpenSesame 3.1.

Thanks in Advance

Diedon

## Comments

And I better mention this in time also,

The MC Questions are randomized. So I have all the choice answers and a question in column 1, then 2, 3, 4, 5, ... and so on. I am keeping it this way so as to randomize the order of the presented MC question. Thereby solutions such as calling Correct_Answer variables as numbers or as "congruent" such as below does not work. The MC Questions have to be numerized some other way first, and then be called as Happy, Meltdown, Fabulous, and Reality.

http://osdoc.cogsci.nl/2.9/tutorials/step-by-step-tutorial/#step-8-configure-the-incorrect-sampler-item

Hi,

To start with the first question. You give the following as an example of what should happen:

But I don't understand this. If you simply subtract the second numbers from the first ones, shouldn't it be:

Or do I misunderstand?

Regarding the second question, you can access experimental variables using

`var.[varname]`

. So what you're describing would go something like:Of course, this is just a rough sketch. The details depend on how you have coded your experiment.

Cheers!

Sebastiaan

Thanks Sebastian,

Regarding the numbers, you subtract the 1st from the second.

You'll have to be a little more specific here, because in your example you're clearly not subtracting the first from the second digit.

In any case, say that you do want subtract the first from the second digit, then you could do so with a script like the one below. You could implement other operations in a similar way.