Skip to main content Accessibility help
×
Hostname: page-component-848d4c4894-4rdrl Total loading time: 0 Render date: 2024-06-20T00:55:12.991Z Has data issue: false hasContentIssue false

Chapter V - Decision making in E-Basic

Published online by Cambridge University Press:  22 November 2022

Get access

Summary

In this chapter, you will learn

In this chapter you will meet some more advanced E-Prime magic. You will learn how to implement two very interesting psychological paradigms, namely the Ultimatum and Cyberball games. As these games require decision making, you need to know how to implement decision making code within an experimental design. Therefore, we first explain certain decision structures with the use of flow charts, which is a helpful way of visualising a program's decision structure before getting down to actually implementing it. Then you will learn some E-Basic commands, such as If-Then, and several important operators (And, Not and the beloved Xor). In addition, you find out how to end the experiment (or part of it) prematurely, based on certain conditions. Finally, in two tutorials, you will learn how to put this knowledge to use and create the Ultimatum and Cyberball games for yourself.

The If-Then statement

Like shopping, programming is all about making the right decisions. The way this works in programming context is that we ask the computer to run one piece of code, or another, depending on the value of some variable. That is, depending on the value of the variable, the program proceeds down one path, or the other. This is called a branching structure.

For example, assume that you have set up an experiment where timing is critical. You want it to only run with a screen refresh rate of 60 Hz. In a flow chart, we can map out exactly how this will work.

From this flow chart, we can see that the program has to makes a decision: depending on the conditional expression ‘ screenfreq = 60’ the experiment should proceed with (run) one of the two branches. The decision part of this chart (the diamond symbol) demonstrates that we need a so-called control structure.

To implement this structure in E-Basic, we need the If-Then-Else-EndIf statement (for short, the If-Then statement). This statement (or combination of statements) checks a set of conditions, and if the conditional expression is evaluated to True, then the program takes some particular course of action. Optionally, if the condition is not met, it does something else instead.

Type
Chapter
Information
The E-Primer
An Introduction to Creating Psychological Experiments in E-Prime
, pp. 135 - 160
Publisher: Amsterdam University Press
Print publication year: 2019

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×