BEGIN{ ################################################# STARTDEFINE MACROS LFTTURN = -1 RGTTURN = 1 FORWARD = 3 VORAID = 0 ADFAID = 1 PLOT_INTERVAL = 8 ################################################# ENDDEFINE SORTTYPE = 0 ANSI=0 PROGNAME = "N A V - T R A I N E R" COPYRIGHT = "Copyright (c) 1991" AUTHOR = "Raymond Hettinger" split( "4 2 6 1 5 3 7", xlatclr ) xlatclr[0] = 0 setPanel() banner() hidecurs() timesetup() # Takes up 1.5 seconds on average setWait(2) # display banner for extra 2 seconds # Set-up functions and constants HELPFILE = "navhelp.asc" TUTORFILE = "navtutor.asc" pi = 3.1415926536 twoPi = 2 * pi pi180 = pi / 180 stdturn = ( 2 * pi ) / ( 2 * 60 ) # 2 minturn in radians per second srandom() coprtest( AUTHOR COPYRIGHT PROGNAME ) setDG() setADF() setVOR() wait() while(1){ genEnv() runSim() } } function genEnv(){ # Random Environment setup initdme = 20 + random() * 10 # start between 20 and 30 miles away initrad = randAngle() # initial position of plane from station ph = randAngle() # magnetic heading of plane in radians airspeed = 120 / 3600 # 120 mph expressed in miles per sec. winddir = randAngle() # wind direction in radians windspd = random() / 4 * airspeed # wind speed upto 25% of normal airspeed simtime = ( gettime() + 7 * 3600 ) % ( 3600 * 24 ) # Actual UTC in seconds on a 24 hour clock} gen_mission() get_difficulty() PLOTFILE = ENV["TMP"] "\\NAVTRAIN.TMP" px = initdme * cos( initrad ) py = initdme * sin( initrad ) close( PLOTFILE ) printf "%5.2f %5.2f\n", py, px > PLOTFILE wx = windspd * cos( winddir ) wy = windspd * sin( winddir ) wdDir = int( asDegrees( winddir + pi ) / 10 + .5 ) * 10 wdSpd = int( windspd * 3600 + .5 ) initdme = initrad = winddir = windspd = "" ttp = PLOT_INTERVAL # seconds till next plot point marktime = simtime # time mark for stopwatch rm = gettime() # realtime mark OBSsetting = 0 # initially 000 from radial in radians navaid = ADFAID lastpeg = lastclock = "NOMATCH" lastman = FORWARD REDRAW_ALL = 1 REALTIME = 0 TIMEMAG=1 } ################################################ MAIN LOOP function runSim( xx, m ){ while(1){ updatePanel() while( REALTIME && !kbhit() ){ xx = gettime() - rm if( xx > 0.333/TIMEMAG ){ move( lastman, xx * TIMEMAG ) rm += xx updatePanel() } } m = toupper( getkey() ) if( m == "UP" ){ action = 4 lastman = FORWARD if( !REALTIME ) move( FORWARD, 30 ) else REDRAW_LWR = 1 }else if( m == "RIGHT" ){ action = 2 lastman = RGTTURN if( !REALTIME ) move( RGTTURN, 10 ) else REDRAW_LWR = 1 }else if( m == "F2" ){ action = 3 REDRAW_LWR = 1 navaid = VORAID OBSsetting = atan2(py,px) }else if( m == "LEFT" ){ action = 1 lastman = LFTTURN if( !REALTIME ) move( LFTTURN, 10 ) else REDRAW_LWR = 1 }else if( m == "DOWN" && !REALTIME ){ action = 5 manTime = 1 simtime -= manTime + manTime airspeed = -airspeed ; wx = -wx ; wy = -wy move( FORWARD, manTime ) airspeed = -airspeed ; wx = -wx ; wy = -wy }else if( m == "F" && !REALTIME ){ action = 4 manTime = window( "Forward. How many seconds?" ) + 0 move( FORWARD, manTime ) }else if( m == "R" && !REALTIME ){ action = 2 manTime = window( "Right turn. How many degrees?" ) * pi180 / stdturn move( RGTTURN, manTime ) }else if( m == "O" ){ action = 3 OBSsetting = asRadians( window( "Dial OBS. To which radial?" ) ) rm = gettime() if( navaid == ADFAID ){ REDRAW_LWR = 1 navaid = VORAID } }else if( m == "L" && !REALTIME ){ action = 1 manTime = window( "Left turn. How many degrees?" ) * pi180 / stdturn move( LFTTURN, manTime ) }else if( m == "B" && !REALTIME ){ action = 5 manTime = window( "Backwards. How many seconds?" ) + 0 simtime -= manTime + manTime airspeed = -airspeed ; wx = -wx ; wy = -wy move( FORWARD, manTime ) airspeed = -airspeed ; wx = -wx ; wy = -wy }else if( m == "S" || m == "T" ){ action = 6 marktime = simtime }else if( m == "A" ){ action = 11 if( navaid == VORAID ){ REDRAW_LWR = 1 navaid = ADFAID } }else if( m == "V" ){ action = 10 if( navaid == ADFAID ){ REDRAW_LWR = 1 navaid = VORAID } }else if( m == "P" ){ action = 8 close( PLOTFILE ) spawn( "showpath " PLOTFILE ) cls() rm = gettime() }else if( m == "F1" || m == "H" ){ action = 7 help() rm = gettime() }else if( m == "C" ){ action = 12 prt_clearance() rm = gettime() }else if( m == "Q" || m == "ESC" ){ action = 9 atExit( 0, "Blue Skys!!" ) }else if( m == "F10" ){ break }else if( m == "X" ){ action = 13 REALTIME = 1 - REALTIME REDRAW_LWR = 1 }else if( m == "F5" ){ action = 14 ANSI = 1 - ANSI REDRAW_ALL = 1 }else if( m == "F6" ){ action = 15 REDRAW_LWR = 1 TIMEMAG *= 2 if( TIMEMAG > 5 ) TIMEMAG = .5 } } } ################################################ REDISPLAY PANEL function updatePanel(){ if( ++coprtesttime == 10 ){ coprtest( AUTHOR COPYRIGHT PROGNAME ) coprtesttime = 0 } removePointer() if( pntr_on ){ pntr_on = 0 if( ANSI ) REDRAW_ALL = 1 else scr_putcells( pntr_cell, PNTRx[step]-1, PNTRy[step]-1 ) } showTopPanel( px, py, ph, simtime, marktime, airspeed ) if( navaid == ADFAID ) showADF( px, py, ph ) else showVOR( px, py, OBSsetting ) if( tutorFLAG ) tutor() else prompt( navaid ) REDRAW_ALL = 0 REDRAW_LWR = 0 } function showTopPanel( px, py, ph, st, marktime, airspeed, gap, dmebeg, spdtostn, dmenxt, nx, ny, h ){ gap = int(st) - int(marktime) h = int( asDegrees( ph ) ) dmebeg = sqrt( ((px*px) + (py*py)) ) nx = px + wx + airspeed * cos( ph ) ny = py + wy + airspeed * sin( ph ) dmenxt = sqrt( ((nx*nx) + (ny*ny)) ) spdtostn = ( dmebeg - dmenxt ) * 3600 if( REDRAW_ALL ){ for( r=1 ; r<=10 ; r++ ) write( p[r], r-1, 0, 0x31 ) write( dgA, 4, 16, 0x30 ) write( dgB, 5, 16, 0x30 ) write( dgC, 6, 16, 0x30 ) } write( sprintf( "%3d", ( (h>=360) ? h-360 : h+000 ) ), 1, 17, 0x3E ) write( sprintf( "%3d", ( (h>=330) ? h-330 : h+030 ) ), 2, 23, 0x31 ) write( sprintf( "%3d", ( (h>=300) ? h-300 : h+060 ) ), 3, 27, 0x31 ) write( sprintf( "%3d", ( (h>=270) ? h-270 : h+090 ) ), 5, 29, 0x31 ) write( sprintf( "%3d", ( (h>=240) ? h-240 : h+120 ) ), 7, 27, 0x31 ) write( sprintf( "%3d", ( (h>=210) ? h-210 : h+150 ) ), 8, 23, 0x31 ) write( sprintf( "%3d", ( (h>=180) ? h-180 : h+180 ) ), 9, 17, 0x31 ) write( sprintf( "%3d", ( (h>=150) ? h-150 : h+210 ) ), 8, 11, 0x31 ) write( sprintf( "%3d", ( (h>=120) ? h-120 : h+240 ) ), 7, 07, 0x31 ) write( sprintf( "%3d", ( (h>=090) ? h-090 : h+270 ) ), 5, 05, 0x31 ) write( sprintf( "%3d", ( (h>=060) ? h-060 : h+300 ) ), 3, 07, 0x31 ) write( sprintf( "%3d", ( (h>=030) ? h-030 : h+330 ) ), 2, 11, 0x31 ) write( sprintf( "%02d:%02d:%02d", hr(st), min(st), sec(st) ), 1, 62, 0x31 ) write( sprintf( "%02d:%02d:%02d", hr(gap), min(gap), sec(gap) ), 2, 62, 0x31 ) write( sprintf( "%03d at %-2d", wdDir, wdSpd ), 4, 61, 0x31 ) write( sprintf( "%5.1f", dmebeg ), 6, 59, 0x31 ) write( sprintf( "%+6.1f", spdtostn ), 7, 60, 0x31 ) write( sprintf( "%3d",int(airspeed*3600+.5) ), 9, 63, 0x31 ) } function showADF( px, py, hdg, rad, dme, rb, clockPos ){ rad = atan2( py, px ) dme = sqrt( ((px*px) + (py*py)) ) rb = pi + rad - hdg if( dme > 25 ) # Add unreliabity of upto .5 degrees for each mile > 25 rb += asRadians( (dme-25) * (random()-.5) ) clockPos = int( ( ( rb + pi / 12 ) % ( twoPi ) ) / ( pi / 6 ) ) clockPos = clockPos==0 ? 12 : clockPos if( REDRAW_ALL || REDRAW_LWR ){ lastclock = "NOMATCH" for( r=1 ; r<=12 ; r++ ) write( a[r], r+9, 0, 0x31 ) } if( clockPos != lastclock ){ write( adfA[ clockPos ], 14, 18, 0x30 ) write( adfB[ clockPos ], 15, 14, 0x30 ) write( adfC[ clockPos ], 16, 13, 0x30 ) write( adfD[ clockPos ], 17, 14, 0x30 ) write( adfE[ clockPos ], 18, 18, 0x30 ) lastclock = clockPos } write( sprintf( "%03d", int( asDegrees(rb) + .5 ) ), 11, 9, 0x3E ) } function showVOR( px, py, obsSet, radial, dme, x, flagB, flagT, offset, peg, obs ){ radial = atan2( py, px ) dme = sqrt( ((px*px) + (py*py))) obs = asDegrees( obsSet ) delta = ( 180 + asDegrees(radial) - obs ) % 360 if( dme > 75 || dme < 0.2 ) # No signal reception beyond 75 miles delta = 270 # or in cone of confusion flagB = " " flagT = " " x = abs( 180 - delta ) if( x < 88 ) flagB = flagFR else if( x > 92 ) flagT = flag_TO else flagT = flagOF offset = abs( ( ( delta + 270 ) % 360 ) - 180 ) - 80 if( offset < 0 ) offset = 0 # full left deflection if( offset > 20 ) offset = 20 # full right deflection peg = int( offset / 20 * 10.9999 ) + 1 if( REDRAW_ALL || REDRAW_LWR ){ lastpeg = "NOMATCH" for( r=1 ; r<=12 ; r++ ) write( v[r], r+9, 0, 0x31 ) } if( peg != lastpeg ){ write( vorA[peg], 15, 13, 0x30 ) write( vorB[peg], 16, 13, 0x30 ) write( vorA[peg], 17, 13, 0x30 ) lastpeg = peg } write( flagT, 14, 19, 0x30 ) write( flagB, 18, 19, 0x30 ) obs = int( obs ) write( sprintf( "%3d", ( (obs>=360) ? obs-360 : obs+000) ), 12, 17, 0x3E ) write( sprintf( "%3d", ( (obs>=330) ? obs-330 : obs+030) ), 13, 23, 0x31 ) write( sprintf( "%3d", ( (obs>=300) ? obs-300 : obs+060) ), 14, 26, 0x31 ) write( sprintf( "%3d", ( (obs>=270) ? obs-270 : obs+090) ), 16, 28, 0x31 ) write( sprintf( "%3d", ( (obs>=240) ? obs-240 : obs+120) ), 18, 26, 0x31 ) write( sprintf( "%3d", ( (obs>=210) ? obs-210 : obs+150) ), 19, 23, 0x31 ) write( sprintf( "%3d", ( (obs>=180) ? obs-180 : obs+180) ), 20, 17, 0x31 ) write( sprintf( "%3d", ( (obs>=150) ? obs-150 : obs+210) ), 19, 11, 0x31 ) write( sprintf( "%3d", ( (obs>=120) ? obs-120 : obs+240) ), 18, 07, 0x31 ) write( sprintf( "%3d", ( (obs>=090) ? obs-090 : obs+270) ), 16, 05, 0x31 ) write( sprintf( "%3d", ( (obs>=060) ? obs-060 : obs+300) ), 14, 07, 0x31 ) write( sprintf( "%3d", ( (obs>=030) ? obs-030 : obs+330) ), 13, 11, 0x31 ) } function prompt( navaid ){ if( REDRAW_ALL || REDRAW_LWR ){ if( lastman == FORWARD ) manText = MFWD else if( lastman == LFTTURN ) manText = MLFT else #( lastman == RGTTURN ) manText = MRGT writecells( prHot, 24, 0 ) if( REALTIME ){ write( prMan, 22, 0, 0x17 ) write( manText, 22, 21, 0x94 ) write( mag[TIMEMAG], 22, 60, 0x14 ) }else writecells( prTop, 22, 0 ) if( navaid == VORAID ) writecells( prVor, 23, 0 ) else writecells( prObs, 23, 0 ) } locate( 23, 49 ) } ################################################# MISC MATH FUNCTIONS function asDegrees( rad ){ return ( rad / pi180 ) % 360 } function asRadians( deg ){ return ( deg * pi180 ) % twoPi } function abs( real ){ return ( real > 0 ? real : -real ) } function sec( seconds ){ return int( seconds % 60 ) } function min( seconds ){ return int( (seconds/60) % 60 ) } function hr( seconds ){ return int( (seconds/3600) % 24 ) } ################################################# MOVEMENT CALCULATIONS function move( manuever, mantimerem, segtime ){ while( mantimerem > 0 ){ segtime = mantimerem > ttp ? ttp : mantimerem if( manuever == LFTTURN || manuever == RGTTURN ) turn( manuever, segtime ) else forward( segtime ) simtime += segtime mantimerem -= segtime ttp -= segtime if( ttp <= 0 ){ printf "%5.2f %5.2f\n", py, px >> PLOTFILE ttp = PLOT_INTERVAL } } } function forward( segtime ){ px += segtime * ( wx + airspeed * cos( ph ) ) py += segtime * ( wy + airspeed * sin( ph ) ) } function turn( direction, segtime, phe, turnradius ){ phe = ph + direction * stdturn * segtime px += direction * airspeed * ( sin(phe) - sin(ph) ) / stdturn + segtime * wx py += direction * airspeed * ( cos(ph) - cos(phe) ) / stdturn + segtime * wy ph = phe % twoPi } ################################################# RANDOM NUMBERS function randupto( limit ){ return 1 + int( limit * random() ) } function randhdg(){ return sprintf( "%03d", int(random()*360) ) } function randAngle(){ return twoPi * random() } function randdist( lowlim, uplim ){ return int( ( int(uplim) - int(lowlim) + 1 ) * random() + int(lowlim) ) } function select( arrstring, cnt, arr ){ cnt = split( arrstring, arr ) return arr[ 1 + int( random() * cnt ) ] } function srandom( box ){ srand() randomTableSize = 50 for( box=0 ; box 0 ){ # stop when node==0 for( msgref in msgopt[ node ] ){ msg = msgopt[node][msgref] if( diflevel[ msg ]+0 <= maxlvl+0 ) cand[ ++candcnt ] = msg } choice = randupto( candcnt ) candcnt = 0 msgselect = cand[ choice ] delete cand add_clearance( msgtxt[ msgselect ] ) node = nextnode[ msgselect ] + 0 } prt_clearance() } delete msgtxt } function add_clearance( txt ){ clearance[ ++clearnum ] = txt } function prt_clearance( i, c, txt, j, line ){ cls() write( sprintf(" \xDA%s\xBF ", BAR75 ), 0, 0, 0x1F ) line = 1 for( i=1 ; i<=clearnum ; i++ ){ c = split( clearance[i], txt, "~" ) for( j=1 ; j<=c ; j++ ) write( sprintf(" \xB3 %-73s \xB3 ", txt[j]), line++, 0, 0x1F ) } write( sprintf(" \xC0%s\xD9 ", BAR75), line++, 0, 0x1F ) write( "Press any key to continue", 24, 28, 0x0F ) write( ".", 24, 53, 0x8F ) getkey() cls() } function reset_clearance(){ delete clearance clearnum = 0 } function setCustom(){ ph = randAngle() airspeed = 120 / 3600 # 120 mph expressed in miles per sec. initrad = randAngle() # initial position of plane from station initdme = 20 + random() * 10 # start between 20 and 30 miles away winddir = randAngle() # wind direction in radians windspd = random() / 4 * airspeed # wind speed upto 25% of normal airspeed simtime = int( random() * 60 * 60 * 24 ) # seconds on a 24 hour clock} } function readExercise( lpipe, lesson, linecount, x ){ lpipe = "pkunzip -c -scode less.zip lesson1.asc" while( lpipe | getline > 0 ) lesson[ ++linecount ] = $0 close( lpipe ) x=8 # Skip the header lines printed by PKZIP ph = asRadians( lesson[++x] ) % twoPi airspeed = lesson[++x] / 3600 initrad = asRadians( lesson[++x] ) % twoPi initdme = lesson[++x]+0 winddir = ( pi + asRadians( lesson[++x] ) ) % twoPi windspd = lesson[++x] / 3600 simtime = lesson[++x]+0 while( x < linecount ) add_clearance( lesson[++x] ) } ################################################# INSTRUMENT GRAPHICS SETUP function setPanel( BAR, TENBAR, NS, BS, ZS, RW, BW ){ BAR = "\xC4" TENBAR = "\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4" BAR29 = TENBAR TENBAR BAR BAR BAR BAR BAR BAR BAR BAR BAR BAR33 = TENBAR TENBAR TENBAR BAR BAR BAR BAR39 = BAR33 BAR BAR BAR BAR BAR BAR BAR75 = TENBAR TENBAR TENBAR TENBAR TENBAR TENBAR TENBAR BAR BAR BAR BAR BAR p[1] = " \xDA" BAR33 "\xC2" BAR39 "\xBF " p[2] = " \xB3 DG: \xB3 Time (UTC): : : \xB3 " p[3] = " \xB3 * \xB3 Stopwatch: : : \xB3 " p[4] = " \xB3 * * \xB3 " BAR29 " \xB3 " p[5] = " \xB3 * * \xB3 Pireps: Winds at \xB3 " p[6] = " \xB3 * * \xB3 " BAR29 " \xB3 " p[7] = " \xB3 * * \xB3 DME: miles \xB3 " p[8] = " \xB3 * * \xB3 Speed to station: mph \xB3 " p[9] = " \xB3 * \xB3 " BAR29 " \xB3 " p[10]= " \xB3 \xB3 Airspeed: mph \xB3 " ################################################ CELLBEGIN prTop = formcells( " Left Forward Right Backward Stopwatch reset Plot path ", "77F777777F777777777F7777777F7777777777F77777777777777777F77777777777777777777", "11111111111111111111111111111111111111111111111111111111111111111111111111111" ) prVor = formcells( " Clearance/Lesson display OBS/setting ADF select: ", "77F77777777777777777777777777F7777777777777F777777777777777777777777777777777", "11111111111111111111111111111111111111111111111111111111111111111111111111111" ) prObs = formcells( " Clearance/Lesson display VOR select: ", "77F77777777777777777777777777F77777777777777777777777777777777777777777777777", "11111111111111111111111111111111111111111111111111111111111111111111111111111" ) prHot = formcells( " F1 Help F2 Center OBS L/R Arrows Turn 30\xF8 \x18\x19 Move 1 mile F10 Menu ", "444400000000044000000000000004440000000000000000" "04" "4" "00000000000000044400000000", "777777777777777777777777777777777777777777777777" "77" "7" "77777777777777777777777777" ) ################################################# CELLEND prMan = " Current Manuever: Time Magnification: " MLFT = "Turning Left" MRGT = "Turning Right" MFWD = "Going Forward" mag[.5] = "Halftime - x0.5" mag[1] = "Realtime - x1.0" mag[2] = "Doubletime - x2.0" mag[4] = "Quadtime - x4.0" } function setADF(){ adfA[1] = " " adfA[2] = " " adfA[3] = " " adfA[4] = " " adfA[5] = " " adfA[6] = "\xB3" adfA[7] = " " adfA[8] = " " adfA[9] = " " adfA[10] = " " adfA[11] = " " adfA[12] = "#" adfB[1] = " # " adfB[2] = " -#" adfB[3] = " " adfB[4] = "-- " adfB[5] = " \\ " adfB[6] = " \xB3 " adfB[7] = " / " adfB[8] = " --" adfB[9] = " " adfB[10] = "#- " adfB[11] = " # " adfB[12] = " \xB3 " adfC[1] = " / " adfC[2] = " ----- " adfC[3] = "----------#" adfC[4] = " ----- " adfC[5] = " \\ " adfC[6] = " \xB3 " adfC[7] = " / " adfC[8] = " ----- " adfC[9] = "#----------" adfC[10] = " ----- " adfC[11] = " \\ " adfC[12] = " \xB3 " adfD[1] = " / " adfD[2] = "-- " adfD[3] = " " adfD[4] = " -#" adfD[5] = " # " adfD[6] = " \xB3 " adfD[7] = " # " adfD[8] = "#- " adfD[9] = " " adfD[10] = " --" adfD[11] = " \\ " adfD[12] = " \xB3 " adfE[1] = " " adfE[2] = " " adfE[3] = " " adfE[4] = " " adfE[5] = " " adfE[6] = "#" adfE[7] = " " adfE[8] = " " adfE[9] = " " adfE[10] = " " adfE[11] = " " adfE[12] = "\xB3" a[1] = " \xC3" BAR33 "\xC5" BAR39 "\xB4 " a[2] = " \xB3 ADF: bearing to station \xB3 \xB3 " a[3] = " \xB3 0 \xB3 \xB3 " a[4] = " \xB3 330 * 30 \xB3 \xB3 " a[5] = " \xB3 300 * * 60 \xB3 " PROGNAME " \xB3 " a[6] = " \xB3 * * \xB3 \xB3 " a[7] = " \xB3 270 * * 90 \xB3 " COPYRIGHT " \xB3 " a[8] = " \xB3 * * \xB3 \xB3 " a[9] = " \xB3 240 * * 120 \xB3 " AUTHOR " \xB3 " a[10]= " \xB3 210 * 150 \xB3 \xB3 " a[11]= " \xB3 180 \xB3 \xB3 " a[12]= " \xC0" BAR33 "\xC1" BAR39 "\xD9 " } function setVOR(){ flagFR = "FR " flag_TO = "TO " flagOF = "OFF" vorA[1] = "\xB3 . " vorA[2] = " \xB3 . " vorA[3] = " \xB3 . " vorA[4] = " \xB3 . " vorA[5] = " \xB3. " vorA[6] = " \xB3 " vorA[7] = " .\xB3 " vorA[8] = " . \xB3 " vorA[9] = " . \xB3 " vorA[10]= " . \xB3 " vorA[11]= " . \xB3 " vorB[1] = "\xB3----+---- " vorB[2] = " \xB3---+---- " vorB[3] = " -\xB3--+---- " vorB[4] = " --\xB3-+---- " vorB[5] = " ---\xB3+---- " vorB[6] = " ----\xB3---- " vorB[7] = " ----+\xB3--- " vorB[8] = " ----+-\xB3-- " vorB[9] = " ----+--\xB3- " vorB[10]= " ----+---\xB3 " vorB[11]= " ----+----\xB3 " v[1] = " \xC3" BAR33 "\xC5" BAR39 "\xB4 " v[2] = " \xB3 VOR: \xB3 \xB3 " v[3] = " \xB3 \xB3 \xB3 " v[4] = " \xB3 * \xB3 \xB3 " v[5] = " \xB3 * * \xB3 " PROGNAME " \xB3 " v[6] = " \xB3 * * \xB3 \xB3 " v[7] = " \xB3 * * \xB3 " COPYRIGHT " \xB3 " v[8] = " \xB3 * * \xB3 \xB3 " v[9] = " \xB3 * * \xB3 " AUTHOR " \xB3 " v[10]= " \xB3 * \xB3 \xB3 " v[11]= " \xB3 \xB3 \xB3 " v[12]= " \xC0" BAR33 "\xC1" BAR39 "\xD9 " } function setDG(){ dgA = " ^ " dgB = "--\xB3--" dgC = " \xB3 " } ################################################# COPYRIGHT PROTECTION SCHEME function coprtest( copystr, choice ){ if( ! coprTestSetup ){ coprTestSetup = 1 srandom() coprTestCount = split( "18181 26927 30727 34273 35171", coprTestBase ) split( "2327 8005 27832 21494 23100", coprTestXpct ) } choice = int( coprTestCount * random() + 1 ) if( coprsum( copystr, coprTestBase[choice], choice )+1 != coprTestXpct[choice]+1 ) atExit(1, "\nCopyright Alteration Detected\nAborting Program\n") } function coprsum( string, base, offset, i, accm ){ for( i=1 ; i<=length(string) ; i++ ) accm += (i+offset) * ord(substr(string,i,1)) return accm %base } ################################################# ON-LINE TUTORIAL function tutor( repeatmsg ){ if( action == XPCT[ step ] ){ repeatmsg = "" step++ }else{ repeatmsg = "Try Again - " beep() } action = 0 if( PNTRx[step] != 0 ){ ptrx = PNTRx[step] - 1 ptry = PNTRy[step] - 1 if( !ANSI ){ pntr_cell = scr_getcells( 2, ptrx, ptry ) } write( sprintf("%c",PNTRt[step]), ptrx, ptry, 0xB4 ) pntr_on = 1 } write( sprintf(" %-75s", SUBJ[ step ]), 22, 0, 0x3E ) write( sprintf(" %-70s", PROC[ step ]), 23, 0, 0x3E ) write( sprintf(" %-75s", repeatmsg ACTN[ step ]), 24, 0, 0x34 ) locate( 22, 64 ) } function removePointer(){ if( pntr_on ){ pntr_on = 0 if( ANSI ) REDRAW_ALL = 1 else scr_putcells( pntr_cell, ptrx, ptry ) } } function setTutor( stepcount ){ # rtn = 0 ; lft = 1 ; rgt = 2 ; obs = 3 ; # fwd = 4 ; bck = 5 ; tim = 6 ; hlp = 7 ; # plt = 8 ; don = 9 ; vor = 10 ; adf = 11 ; # clr = 12 ; rtm = 13 ; ans = 14 ; mag = 15 ; while( getline 0 ){ SUBJ[++stepcount] = $0 getline