________________________________________________________________________

This file is part of Logtalk <https://logtalk.org/>  
Copyright 1998-2022 Paulo Moura <pmoura@logtalk.org>  
SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
________________________________________________________________________


% load the example:

| ?- logtalk_load(tak(loader)).
...

% NOTE: the example queries below use a SWI-Prolog proprietary predicate 
% time/1 in order to get accurate goal times. This predicate is also found 
% on recent development versions of YAP and XSB. For other Prolog compilers, 
% replace the time/1 call by any appropriate timing calls (e.g. cputime/0).


% single-threaded version:

| ?- time(tak(1)::tak(18, 12, 6, R)).
% 254,476 inferences, 0.06 CPU in 0.07 seconds (91% CPU, 4241267 Lips)

R = 7
yes


% multi-threaded version:

| ?- time(tak(3)::tak(18, 12, 6, R)).
% 714 inferences, 0.06 CPU in 0.05 seconds (121% CPU, 11900 Lips)

R = 7
yes


% single-threaded version:

| ?- time(tak(1)::tak(21, 14, 7, R)).
% 1,583,068 inferences, 0.52 CPU in 0.61 seconds (86% CPU, 3044362 Lips)

R = 14
yes


% multi-threaded version:

| ?- time(tak(3)::tak(21, 14, 7, R)).
% 106 inferences, 0.48 CPU in 0.38 seconds (127% CPU, 221 Lips)

R = 14
yes
