Stable marriage problem: Difference between revisions

Content added Content deleted
m (→‎{{header|Tcl}}: Shortened lines)
Line 839: Line 839:
set guylikes [dict get $preferences $guy]
set guylikes [dict get $preferences $guy]
if {pos($guylikes,$guysgirl) > pos($guylikes,$she)} {
if {pos($guylikes,$guysgirl) > pos($guylikes,$she)} {
puts "$she likes $guy better than $he and $he likes $she better than their current partner"
puts "$she likes $guy better than $he and $he likes $she better\
than their current partner"
return 0
return 0
}
}
Line 847: Line 848:
set gallikes [dict get $preferences $gal]
set gallikes [dict get $preferences $gal]
if {pos($gallikes,$galsguy) > pos($gallikes,$he)} {
if {pos($gallikes,$galsguy) > pos($gallikes,$he)} {
puts "$he likes $gal better than $she and $she likes $he better than their current partner"
puts "$he likes $gal better than $she and $she likes $he better\
than their current partner"
return 0
return 0
}
}