Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Constraining pseudorandomisation to a maximum distance

edited June 2018 in OpenSesame

Hi all,

I am programming a variation of the n-back task. I am presenting a string of 16 letters (using a loop with the variable, letter). 12 of the letters are unique and four are repeated.
In the 1-back condition, the repeated letters must be presented immediately after the first appearance of the letter.
In the 2-back condition, the repeated letters must be presented 2 letters after the first appearance of the letter.
In the 3-back condition, the repeated letters must be presented 3 letters after the first appearance of the letter.

I am hoping to randomise the order of the presentation of the letters but need to constrain the presentation of the repeated letters.
There is the constrain variable mindist function, which can set a minimum distance for the repeated letters. Is there an equivalent maxdist? If so, I can set mindist and maxdist to the same value.

If not, how can I ensure the presentation at the correct number of letters?

Attached is a picture of how my experiment currently looks (the letters are assigned in the set_stims_order inline scripts).

Thank you in advance for any help people can provide.

Kyran.

Comments

  • Hey,

    I do not know about the maxdist function but just one question can the first presentation of a repeated letter happen successively, like:

    ABCAB... (for the 3 back here for instance)?

    Best,

    Sylvain

  • Hi Sylvain,

    Thank you for your response.

    Yes, the different presentations can be intermixed as you have described.

    Kyran.

  • Hello Kyran,

    I think this should work.
    Look at this example for the 3-back:

    import random
    letter = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
    
    random.shuffle(letter)
    
    n_back = 3
    # define the possible slot where the repeated item can be
    all_slot_possible_repeat = range(n_back, 16)
    # define all slot possible
    all_slot_possible_all = range(16)
    
    #define the final list of stims
    var.list_final = ['NA'] * 16
    
    for i in range(4):
        # select a slot randomly in all_slot_possible
        element_repeat = random.choice(all_slot_possible_repeat)
        # remove this slot from the list all_slot_possible_repeat and all_slot_possible_possible
        all_slot_possible_repeat.remove(element_repeat)
        # now for the first presentation
        element_first = element_repeat - n_back
        if element_first in all_slot_possible_repeat:
            all_slot_possible_repeat.remove(element_first)
        # now fill var.list_final
        var.list_final[element_repeat] = letter[0]
        var.list_final[element_first] = letter[0]
        # remove the letter
        letter.pop(0)
    
    # now fill the remaining letters
    
    for pos, value in enumerate(var.list_final):
        if value == 'NA':
            var.list_final[pos] = letter[0]
            letter.pop(0)
    

    Also a script attached to show you how to populate your loops.

    I hope it helps!

    Sylvain

  • Sorry for getting back to you so late but thank you so much for doing that, Sylvain.

    I will have a look now to see how it works for me.

  • Brilliant, that does precisely what I need it to.

    Thank you very much for your efforts, I really appreciate it.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games