Changes

Jump to: navigation, search

Fortran

5,499 bytes added, 09:58, 25 May 2018
Created page with "'''Home * Programming * Languages * Fortran''' '''Fortran''', (FORTRAN)<br/> a general purpose, [https://en.wikipedia.org/wiki/Procedural_programming pr..."
'''[[Main Page|Home]] * [[Programming]] * [[Languages]] * Fortran'''

'''Fortran''', (FORTRAN)<br/>
a general purpose, [https://en.wikipedia.org/wiki/Procedural_programming procedural] and [https://en.wikipedia.org/wiki/Imperative_programming_language imperative] [https://en.wikipedia.org/wiki/Programming_language programming language]. Fortran was proposed and designed by [https://en.wikipedia.org/wiki/John_Backus John W. Backus] as alternative for the [[IBM 704]] [[Assembly|assembly]] language. A draft specification for the [[IBM]] mathematical '''For'''mula '''Tran'''slating System was completed by mid 1954. The first Fortran compiler appeared in 1957 and was the first widely used [https://en.wikipedia.org/wiki/High-level_programming_language high-level programming language]. Successive versions have added varios features over the years, such as [[Recursion|recursive routines]] and [https://en.wikipedia.org/wiki/Dynamic_memory_allocation dynamic memory allocation] in [https://en.wikipedia.org/wiki/Fortran#Fortran_90 Fortran 90]. Many early chess programs were written in Fortran.

=Punched card=
[[FILE:FortranCardPROJ039.agr.jpg|none|border|text-bottom|800px]]
[https://en.wikipedia.org/wiki/Punched_card Punched card] from a Fortran program: Z(1) = Y + W(1) <ref>[https://en.wikipedia.org/wiki/Punched_card Punched card from Wikipedia]</ref>

=Sample Chess Code=
A recursive Fortran 90 [[Alpha-Beta]] search routine <ref>[http://cap.connx.com/chess-engines/new-approach/chessf90.zip chessf90.zip, Source and 64 bit Windows executable of A Fortran 90 chess program] from [http://cap.connx.com/ cap.connx.com] by [[Dann Corbit]]</ref>:
<pre>
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
</pre>

=See also=
* [[Basic]]
* [[IBM 704]]

=Publications=
* P E Bryant and M J Baylis ('''1968'''). ''[http://www.chilton-computing.org.uk/acl/literature/reports/p022.htm FORTRAN - A Comparative Study]''. [http://www.chilton-computing.org.uk/acl/literature/reports/overview.htm Literature: Reports] hosted by [[Atlas Computer Laboratory]]
* [[James Gillogly]] ('''1970'''). ''[http://www.rand.org/pubs/papers/P4428/ MAX : A FORTRAN Chess Player]''. [https://en.wikipedia.org/wiki/RAND RAND] paper
* [https://en.wikipedia.org/wiki/John_Backus John Backus] ('''1978''') ''[http://portal.acm.org/citation.cfm?id=1198345 The history of Fortran I, II, and III]''. in [https://en.wikipedia.org/wiki/Richard_Wexelblat Richard L. Wexelblat] (ed) [http://portal.acm.org/citation.cfm?id=800025&picked=prox&cfid=20756760&cftoken=81135282 History of programming languages I]
* [http://www.iumsp.ch/Unites/us/Alfio/msp_Alfio.htm Alfio Marazz], [[Johann Joss]], [http://www.365chess.com/players/Alex_Randriamiharisoa Alex Randriamiharisoa] ('''1993'''). ''[http://portal.acm.org/citation.cfm?id=134866 Algorithms, routines, and S functions for robust statistics: the FORTRAN library ROBETH with an interface to S-PLUS]''. Wadsworth And Brooks/Cole Statistics/Probability Series, [http://www.amazon.com/exec/obidos/ASIN/0534196985/acmorg-20 amazon]

=External Links=
* [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://software.intel.com/en-us/intel-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://sydney.edu.au/engineering/aeromech/wwwcomp/f90faq.htm Fortran FAQ]
* [http://groups.google.com/group/comp.lang.fortran/topics comp.lang.fortran] Discussion about Fortran

=References=
<references />

'''[[Languages|Up one Level]]'''

Navigation menu