When the great army arrived at Dingjun Mountain, Huang Zhong could vaguely see that the terrain was steep and difficult to seize quickly. Fa Zheng said: 'First, we can occupy the high ground and block the key passes. If they come out rashly, we can strike them.' Huang Zhong Following the plan, they set up camp at the foot of Dingjun Mountain, backed by the mountain and facing the river, and sent soldiers daily to provoke battle. Xiahou Yuan, relying on his own bravery, wanted to go out and fight, but was stopped by Zhang He. After a few days, Huang Zhong feigned defeat and retreated, luring Xiahou Yuan out of his camp to pursue. Xiahou Yuan indeed fell for the trap, leading his troops in pursuit, but unexpectedly Huang Zhong had set up an ambush halfway, thoroughly defeating Xiahou Yuan and forcing him to retreat to Dingjun Mountain. Huang Zhong's morale was greatly boosted, and he pressed the advantage in pursuit, directly reaching the foot of the mountain.
Fa Zheng climbed to a high vantage point and observed that Xiahou Yuan's army was demoralized, and seeing his impatient nature, knew he would personally come to supervise the battle. He then said to Huang Zhong: 'Now we can conserve our strength and wait for them to become exhausted before attacking. I observe that Xiahou Yuan will personally come out tomorrow to repair the cheval-de-frise. General, you can take advantage of his unpreparedness and strike in one go!' Huang Zhong Following the advice, he held his troops in place, only waiting for the next day. The next day, Xiahou Yuan indeed came out personally to supervise the repair of the cheval-de-frise. At that time, Fa Zheng saw him from a distance and immediately gave the order for Huang Zhong to attack.
Huang Zhong heard the drum, his spirits lifted, and charging forward alone on his horse with a single blade, he rushed straight ahead. Xiahou Yuan, unable to defend himself, caught off guard, was split in two by Huang Zhong with a furious shout and a flash of his blade. Thus, Dingjun Mountain was taken by Huang Zhong. When Cao Cao heard of Xiahou Yuan's death, he was enraged and personally led a great army to seize Hanzhong. Liu Bei and Zhuge Liang were on full alert, awaiting him. Cao Cao repeatedly attacked but could not succeed. Additionally, his provisions were insufficient, his soldiers were exhausted, and morale wavered. Moreover, Yang Xiu was executed by Cao Cao for seeing through the meaning of the two words 'chicken rib.' In the end, Cao Cao found himself in a dilemma and had no choice but to lead his troops back to Chang'an. Liu Bei thus gained all of Hanzhong, proclaimed himself King of Hanzhong, established his government, appointed officials, and enfeoffed the Five Tiger Generals, his prestige shaking the realm for a time.