Difference between revisions of "Fortran"

From Chessprogramming wiki
Jump to: navigation, search
 
Line 75: Line 75:
 
=External Links=  
 
=External Links=  
 
* [https://en.wikipedia.org/wiki/Fortran Fortran from Wikipedia]
 
* [https://en.wikipedia.org/wiki/Fortran Fortran from Wikipedia]
* [ftp://ftp.cis.uab.edu/pub/hyatt/crayblitz/ Cray Blitz FTP Page] crayblitz.tar.gz Source Code, by [[Robert Hyatt]]
 
 
* [http://www.emsps.com/oldtools/msforv.htm Microsoft® FORTRAN Version Features]
 
* [http://www.emsps.com/oldtools/msforv.htm Microsoft® FORTRAN Version Features]
* [http://software.intel.com/en-us/intel-compilers/ Intel Fortran Compiler]
+
* [https://software.intel.com/en-us/fortran-compilers Intel Fortran Compiler]
 
* [http://www.softwarepreservation.org/projects/FORTRAN/ History of FORTRAN and FORTRAN II — Software Preservation Group] from [[The Computer History Museum]]
 
* [http://www.softwarepreservation.org/projects/FORTRAN/ History of FORTRAN and FORTRAN II — Software Preservation Group] from [[The Computer History Museum]]
* [http://sydney.edu.au/engineering/aeromech/wwwcomp/f90faq.htm Fortran FAQ]
+
* [https://groups.google.com/forum/#!forum/comp.lang.fortran comp.lang.fortran] Discussion about Fortran
* [http://groups.google.com/group/comp.lang.fortran/topics comp.lang.fortran] Discussion about Fortran
 
  
 
=References=
 
=References=
 
<references />
 
<references />
 
'''[[Languages|Up one Level]]'''
 
'''[[Languages|Up one Level]]'''

Latest revision as of 23:37, 6 November 2019

Home * Programming * Languages * Fortran

Fortran, (FORTRAN)
a general purpose, procedural and imperative programming language. Fortran was proposed and designed by John W. Backus as alternative for the IBM 704 assembly language. A draft specification for the IBM mathematical Formula Translating System was completed by mid 1954. The first Fortran compiler appeared in 1957 and was the first widely used high-level programming language. Successive versions have added varios features over the years, such as recursive routines and dynamic memory allocation in Fortran 90. Many early chess programs were written in Fortran.

Punched card

FortranCardPROJ039.agr.jpg

Punched card from a Fortran program: Z(1) = Y + W(1) [1]

Sample Chess Code

A recursive Fortran 90 Alpha-Beta search routine [2]:

RECURSIVE FUNCTION EVALUATE (ID, PRUNE) RESULT (RES) 
  USE GLOBALS 
  IMPLICIT INTEGER(A-Z) 
  DIMENSION XX(0:26), YY(0:26), CC(0:26) 
  LEVEL=LEVEL+1 
  BESTSCORE=10000*ID 
  DO B=7,0, -1 
     DO A=7,0, -1 
        ! generate the moves for all the pieces 
        ! and iterate through them 
        IF (SGN(BOARD(B,A))/=ID) CYCLE 
        CALL MOVELIST (A, B, XX, YY, CC, NDX) 
        DO I=0,NDX,1 
           X=XX(I); Y=YY(I); C=CC(I) 
           OLDSCORE=SCORE; MOVER=BOARD(B,A); TARG=BOARD(Y,X) 
           ! make the move and evaluate the new position 
           ! recursively. Targ holds the relative value of the piece 
           ! allowing use to calculate material gain/loss 
           CALL MAKEMOVE (A, B, X, Y, C) 
           IF (LEVEL<MAXLEVEL) THEN 
              SCORE=SCORE+EVALUATE(-ID, & 
                    BESTSCORE-TARG+ID*(8-ABS(4-X)-ABS(4-Y))) 
           END IF 
           SCORE=SCORE+TARG-ID*(8-ABS(4-X)-ABS(4-Y)) 
           ! we want to minimize the maximum possible loss 
           ! for black 
           IF ((ID<0 .AND. SCORE>BESTSCORE) .OR. & 
              (ID>0 .AND. SCORE<BESTSCORE)) THEN 
              BESTA(LEVEL)=A; BESTB(LEVEL)=B 
              BESTX(LEVEL)=X; BESTY(LEVEL)=Y 
              BESTSCORE=SCORE 
              IF ((ID<0 .AND. BESTSCORE>=PRUNE) .OR. & 
                 (ID>0 .AND. BESTSCORE<=PRUNE)) THEN 
                 BOARD(B,A)=MOVER; BOARD(Y,X)=TARG; SCORE=OLDSCORE 
                 LEVEL=LEVEL-1 
                 RES = BESTSCORE 
                 RETURN 
              END IF 
           END IF 
           BOARD(B,A)=MOVER; BOARD(Y,X)=TARG; SCORE=OLDSCORE 
        END DO 
     END DO 
  END DO 
  LEVEL=LEVEL-1 
  RES=BESTSCORE 
  RETURN 
END FUNCTION EVALUATE 

See also

Publications

Forum Posts

External Links

References

Up one Level