home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,745 of 2,978   
   John Smith to Jochen   
   Re: Tic-Tac-Toe   
   06 Jun 05 19:23:29   
   
   From: assemblywizard@gmail.com   
      
   ROFLOL!!!!!!!!!!!!   
      
   John   
   "Jochen"  wrote in message   
   news:42a4f845$0$18646$14726298@news.sunsite.dk...   
   > John Smith typed:   
   >   
   > .. and is still not able to do correct postings .. but at least tries   
   > to   
   > help another blind one - with ugly code that has to be corrected.   
   >   
   > "science guy" :)   
   >>> Hello people. I am doing a program that uses multi-dimensional   
   >>> arrays   
   >>> to creat a tic-tac-toe program.   
   >>>   
   >>> Can anyone help me get started? Oh and should I use procedures or   
   >>> functions?   
   >   
   >> Here is the code to create an array and zero the array (spaces would   
   >> be better )   
   >> also, the code to write out the array should give you a clear picture   
   >> of accessing the two dimensional elements...   
   >> program tic;   
   >>   
   >> USES   
   >>    crt;   
   >>   
   >> TYPE   
   >>    ticarray = ARRAY[1..3] of ARRAY[1..3] OF INTEGER;   
   >   
   > if u like chars more why not make it array of char then?   
   >   
   > like ticarray = array[1..3,1..3] of char?   
   >   
   >>   
   >> Var   
   >>    t:  ticarray;   
   >>    r, c, x:  integer;   
   >>   
   >> PROCEDURE cleararray;   
   >>    BEGIN   
   >>       r := 1;   
   >>       c := 1;   
   >>       x := 0;   
   >   
   > modifing global vars? - ever herad of side effects?   
   > why not make them local?   
   > why not use procedure cleararray(var t: ticarray)?   
   > why did u declare the type b4 - when not using it?   
   >   
   >>       while r < 4 do   
   >   
   > while? why?   
   > not runing from 1 -3 ? expecting errors/expections?   
   >   
   > if it is clear that is is 1-3 why not use for localvar1:=1 to 3 do ...   
   >   
   >>          BEGIN   
   >   
   > why begin here? - ahh yes. u have to reset some global vars after the   
   > nested loop   
   >   
   >>             while c < 4 do   
   >>                BEGIN   
   >   
   > same again   
   >   
   >>                   t[r,c] := x;   
   >>                   c := c+1;   
   >>                END;   
   >>             c := 1;   
   >>             r := r+1;   
   >>          END;   
   >>    END;   
   >>   
   >> PROCEDURE writearray;   
   > (var t:ticarray?)   
   >   
   > var x,y: integer;   
   > for y := 1 to 3 do   
   >  begin   
   >    for x := 1 to 3 do   
   >      write(t[x,y]:2)   
   >    writeln;   
   >  end;   
   >   
   >   
   >>    BEGIN   
   >>       write(t[1,1]);   
   >>       write(t[1,2]);   
   >>       write(t[1,3]);   
   >> writeln;   
   >>       write(t[2,1]);   
   >>       write(t[2,2]);   
   >>       write(t[2,3]);   
   >> writeln;   
   >>       write(t[3,1]);   
   >>       write(t[3,2]);   
   >>       write(t[3,3]);   
   >>   
   >>    END;   
   >>   
   >> BEGIN   
   >>    ClrScr;   
   >>    cleararray;   
   >>    writearray;   
   >> END.   
   >>   
   >   
   > btw ...   
   >   
   > i missed the boeing part. - "john smith" does design airplanes? this   
   > J.S?   
   >   
   > newsgroups ARE fun!   
   >   
   > sometimes even those about programming!   
   >   
   > greets   
   > jo   
   >   
   > --   
   > http://radio789.net.ms - Radio 789 - We play it ALL   
   > Radiostream: http://stream789.net.ms   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca