<commit_before>/*
 * Copyright © 2015 <NAME>. All rights reserved.
 */

package io.vivarium.visualization;

import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import io.vivarium.core.brain.Brain;
import io.vivarium.core.brain.RandomBrain;

public class BrainViewerDemo extends JPanel
{
    private static JFrame _window;

    private static final long serialVersionUID = -3105685457075818705L;

    // Animation variables
    private SwingGeometricGraphics _swingGraphics;
    private BrainRenderer _brainRenderer;

    public BrainViewerDemo(Brain brain)
    {
        _brainRenderer = new BrainRenderer(brain);
        _swingGraphics = new SwingGeometricGraphics(_brainRenderer, this);
    }

    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);

        // Get the graphics for the graphical delegate
        Graphics2D g2 = (Graphics2D) g;
        _swingGraphics.setResources(g2);

        // Hand off to the graphical delegate to perform the render
        _swingGraphics.executeRender();
    }

    public static void main(String[] args)
    {
        Brain brain = new RandomBrain(4);

        // Create and show the window
        BrainViewerDemo bv = new BrainViewerDemo(brain);
        _window = new JFrame();
        _window.add(bv);
        _window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        _window.validate();
<commit_msg>Working NN in Swing Demo<commit_after>/*
 * Copyright © 2015 <NAME>. All rights reserved.
 */

package io.vivarium.visualization;

import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import io.vivarium.core.brain.Brain;
import io.vivarium.core.brain.NeuralNetworkBrain;

public class BrainViewerDemo extends JPanel
{
    private static JFrame _window;

    private static final long serialVersionUID = -3105685457075818705L;

    // Animation variables
    private SwingGeometricGraphics _swingGraphics;
    private BrainRenderer _brainRenderer;

    public BrainViewerDemo(Brain brain)
    {
        _brainRenderer = new BrainRenderer(brain);
        _swingGraphics = new SwingGeometricGraphics(_brainRenderer, this);
    }

    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);

        // Get the graphics for the graphical delegate
        Graphics2D g2 = (Graphics2D) g;
        _swingGraphics.setResources(g2);

        // Hand off to the graphical delegate to perform the render
        _swingGraphics.executeRender();
    }

    public static void main(String[] args)
    {
        Brain brain = new NeuralNetworkBrain(4, 4, true, false);

        // Create and show the window
        BrainViewerDemo bv = new BrainViewerDemo(brain);
        _window = new JFrame();
        _window.add(bv);
        _window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        _window.validate();

{'fraction_non_alphanumeric': 0.08011869436201781, 'fraction_numerical': 0.01945268710847346, 'mean_word_length': 3.1675824175824174, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4232725', 'n_tokens_mistral': 942, 'n_tokens_neox': 849, 'n_words': 227}