A Scilab game for memorizing lots of things

This is just an improvement of the program that I described in my previous post.

That version was hard-coded just for learning binary-hex conversion but there are many things in life to memorize besides binary and hexadecimal numbers, so I decided to make the program a little bit more general.

Now, the list of questions and answers is stored in a separate matrix. It is in the beginning of the code, and can be easily updated.

Also, instead of buttons for all possible answers (which can be many), only five choices are given.

binhex2_1

The code is as follows.


clear,clc;

QA = [...
'0000' '0'
'0001' '1'
'0010' '2'
'0011' '3'
'0100' '4'
'0101' '5'
'0110' '6'
'0111' '7'
'1000' '8'
'1001' '9'
'1010' 'A'
'1011' 'B'
'1100' 'C'
'1101' 'D'
'1110' 'E'
'1111' 'F'];

question = QA(:,1);
answ = QA(:,2);

L = size(question,1);
i_previous = -1;

while (%t)
    i = grand(1,1,"uin",1,L);
    while i == i_previous
        i = grand(1,1,"uin",1,L);
    end

    msg = question(i);
    
    key = [i];
    while length(key) < 5
        j = grand(1,1,"uin",1,L);
        if ~or((j == key)) then
            key = [key j];
        end
    end
    key = key(grand(1,"prm",(1:5)')); 
    
    buttons = answ(key);
    k = messagebox(msg,'','question',buttons,'modal');
    if k < 1 then
        abort
    end

    while (i <> key(k))
        wrong = 'Wrong! '+msg+' is not ' + answ(key(k));
        nxt = messagebox(wrong,'Ohh...','error',...
        ['Try again','Try another','Finish'],'modal')

        if nxt == 1 then
            k = messagebox(msg,'','question',...
            buttons,'modal');
            if k < 1 then
                abort
            end
        elseif nxt == 2 then
            break
        else
            abort
        end
    end

    if i == key(k) then
        good = 'Good! '+msg+' is '+answ(key(k));
        nxt = messagebox(good,'Wow...','',...
        ['Next','Finish'],'modal')
        if nxt <> 1 then
            abort
        end
    end

    i_previous = i;
end

If you want to practice memorizing something else, say, Italian military words, you just need to change the matrix of questions and answers:


QA = [...
'l''attacco' 'the attack'
'il jet da combattimento' 'the fighter jet'
'il cessate il fuoco' 'the cease fire'
'il comandante' 'the commander'
'l''esercito' 'the army'
'il generale' 'the general'
'l''elicottero' 'the helicopter'
'la vittima' 'the casualty'
'il missile' 'the missile'
'il soldato' 'the soldier'
'il carro armato' 'the tank'
'la battaglia' 'the battle'
'la bomba' 'the bomb'
'l''esplosione' 'the explosion'
'la forza aerea' 'the airforce'
'la granata' 'the grenade'
'la guerra' 'the war'
'l''invasione' 'the invasion'
'la marina' 'the navy'
'la pace' 'the peace'
'le armi' 'the weapons'];

binhex2_2

It also works well for memorizing Q-signals (link)

binhex2_3

Happy learning!

Advertisements
Published in: on 15/03/2015 at 01:45  Leave a Comment  

The URI to TrackBack this entry is: https://burubaxair.wordpress.com/2015/03/15/a-scilab-game-for-memorizing-lots-of-things/trackback/

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: