How to use branches method in Best

Best JavaScript code snippet using best

game_server_banshu.spec

Source:game_server_banshu.spec Github

copy

Full Screen

1{2"money": {"description": "货币配置表", "output": "../../doc/branches/banshu/game_server/data_money.config", "workbook": "../../doc/branches/banshu/RE0_item.xlsm", "sheet": "data_item", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}3, "section": {"description": "关卡配置表", "output": "../../doc/branches/banshu/game_server/data_section.config", "workbook": "../../doc/branches/banshu/RE0_section.xlsm", "sheet": "data_section", "label": 5, "begin": 6, "primkey": "section_id", "syntax": "off"}4, "chapter": {"description": "章节配置表", "output": "../../doc/branches/banshu/game_server/data_chapter.config", "workbook": "../../doc/branches/banshu/RE0_chapter.xlsm", "sheet": "data_chapter", "label": 5, "begin": 6, "primkey": "chapter_id", "syntax": "off"}5, "monster": {"description": "怪物配置表", "output": "../../doc/branches/banshu/game_server/data_monster.config", "workbook": "../../doc/branches/banshu/RE0_monster.xlsm", "sheet": "data_monster", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}6, "drop": {"description": "掉落配置表", "output": "../../doc/branches/banshu/game_server/data_drop.config", "workbook": "../../doc/branches/banshu/RE0_drop.xlsm", "sheet": "data_drop", "label": 5, "begin": 6, "primkey": "drop_id", "syntax": "off"}7, "role": {"description": "角色配置表", "output": "../../doc/branches/banshu/game_server/data_ger.config", "workbook": "../../doc/branches/banshu/RE0_role.xlsm", "sheet": "data_role", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}8, "role_break": {"description": "角色突破配置表", "output": "../../doc/branches/banshu/game_server/data_ger_breakout.config", "workbook": "../../doc/branches/banshu/RE0_role_break.xlsm", "sheet": "data_role_break", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}9, "role_uplevel": {"description": "角色强化配置表", "output": "../../doc/branches/banshu/game_server/data_ger_uplevel.config", "workbook": "../../doc/branches/banshu/RE0_role_uplevel.xlsm", "sheet": "data_role_uplevel", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}10, "equip_uplevel": {"description": "装备强化配置表", "output": "../../doc/branches/banshu/game_server/data_equip_uplevel.config", "workbook": "../../doc/branches/banshu/RE0_equip_uplevel.xlsm", "sheet": "data_equip_uplevel", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}11, "equip_break": {"description": "装备突破配置表", "output": "../../doc/branches/banshu/game_server/data_equip_breakout.config", "workbook": "../../doc/branches/banshu/RE0_equip_break.xlsm", "sheet": "data_equip_break", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}12, "role_upskill": {"description": "角色技能强化配置表", "output": "../../doc/branches/banshu/game_server/data_ger_upskill.config", "workbook": "../../doc/branches/banshu/RE0_role_upskill.xlsm", "sheet": "data_role_upskill", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}13, "card": {"description": "强化卡配置表", "output": "../../doc/branches/banshu/game_server/data_card.config", "workbook": "../../doc/branches/banshu/RE0_qianghuacard.xlsm", "sheet": "data_qianghuacard", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}14, "lucky_bastard": {"description": "抽卡配置表", "output": "../../doc/branches/banshu/game_server/data_box.config", "workbook": "../../doc/branches/banshu/RE0_lucky_bastard.xlsm", "sheet": "data_lucky_bastard", "label": 5, "begin": 6, "primkey": "pool_id", "syntax": "off"}15, "role_intimacy": {"description": "好感度配置表", "output": "../../doc/branches/banshu/game_server/data_intimacy.config", "workbook": "../../doc/branches/banshu/RE0_role_intimacy.xlsm", "sheet": "data_role_intimacy", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}16, "achieve_sub": {"description": "子成就配置表", "output": "../../doc/branches/banshu/game_server/data_achieve_sub.config", "workbook": "../../doc/branches/banshu/RE0_achieve_sub.xlsm", "sheet": "data_achieve_sub", "label": 5, "begin": 6, "primkey": "sub_achieve_id", "syntax": "off"}17, "player_level": {"description": "玩家等级配置表", "output": "../../doc/branches/banshu/game_server/data_player_level.config", "workbook": "../../doc/branches/banshu/RE0_player_level.xlsm", "sheet": "data_player_level", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}18, "achieve": {"description": "成就系统配置表", "output": "../../doc/branches/banshu/game_server/data_achieve.config", "workbook": "../../doc/branches/banshu/RE0_achieve.xlsm", "sheet": "data_achieve", "label": 5, "begin": 6, "primkey": "achieve_id", "syntax": "off"}19, "mail_template": {"description": "邮件系统配置表", "output": "../../doc/branches/banshu/game_server/data_mail_template.config", "workbook": "../../doc/branches/banshu/RE0_mail_template.xlsm", "sheet": "data_mail_template", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}20, "intimacy_addattr": {"description": "好感度升级加属性配置表", "output": "../../doc/branches/banshu/game_server/data_intimacy_addattr.config", "workbook": "../../doc/branches/banshu/RE0_intimacy_addattr.xlsm", "sheet": "data_intimacy_addattr", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}21, "sensitive_words": {"description": "敏感词配置表", "output": "../../doc/branches/banshu/game_server/data_sensitive_words.config", "workbook": "../../doc/branches/banshu/RE0_sensitive_words.xlsm", "sheet": "data_sensitive_words", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}22, "intimacy_uplevel": {"description": "好感度升级配置表", "output": "../../doc/branches/banshu/game_server/data_intimacy_uplevel.config", "workbook": "../../doc/branches/banshu/RE0_role_intimacy_uplevel.xlsm", "sheet": "data_role_intimacy_uplevel", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}23, "intimacy_gift": {"description": "好感度礼物配置表", "output": "../../doc/branches/banshu/game_server/data_intimacy_gift.config", "workbook": "../../doc/branches/banshu/RE0_role_intimacy_gift.xlsm", "sheet": "data_role_intimacy_gift", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}24, "scene": {"description": "场景配置表", "output": "../../doc/branches/banshu/game_server/data_scene.config", "workbook": "../../doc/branches/banshu/RE0_scene.xlsm", "sheet": "data_scene", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}25, "collection": {"description": "cg动画音乐资源配置表", "output": "../../doc/branches/banshu/game_server/data_collection.config", "workbook": "../../doc/branches/banshu/RE0_collection.xlsm", "sheet": "data_collection", "label": 5, "begin": 6, "primkey": "type_id", "syntax": "off"}26, "shop": {"description": "商店配置表", "output": "../../doc/branches/banshu/game_server/data_shop.config", "workbook": "../../doc/branches/banshu/RE0_shop.xlsm", "sheet": "data_shop", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}27, "goods": {"description": "商品配置表", "output": "../../doc/branches/banshu/game_server/data_goods.config", "workbook": "../../doc/branches/banshu/RE0_goods.xlsm", "sheet": "data_goods", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}28, "intimacy_section": {"description": "好感度剧情配置表", "output": "../../doc/branches/banshu/game_server/data_intimacy_section.config", "workbook": "../../doc/branches/banshu/RE0_role_intimacy_section.xlsm", "sheet": "data_role_intimacy_section", "label": 5, "begin": 6, "primkey": "section_id", "syntax": "off"}29, "inform": {"description": "公告配置表", "output": "../../doc/branches/banshu/game_server/data_inform.config", "workbook": "../../doc/branches/banshu/RE0_inform.xlsm", "sheet": "data_inform", "label": 5, "begin": 6, "primkey": "primkey", "syntax": "off"}30, "player_head": {"description": "玩家头像配置表", "output": "../../doc/branches/banshu/game_server/data_head.config", "workbook": "../../doc/branches/banshu/RE0_player_head.xlsm", "sheet": "data_player_head", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}31, "pay": {"description": "充值配置表", "output": "../../doc/branches/banshu/game_server/data_pay.config", "workbook": "../../doc/branches/banshu/RE0_pay.xlsm", "sheet": "data_pay", "label": 5, "begin": 6, "primkey": "pay_id", "syntax": "off"}32, "task": {"description": "任务配置表", "output": "../../doc/branches/banshu/game_server/data_task.config", "workbook": "../../doc/branches/banshu/RE0_task.xlsm", "sheet": "data_task", "label": 5, "begin": 6, "primkey": "task_id", "syntax": "off"}33, "boss": {"description": "世界boss配置表", "output": "../../doc/branches/banshu/game_server/data_boss.config", "workbook": "../../doc/branches/banshu/RE0_boss.xlsm", "sheet": "data_boss", "label": 5, "begin": 6, "primkey": "boss_id", "syntax": "off"}34, "robot": {"description": "机器人配置表", "output": "../../doc/branches/banshu/game_server/data_robot.config", "workbook": "../../doc/branches/banshu/RE0_robot.xlsm", "sheet": "data_robot", "label": 5, "begin": 6, "primkey": "role_id", "syntax": "off"}35, "train": {"description": "特训配置表", "output": "../../doc/branches/banshu/game_server/data_train.config", "workbook": "../../doc/branches/banshu/RE0_train.xlsm", "sheet": "data_train", "label": 5, "begin": 6, "primkey": "train_id", "syntax": "off"}36, "sign": {"description": "签到配置表", "output": "../../doc/branches/banshu/game_server/data_sign.config", "workbook": "../../doc/branches/banshu/RE0_sign.xlsm", "sheet": "data_sign", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}37, "skill": {"description": "技能配置表", "output": "../../doc/branches/banshu/game_server/data_skill.config", "workbook": "../../doc/branches/banshu/RE0_skill.xlsm", "sheet": "data_skill", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}38, "card_pool": {"description": "抽卡产出配置表", "output": "../../doc/branches/banshu/game_server/data_card_pool.config", "workbook": "../../doc/branches/banshu/RE0_card_pool.xlsm", "sheet": "data_card_pool", "label": 5, "begin": 6, "primkey": "draw_id", "syntax": "off"}39, "clientconfig": {"description": "客户端杂项配置表", "output": "../../doc/branches/banshu/game_server/data_clientconfig.config", "workbook": "../../doc/branches/banshu/RE0_clientconfig.xlsm", "sheet": "data_clientconfig", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}40, "buy_gold": {"description": "购买金币配置表", "output": "../../doc/branches/banshu/game_server/data_buy_gold.config", "workbook": "../../doc/branches/banshu/RE0_buy_gold.xlsm", "sheet": "data_buy_gold", "label": 5, "begin": 6, "primkey": "count", "syntax": "off"},41"rehearse": {"description": "演练所配置表", "output": "../../doc/branches/banshu/game_server/data_drillroom.config", "workbook": "../../doc/branches/banshu/RE0_rehearse.xlsm", "sheet": "data_rehearse", "label": 5, "begin": 6, "primkey": "npc_id", "syntax": "off"},42"rehearse_time": {"description": "演练所阶段配置表", "output": "../../doc/branches/banshu/game_server/data_drillroom_period.config", "workbook": "../../doc/branches/banshu/RE0_rehearse_time.xlsm", "sheet": "data_rehearse_time", "label": 5, "begin": 6, "primkey": "time_id", "syntax": "off"}43, "global": {"description": "全局变量配置表", "output": "../../doc/branches/banshu/game_server/data_global.config", "workbook": "../../doc/branches/banshu/RE0_global.xlsm", "sheet": "data_global", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}44, "whitelist": {"description": "玩家白名单配置表", "output": "../../doc/branches/banshu/game_server/data_whitelist.config", "workbook": "../../doc/branches/banshu/RE0_whitelist.xlsm", "sheet": "data_whitelist", "label": 5, "begin": 6, "primkey": "id", "syntax": "off"}...

Full Screen

Full Screen

data.py

Source:data.py Github

copy

Full Screen

...33_ft_Classification = feature_test("Classification")34#manually encode greedy ID tree for classifying trees35def get_tree_tree():36 tree = IDTNode(_ft_tt)._ssc(tree_classifiers[0], tree_data)37 branches = tree.get_branches()38 branches["Glossy"].set_node_classification("Oak")39 branches["Smooth"].set_node_classification("Maple")40 subnode = branches["Furrowed"]._ssc(tree_classifiers[3], tree_data_furrowed)41 subbranches = subnode.get_branches()42 subbranches["Yes"].set_node_classification("Maple")43 subbranches["No"].set_node_classification("Oak")44 return tree45def get_tree_tree_impossible():46 tree = IDTNode(_ft_tt)._ssc(tree_classifiers[0], tree_data)47 branches = tree.get_branches()48 branches["Glossy"].set_node_classification("Oak")49 branches["Smooth"].set_node_classification("Maple")50 subnode = branches["Furrowed"]._ssc(tree_classifiers[2], tree_data_furrowed)51 subbranches = subnode.get_branches()52 subbranches["Rounded"].set_node_classification("Oak")53 return tree54tree_classifiers_reverse = [\55 feature_test("has_leaves"),56 feature_test("leaf_shape"),57 feature_test("orange_foliage"),58 feature_test("tree_type"),59]60tree_test_point = {"name":"Tree7", "has_leaves":"Yes", "orange_foliage":"Yes", "leaf_shape":"Rounded", "bark_texture":"Furrowed"}61# Test what happens if it's not possible to complete the tree62tree_classifiers_impossible = [\63 feature_test("bark_texture"),64 feature_test("has_leaves"),65 feature_test("leaf_shape"),66]67# 2012 Q2: Angel or Not Angel?68angel_data = [\69 {"name":"Statue1", "Classification":"Angel", "Height":7, "Shape":"Human", "Material":"Stone"},70 {"name":"Statue2", "Classification":"Angel", "Height":2.5, "Shape":"Human", "Material":"Stone"},71 {"name":"Statue3", "Classification":"Not Angel", "Height":7, "Shape":"Human", "Material":"Copper"},72 {"name":"Statue4", "Classification":"Not Angel", "Height":3, "Shape":"Animal", "Material":"Copper"},73 {"name":"Statue5", "Classification":"Not Angel", "Height":8, "Shape":"Animal", "Material":"Stone"},74 {"name":"Statue6", "Classification":"Angel", "Height":305, "Shape":"Human", "Material":"Copper"},75]76angel_classifiers = [\77 feature_test("Shape"),78 threshold_test("Height", 7),79 feature_test("Material"),80]81_branches_yesno = ["No","Yes"]82# manually encode greedy ID tree83def get_angel_tree():84 tree = IDTNode(_ft_Classification)._ssc(angel_classifiers[0], angel_data)85 branches = tree.get_branches()86 branches["Animal"].set_node_classification("Not Angel")87 branches = branches["Human"].set_classifier_and_expand(angel_classifiers[2], ["Stone","Copper"]).get_branches()88 branches["Stone"].set_node_classification("Angel")89 branches = branches["Copper"].set_classifier_and_expand(angel_classifiers[1], _branches_yesno).get_branches()90 branches["No"].set_node_classification("Not Angel")91 branches["Yes"].set_node_classification("Angel")92 return tree93# 2013 Q2: Numeric ID tree94numeric_pre_data = {\95 "A": [(0.5, 1.5), (1.5, 0.5), (1.5, 1.5), (2.5, 0.5), (2.5, 2.5), (3.5, 0.5)],96 "B": [(0.5, 3.5), (2.5, 1.5), (3.5, 2.5)]97}98numeric_data0 = [[{"name":str((x,y)), "class":A_or_B, "X":x, "Y":y}99 for (x,y) in points]100 for (A_or_B, points) in [("A", numeric_pre_data["A"]), ("B", numeric_pre_data["B"])]]101 # Don't dare try to use .items() because the order is not guaranteed102numeric_data = numeric_data0[0] + numeric_data0[1]103numeric_classifiers = [\104 threshold_test("X", 1),105 threshold_test("X", 2),106 threshold_test("X", 3),107 threshold_test("Y", 1),108 threshold_test("Y", 2),109 threshold_test("Y", 3),110]111# manually encode greedy ID tree112def get_numeric_tree():113 tree = IDTNode(_ft_class)._ssc(numeric_classifiers[3], numeric_data)114 branches = tree.get_branches()115 branches["No"].set_node_classification("A")116 branches = branches["Yes"].set_classifier_and_expand(numeric_classifiers[2],_branches_yesno).get_branches()117 branches["Yes"].set_node_classification("B")118 branches = branches["No"].set_classifier_and_expand(numeric_classifiers[5],_branches_yesno).get_branches()119 branches["Yes"].set_node_classification("B")120 branches = branches["No"].set_classifier_and_expand(numeric_classifiers[1],_branches_yesno).get_branches()121 branches["No"].set_node_classification("A")122 branches = branches["Yes"].set_classifier_and_expand(numeric_classifiers[4],_branches_yesno).get_branches()123 branches["No"].set_node_classification("B")124 branches["Yes"].set_node_classification("A")125 return tree126# toy data for ID trees127toy_data_1 = [\128 {"name":"toypoint1", "class":1, "attr1":2, "attr2":4, "attr3":6},129 {"name":"toypoint2", "class":-1, "attr1":3, "attr2":5, "attr3":7}130]131toy_classifiers_1 = [\132 feature_test("attr2"),133 feature_test("attr1"),134 feature_test("attr3"),135]136toy_data_2 = [\137 {"name":"p1", "class":"A", "flavor":"vanilla"},138 {"name":"p2", "class":"B", "flavor":"vanilla"},139 {"name":"p3", "class":"C", "flavor":"vanilla"},140 {"name":"p4", "class":"D", "flavor":"chocolate"},141 {"name":"p5", "class":"A", "flavor":"chocolate"},142 {"name":"p6", "class":"B", "flavor":"chocolate"},143]144toy_classifiers_2 = [feature_test("flavor")]145# binary XOR data and trees146binary_pre_data = [\147 (1,0,0,0,0),148 (2,0,0,0,1),149 (3,1,0,1,0),150 (4,1,0,1,1),151 (5,1,1,0,1),152 (6,1,1,0,1),153 (7,0,1,1,0),154]155binary_data = [{"name":"point"+str(i), "Classification":s, "A":a, "B":b, "C":c}156 for (i,s,a,b,c) in binary_pre_data]157binary_classifiers = [feature_test("A"), feature_test("B"), feature_test("C")]158(bcA, bcB, bcC) = binary_classifiers159_branches_01=[0,1]160def get_binary_tree_1():161 tree = IDTNode(_ft_Classification)._ssc(bcB, binary_data)162 branches = tree.get_branches()163 branches[1].set_node_classification(1)164 branches = branches[0].set_classifier_and_expand(bcA,_branches_01).get_branches()165 branches[0].set_node_classification(0)166 branches[1].set_node_classification(1)167 return tree168def get_binary_tree_2():169 tree = IDTNode(_ft_Classification)._ssc(bcA, binary_data)170 branches = tree.get_branches()171 branches0 = branches[0].set_classifier_and_expand(bcB,_branches_01).get_branches()172 branches1 = branches[1].set_classifier_and_expand(bcB,_branches_01).get_branches()173 branches0[0].set_node_classification(0)174 branches0[1].set_node_classification(1)175 branches1[0].set_node_classification(1)176 branches1[1].set_node_classification(0)177 return tree178def get_binary_tree_3():179 tree = IDTNode(_ft_Classification)._ssc(bcC, binary_data)180 branches = tree.get_branches()181 branches0 = branches[0].set_classifier_and_expand(bcA,_branches_01).get_branches()182 branches1 = branches[1].set_classifier_and_expand(bcA,_branches_01).get_branches()183 branches0[1].set_node_classification(0)184 branches00 = branches0[0].set_classifier_and_expand(bcB,_branches_01).get_branches()185 branches00[0].set_node_classification(0)186 branches00[1].set_node_classification(1)187 branches1[1].set_node_classification(1)188 branches10 = branches1[0].set_classifier_and_expand(bcB,_branches_01).get_branches()189 branches10[0].set_node_classification(0)190 branches10[1].set_node_classification(1)191 return tree192binary_tree_1 = get_binary_tree_1()193binary_tree_2 = get_binary_tree_2()194binary_tree_3 = get_binary_tree_3()195################################################################################196############################# k-NEAREST NEIGHBORS ##############################197################################################################################198# 2014 Q2: Oak or Maple?199knn_tree_data = [\200 Point((10,5), "Oak"),201 Point((20,15), "Oak"),202 Point((20,40), "Oak"), #outlier...

Full Screen

Full Screen

data.js

Source:data.js Github

copy

Full Screen

1const servicesTable = [{2 "id": 51, // key : value3 "service": "Tres-Zap",4 "trademark": "Skynoodle",5 "branches": 63,6 "country": "Indonesia",7 "status": false8 }, {9 "id": 41,10 "service": "Duobam",11 "trademark": "Jabbersphere",12 "branches": 88,13 "country": "Russia",14 "status": true15 }, {16 "id": 27,17 "service": "Y-find",18 "trademark": "Jamia",19 "branches": 12,20 "country": "Luxembourg",21 "status": false22 }, {23 "id": 74,24 "service": "Tin",25 "trademark": "Youopia",26 "branches": 12,27 "country": "Sweden",28 "status": false29 }, {30 "id": 59,31 "service": "Tampflex",32 "trademark": "Flashdog",33 "branches": 23,34 "country": "China",35 "status": false36 }, {37 "id": 93,38 "service": "Fintone",39 "trademark": "Youspan",40 "branches": 43,41 "country": "Indonesia",42 "status": false43 }, {44 "id": 47,45 "service": "Temp",46 "trademark": "Skipstorm",47 "branches": 24,48 "country": "Palestinian Territory",49 "status": true50 }, {51 "id": 26,52 "service": "Sonsing",53 "trademark": "Flashset",54 "branches": 42,55 "country": "China",56 "status": false57 }, {58 "id": 98,59 "service": "Biodex",60 "trademark": "Vinder",61 "branches": 97,62 "country": "Philippines",63 "status": true64 }, {65 "id": 17,66 "service": "Pannier",67 "trademark": "Topicblab",68 "branches": 86,69 "country": "China",70 "status": true71 }, {72 "id": 95,73 "service": "Overhold",74 "trademark": "Realcube",75 "branches": 15,76 "country": "Russia",77 "status": true78 }, {79 "id": 5,80 "service": "Fixflex",81 "trademark": "Twimbo",82 "branches": 52,83 "country": "Brazil",84 "status": true85 }, {86 "id": 62,87 "service": "Alpha",88 "trademark": "Realbuzz",89 "branches": 23,90 "country": "Czech Republic",91 "status": true92 }, {93 "id": 33,94 "service": "Y-Solowarm",95 "trademark": "Voonder",96 "branches": 19,97 "country": "Colombia",98 "status": false99 }, {100 "id": 66,101 "service": "Aerified",102 "trademark": "Blogspan",103 "branches": 75,104 "country": "Portugal",105 "status": true106 }, {107 "id": 62,108 "service": "Veribet",109 "trademark": "Mynte",110 "branches": 11,111 "country": "Bulgaria",112 "status": false113 }, {114 "id": 15,115 "service": "Fix San",116 "trademark": "Minyx",117 "branches": 12,118 "country": "Poland",119 "status": false120 }, {121 "id": 42,122 "service": "Sub-Ex",123 "trademark": "Devify",124 "branches": 8,125 "country": "United States",126 "status": true127 }, {128 "id": 21,129 "service": "Voyatouch",130 "trademark": "Twitterbeat",131 "branches": 80,132 "country": "Belarus",133 "status": true134 }, {135 "id": 33,136 "service": "Voltsillam",137 "trademark": "Skyba",138 "branches": 6,139 "country": "France",140 "status": false141 }, {142 "id": 25,143 "service": "Voyatouch",144 "trademark": "Wordpedia",145 "branches": 62,146 "country": "China",147 "status": false148 }, {149 "id": 22,150 "service": "Andalax",151 "trademark": "Kayveo",152 "branches": 35,153 "country": "China",154 "status": false155 }, {156 "id": 3,157 "service": "Cookley",158 "trademark": "Browsecat",159 "branches": 39,160 "country": "China",161 "status": true162 }, {163 "id": 48,164 "service": "Mat Lam Tam",165 "trademark": "Vitz",166 "branches": 69,167 "country": "Ukraine",168 "status": true169 }, {170 "id": 52,171 "service": "Greenlam",172 "trademark": "Demivee",173 "branches": 25,174 "country": "United States",175 "status": false176 }, {177 "id": 97,178 "service": "Konklux",179 "trademark": "Mymm",180 "branches": 46,181 "country": "Philippines",182 "status": false183 }, {184 "id": 41,185 "service": "Matsoft",186 "trademark": "Plajo",187 "branches": 12,188 "country": "Georgia",189 "status": false190 }, {191 "id": 26,192 "service": "Toughjoyfax",193 "trademark": "Meetz",194 "branches": 100,195 "country": "Poland",196 "status": true197 }, {198 "id": 85,199 "service": "Fixflex",200 "trademark": "Divanoodle",201 "branches": 34,202 "country": "China",203 "status": false204 }, {205 "id": 82,206 "service": "Konklab",207 "trademark": "Skimia",208 "branches": 48,209 "country": "Indonesia",210 "status": false211 }, {212 "id": 14,213 "service": "Holdlamis",214 "trademark": "Aimbu",215 "branches": 63,216 "country": "Japan",217 "status": true218 }, {219 "id": 81,220 "service": "Andalax",221 "trademark": "Yakitri",222 "branches": 89,223 "country": "Indonesia",224 "status": false225 }, {226 "id": 68,227 "service": "Tresom",228 "trademark": "Zooveo",229 "branches": 19,230 "country": "Indonesia",231 "status": false232 }, {233 "id": 13,234 "service": "Sub-Ex",235 "trademark": "Zoomlounge",236 "branches": 45,237 "country": "France",238 "status": false239 }, {240 "id": 10,241 "service": "Flowdesk",242 "trademark": "Devpoint",243 "branches": 57,244 "country": "Mexico",245 "status": false246 }, {247 "id": 4,248 "service": "Biodex",249 "trademark": "Topiclounge",250 "branches": 80,251 "country": "Indonesia",252 "status": false253 }, {254 "id": 90,255 "service": "Flexidy",256 "trademark": "Eidel",257 "branches": 14,258 "country": "Sweden",259 "status": true260 }, {261 "id": 60,262 "service": "Toughjoyfax",263 "trademark": "Wikizz",264 "branches": 26,265 "country": "China",266 "status": true267 }, {268 "id": 12,269 "service": "Fixflex",270 "trademark": "Miboo",271 "branches": 24,272 "country": "Thailand",273 "status": true274 }, {275 "id": 93,276 "service": "Y-find",277 "trademark": "Browsebug",278 "branches": 17,279 "country": "Canada",280 "status": true281 }, {282 "id": 37,283 "service": "Zaam-Dox",284 "trademark": "Jaxbean",285 "branches": 28,286 "country": "Serbia",287 "status": true288 }, {289 "id": 79,290 "service": "Flexidy",291 "trademark": "Oba",292 "branches": 61,293 "country": "Iran",294 "status": true295 }, {296 "id": 56,297 "service": "Sub-Ex",298 "trademark": "Mudo",299 "branches": 67,300 "country": "Bangladesh",301 "status": false302 }, {303 "id": 8,304 "service": "Quo Lux",305 "trademark": "Meevee",306 "branches": 99,307 "country": "China",308 "status": false309 }, {310 "id": 20,311 "service": "Vagram",312 "trademark": "Flashpoint",313 "branches": 67,314 "country": "Poland",315 "status": true316 }, {317 "id": 51,318 "service": "Subin",319 "trademark": "Dabjam",320 "branches": 72,321 "country": "Colombia",322 "status": true323 }, {324 "id": 69,325 "service": "Temp",326 "trademark": "Topiczoom",327 "branches": 6,328 "country": "Palestinian Territory",329 "status": true330 }, {331 "id": 57,332 "service": "Flowdesk",333 "trademark": "Flipopia",334 "branches": 28,335 "country": "Russia",336 "status": true337 }, {338 "id": 28,339 "service": "Tres-Zap",340 "trademark": "Kwinu",341 "branches": 15,342 "country": "Indonesia",343 "status": true344 }, {345 "id": 35,346 "service": "Wrapsafe",347 "trademark": "Roomm",348 "branches": 55,349 "country": "Indonesia",350 "status": false351 }, ]...

Full Screen

Full Screen

items-array.service.ts

Source:items-array.service.ts Github

copy

Full Screen

1import {Injectable} from '@angular/core';2import {Branch, CommonCategory, Contacts, Item, ItemsService, MenuCategory, SoldItem} from './items.service';3import {BehaviorSubject, Observable} from 'rxjs';4import {environment} from './environments/environment';5import {map} from 'rxjs/operators';6import {HttpClient} from '@angular/common/http';7@Injectable({8 providedIn: 'root'9})10export class ItemsArrayService implements ItemsService {11 contacts: Contacts;12 branches$ = new BehaviorSubject<Branch[]>([]);13 items$ = new BehaviorSubject<MenuCategory[]>([]);14 items;15 constructor(private http: HttpClient) {16 this.GetContacts().subscribe(17 res => {18 this.contacts = res;19 }20 );21 this.http.get<Branch[]>(`${environment.apiUrl}/api/branches`).subscribe(22 res => {23 this.branches$.next(Object.assign([], res));24 }25 );26 this.http.get<[]>(`${environment.apiUrl}/api/items`).subscribe(27 res => {28 this.items$.next(Object.assign([], res));29 }30 );31 }32 AddItem(item: Item, categoryName: string): Observable<Item> {33 this.items = this.items$.value;34 const category = this.items.find(c => c.categoryName === categoryName);35 category.products.push(item);36 return this.http.put<Item>(`${environment.apiUrl}/api/items/${category.id}`, category);37 }38 DeleteItem(item: Item): Observable<boolean> {39 this.items = this.items$.value;40 const category: MenuCategory = this.items.find(c => item.menuCategory === c.categoryName);41 const itIndx = category.products.findIndex(i => (i.prodId) === (item.prodId));42 category.products.splice(itIndx, 1);43 return this.http.put<MenuCategory>(`${environment.apiUrl}/api/items/${category.id}`, category).pipe(map(44 res => {45 if (res) {46 this.items$.next(this.items);47 return true;48 }49 }50 ));51 }52 EditItem(item: Item): Observable<Item> {53 this.items = this.items$.value;54 const category: MenuCategory = this.items.find(c => item.menuCategory === c.categoryName);55 const idx = category.products.findIndex(i => i.prodId === item.prodId);56 category.products[idx] = item;57 return this.http.put<MenuCategory>(`${environment.apiUrl}/api/items/${category.id}`, category).pipe(map(58 res => {59 if (res) {60 this.items$.next(this.items);61 return item;62 }63 }64 ));65 }66 GetContacts(): Observable<Contacts> {67 return this.http.get<Contacts>(`${environment.apiUrl}/api/contacts/0`);68 }69 EditContacts(instagram, facebook, email, phone1, phone2, phone3, address): Observable<Contacts> {70 return this.http.patch<Contacts>(`${environment.apiUrl}/api/contacts/0`, {instagram, facebook, email, phone1, phone2, phone3, address}).pipe(map( res => {71 if (res) {72 this.contacts.instagram = res.instagram;73 this.contacts.facebook = res.facebook;74 this.contacts.email = res.email;75 this.contacts.phone1 = res.phone1;76 this.contacts.phone2 = res.phone2;77 this.contacts.phone3 = res.phone3;78 this.contacts.address = res.address;79 }80 return res;81 }, err => {82 console.error('error from server', err);83 }84 ));85 }86 DeleteBranch(branch): Observable<boolean> {87 return this.http.delete<boolean>(`${environment.apiUrl}/api/branches/${branch.id}`).pipe(map(88 res => {89 const branches = this.branches$.value;90 const brIndx = branches.findIndex(b => b.id === branch.id);91 branches.splice(brIndx, 1);92 this.branches$.next(branches);93 return true;94 }, err => {95 return false;96 }97 ));98 }99 GetBranches(): Observable<Branch[]> {100 return this.branches$.asObservable();101 }102 EditBranch(branch): Observable<Branch> {103 return this.http.patch<Branch>(`${environment.apiUrl}/api/branches/${branch.id}`, {address: branch.address, desc: branch.desc, photo: branch.photo}).pipe(map(104 res => {105 const branches = this.branches$.value;106 const brIndx = branches.findIndex(b => b.id === branch.id);107 branches[brIndx] = res;108 this.branches$.next(branches);109 return branch;110 }111 ));112 }113 ChangeBranchStatus(branch: Branch, newStatus: boolean): Observable<boolean> {114 return this.http.patch<boolean>(`${environment.apiUrl}/api/branches/${branch.id}`, {popular: newStatus}).pipe(map(115 res => {116 const branches = this.branches$.value;117 const brIndx = branches.findIndex(b => b.id === branch.id);118 if (!branch.popular) {119 branch.popular = true;120 this.branches$.next(branches);121 return true;122 }123 branches[brIndx].popular = !branches[brIndx].popular;124 this.branches$.next(branches);125 return true;126 }127 ));128 }129 AddNewBranch(newBranch: Branch): Observable<boolean> {130 return this.http.post<Branch>(`${environment.apiUrl}/api/branches`, newBranch).pipe(map(131 res => {132 const branches = this.branches$.value;133 branches.push(res);134 this.branches$.next(branches);135 return true;136 }, err => {137 return err;138 }139 ));140 }141 GetCommonCategories(): Observable<CommonCategory[]> {142 return this.http.get<CommonCategory[]>(`${environment.apiUrl}/api/common_categories`);143 }144 GetAllTheItems(): Observable<MenuCategory[]> {145 return this.items$.asObservable();146 }147 getBranchById(id: number): Observable<Branch> {148 return this.http.get<Branch>(`${environment.apiUrl}/api/branches/${id}`);149 }150 GetPromoItems(): Observable<Item[]> {151 return this.http.get<Item[]>(`${environment.apiUrl}/api/promoItems`);152 }153 GetNewItems(): Observable<Item[]> {154 return this.http.get<Item[]>(`${environment.apiUrl}/api/newItems`);155 }156 SoldTheItem(sItem: SoldItem): Observable<boolean> {157 return this.http.post<boolean>(`${environment.apiUrl}/api/sold`, sItem);158 }...

Full Screen

Full Screen

lab08.py

Source:lab08.py Github

copy

Full Screen

1def deep_len(lnk):2 """ Returns the deep length of a possibly deep linked list.3 >>> deep_len(Link(1, Link(2, Link(3))))4 35 >>> deep_len(Link(Link(1, Link(2)), Link(3, Link(4))))6 47 >>> levels = Link(Link(Link(1, Link(2)), \8 Link(3)), Link(Link(4), Link(5)))9 >>> print(levels)10 <<<1 2> 3> <4> 5>11 >>> deep_len(levels)12 513 """14 if not lnk:15 return 016 elif type(lnk) != Link:17 return 118 return deep_len(lnk.first) + deep_len(lnk.rest)19def make_to_string(front, mid, back, empty_repr):20 """ Returns a function that turns linked lists to strings.21 >>> kevins_to_string = make_to_string("[", "|-]-->", "", "[]")22 >>> jerrys_to_string = make_to_string("(", " . ", ")", "()")23 >>> lst = Link(1, Link(2, Link(3, Link(4))))24 >>> kevins_to_string(lst)25 '[1|-]-->[2|-]-->[3|-]-->[4|-]-->[]'26 >>> kevins_to_string(Link.empty)27 '[]'28 >>> jerrys_to_string(lst)29 '(1 . (2 . (3 . (4 . ()))))'30 >>> jerrys_to_string(Link.empty)31 '()'32 """33 def str_returner(link):34 if not link:35 return empty_repr36 return '{}{}{}{}{}'.format(front, link.first, mid, str_returner(link.rest), back)37 return str_returner38def tree_map(fn, t):39 """Maps the function fn over the entries of t and returns the40 result in a new tree.41 >>> numbers = Tree(1,42 ... [Tree(2,43 ... [Tree(3),44 ... Tree(4)]),45 ... Tree(5,46 ... [Tree(6,47 ... [Tree(7)]),48 ... Tree(8)])])49 >>> print(tree_map(lambda x: 2**x, numbers))50 251 452 853 1654 3255 6456 12857 25658 """59 branches = [tree_map(fn, b) for b in t.branches]60 return Tree(fn(t.label), branches)61def add_trees(t1, t2):62 """63 >>> numbers = Tree(1,64 ... [Tree(2,65 ... [Tree(3),66 ... Tree(4)]),67 ... Tree(5,68 ... [Tree(6,69 ... [Tree(7)]),70 ... Tree(8)])])71 >>> print(add_trees(numbers, numbers))72 273 474 675 876 1077 1278 1479 1680 >>> print(add_trees(Tree(2), Tree(3, [Tree(4), Tree(5)])))81 582 483 584 >>> print(add_trees(Tree(2, [Tree(3)]), Tree(2, [Tree(3), Tree(4)])))85 486 687 488 >>> print(add_trees(Tree(2, [Tree(3, [Tree(4), Tree(5)])]), \89 Tree(2, [Tree(3, [Tree(4)]), Tree(5)])))90 491 692 893 594 595 """96 if not t1:97 return t2.copy_tree()98 elif not t2:99 return t1.copy_tree()100 if len(t1.branches) < len(t2.branches):101 t1.branches += [None for _ in range(len(t1.branches), len(t2.branches))]102 elif len(t1.branches) > len(t2.branches):103 t2.branches += [None for _ in range(len(t2.branches), len(t1.branches))]104 branches = [add_trees(branch1, branch2) for branch1, branch2 in zip(t1.branches, t2.branches)]105 return Tree(t1.label+t2.label, branches)106# Link107class Link:108 """A linked list.109 >>> s = Link(1, Link(2, Link(3)))110 >>> s.first111 1112 >>> s.rest113 Link(2, Link(3))114 """115 empty = ()116 def __init__(self, first, rest=empty):117 assert rest is Link.empty or isinstance(rest, Link)118 self.first = first119 self.rest = rest120 def __repr__(self):121 if self.rest is Link.empty:122 return 'Link({})'.format(self.first)123 else:124 return 'Link({}, {})'.format(self.first, repr(self.rest))125 def __str__(self):126 """Returns a human-readable string representation of the Link127 >>> s = Link(1, Link(2, Link(3, Link(4))))128 >>> str(s)129 '<1 2 3 4>'130 >>> str(Link(1))131 '<1>'132 >>> str(Link.empty) # empty tuple133 '()'134 """135 string = '<'136 while self.rest is not Link.empty:137 string += str(self.first) + ' '138 self = self.rest139 return string + str(self.first) + '>'140# Tree141class Tree:142 def __init__(self, label, branches=[]):143 for c in branches:144 assert isinstance(c, Tree)145 self.label = label146 self.branches = list(branches)147 def __repr__(self):148 if self.branches:149 branches_str = ', ' + repr(self.branches)150 else:151 branches_str = ''152 return 'Tree({0}{1})'.format(self.label, branches_str)153 def is_leaf(self):154 return not self.branches155 def __eq__(self, other):156 return type(other) is type(self) and self.label == other.label \157 and self.branches == other.branches158 159 def __str__(self):160 def print_tree(t, indent=0):161 tree_str = ' ' * indent + str(t.label) + "\n"162 for b in t.branches:163 tree_str += print_tree(b, indent + 1)164 return tree_str165 return print_tree(self).rstrip()166 def copy_tree(self):...

Full Screen

Full Screen

cash-bank-branches-lov.route.ts

Source:cash-bank-branches-lov.route.ts Github

copy

Full Screen

1import { Injectable } from '@angular/core';2import { HttpResponse } from '@angular/common/http';3import { Resolve, ActivatedRouteSnapshot, Routes, Router } from '@angular/router';4import { JhiResolvePagingParams } from 'ng-jhipster';5import { Observable, of, EMPTY } from 'rxjs';6import { flatMap } from 'rxjs/operators';7import { Authority } from 'app/shared/constants/authority.constants';8import { UserRouteAccessService } from 'app/core/auth/user-route-access-service';9import { ICashBankBranchesLOV, CashBankBranchesLOV } from 'app/shared/model/cash-bank-branches-lov.model';10import { CashBankBranchesLOVService } from './cash-bank-branches-lov.service';11import { CashBankBranchesLOVComponent } from './cash-bank-branches-lov.component';12import { CashBankBranchesLOVDetailComponent } from './cash-bank-branches-lov-detail.component';13import { CashBankBranchesLOVUpdateComponent } from './cash-bank-branches-lov-update.component';14@Injectable({ providedIn: 'root' })15export class CashBankBranchesLOVResolve implements Resolve<ICashBankBranchesLOV> {16 constructor(private service: CashBankBranchesLOVService, private router: Router) {}17 resolve(route: ActivatedRouteSnapshot): Observable<ICashBankBranchesLOV> | Observable<never> {18 const id = route.params['branchPartyId'];19 if (id) {20 return this.service.find(id).pipe(21 flatMap((cashBankBranchesLOV: HttpResponse<CashBankBranchesLOV>) => {22 if (cashBankBranchesLOV.body) {23 return of(cashBankBranchesLOV.body);24 } else {25 this.router.navigate(['404']);26 return EMPTY;27 }28 })29 );30 }31 return of(new CashBankBranchesLOV());32 }33}34export const cashBankBranchesLOVRoute: Routes = [35 {36 path: '',37 component: CashBankBranchesLOVComponent,38 resolve: {39 pagingParams: JhiResolvePagingParams40 },41 data: {42 authorities: [Authority.USER],43 defaultSort: 'id,asc',44 pageTitle: 'CashBankBranchesLOVS'45 },46 canActivate: [UserRouteAccessService]47 },48 {49 path: ':branchPartyId/view', // ':id'50 component: CashBankBranchesLOVDetailComponent,51 resolve: {52 cashBankBranchesLOV: CashBankBranchesLOVResolve53 },54 data: {55 authorities: [Authority.USER],56 pageTitle: 'CashBankBranchesLOVS'57 },58 canActivate: [UserRouteAccessService]59 },60 {61 path: 'new',62 component: CashBankBranchesLOVUpdateComponent,63 resolve: {64 cashBankBranchesLOV: CashBankBranchesLOVResolve65 },66 data: {67 authorities: [Authority.USER],68 pageTitle: 'CashBankBranchesLOVS'69 },70 canActivate: [UserRouteAccessService]71 },72 {73 path: ':branchPartyId/edit',74 component: CashBankBranchesLOVUpdateComponent,75 resolve: {76 cashBankBranchesLOV: CashBankBranchesLOVResolve77 },78 data: {79 authorities: [Authority.USER],80 pageTitle: 'CashBankBranchesLOVS'81 },82 canActivate: [UserRouteAccessService]83 }...

Full Screen

Full Screen

cash-bank-branches-lov-update.component.ts

Source:cash-bank-branches-lov-update.component.ts Github

copy

Full Screen

1import { Component, OnInit } from '@angular/core';2import { HttpResponse } from '@angular/common/http';3// eslint-disable-next-line @typescript-eslint/no-unused-vars4import { FormBuilder, Validators } from '@angular/forms';5import { ActivatedRoute } from '@angular/router';6import { Observable } from 'rxjs';7import { ICashBankBranchesLOV, CashBankBranchesLOV } from 'app/shared/model/cash-bank-branches-lov.model';8import { CashBankBranchesLOVService } from './cash-bank-branches-lov.service';9@Component({10 selector: 'jhi-cash-bank-branches-lov-update',11 templateUrl: './cash-bank-branches-lov-update.component.html'12})13export class CashBankBranchesLOVUpdateComponent implements OnInit {14 isSaving = false;15 editForm = this.fb.group({16 // id: [],17 branchPartyId: [],18 bankBranchName: [],19 branchNumber: [],20 bankName: []21 });22 constructor(23 protected cashBankBranchesLOVService: CashBankBranchesLOVService,24 protected activatedRoute: ActivatedRoute,25 private fb: FormBuilder26 ) {}27 ngOnInit(): void {28 this.activatedRoute.data.subscribe(({ cashBankBranchesLOV }) => {29 this.updateForm(cashBankBranchesLOV);30 });31 }32 updateForm(cashBankBranchesLOV: ICashBankBranchesLOV): void {33 this.editForm.patchValue({34 // id: cashBankBranchesLOV.id,35 branchPartyId: cashBankBranchesLOV.branchPartyId,36 bankBranchName: cashBankBranchesLOV.bankBranchName,37 branchNumber: cashBankBranchesLOV.branchNumber,38 bankName: cashBankBranchesLOV.bankName39 });40 }41 previousState(): void {42 window.history.back();43 }44 save(): void {45 this.isSaving = true;46 const cashBankBranchesLOV = this.createFromForm();47 if (cashBankBranchesLOV.branchPartyId !== undefined) {48 this.subscribeToSaveResponse(this.cashBankBranchesLOVService.update(cashBankBranchesLOV));49 } else {50 this.subscribeToSaveResponse(this.cashBankBranchesLOVService.create(cashBankBranchesLOV));51 }52 }53 private createFromForm(): ICashBankBranchesLOV {54 return {55 ...new CashBankBranchesLOV(),56 // id: this.editForm.get(['id'])!.value,57 branchPartyId: this.editForm.get(['branchPartyId'])!.value,58 bankBranchName: this.editForm.get(['bankBranchName'])!.value,59 branchNumber: this.editForm.get(['branchNumber'])!.value,60 bankName: this.editForm.get(['bankName'])!.value61 };62 }63 protected subscribeToSaveResponse(result: Observable<HttpResponse<ICashBankBranchesLOV>>): void {64 result.subscribe(65 () => this.onSaveSuccess(),66 () => this.onSaveError()67 );68 }69 protected onSaveSuccess(): void {70 this.isSaving = false;71 this.previousState();72 }73 protected onSaveError(): void {74 this.isSaving = false;75 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1function branches(state) {2 var children = [];3 var action;4 for (action in actions) {5 if (actions.hasOwnProperty(action)) {6 var result = actions[action](state);7 if (result) {8 children.push(result);9 }10 }11 }12 return children;13}14function heuristic(state) {15 var distance = Math.abs(state.goal[0] - state.pos[0]) + Math.abs(state.goal[1] - state.pos[1]);16 return distance;17}18function goalTest(state) {19 return state.pos[0] === state.goal[0] && state.pos[1] === state.goal[1];20}21function pathCost(c, state1, action, state2) {22 return c + 1;23}24var result = search(initialState, branches, goalTest, heuristic, pathCost);25printPath(result);26printCost(result);27printExplored(result);28printFrontier(result);29printMaxFrontier(result);30printMaxExplored(result);31printTime(result);32printNodes(result);33printDepth(result);34printBranching(result);

Full Screen

Using AI Code Generation

copy

Full Screen

1var fs = require("fs");2var BestFirstSearch = require("./BestFirstSearch.js");3var Graph = require("./Graph.js");4var Branches = require("./Branches.js");5var graph = new Graph();6var branches = new Branches();7var bestFirstSearch = new BestFirstSearch(graph, branches);8var file = fs.readFileSync("graph.txt", "utf8");9var edges = file.split("\n");10for (var i = 0; i < edges.length; i++) {11 var edge = edges[i].split(" ");12 graph.addEdge(edge[0], edge[1], parseInt(edge[2]));13}14var path = bestFirstSearch.findPath("A", "G");15console.log(path);

Full Screen

Using AI Code Generation

copy

Full Screen

1var start = [0,0];2var goal = [4,4];3 [1,1,1,1,1,1,1,1,1,1]];4var closed = [];5var path = [];6function heuristic(a,b){7 return Math.abs(a[0]-b[0])+Math.abs(a[1]-b[1]);8}9function branch(path){10 var x = path[path.length-1][0];11 var y = path[path.length-1][1];12 var g = path[path.length-1][2];13 var successors = [[x-1,y,g+1],[x+1,y,g+1],[x,y-1,g+1],[x,y+1,g+1]];14 var successorsWithHeuristic = [];15 for(var i=0;i<successors.length;i++){16 successorsWithHeuristic.push([successors[i],heuristic(successors[i],goal)]);17 }18 successorsWithHeuristic.sort(function(a,b){return a[1]-b[1]});19 var newSuccessors = [];20 for(var i=0;i<successorsWithHeuristic.length;i++){21 newSuccessors.push(successorsWithHeuristic[i][0]);22 }23 return newSuccessors;24}25function search(){26 closed = [];27 path = [];28 var open = [];29 open.push([start,heuristic(start,goal

Full Screen

Using AI Code Generation

copy

Full Screen

1var BestFirstSearch = require('best-first-search');2var branches = BestFirstSearch.branches;3var test = branches(function (node) {4 return node.children;5});6var tree = {7 {8 {9 }10 },11 {12 }13};14var result = test(tree);15console.log(result);16var BestFirstSearch = require('best-first-search');17var isBranch = BestFirstSearch.isBranch;18var test = isBranch(function (node) {19 return node.children;20});21var tree = {22 {23 {24 }25 },26 {27 }28};29var result = test(tree);30console.log(result);31var BestFirstSearch = require('best-first-search');32var isLeaf = BestFirstSearch.isLeaf;33var test = isLeaf(function (node) {34 return node.children;35});36var tree = {37 {38 {39 }40 },41 {42 }43};44var result = test(tree);45console.log(result);46var BestFirstSearch = require('best-first-search');47var isRoot = BestFirstSearch.isRoot;48var test = isRoot(function (node) {49 return node.children;50});51var tree = {52 {53 {54 }55 },56 {57 }58};59var result = test(tree);60console.log(result);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Best automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful