|
|
@ -27,16 +27,16 @@ import { TemplateRecord } from "./TemplateRecord";
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export function GetDeepestTemplate(brs: Board[]): TemplateRecord | undefined
|
|
|
|
export function GetDeepestTemplate(brs: Board[]): TemplateRecord | undefined
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let minDepth = Infinity;
|
|
|
|
let maxDepth = -Infinity;
|
|
|
|
let deepestTemplate: TemplateRecord;
|
|
|
|
let deepestTemplate: TemplateRecord;
|
|
|
|
for (let br of brs)
|
|
|
|
for (let br of brs)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (br.Template && br.Template.Object)
|
|
|
|
if (br.Template && br.Template.Object)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let template = br.Template.Object as TemplateRecord;
|
|
|
|
let template = br.Template.Object as TemplateRecord;
|
|
|
|
if (template.NodeDepth < minDepth)
|
|
|
|
if (template.NodeDepth > maxDepth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
minDepth = template.NodeDepth;
|
|
|
|
maxDepth = template.NodeDepth;
|
|
|
|
deepestTemplate = template;
|
|
|
|
deepestTemplate = template;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|