# MODELCT1, PLOTCT1

**URL:** <http://discourse.iapct.org/t/modelct1-plotct1/6609>\
**Category:** CSG1996\
**Created:** [February 13, 1996, 11:10pm UTC](http://discourse.iapct.org/t/modelct1-plotct1/6609 "1996-02-13T23:10:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruce\_Abbott](http://discourse.iapct.org/letter_avatar_proxy/v4/letter/b/ba8739/32.png) [@Bruce\_Abbott](http://discourse.iapct.org/u/Bruce_Abbott)\
**Post date:** [February 13, 1996, 11:10pm UTC](http://discourse.iapct.org/t/modelct1-plotct1/6609/1 "1996-02-13T23:10:30Z")

</div>

[From Bruce Abbott (960213.1810 EST)]

Just to make things tidy, Bill Powers's MODELCT1.PAS program should have the  
following two lines added at the bottom, just before the final END statement:

restorecrtmode;  
closegraph;

I tried a run and found that on my system the cursor lags behind the mouse  
enough to create problems. However, I was running the program in a DOS box  
within Windows, which probably slows things up considerably. Also, I'm  
using a 25 mHz 386, which is slow by today's standards. I'll try it later  
outside Windows and post the data after I've had some practice.

Appended is a simple Turbo Pascal program that reads the data file created  
by MODELCT1 and plots the target and cursor positions as a function of time  
during the run.

Regards,

Bruce

> **···**
>
> ------------------------------------------------------------------------------  
> program plotct1;  
> {  
> &nbsp;&nbsp;This program displays the target and cursor movements during a run of  
> &nbsp;&nbsp;MODELCT1, as recorded in the data file SQUARE.DAT, and is written in  
> &nbsp;&nbsp;Turbo (Borland) Pascal (compile with version 5.0 or higher).
> 
> &nbsp;&nbsp;written by Bruce Abbott  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Psychological Sciences  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Indiana U. - Purdue U. Fort Wayne  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fort Wayne IN 46815  
> &nbsp;&nbsp;(960213)  
> }
> 
> uses dos, crt, graph, grutils;
> 
> type datatype = array[0..3599] of integer;
> 
> var cursor,target: integer;  
> &nbsp;&nbsp;&nbsp;&nbsp;c,t: datatype;  
> &nbsp;&nbsp;&nbsp;&nbsp;i,maxx,maxy,graphmode: integer;  
> &nbsp;&nbsp;&nbsp;&nbsp;ch: char;  
> &nbsp;&nbsp;&nbsp;&nbsp;sqrdat: text;
> 
> procedure initial;  
> begin  
> initgraphics;  
> graphmode := getmaxmode;  
> setgraphmode(graphmode);  
> end;
> 
> procedure plotdata;  
> var  
> &nbsp;&nbsp;i, j, k, x, y, z, offset, amount: integer;  
> begin  
> &nbsp;&nbsp;k := 0;  
> &nbsp;&nbsp;amount := 65;  
> &nbsp;&nbsp;offset := MaxY - MaxY div 5;  
> &nbsp;&nbsp;outtextxy(MaxX div 2 - 125, 10, 'Square Wave Data Display');  
> &nbsp;&nbsp;for j := 1 to 6 do  
> &nbsp;&nbsp;&nbsp;&nbsp;begin  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i := 1 to 600 do  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x := i div 1;  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y := MaxY-offset - t[k] div 4;  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z := MaxY-offset - c[k] div 4;  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;putpixel(x, y, white);  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;putpixel(x, z, yellow);  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inc(k);  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end;  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset := offset - amount;  
> &nbsp;&nbsp;&nbsp;&nbsp;end;  
> end;
> 
> begin  
> initial;  
> maxx := getmaxx; maxy := getmaxy;  
> assign(sqrdat,'square.dat');  
> reset(sqrdat);  
> for i := 0 to 3599 do  
> &nbsp;&nbsp;begin  
> &nbsp;&nbsp;&nbsp;read(sqrdat,t[i],c[i]);  
> &nbsp;&nbsp;end;  
> plotdata;  
> ch := readkey;  
> close(sqrdat);  
> restorecrtmode;  
> closegraph;  
> end.
