Q:

Bridges (Hashi)

Unsolved puzzle:

Solved Puzzle:

Rules

Each circle with number must have as many lines from it as the number
in the circle.
It is not allowed to have more than two lines between two circles.
The lines can not cross each other.
All the lines must either be horizontal or vertical. It is not allowed to draw lines diagonally.
All lines must be connected.

Program Description
Write a program to input a bridges puzzle from a text file and output the solution
Input file guidelines
The input file must display a number for the number of bridges connected and . for whitespace.
Example:
2.2.5.2.
.....1.3
6.3.....
.2..6.1.
3.1..2.6
.2......
1.3.5..3
.2.3..2.

Output guidelines
Replace periods with

- single horizontal line
= double horizontal line
| single vertical line
$ double vertical line

From the data file above, you should get this as output:
2 2-5=2 
$ | $1-3
6=3 $  $
$2--6-1$
3|1 $2=6
|2| $  $
1|3=5--3
 2-3==2 

A:

Ruby, 414 characters
h=->l,s,v{l[s.index(v)||s.size]}
c=->r,f{r[f].to_i-h[[1,2,0],'|$',r[f-N]]-h[[1,2,0],'-=',r[f-1]]-h[[1,2,0],'-=',r[f+1]]}
s=->r{(f=r=~/\./)&&(m=h[[2,4,25,25,25,31],w='|$-= ',a=r[f-N]]&h[[7,7,8,16,7,31],w,r[f-1]]
a=~/\d/&&m&=(0>d=c[r,f-N])?0:d<1?25:d<2?2:d<3?4:0
' |$-='.chars{|k|m&1>0&&(r[f]=k;s[r]);m=m>>1};r[f]='.')||r[-N..-1]=~/^ +$/&&$><<r[N..-N].tr("0",$/)}
N=1+((t=STDIN.read)=~/$/)
s[$/*N+t.tr($/,"0")+"."*N]

Example:
2.2.5.2.
.....1.3
6.3.....
.2..6.1.
3.1..2.6
.2......
1.3.5..3
.2.3..2.

2 2-5=2
$ | $1-3
6=3 $  $
$2--6-1$
3|1 $2=6
|2| $  $
1|3=5--3
 2-3==2

