"""Normalize 12 per-app Time instruction fragment templates.""" from pathlib import Path ROOT = Path(__file__).resolve().parents[1] INST = ROOT / "_templates" / "instructions" LOT_TABLE_4W = """
Which is your preferred alternative
The Lottery - Tomorrow or The Lottery - 4 weeks
which pays

$9.00 tomorrow if the coin shows head
or
$4.00 tomorrow if the coin shows tail.

which pays

$12.00 in 4 weeks if the coin shows head
or
$6.50 in 4 weeks if the coin shows tail.

""" LOT_TABLE_8W = LOT_TABLE_4W.replace("CB99D9", "2E8B57").replace("4 weeks", "8 weeks") _CLOSING = "{% include 'instructions/instructions_closing.html' %}" def lot_payoff(weeks_color: str, weeks_label: str) -> str: return ( f"""

This task will consist of 3 rounds each containing 6 choices. That means that you will make a total of 18 choices similar to the example above. For all 18 choices the payment dates remain the same. However, the monetary amounts of the lotteries differ. Within one round, the amounts of the Lottery - Tomorrow remain constant. They only change once you start a new round. The amounts of the Lottery - {weeks_label}, on the other hand, differ from choice to choice. It is very important that you pay attention to those changes when you make your decision.

Payoff

If your choice for this part (Part 2) is selected for payment, we will randomly select one out of the four tasks in this part and implement the payment on the respective date of payment. Each choice has the same probability of being selected for payment. The computer will then randomly conduct the lottery by simulating a coin toss on the respective date according to your choice. According to the outcome of the coin toss you will then either receive the higher amount if the coin shows heads or the lower amount if the coin shows tails. Since all of your choices in this part have the same probability to be chosen for payment, it is always in your best interest to choose the option you prefer the most.

Please note again that the questions are not designed to test you. There are no right or wrong answers. Simply choose the payment option that you prefer the most.

""" + _CLOSING + "\n" ) LOT_PAYOFF_4W = lot_payoff("#CB99D9", "4 weeks") LOT_PAYOFF_8W = lot_payoff("#2E8B57", "8 weeks") LOT_TASK1_4W = """

This part of the study will consist of four tasks. We will explain one task at a time, starting with the first task.

Part 2 - Task 1
In the first task you will have to choose between different lottery alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Lottery - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the two potential amounts you can earn in that lottery are usually low. The second alternative, which we refer to as the Lottery - 4 weeks will be paid out in 4 weeks (i.e., {% include 'instructions/payment_date_28.html' %}). Since this alternative will be paid out "later", the two potential amounts you can earn in that lottery are usually higher. The example below illustrates this. By comparing the outcomes of the two lotteries, you can see how both the outcome in the best case scenario and the outcome in the worst case scenario are higher in the Lottery - 4 weeks.
Your task is to choose between the Lottery - Tomorrow and the Lottery - 4 weeks. Each lottery will pay you either the high or the low amount depending on the outcome of a computerized coin toss. So for each amount, there exists a 50-50 chance that it will materialize.

""" LOT_TASK1_8W = """

Task 1 of this part continues with a longer payment horizon. The only difference is that the second alternative will be paid out in 8 weeks, instead of 4 weeks. Apart from the payment date, the instructions are identical to those for Task 1. We include them here in case you would like to review them. Once you have completed Task 1, we will explain the next task.

Part 2 - Task 1
In the first task you will have to choose between different lottery alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Lottery - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the two potential amounts you can earn in that lottery are usually low. The second alternative, which we refer to as the Lottery - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the two potential amounts you can earn in that lottery are usually higher. The example below illustrates this. By comparing the outcomes of the two lotteries, you can see how both the outcome in the best case scenario and the outcome in the worst case scenario are higher in the Lottery - 8 weeks.
Your task is to choose between the Lottery - Tomorrow and the Lottery - 8 weeks. Each lottery will pay you either the high or the low amount depending on the outcome of a computerized coin toss. So for each amount, there exists a 50-50 chance that it will materialize.

""" LOT_TASK2_4W = """

Task 2 of this part is almost identical to Task 1. The only difference is that you will have to choose between different lottery alternatives, instead of fixed alternatives. Please read the instructions below for a detailed description. Once you have completed Task 2, we will explain the next task.

Part 2 - Task 2
In the second task you will have to choose between different lottery alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Lottery - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the two potential amounts you can earn in that lottery are usually low. The second alternative, which we refer to as the Lottery - 4 weeks will be paid out in 4 weeks (i.e., {% include 'instructions/payment_date_28.html' %}). Since this alternative will be paid out "later", the two potential amounts you can earn in that lottery are usually higher. The example below illustrates this. By comparing the outcomes of the two lotteries, you can see how both the outcome in the best case scenario and the outcome in the worst case scenario are higher in the Lottery - 4 weeks.
Your task is to choose between the Lottery - Tomorrow and the Lottery - 4 weeks. Each lottery will pay you either the high or the low amount depending on the outcome of a computerized coin toss. So for each amount, there exists a 50-50 chance that it will materialize.

""" LOT_TASK2_8W = """

Task 2 of this part is almost identical to Task 1. The only difference is that the second alternative will be paid out in 8 weeks, instead of 4 weeks. Apart from the payment date, the instructions are identical to those from Task 1. We include them here in case you would like to review them. Once you have completed Task 2, we will explain the next task.

Part 2 - Task 2
In the second task you will have to choose between different lottery alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Lottery - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the two potential amounts you can earn in that lottery are usually low. The second alternative, which we refer to as the Lottery - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the two potential amounts you can earn in that lottery are usually higher. The example below illustrates this. By comparing the outcomes of the two lotteries, you can see how both the outcome in the best case scenario and the outcome in the worst case scenario are higher in the Lottery - 8 weeks.
Your task is to choose between the Lottery - Tomorrow and the Lottery - 8 weeks. Each lottery will pay you either the high or the low amount depending on the outcome of a computerized coin toss. So for each amount, there exists a 50-50 chance that it will materialize.

""" LOT_84_TASK1_8W = """

This part of the study will consist of four tasks. We will start by explaining the first task. Once you have completed Task 1, we will explain the next task.

Part 2 - Task 1
In the first task you will have to choose between different lottery alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Lottery - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the two potential amounts you can earn in that lottery are usually low. The second alternative, which we refer to as the Lottery - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the two potential amounts you can earn in that lottery are usually higher. The example below illustrates this. By comparing the outcomes of the two lotteries, you can see how both the outcome in the best case scenario and the outcome in the worst case scenario are higher in the Lottery - 8 weeks.
Your task is to choose between the Lottery - Tomorrow and the Lottery - 8 weeks. Each lottery will pay you either the high or the low amount depending on the outcome of a computerized coin toss. So for each amount, there exists a 50-50 chance that it will materialize.

""" def ce_table_footer(weeks_color: str, weeks_label: str, date_include: str) -> str: return ( f"""
Which alternative do you prefer?
The Alternative – Tomorrow or The Alternative – {weeks_label}
which pays

$4.00 tomorrow.

which pays

$10.00 in {weeks_label}.


This task will consist of 3 rounds each containing 6 choices. That means that you will make a total of 18 choices similar to the example above. For all 18 choices the payment dates remain the same. However, the monetary amounts you can earn differ. Within one round, the amounts of the Alternative - Tomorrow remain constant. They only change once you start a new round. The amounts of the Alternative - {weeks_label}, on the other hand, differ from choice to choice. It is very important that you pay attention to those changes when you make your decision.

Payoff

If your choice for this part (Part 2) is selected for payment, we will randomly select one out of the four tasks in this part and implement the payment on the respective date of payment. Each choice has the same probability of being selected for payment. Since all of your choices in this part have the same probability to be chosen for payment, it is always in your best interest to choose the option you prefer the most.

Please note again that the questions are not designed to test you. There are no right or wrong answers. Simply choose the payment option that you prefer the most.

""" + _CLOSING + "\n" ) def write_ce_48_4w(): content = """{% if discount_seq == 2 %}

This part of the study will consist of four tasks. We will explain one task at a time, starting with the first task.

Part 2 - Task 1
In the first task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 4 weeks will be paid out in 4 weeks (i.e., {% include 'instructions/payment_date_28.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 4 weeks.

{% endif %} {% if discount_seq == 1 %}

Task 3 of this part is almost identical to Task 1. The only difference is that you will have to choose between different fixed alternatives, instead of lottery alternatives. Please read the instructions below for a detailed description. Once you have completed Task 3, we will explain the next task.

Part 2 - Task 3
In the third task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 4 weeks will be paid out in 4 weeks (i.e., {% include 'instructions/payment_date_28.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 4 weeks.

{% endif %} """ content += ce_table_footer("#CB99D9", "4 weeks", "payment_date_28") (INST / "time_ce_48_4w.html").write_text(content, encoding="utf-8") def write_ce_48_8w(): content = """{% if discount_seq == 2 %}

Task 2 of this part is almost identical to Task 1. The only difference is that the second alternative will be paid out in 8 weeks, instead of 4 weeks. Apart from the payment date, the instructions are identical those for Task 1. We include them here in case you would like to review them. Once you have completed Task 2, we will explain the next task.

Part 2 - Task 2
In the second task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 8 weeks.

{% endif %} {% if discount_seq == 1 %}

Task 4 of this part is almost identical to Task 3. The only difference is that the second alternative will be paid out in 8 weeks, instead of 4 weeks. Please read the instructions below for a detailed description. Once you have completed Task 4, you will proceed to the next part of the study (Part 3).

Part 2 - Task 4
In the forth task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 8 weeks.

{% endif %} """ content += ce_table_footer("#2E8B57", "8 weeks", "payment_date_56") (INST / "time_ce_48_8w.html").write_text(content, encoding="utf-8") def write_ce_84_4w(): content = """{% if discount_seq == 4 %}

Task 2 of this part is almost identical to Task 1. The only difference is that the second alternative will be paid out in 4 weeks, instead of 8 weeks. Apart from the payment date, the instructions are identical those for Task 1. We include them here in case you would like to review them. Once you have completed Task 2, we will explain the next task.

Part 2 - Task 2
In the second task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 4 weeks will be paid out in 4 weeks (i.e., {% include 'instructions/payment_date_28.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 4 weeks.

{% endif %} {% if discount_seq == 3 %}

Task 4 of this part is almost identical to Task 3. The only difference is that the second alternative will be paid out in 4 weeks, instead of 8 weeks. Please read the instructions below for a detailed description. Once you have completed Task 4, you will proceed to the next part of the study (Part 3).

Part 2 - Task 4
In the forth task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 4 weeks will be paid out in 4 weeks (i.e., {% include 'instructions/payment_date_28.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 4 weeks.

{% endif %} """ content += ce_table_footer("#CB99D9", "4 weeks", "payment_date_28") (INST / "time_ce_84_4w.html").write_text(content, encoding="utf-8") def write_ce_84_8w(): content = """{% if discount_seq == 4 %}

This part of the study will consist of four tasks. We will explain one task at a time, starting with the first task.

Part 2 - Task 1
In the first task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 8 weeks.

{% endif %} {% if discount_seq == 3 %}

Task 3 of this part is almost identical to Task 1. The only difference is that you will have to choose between different fixed alternatives, instead of lottery alternatives. Please read the instructions below for a detailed description. Once you have completed Task 3, we will explain the next task.

Part 2 - Task 3
In the third task you will have to choose between different fixed alternatives, which will be paid out at two different points in time. The first alternative, which we refer to as the Alternative - Tomorrow will be paid out tomorrow. Since this alternative will be paid out "sooner", the monetary value is usually low. The second alternative, which we refer to as the Alternative - 8 weeks will be paid out in 8 weeks (i.e., {% include 'instructions/payment_date_56.html' %}). Since this alternative will be paid out "later", the monetary value is usually higher. The example below illustrates this.
Your task is to choose between the Alternative - Tomorrow and the Alternative - 8 weeks.

{% endif %} """ content += ce_table_footer("#2E8B57", "8 weeks", "payment_date_56") (INST / "time_ce_84_8w.html").write_text(content, encoding="utf-8") def main(): write_ce_48_4w() write_ce_48_8w() write_ce_84_4w() write_ce_84_8w() (INST / "time_Lot_1_48_4w.html").write_text( LOT_TASK1_4W + LOT_TABLE_4W + LOT_PAYOFF_4W, encoding="utf-8", ) (INST / "time_Lot_1_48_8w.html").write_text( LOT_TASK1_8W + LOT_TABLE_8W + LOT_PAYOFF_8W, encoding="utf-8", ) (INST / "time_Lot_2_48_4w.html").write_text( LOT_TASK2_4W + LOT_TABLE_4W + LOT_PAYOFF_4W, encoding="utf-8", ) (INST / "time_Lot_2_48_8w.html").write_text( LOT_TASK2_8W + LOT_TABLE_8W + LOT_PAYOFF_8W, encoding="utf-8", ) (INST / "time_Lot_1_84_4w.html").write_text( (INST / "time_Lot_1_48_4w.html").read_text(encoding="utf-8"), encoding="utf-8", ) (INST / "time_Lot_1_84_8w.html").write_text( LOT_84_TASK1_8W + LOT_TABLE_8W + LOT_PAYOFF_8W, encoding="utf-8", ) (INST / "time_Lot_2_84_4w.html").write_text( (INST / "time_Lot_2_48_4w.html").read_text(encoding="utf-8"), encoding="utf-8", ) (INST / "time_Lot_2_84_8w.html").write_text( (INST / "time_Lot_2_48_8w.html").read_text(encoding="utf-8"), encoding="utf-8", ) for old in [ "time_ce_48_4w_body.html", "time_ce_48_8w_body.html", "time_lot_4w_body.html", "time_lot_8w_body.html", ]: p = INST / old if p.exists(): p.unlink() print("removed", old) if __name__ == "__main__": main()