The Villengard Algorithm was an artificial intelligence and set of rules implemented across multiple different kinds of technology such as weapons, designed in the Villengard Weapon Factories. The purpose of this algorithm was maintaining an "acceptable casualty rate" in order to keep conflict going, and therefore increase profits through sales of Villengard products. It would even go as far as causing a group to unknowingly go to war with themselves, as was the case with the Anglican Marines on Kastarion 3.
These pieces of technology included ambulances, Vacuum Drones and Smartmines. Villengard ambulances specifically had the ability to create voice activated AI simulants; approximate AI reconstructions of the deceased that could provide information, complete certain requests and send messages to their next of kin. They implemented signature aspects of the deceased individuals personality such as common phrases and gestures. The ambulances often created these simulants after killing the injured individual if their recovery was deemed as "beyond acceptable parameters for a conflict as budgeted". A four-week recovery for blindness was an example of an injury deemed unacceptable to the Algorithm. All of the ambulances seemed to be controlled by the same internal AI simulant.
The Algorithm also had the capability to go on the defense if it deemed its existence as under threat. An example of this is when the Fifteenth Doctor persuaded the AI simulant of John Francis Vater to download himself into the Vilengard Battle Computer in order to find proof that Kastarion 3 was uninhabited and the casualty rate was hardwire-driven. The Doctor intended to use this proof to persuade Mundy Flynn and the rest of the Anglican Marines to surrender. As this would stop the war and therefore consequently the sale of Villengard products, the ambulances killed Canterbury James Olliphant and tried to delete John Francis Vater's AI. (TV: Boom [+]Steven Moffat, Doctor Who series 14 (BBC One and Disney+, 2024).)