Here's a very basic and rough engine script that utilizes Lookout and beats both scripts in the OP:
# "Simulators can't play engines!"
{
name: 'KC-Engine'
author: 'SheCantSayNo'
requires: ['Lookout', 'Caravan', 'Bazaar', 'Festival', 'Embassy', "King's Court"]
gainPriority: (state, my) -> [
"Festival" if my.countInDeck("King's Court") > 1 and my.countInDeck("Festival") == 0
"King's Court" if my.countInDeck("King's Court") < 5
"Colony"
"Province" if state.gainsToEndGame() <= 3
"Bazaar" if my.countInDeck("Bazaar") < 3 #5-2 opening
"Embassy" if my.countInDeck("Embassy") == 0
"Caravan" if my.countInDeck("Caravan") < 1 #4-3 opening
"Lookout" if my.countInDeck("Lookout") < 1 #4-3 opening
"Festival" if my.countInDeck("Festival") < 2
"Festival" if my.ai.drewDeck(state, my) == 1
"Duchy" if state.gainsToEndGame() <= 2
"Bazaar"
"Caravan" if state.gainsToEndGame() > 2
"Silver" if state.gainsToEndGame() > 2
"Estate" if state.gainsToEndGame() <= 2
]
drewDeck: (state, my) ->
draw = my.cardsInDeck
for card in my.hand
draw--
for card in my.inPlay
draw--
if draw == 0
return 1
else
return 0
multipliedPriority: (state, my) -> [
"King's Court"
"Caravan" if my.ai.drewDeck(state, my) == 0
"Bazaar" if my.ai.drewDeck(state, my) == 0
"Festival"
"Embassy" if my.ai.drewDeck(state, my) == 0
"Bazaar"
"Caravan"
"Lookout" if state.gainsToEndGame() >= 6
]
playPriority: (state, my) -> [
"King's Court"
"Lookout" if state.gainsToEndGame() >= 4
"Caravan"
"Bazaar"
"Festival"
"Embassy"
"Silver"
"Copper"
]
}
Try skipping Lookout to see how much poorer it does.