diff --git a/Makefile b/Makefile index 742516b8ede5bb8f539ddf3876cf0afb46c194c5..34b60e8b5d3b344d3e1de4f2439db520d584d5ae 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ all: loesung -WARNINGS = -Wall #-Werror +WARNINGS = -Wall -Werror OPTIONAL = -Wextra -Wpedantic -Wshadow DEBUG = -g -ggdb -fno-omit-frame-pointer -OPTIMIZE = -Og -std=c11 +OPTIMIZE = -std=c11 loesung: Makefile loesung.c $(CC) -o $@ $(WARNINGS) $(OPTIONAL) $(DEBUG) $(OPTIMIZE) loesung.c diff --git a/check b/check new file mode 100755 index 0000000000000000000000000000000000000000..2a419bff2a2959d327cc896a6ab8fe1c23dd6e19 --- /dev/null +++ b/check @@ -0,0 +1,2 @@ +#!/bin/bash +./loesung <$1 | ./check_result $1 diff --git a/loesung.c b/loesung.c index c319c2a7a4639750356a094855b7877734c86eaa..1d9d06b0ac56ef9e4d216b24dcce37cb3f80b08a 100755 --- a/loesung.c +++ b/loesung.c @@ -303,8 +303,7 @@ bool hk_dfs(Field *this, uint32_t e) { void hk_print(Field *this) { Tile *t = this->tiles; for (uint32_t i = 1; i < this->num_tiles; i++) { - uint32_t p = t[i].pair; - if (this->tiles[i].pair == 0) { + if (t[i].pair == 0) { printf("None\n"); return; } diff --git a/visulize.py b/visulize.py new file mode 100755 index 0000000000000000000000000000000000000000..1a4093efdace8c6b3da79ea5d48fa7f94bc66762 --- /dev/null +++ b/visulize.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 +import sys +import matplotlib.pyplot as plt +import numpy as np +inp = sys.argv[1] + +def load(): + f = open(inp) + xs = [] + ys = [] + for line in f: + point = [int(i) for i in line.split()] + xs.append(point[0]) + ys.append(point[1]) + + plt.scatter(xs, ys, marker="s") + plt.show() + +while True: + load() + diff --git a/visulize_result.py b/visulize_result.py new file mode 100755 index 0000000000000000000000000000000000000000..b4000aac902d60ea1cdc8062520258dc0cd655ea --- /dev/null +++ b/visulize_result.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 +import sys +import matplotlib.pyplot as plt +import numpy as np +inp = sys.argv[1] + +def load(): + f = open(inp) + xs = [] + ys = [] + for line in f: + for p in line.split(";"): + point = [int(i) for i in p.split()] + xs.append(point[0]) + ys.append(point[1]) + xs.append(None) + ys.append(None) + + plt.plot(xs, ys, marker="s") + plt.show() + +while True: + load() +