<commit_before>import '../../SBURBSim.dart';
import '../../navbar.dart';
import 'dart:html';
import 'dart:typed_data';
import 'dart:collection';
import "dart:async";
import "../../SessionEngine/SessionSummaryLib.dart";

//replaces the poorly named scenario_controller2.js
SessionFinderControllerJunior self; //want to access myself as more than just a sim controller occasionally

void main() {
  doNotRender = true;
  loadNavbar();
  window.onError.listen((Event event){
    ErrorEvent e = event as ErrorEvent;
    //String msg, String url, lineNo, columnNo, error
    printCorruptionMessage(SimController.instance.currentSessionForErrors,e);//(e.message, e.path.toString(), e.lineno.toString(), e.colno.toString(), e.toString());
    return;
  });
  new SessionFinderControllerJunior();
  self = SimController.instance;

  if(getParameterByName("seed",null) != null){
    self.initial_seed = int.parse(getParameterByName("seed",null));
  }else{
    var tmp = getRandomSeed();
    self.initial_seed = tmp;
  }
  self.formInit();
  if(SimController.shogun) doShogun();

}


void doShogun() {
  (querySelector("#avatar") as ImageElement).src = "images/ABJ_burn.png";

}


void checkSessionsJunior() {
  self.checkSessions();
}


class SessionFinderControllerJunior extends SimController {

  List<int> sessionsSimulated = [];
  Random rand;

  List<SessionSummaryJunior> allSessionsSummaries = [];
  //how filtering works
  List<SessionSummaryJunior> sessionSummariesDisplayed = [];

  int numSimulationsDone = 0;

  num numSimulationsToDo = 0;
  SessionFinderControllerJunior() : super() {
      rand = new Random();
  }

//kid boy and abj is canon
//you'll know that ABJ is thinking of kid boi every time she says "Interesting!!!"
//it will be secret code
//and definitely not terrifying at all
    void filterSessionsJunior(){
    //;
      int num_players =int.parse((querySelector("#num_players")as InputElement).value);
      List<dynamic> tmp = [];
      sessionSummariesDisplayed = [];
      for(int i = 0; i<allSessionsSummaries.length; i++){
        sessionSummariesDisplayed.add(allSessionsSummaries[i]);
      }

      for(int i = 0; i<sessionSummariesDisplayed.length; i++){
        var ss = sessionSummariesDisplayed[i];
        if(ss.players.length == num_players){
          tmp.add(ss);
        }
      }
      sessionSummariesDisplayed = tmp;
      printSummariesJunior();
      printStatsJunior();
    }


  void formInit(){
    querySelector("#button").onClick.listen((e) => checkSessionsJunior());
    (querySelector("#button")as ButtonElement).disabled =false;
    (querySelector("#num_sessions_text")as InputElement).value =(querySelector("#num_sessions")as InputElement).value;

    querySelector("#num_sessions").onChange.listen((Event e) {
      (querySelector("#num_sessions_text")as InputElement).value =(querySelector("#num_sessions")as InputElement).value;
    });
  }

  void checkSessions() {
    print("abj is checking a sessions");
    numSimulationsDone = 0; //but don't reset stats
    sessionSummariesDisplayed = [];
    for(num i = 0; i<allSessionsSummaries.length; i++){
      sessionSummariesDisplayed.add(allSessionsSummaries[i]);
    }
    setHtml(SimController.instance.storyElement, "");
    numSimulationsToDo = int.parse((querySelector("#num_sessions")as InputElement).value);
    (querySelector("#button")as ButtonElement).disabled =true;
    print("ab is going to make a session");
    Session session = new Session(SimController.instance.initial_seed);
    checkEasterEgg(session);
    SimController.instance.easterEggCallBack(session);
    //session.startSession();
  }

  @override
  void easterEggCallBack(Session session) {
    //initializePlayers(session.players, session);  //need to redo it here because all other versions are in case customizations
    //aaaaand. done.
    sessionsSimulated.add(session.session_id);
    SessionSummary sum = session.generateSummary();
    SessionSummaryJunior sumJR = sum.getSessionSummaryJunior();
    allSessionsSummaries.add(sumJR);
    sessionSummariesDisplayed.add(sumJR);
    var str = sumJR.generateHTML();
    debug("<br><hr><font color = 'orange'> ABJ: " + getQuipAboutSession() + "</font><Br>" );
    debug(str);
    printStatsJunior();
    numSimulationsDone ++;
    if(numSimulationsDone >= numSimulationsToDo){
      (querySelector("#button")as ButtonElement).disabled =false;
    }else{
      initial_seed = getRandomSeed();
      session = new Session(initial_seed);
      session.startSession();
    }
  }



  @override
  void easterEggCallBackRestart(Session session) {
    throw "ABJ does not actually simulate shit.";
  }

  @override
  void callNextIntro([num time]) {
    throw "ABJ does not actually simulate shit.";
  }

  @override
  void checkSGRUB() {
    throw "ABJ does not actually simulate shit.";
  }<commit_msg>ABJ is fast and taciturn again<commit_after>import '../../SBURBSim.dart';
import '../../navbar.dart';
import 'dart:html';
import 'dart:typed_data';
import 'dart:collection';
import "dart:async";
import "../../SessionEngine/SessionSummaryLib.dart";

//replaces the poorly named scenario_controller2.js
SessionFinderControllerJunior self; //want to access myself as more than just a sim controller occasionally

void main() {
  doNotRender = true;
  loadNavbar();
  window.onError.listen((Event event){
    ErrorEvent e = event as ErrorEvent;
    //String msg, String url, lineNo, columnNo, error
    printCorruptionMessage(SimController.instance.currentSessionForErrors,e);//(e.message, e.path.toString(), e.lineno.toString(), e.colno.toString(), e.toString());
    return;
  });
  new SessionFinderControllerJunior();
  self = SimController.instance;

  if(getParameterByName("seed",null) != null){
    self.initial_seed = int.parse(getParameterByName("seed",null));
  }else{
    var tmp = getRandomSeed();
    self.initial_seed = tmp;
  }
  self.formInit();
  if(SimController.shogun) doShogun();

}


void doShogun() {
  (querySelector("#avatar") as ImageElement).src = "images/ABJ_burn.png";

}


void checkSessionsJunior() {
  self.checkSessions();
}


class SessionFinderControllerJunior extends SimController {

  List<int> sessionsSimulated = [];
  Random rand;

  List<SessionSummaryJunior> allSessionsSummaries = [];
  //how filtering works
  List<SessionSummaryJunior> sessionSummariesDisplayed = [];

  int numSimulationsDone = 0;

  num numSimulationsToDo = 0;
  SessionFinderControllerJunior() : super() {
      rand = new Random();
  }

//kid boy and abj is canon
//you'll know that ABJ is thinking of kid boi every time she says "Interesting!!!"
//it will be secret code
//and definitely not terrifying at all
    void filterSessionsJunior(){
    //;
      int num_players =int.parse((querySelector("#num_players")as InputElement).value);
      List<dynamic> tmp = [];
      sessionSummariesDisplayed = [];
      for(int i = 0; i<allSessionsSummaries.length; i++){
        sessionSummariesDisplayed.add(allSessionsSummaries[i]);
      }

      for(int i = 0; i<sessionSummariesDisplayed.length; i++){
        var ss = sessionSummariesDisplayed[i];
        if(ss.players.length == num_players){
          tmp.add(ss);
        }
      }
      sessionSummariesDisplayed = tmp;
      printSummariesJunior();
      printStatsJunior();
    }


  void formInit(){
    querySelector("#button").onClick.listen((e) => checkSessionsJunior());
    (querySelector("#button")as ButtonElement).disabled =false;
    (querySelector("#num_sessions_text")as InputElement).value =(querySelector("#num_sessions")as InputElement).value;

    querySelector("#num_sessions").onChange.listen((Event e) {
      (querySelector("#num_sessions_text")as InputElement).value =(querySelector("#num_sessions")as InputElement).value;
    });
  }

  void checkSessions() {
    print("abj is checking a sessions");
    numSimulationsDone = 0; //but don't reset stats
    sessionSummariesDisplayed = [];
    for(num i = 0; i<allSessionsSummaries.length; i++){
      sessionSummariesDisplayed.add(allSessionsSummaries[i]);
    }
    setHtml(SimController.instance.storyElement, "");
    numSimulationsToDo = int.parse((querySelector("#num_sessions")as InputElement).value);
    (querySelector("#button")as ButtonElement).disabled =true;
    print("ab is going to make a session");
    Session session = new Session(SimController.instance.initial_seed);
    checkEasterEgg(session);
    SimController.instance.easterEggCallBack(session);
    //session.startSession();
  }

  @override
  void easterEggCallBack(Session session) {
    //initializePlayers(session.players, session);  //need to redo it here because all other versions are in case customizations
    //aaaaand. done.
    sessionsSimulated.add(session.session_id);
    SessionSummary sum = session.generateSummary();
    SessionSummaryJunior sumJR = sum.getSessionSummaryJunior();
    allSessionsSummaries.add(sumJR);
    sessionSummariesDisplayed.add(sumJR);
    var str = sumJR.generateHTML();
    debug("<br><hr><font color = 'orange'> ABJ: " + getQuipAboutSession() + "</font><Br>" );
    debug(str);
    printStatsJunior();
    numSimulationsDone ++;
    if(numSimulationsDone >= numSimulationsToDo){
      (querySelector("#button")as ButtonElement).disabled =false;
    }else{
      initial_seed = getRandomSeed();
      session = new Session(initial_seed);
      checkEasterEgg(session);
      SimController.instance.easterEggCallBack(session);
      //session.startSession();
    }
  }



  @override
  void easterEggCallBackRestart(Session session) {
    throw "ABJ does not actually simulate shit.";
  }

  @override
  void callNextIntro([num time]) {
    throw "ABJ does not actually simulate shit.";
  }

  @override
  void checkSGRUB() {
    throw "ABJ does not actually simulate shit.";
  }
{'fraction_non_alphanumeric': 0.13012787723785166, 'fraction_numerical': 0.001432225063938619, 'mean_word_length': 4.112970711297071, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, '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': '3438194', 'n_tokens_mistral': 3025, 'n_tokens_neox': 2952, 'n_words': 637}