Howdy, Stranger!

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

Supported by

Constrain not working

Hello!

I am almost finished with my experiment but I have one last little problem to solve. In the 'different' loops I do not want any objects repeated. So I have made a column that is called nbr and I have assigned all rows with repeating objects the same number. Then I put constrain nbr maxrep=1. When I do this one row is repeated every time. I do not know why? Furthermore, I do not want the correct answer to land on the same side more than twice. So, I made a column labeled side where the items are 'l' and 'r.' Then I put constrain side mindist=2. If I put both:

constrain side mindist=2
constrain nbr maxrep=1
it will not run. it says error (maxshuffle=100)

I would appreciate any advice you may have! Thanks so much in advance.

Best,
Mollie

Comments

  • Hi Mollie,

    > Then I put constrain nbr maxrep=1. When I do this one row is repeated every time. I do not know why?

    Could you give an example of this? This constraint has the effect of not allowing the same value of `nbr` to be repeated. But perhaps that's not what you mean by one row being repeated?

    Cheers!
    Sebastiaan
  • Hey Sebastian!

    Thanks for your reply! I do not want any of the same objects repeated during a block. I am measuring proactive interference so during one block every trial should have the same objects and during the other block every trial should have different objects. So, there are four different ways that object 3 and object 4 can be presented I have labeled all of the these with ‘nbr’ 1. There are four different ways that object 5 and object 6 can be presented so I have labeled these ‘nbr’ 2. When I put constrain ‘nbr’ Maxrep=1 I am hoping that it will display the objects that have ‘nbr’ 1 one time, that have nbr 2 one time etc. Therefore, no objects should be presented twice during a block. Thanks so much!

    Best,
    Mollie
  • Hi Mollie,

    Right, I see now. That's not what the maxrep constraint does, though: It prevents direct repetitions of some value, i.e. in consecutive rows.

    But what you want is essentially to have some variables (left and right) fixed while others (target, elmo, and side) are randomly chosen.

    I would do this using the Python random.choice() function, like so:

    Do you get the idea? So you select a fixed value for left and right, and randomly select values for the other variables. You don't need any constraints other advanced loop operations.

    To make this work, you need to import the choice() function into the Python workspace of OpenSesame. You can do this by inserting an inline_script at the start of the experiment with the following line in the Prepare phase:

    from random import choice
    

    Cheers!
    Sebastiaan

  • Hey Sebastian,

    Thanks so much. The problem with this is I don't want the target to be a random choice because I want to make sure that the correct answer does not end up on the same side more than twice in a row. So I do not want any objects repeated but I also don't want the correct answer to be on the same side more than twice in a row. Does that make sense? If I am randomly selecting the target then I can't control if the correct answer is on the right or left. Sorry about the confusion! Thanks so much for any advice.

    I appreciate your time,
    Mollie

  • Sorry one more thing! When I try what you suggested I get an error.
    TypeError: choice() takes exactly 2 arguments (3 given)... any idea why? Thanks so much!

  • Hi Mollie,

    I see. So if I understand correctly, for some variables, such as side, you want:

    • A random starting value for the first cycle
    • Then switch to another value (the other side) on each subsequent cycle

    You could do this with a clever expression in the loop table, but that's probably more trouble then it's worth. So instead I would insert an inline_script at the start of the sequence and define the variable in the Prepare. Here's a dummy example that implements the basic logic:

    from random import choice
    
    # On the first cycle, randomly pick a value
    if var.live_row == 0:
        var.my_var = choice(['a', 'b'])
    # On subsequent cycles, switch from a to b or vice versa
    elif var.my_var == 'a':
        var.my_var = 'b'
    elif var.my_var == 'b':
        var.my_var = 'a'
    # A sanity check to make sure that there are no typos etc.
    else:
        raise ValueError('This should not happen!')
    

    TypeError: choice() takes exactly 2 arguments (3 given)... any idea why?

    Right, the elements to choose from should have been inside a [l, i, s, t] rather than passed as individual arguments!

    Cheers!
    Sebastiaan

  • thank you!!

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