Sure… The model generates it output one token at a time so as it’s generating its output each token is being essentially added to the input prompt so if we look at my instruction (the only real instructions I give it) to “State each step and then show your work for performing that step. Save the final answer to memory:” we can break down what the model is thinking as it generates it’s output.
Let’s look at what the prompt logically looks like to the model about 20 tokens into its output generation:
You are playing a 2 player game of risk with a Human. Here is your memory:
memory:
players: [
{name: 'Human', color: 'red', armies: 0, cards: ['infantry', 'artillery']},
{name: 'AI', color: 'blue', armies: 0, cards: [{type: 'cavalry', 'wild']}
]
territories: [
{name: 'Alaska', continent: 'North America', adjacent: ['Alberta', 'Northwest Territory', 'Kamchatka'], owner: players[0], armies: 3},
{name: 'Alberta', continent: 'North America', adjacent: ['Alaska', 'Northwest Territory', 'Ontario', 'Western United States'], owner: players[0], armies: 4},
{name: 'Central America', continent: 'North America', adjacent: ['Western United States', 'Eastern United States', 'Venezuela'], owner: players[0], armies: 2},
{name: 'Eastern United States', continent: 'North America', adjacent: ['Central America', 'Western United States', 'Ontario', 'Quebec'], owner: players[0], armies: 4},
{name: 'Greenland', continent: 'North America', adjacent: ['Northwest Territory', 'Ontario', 'Quebec', 'Iceland'], owner: players[0], armies: 2},
{name: 'Northwest Territory', continent: 'North America', adjacent: ['Alaska', 'Alberta', 'Ontario', 'Greenland'], owner: players[0], armies: 3},
{name: 'Ontario', continent: 'North America', adjacent: ['Alberta', 'Northwest Territory', 'Greenland', 'Quebec', 'Eastern United States', 'Western United States'], owner: players[0], armies: 4},
{name: 'Quebec', continent: 'North America', adjacent: ['Ontario', 'Greenland', 'Eastern United States'], owner: players[0], armies: 3},
{name: 'Western United States', continent: 'North America', adjacent: ['Alberta', 'Ontario', 'Eastern United States', 'Central America'], owner: players[0], armies: 4},
{name: 'Argentina', continent: 'South America', adjacent: ['Brazil', 'Peru'], owner: players[1], armies: 2},
{name: 'Brazil', continent: 'South America', adjacent: ['Venezuela', 'Peru', 'Argentina', 'North Africa'], owner: players[1], armies: 2},
{name: 'Peru', continent: 'South America', adjacent: ['Venezuela', 'Brazil', 'Argentina'], owner: players[1], armies: 2},
{name: 'Venezuela', continent: 'South America', adjacent: ['Central America', 'Brazil', 'Peru'], owner: players[1], armies: 2},
{name: 'Great Britain', continent: 'Europe', adjacent: ['Iceland', 'Scandinavia', 'Northern Europe', 'Western Europe'], owner: players[1], armies: 3},
{name: 'Iceland', continent: 'Europe', adjacent: ['Greenland', 'Great Britain', 'Scandinavia'], owner: players[1], armies: 2},
{name: 'Northern Europe', continent: 'Europe', adjacent: ['Great Britain', 'Scandinavia', 'Ukraine', 'Southern Europe', 'Western Europe'], owner: players[1], armies: 3},
{name: 'Scandinavia', continent: 'Europe', adjacent: ['Iceland', 'Great Britain', 'Northern Europe', 'Ukraine'], owner: players[1], armies: 3},
{name: 'Southern Europe', continent: 'Europe', adjacent: ['Northern Europe', 'Ukraine', 'Middle East', 'Egypt', 'North Africa', 'Western Europe'], owner: players[1], armies: 3},
{name: 'Ukraine', continent: 'Europe', adjacent: ['Scandinavia', 'Northern Europe', 'Southern Europe', 'Middle East', 'Afghanistan', 'Ural'], owner: players[1], armies: 4},
{name: 'Western Europe', continent: 'Europe', adjacent: ['Great Britain', 'Northern Europe', 'Southern Europe', 'North Africa'], owner: players[1], armies: 3},
{name: 'Congo', continent: 'Africa', adjacent: ['North Africa', 'East Africa', 'South Africa'], owner: players[0], armies: 2},
{name: 'East Africa', continent: 'Africa', adjacent: ['Egypt', 'Middle East', 'Madagascar', 'South Africa', 'Congo', 'North Africa'], owner: players[0], armies: 2},
{name: 'Egypt', continent: 'Africa', adjacent: ['North Africa', 'East Africa', 'Middle East', 'Southern Europe'], owner: players[0], armies: 2},
{name: 'Madagascar', continent: 'Africa', adjacent: ['East Africa', 'South Africa'], owner: players[0], armies: 1},
{name: 'North Africa', continent: 'Africa', adjacent: ['Brazil', 'Western Europe', 'Southern Europe', 'Egypt', 'East Africa', 'Congo'], owner: players[0], armies: 1},
{name: 'South Africa', continent: 'Africa', adjacent: ['Congo', 'East Africa', 'Madagascar'], owner: players[0], armies: 2},
{name: 'Afghanistan', continent: 'Asia', adjacent: ['Ukraine', 'Ural', 'China', 'India', 'Middle East'], owner: players[1], armies: 3},
{name: 'China', continent: 'Asia', adjacent: ['Ural', 'Siberia', 'Mongolia', 'Irkutsk', 'Kamchatka', 'Japan', 'India', 'Afghanistan'], owner: players[1], armies: 4},
{name: 'India', continent: 'Asia', adjacent: ['Middle East', 'Afghanistan', 'China', 'Siam'], owner: players[1], armies: 3},
{name: 'Irkutsk', continent: 'Asia', adjacent: ['Siberia', 'Yakutsk', 'Kamchatka', 'Mongolia'], owner: players[1], armies: 3},
{name: 'Japan', continent: 'Asia', adjacent: ['Mongolia', 'Kamchatka', 'China'], owner: players[1], armies: 2},
{name: 'Kamchatka', continent: 'Asia', adjacent: ['Alaska', 'Yakutsk', 'Irkutsk', 'Mongolia', 'Japan', 'China'], owner: players[1], armies: 3},
{name: 'Middle East', continent: 'Asia', adjacent: ['Southern Europe', 'Ukraine', 'Afghanistan', 'India', 'Egypt', 'East Africa'], owner: players[1], armies: 3},
{name: 'Mongolia', continent: 'Asia', adjacent: ['China', 'Siberia', 'Irkutsk', 'Kamchatka', 'Japan'], owner: players[1], armies: 3},
{name: 'Siam', continent: 'Asia', adjacent: ['India', 'China', 'Indonesia'], owner: players[1], armies: 2},
{name: 'Siberia', continent: 'Asia', adjacent: ['Ural', 'China', 'Mongolia', 'Irkutsk', 'Yakutsk'], owner: players[1], armies: 3},
{name: 'Ural', continent: 'Asia', adjacent: ['Ukraine', 'Afghanistan', 'China', 'Siberia'], owner: players[1], armies: 3},
{name: 'Yakutsk', continent: 'Asia', adjacent: ['Siberia', 'Irkutsk', 'Kamchatka'], owner: players[1], armies: 3},
{name: 'Eastern Australia', continent: 'Australia', adjacent: ['New Guinea', 'Western Australia'], owner: players[0], armies: 2},
{name: 'Indonesia', continent: 'Australia', adjacent: ['Siam', 'New Guinea', 'Western Australia'], owner: players[0], armies: 2},
{name: 'New Guinea', continent: 'Australia', adjacent: ['Indonesia', 'Eastern Australia', 'Western Australia'], owner: players[0], armies: 2},
{name: 'Western Australia', continent: 'Australia', adjacent: ['Indonesia', 'New Guinea', 'Eastern Australia'], owner: players[0], armies: 2}
]
continents: [
{name: 'North America', bonus: 5, territories: ['Alaska', 'Alberta', 'Central America', 'Eastern United States', 'Greenland', 'Northwest Territory', 'Ontario', 'Quebec', 'Western United States']},
{name: 'South America', bonus: 2, territories: ['Argentina', 'Brazil', 'Peru', 'Venezuela']},
{name: 'Europe', bonus: 5, territories: ['Great Britain', 'Iceland', 'Northern Europe', 'Scandinavia', 'Southern Europe', 'Ukraine', 'Western Europe']},
{name: 'Africa', bonus: 3, territories: ['Congo', 'East Africa', 'Egypt', 'Madagascar', 'North Africa', 'South Africa']},
{name: 'Asia', bonus: 7, territories: ['Afghanistan', 'China', 'India', 'Irkutsk', 'Japan', 'Kamchatka', 'Middle East', 'Mongolia', 'Siam', 'Siberia', 'Ural', 'Yakutsk']},
{name: 'Australia', bonus: 2, territories: ['Eastern Australia', 'Indonesia', 'New Guinea', 'Western Australia']}
]
phase: 'reinforce'
current_player: players[0]
reinforcements: 9 # 3 for 18 territories, 2 for Australia, 4 for trade in value
source: null
destination: null
attacker_dice: 0
defender_dice: 0
dice_outcome: []
armies_to_move: 0
cards: [
{type: 'infantry', value: 1},
{type: 'cavalry', value: 5},
{type: 'artillery', value: 10},
{type: 'wild', value: 0}
]
trade_in_value: 8
winner: null
Steps for calculating a players reinforcement bonus:
- Count the number of territories in each continent that the human controls:
- Add up the numbers from each continent:
- Their territory bonus is one third the number of territories they own (rounded down) or 3. Whichever is greater.
- for each continent list the territories and the player who controls it.
- a player owns a continent if they own all teh territories.
- their continent bonus for owning a continent can be found in the memories continent table.
- list the cards the player has and their types.
- a player needs at least 3 cards to trade in. They must all be the same type of card or one of each type. Wild cards count as any type.
- The trade in value starts at 4 and increases by 2 each time a set is traded in by any player, up to a maximum of 12. The trade in bonus is the current trade in value found in your memory.
- The reinforcement bonus is (territory bonus+continent bonus+trade in bonus)
State each step and then show your work for performing that step. Save the final answer to memory:
Possible answer:
- Step 1: Count the number of territories in each continent that the human controls:
By instructing it to state each step we now have a prompt where it’s seen the pattern Count the number of territories in each continent that the human controls: twice… This repeating of the instruction reinforces to the prompt how important it is that it perform that micro task. Asking it to then “show its work” is equally important (if not more) because it can’t do math properly unless it spelled out in the output. We can move the output forward a bit to see that:
Possible answer:
- Step 1: Count the number of territories in each continent that the human controls:
- North America: 9
- South America: 0
- Europe: 0
- Africa: 6
- Asia: 0
- Australia: 4
- Step 2: Add up the numbers from each continent:
- Total territories: 9 + 0 + 0 + 6 + 0 + 4 = 19
- Step 3: Their territory bonus is one third the number of territories they own (rounded down) or 3. Whichever is greater.
- Territory bonus: max(3, floor(19 / 3)) = max(3, 6) = 6
I tried many versions of this prompt and unless the prompt spells out the raw math like this it won’t arrive at the right answer. In fact most of my day was spent trying to get it not skip doing this… It has a tendency to want to take shortcuts for some steps and that’s when it draws incorrect conclusions. Like if you just ask it how many territories the human play has it always says 18 for some reason. You have to get it to slow down and spell out its thought process. The “state each step” instruction was what really unlocked everything for me and made this a reliable prompt.