Category : Files from Magazines
Archive   : DDJ8708.ZIP
Filename : BOWMAN.EXP

 
Output of file : BOWMAN.EXP contained in archive : DDJ8708.ZIP

1: bktkfind( node )
2: begin
3: if( node = SUCCESS )
4: then
5: return( I_FOUND_IT )
6: endif
7: for( each_choice_at_this_node )
8: do
9: ret_stat = bktkfind( child_node )
10: if( ret_stat = SUCCESS )
11: then
12: return( ret_stat )
13: endif
14: done
15: return( FAIL )
16: endproc

Example 1: Pseudocode for a chronological backtracking function



@puzzle
----
$-$- (`$' = Blank)
----
-$$-
@words
best
tamp
tops
era
to

Example 2: Sample input




best
$r$o (`$' = Blank)
tamp
o$$s

Example 3: Sample output




1: posn := [];
2: (forall j in [ 1..8 ])
3: { j : j in [ 1..8 ] | OK }
4: unattacked := { 1..8 } - { posn(k) + (j-k)*slope
5: : k in [ 1..j-1 ],
6: slope in [ -1..+1 ] }
7: if( unattacked = {} )
8: then
9: FAIL;
10: else
11: posn(j) := ord unattacked;
12: endif;
13: end forall;
14: print( posn );

Example 4: Eight queens problem





1: solve( length, width )
2: int length, width;
3: {
4: int l, w, i, len, tmp, type;
5: char old[ WORDLEN - MINWORD + 1 ];
6:
7: w = width;
8: l = length;
9: len = next( &l, &w, &type );
10: if( len == 0 )
11: return( SOLVED );
12:
13: for(i = 0;i 14: if( FLAG(len, i) == FREE
15: && itfits(l, w, WORD(len, i), type) ){
16: FLAG(len, i) = USED;
17: enter(old, l, w, WORD(len,i), type);
18: prev = type;
19: tmp = solve( l, w );
20: if( tmp == SOLVED )
21: return( SOLVED );
22: restore( old, l, w, type );
23: FLAG(len, i) = FREE;
24: }
25: }
26:
27: return( 0 );
28: }

Example 5: The function solve().


  3 Responses to “Category : Files from Magazines
Archive   : DDJ8708.ZIP
Filename : BOWMAN.EXP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/