Monday, August 23, 2004

Need a good software be complex to write?

... Frankly speaking i am also searching for the answer!
I had just started reading some of the initial pages of New Kind of Science by Stephen Wolfram
... and i have got a feeling that well it might be possible to write any software in a "more simple" way but not simpler.

For example i was trying to write a shortest program (in terms of condition checking) for finding all possible knight moves in fortran and ended up with the following, o/w a lot of thinking:
===================================

program knight
dimension id(16)
data id /2,-1, 2,1, -1,2, 1,2, -2,-1, -2,1, -1,-2, 1,-2/
read(*,*) i, j
if(i.gt.8.or.j.gt.8) stop
do m=1,16,+2
k=id(m)+i
l=id(m+1)+j
if(IOR(k,l).gt.0.and.k.le.8.and.l.le.8.and.k*l.ne.0)write(*,*)k,l
enddo
end


===================================

thought i feel the code is compact, i have a strong feeling that the program can be reduced further. but to do so i have to do a lot of background thinking, which infact may complicate the understanding of the program it self!

... may be my conclusions are primitive, or completely wrong? ... i am still researching!

No comments: