Skip to content

Instantly share code, notes, and snippets.

View Anniepoo's full-sized avatar
💭
baffled by too much tech stack

Anne Ogborn Anniepoo

💭
baffled by too much tech stack
View GitHub Profile
clpfd:clpfd_equal_(A, B) :-
( cyclic_term(A)
-> domain_error(clpfd_expression, A)
; cyclic_term(B)
-> domain_error(clpfd_expression, B)
; false
).
clpfd:clpfd_equal_(A, B) :-
( nonvar(A),
( A= ?(C)
:- use_module(library(chr)).
:- chr_constraint player/3, rocket/3, target/2, input/1, tick/0.
player(X,Y,H),input(space) ==> rocket(X,Y,H).
tick \ rocket(X,Y,H) <=> NX is X + cos(H) * V, NY is Y + sin(H) * V, rocket(NX, NY, H).
rocket(X,Y,_), target(TX, TY, _) <=> near(X,Y,TX,TY), explosion(TX,TY).
go(Y) :-
setof(X, a_tweet(X), Tweets),
random_permutation(Tweets, RandTweets),
!,
member(Y, RandTweets).
a_tweet(X) :-
phrase(rando_tweet, Code),
length(Code, L),
?: (what do I hate) ^keep() ^repeat() @0 = ^query(direct_sv %user hate ?)
if(^length(@0) = 0) {
You don't hate anything
} else if (^length(@0) = 1) {
You hate ^first(@0object).
} else if (^length(@0) = 2) {
You hate ^first(@0object) and ^first(@0object).
} else {
_1 = ^length(@0) - 1
You hate
english(X) :-
phrase(sentence, X).
sentence --> sentence(_).
sentence(Number) -->
noun_phrase(Number),
verb_phrase(Number).
noun_phrase(Number) -->
:- module(login_advisor2, [login_advisor2/0]).
/** <module> Login Advisor rev 2
*
* This is an expert system like tool to help set up
* an identity instance
*/
:- dynamic question_answer/2.
login_advisor2 :-
retractall(question_answer(_, _)), % TODO expand
:- module(clpfdwsc, [go/1]).
:-use_module(library(clpfd)).
go(M) :-
wsc([[0,0,0,0]], M),
flatten(M, FM),
label(FM).
wsc([[1,1,1,1]|R], [[1,1,1,1]|R]).
:- module(clpstr, [
cl_len/2,
cl_regex/2,
cl_insensitive/2,
cl_str/1
]).
/** <module> Constraint Logic Programming over strings
*
* constraints over 'real' strings
*/
:- chr_constraint temp_persist/2, collect_persist/2, get_persist/2.
get_all_persistant(S, Persistant) :-
chr_trace, chr_leash(-all),
get_persist(S, Persistant).
persistant(S, Data), get_persist(S, _) ==> temp_persist(S, Data).
get_persist(S, Persist) <=> collect_persist(S, Persist).
temp_persist(S, Data), collect_persist(S, Persist) <=>
Persist = [Data | Rest],
:- module(cooking, [go/0]).
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_parameters)).
:- use_module(library(http/http_session)).
:- use_module(library(http/html_write)).
:- use_module(library(chr)).