kontrolle(1,1):-!.
kontrolle(2,2):-!.
kontrolle(Seis,N):-
Seis1 is Seis - 1,
Seis2 is Seis - 2,
kontrolle(Seis1,N1),
kontrolle(Seis2,N2),
N is 2*N1 + 2*N2 + 2,!.
plot_function :-
To is 20,
PlotStep is 1,
Step is 2,
new(W, auto_sized_picture('Plotter demo')),
send(W, display, new(P, plotter)),
send(P, axis, new(X, plot_axis(x, 1, To, Step, 200))),
send(P, axis, plot_axis(y, 0, 225000000, @default, 300)),
send(X, format, '%i'),
send(P, graph, new(G, plot_graph)),
plot_function(1, To, PlotStep, Template, G),
send(W, open).
plot_function(X, To, _, _, _) :-
X > To, !.
plot_function(X, To, Step, Template, G) :-
kontrolle(X,Y),
send(G, append, X, Y),
NewX is X + Step,
plot_function(NewX, To, Step, Template, G).