Skip to content
Snippets Groups Projects
Select Git revision
  • 2dd4b91be49edabe40175707f1f8a9624160ce56
  • main default protected
  • renovate/djangorestframework-3.x
  • renovate/django-5.x
  • renovate/django-bootstrap5-25.x
  • renovate/django-debug-toolbar-6.x
  • renovate/jsonschema-4.x
  • koma/feature/preference-polling-form
8 results

models.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    App.svelte 1.49 KiB
    <script lang="ts">
        import type { ConjunctiveClause } from './models';
        import {getGraphCodeForNodeTree} from './dpll-grapher'
        import {parse, SyntaxError} from './knf-parser';
        import { runAlgo } from './dpll-algo';
        import mermaid from "mermaid";
    
        mermaid.mermaidAPI.initialize({
          startOnLoad: false,
        });
        function tryParse(textToParse: string): ConjunctiveClause {
            try {
                return parse(input);
            } catch (ex) {
                console.warn(ex);
                return []
            }
        }
    
        let input = '{{X1∨X2∨X3}∧{¬X1∨X2∨¬X4}∧{¬X2}∧{¬X1∨X3}∧{¬X1∨¬X3∨X4}∧{X1∨¬X3}}';
        $: parsed = tryParse(input);
        $: algoResult = parsed.length > 0 ? runAlgo(parsed) : null;
        $: mermaidCode = algoResult !== null ? getGraphCodeForNodeTree(algoResult, parsed) : '';
        $: graphSvg = mermaidCode !== '' ?mermaid.mermaidAPI.render("graphDiv", mermaidCode): '';
    </script>
    
    <main>
        Enter your text here:
        <textarea bind:value={input} style="width: 100%;"/>
        <br>
        <details>
            <summary>AST</summary>
            <pre>{JSON.stringify(parsed, null, 2)}</pre>
        </details>
        <details>
            <summary>Result JSON</summary>
            <pre>{JSON.stringify(algoResult, null, 2)}</pre>
        </details>
        <br>
        <svg>{@html graphSvg}</svg>
    </main>
    
    <a href="https://gitlab.fachschaften.org/jfowl/swk-dpll">SourceCode</a>
    
    <style>
      svg {
        padding: 0.5%;
        min-height: 50rem;
        min-width: 99%;
        border: 2px solid;
      }
    </style>