<commit_before>#!/usr/bin/python

import unittest
import sys
import random
import time
import traceback

import testcases
from vmpoolstate import VMPoolState
from dijkstra import VMPoolShortestPathFinder
from aspiers import VMPoolAdamPathFinder

STRATEGY = VMPoolAdamPathFinder

while True:
    #min_vm_ram = random.randint(128, 512)
    max_vm_ram = random.randint(1024, 4096)
    stateA, stateB, expected_path = \
        testcases.random.identical_hosts(max_vm_ram=max_vm_ram)

    path_finder = STRATEGY(stateA, stateB)
    try:
        path = path_finder.find_path()
    except RuntimeError, exc:
        continue # nothing to see here, move along

    if path:
        path.animate(True, 0.2)
    else:
        print path_finder.challenge_visualization(10, 80)
        print "\nNo path found to animate!"
        time.sleep(10)<commit_msg>control demo via CLI args<commit_after>#!/usr/bin/python

import unittest
import sys
import random
import time
import traceback

import testcases
from vmpoolstate import VMPoolState
from dijkstra import VMPoolShortestPathFinder
from aspiers import VMPoolAdamPathFinder

STRATEGY = VMPoolAdamPathFinder

clear = True
sleep = 0.2
if len(sys.argv) >= 2:
    sleep = float(sys.argv[1])
if len(sys.argv) >= 3:
    clear = False if sys.argv[2] == 'false' else True

while True:
    #min_vm_ram = random.randint(128, 512)
    max_vm_ram = random.randint(1024, 4096)
    stateA, stateB, expected_path = \
        testcases.random.identical_hosts(max_vm_ram=max_vm_ram)

    path_finder = STRATEGY(stateA, stateB)
    try:
        path = path_finder.find_path()
    except RuntimeError, exc:
        continue # nothing to see here, move along

    if path:
        path.animate(clear, sleep)
    else:
        print path_finder.challenge_visualization(10, 80)
        print "\nNo path found to animate!"
        time.sleep(10)
{'fraction_non_alphanumeric': 0.08055853920515575, 'fraction_numerical': 0.02577873254564984, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1227034', 'n_tokens_mistral': 669, 'n_tokens_neox': 612, 'n_words': 162}