I endorse the idea of a 'two-stay' trip - 3+/- nights in St. Andrews followed by 3+/- nights in another center (Gullane, Troon...) - around St. Andrews I would actually opt for Kingsbarns over Carnoustie, other than the novelty value of playing a strong/tough Open venue (I just find Kingsbarns to be outstanding AND to be more fun...along with spectacular scenery...plus Kingsbarns saves 45+ minutes driving...each way)...I would play a day at Crail (Balcomie and Craighead)...very affordable and nice mix of classic old and modern links. Many others in the area including Elie and Lundin, plus of course the other St. Andrews courses (none of which I have played!)
From St. Andrews, Troon and East Lothian are easily driveable within ~ 2 hours, but not ideal for day trips - you need to MOVE to one of the towns...Troon/Prestwick or Gullane/North Berwick...both are fabulous...whichever one you miss this trip you must cover next time...in Ayrshire you play Troon, Prestwick, Western Gailes, Turnberry etc (all classics)....in East Lothian you work everything around the Muirfiield calendar, and add North Berwick first, then Gullane, then some combination of Renaissance, Luffnes etc