<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>https://www.glc.us.es/~jalonso/LCyTM2018/index.php?action=history&amp;feed=atom&amp;title=Masyu_%28Jan_Wasilewski%29</id>
	<title>Masyu (Jan Wasilewski) - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="https://www.glc.us.es/~jalonso/LCyTM2018/index.php?action=history&amp;feed=atom&amp;title=Masyu_%28Jan_Wasilewski%29"/>
	<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/LCyTM2018/index.php?title=Masyu_(Jan_Wasilewski)&amp;action=history"/>
	<updated>2026-09-25T17:39:44Z</updated>
	<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://www.glc.us.es/~jalonso/LCyTM2018/index.php?title=Masyu_(Jan_Wasilewski)&amp;diff=248&amp;oldid=prev</id>
		<title>Mjoseh: Página creada con «&lt;source lang = &quot;prolog&quot;&gt; %white(1,3). %white(2,3). %white(4,1). %white(5,3). %black(4,2).  white(1,3). black(1,6). black(3,1). black(3,4). white(3,5). black(3,8). white(3,1…»</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/~jalonso/LCyTM2018/index.php?title=Masyu_(Jan_Wasilewski)&amp;diff=248&amp;oldid=prev"/>
		<updated>2020-02-09T20:24:02Z</updated>

		<summary type="html">&lt;p&gt;Página creada con «&amp;lt;source lang = &amp;quot;prolog&amp;quot;&amp;gt; %white(1,3). %white(2,3). %white(4,1). %white(5,3). %black(4,2).  white(1,3). black(1,6). black(3,1). black(3,4). white(3,5). black(3,8). white(3,1…»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang = &amp;quot;prolog&amp;quot;&amp;gt;&lt;br /&gt;
%white(1,3).&lt;br /&gt;
%white(2,3).&lt;br /&gt;
%white(4,1).&lt;br /&gt;
%white(5,3).&lt;br /&gt;
%black(4,2).&lt;br /&gt;
&lt;br /&gt;
white(1,3). black(1,6). black(3,1). black(3,4). white(3,5).&lt;br /&gt;
black(3,8). white(3,10). white(4,7). black(5,3). black(5,8).&lt;br /&gt;
white(5,9). white(5,10). white(6,6). white(7,2). white(7,4).&lt;br /&gt;
white(7,7). white(7,8). white(8,2). white(8,5). black(9,9).&lt;br /&gt;
black(10,1). white(10,3). white(10,6).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#const n = 10.&lt;br /&gt;
#const m = 10.&lt;br /&gt;
col(1..n). row(1..m). direction(v;h).&lt;br /&gt;
ball(X,Y) :- black(X,Y), col(X), row(Y).&lt;br /&gt;
ball(X,Y) :- white(X,Y), col(X), row(Y).&lt;br /&gt;
&lt;br /&gt;
% Generate a set of unit segments passing through cells&lt;br /&gt;
&lt;br /&gt;
{line(S,X,Y)} :- direction(S), col(X), row(Y).&lt;br /&gt;
:- line(h,n,Y), row(Y).&lt;br /&gt;
:- line(v,X,m), col(X).&lt;br /&gt;
&lt;br /&gt;
% including balls:&lt;br /&gt;
&lt;br /&gt;
:- ball(X,Y), not on(X,Y).&lt;br /&gt;
on(X,Y) :- line(S,X,Y), direction(S), col(X), row(Y).&lt;br /&gt;
on(X+1,Y) :- line(h,X,Y), col(X), row(Y), X&amp;lt;n.&lt;br /&gt;
on(X,Y+1) :- line(v,X,Y), col(X), row(Y), Y&amp;lt;m.&lt;br /&gt;
&lt;br /&gt;
% ensuring the constraints M1--M3 are satisfied:&lt;br /&gt;
% M1:&lt;br /&gt;
% Every cell that the generated line passes through is&lt;br /&gt;
% connected to exactly 2 such grid cells:&lt;br /&gt;
&lt;br /&gt;
:- 3 {line(h,X-1,Y); line(h,X,Y); line(v,X,Y); line(v,X,Y-1)}, on(X,Y), col(X), row(Y).&lt;br /&gt;
:- {line(h,X-1,Y); line(h,X,Y); line(v,X,Y); line(v,X,Y-1)} 1, on(X,Y), col(X), row(Y).&lt;br /&gt;
&lt;br /&gt;
% Furthermore, every cell on the generated line is reachable&lt;br /&gt;
% from other grid cells on the line:&lt;br /&gt;
&lt;br /&gt;
:- on(X,Y), on(Z,W), not reachable(X,Y,Z,W), col(X;Z), row(Y;W).&lt;br /&gt;
adj(X,Y,X,Y+1) :- line(v,X,Y), col(X), row(Y), Y&amp;lt;m.&lt;br /&gt;
adj(X,Y,X+1,Y) :- line(h,X,Y), col(X), row(Y), X&amp;lt;n.&lt;br /&gt;
adj(X,Y,Z,W) :- adj(Z,W,X,Y), col(X;Z), row(Y;W).&lt;br /&gt;
reachable(X,Y,X,Y) :- on(X,Y), col(X;Z), row(Y;W).&lt;br /&gt;
reachable(X,Y,Z,W) :- reachable(I,J,Z,W), adj(X,Y,I,J), col(X;I;Z), row(Y;J;W).&lt;br /&gt;
&lt;br /&gt;
% M3:&lt;br /&gt;
% The loop must turn (90 degrees) at black circles&lt;br /&gt;
&lt;br /&gt;
:- black(X,Y), line(h,X,Y), line(h,X-1,Y), col(X), row(Y).&lt;br /&gt;
:- black(X,Y), line(v,X,Y), line(v,X,Y-1), col(X), row(Y).&lt;br /&gt;
&lt;br /&gt;
% but it must travel straight through the next and previous&lt;br /&gt;
% cells in its path.&lt;br /&gt;
&lt;br /&gt;
:- 1{line(v,X+1,Y); line(v,X+1,Y-1)}, black(X,Y), line(h,X,Y), col(X), row(Y).&lt;br /&gt;
:- 1{line(v,X-1,Y); line(v,X-1,Y-1)}, black(X,Y), line(h,X-1,Y), col(X),row(Y).&lt;br /&gt;
:- 1{line(h,X,Y+1); line(h,X-1,Y+1)}, black(X,Y), line(v,X,Y), col(X), row(Y).&lt;br /&gt;
:- 1{line(h,X,Y-1); line(h,X-1,Y-1)}, black(X,Y), line(v,X,Y-1), col(X), row(Y).&lt;br /&gt;
&lt;br /&gt;
% M2:&lt;br /&gt;
% White circles must be traveled straight through&lt;br /&gt;
&lt;br /&gt;
:- 1{line(v,X,Y); line(v,X,Y-1)}, 1{line(h,X,Y); line(h,X-1,Y)}, white(X,Y), col(X), row(Y).&lt;br /&gt;
&lt;br /&gt;
% but the loop must turn (90 degrees) in the previous&lt;br /&gt;
% and/or next cell in its path.&lt;br /&gt;
&lt;br /&gt;
:- white(X,Y), line(h,X,Y), line(h,X+1,Y), line(h,X-1,Y), line(h,X-2,Y), col(X), row(Y).&lt;br /&gt;
:- white(X,Y), line(v,X,Y), line(v,X,Y+1), line(v,X,Y-1), line(v,X,Y-2), col(X), row(Y).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#show on/2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mjoseh</name></author>
		
	</entry>
</feed>