Forcing a certain outcome

David McFarlane mcfarla9 at msu.edu
Thu Jun 17 19:43:20 UTC 2010


It seems to me that something is missing from your description.  In 
particular, you define a function called "PointMod()", but I do not 
see where you use that function.  Also, I do not see where you set 
FirstTrial to False after the first trial.

Beyond that, PointMod() re-initializes the PRNG on each call (see the 
Randomize topic in the online E-Basic Help), this is poor programming form.

This is all elementary computer programming stuff that would be 
covered in any intro class.  So I wonder, what training do you have 
in computer programming?

-- David McFarlane, Professional Faultfinder


At 6/16/2010 01:15 PM Wednesday, you wrote:
>I think I narrowed down the problem.
>
>I declared this in an initial InLine object (outside of the trial
>loop): FirstTrial = true
>
>Then I negated that in an InLine object within the loop: FirstTrial =
>false
>
>It seems that negating it within the loop lead the program to ignore
>my If statement, but only for issuing the outcome of the trial. The
>code:
>
>If FirstTrial Then
>c.SetAttrib "ActorValue", "50/50"
>c.SetAttrib "PartValue", "Bad"
>took = true
>End If
>
>always seemed to be read though (it does come before the FirstTrial =
>false statement though).
>
>After reading this, does anyone have any idea what I'm talking about?
>I think that my design may be too complicated to communicate on the
>forum!
>
>On Jun 16, 10:37 am, John <manutd... at gmail.com> wrote:
> > First, I apologize if I haven't given enough information to solve this
> > problem. Please let me know if you need more information!
> >
> > I am trying to force an outcome in this game I've designed, but only
> > for the very first trial.
> >
> > Basically I have the program randomly choose a number 0-99 and for
> > that to decide the outcome, but for the first trial I want to make
> > sure that the initial choice and then outcome is always the same. I
> > have created some code that usually leads to the outcome I want, but
> > 1/10 times it seems to not work.
> >
> > More specifically, sometimes both the "actor" and "participant" are
> > gaining points, which I don't want. Instead, I want the "actor" to
> > always gain points and the "participant" to always lose points, but
> > just for the very first trial. After that, I want to use the code I've
> > created to determine the subsequent decisions.
> >
> > My failed solution: instead of allowing the computer to randomly
> > generate a number, I tried to force it to use 0, but only for the
> > first trial. This doesn't seem to work in about 1/10 times for some
> > reason.
> >
> > So in an initial InLine object I state:
> >
> > FirstTrial = true
> >
> > Then in the Procedure I have:
> >
> > If FirstTrial Then
> > c.SetAttrib "ActorValue", "50/50"
> > c.SetAttrib "PartValue", "Bad"
> > took = true
> > End If
> >
> > Then in the general User script I have:
> >
> > Dim FirstTrial as Boolean
> > 'Calculates how much someone's points will change if they took
> > Function PointMod(Value as String, FirstTrial as Boolean) as Integer
> > Randomize
> > Dim percent as Integer
> > percent = Random(0, 99)
> > If FirstTrial Then
> >         percent = 0
> > End If
> > Select Case Value
> >         Case "Good"
> >                 If percent < 85 Then
> >                         pointMod = 10
> >                 Else
> >                         pointMod = -10
> >                 End If
> >         Case "Bad"
> >                 If percent < 85 Then
> >                         pointMod = -10
> >                 Else
> >                         pointMod = 10
> >                 End If
> >         Case "50/50"
> >                 If percent < 50 Then
> >                         pointMod = 10
> >                 Else
> >                         pointMod = -10
> >                 End If
> > End Select
> > End Function

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list