Rosetta Code/Tasks without examples: Difference between revisions

m (→‎{{header|zkl}}: Does not retrieve task descriptions)
(→‎{{header|zkl}}: added noise)
Line 222:
 
=={{header|zkl}}==
{{incomplete|zkl|Task specifically asks to retrieve the task descriptions, not just the names.}}
This is a bit of a twist on the task: Programmer wants to know which tasks
have not been implimeted by their favorite language.
Line 237 ⟶ 236:
"&list=categorymembers"
"&cmtitle=Category:%s"
"&cmcontinue=%s").fmt(language,continueValue),Void);
page=page[0].del(0,page[1]); // get rid of HTML headerbody
json:=YAJL().write(page).close();
json["query"]["categorymembers"].pump(tasks,T("get","title"));
Line 250 ⟶ 249:
var allTasks =getTasks.future("Programming_Tasks"); // thread
var draftTasks=getTasks.future("Draft_Programming_Tasks"); // thread
var tasks =getTasks.future("zkl"lang); // thread
 
fcn newTasks{
Line 256 ⟶ 255:
unimplementedTasks:=allTasks.filter('!(langTasks.holds))
.extend(draftTasks.filter('!(langTasks.holds)));
#if 0
 
println("http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_Zkl\n");
unimplementedTasks.pump(List()).sort().pump(Console.println);
#else // this next part is very very slow, useless, can't find a wikimedia api
// and the amount of information is pretty overwhelming
curl:=CURL();
foreach task in (unimplementedTasks.pump(List()).sort()){
// some task names have a / in them, can't url encode: "Active Directory/Connect"
page:="https://rosettacode.org/wiki/" + task.replace(" ","_");
page:=curl.get(page); // sloooow
page:=page[0]; // sloooow
s,s := page.find("\"infobox\""), page.find("<p>",s);
if(not (e:=page.find("<div id=\"toc\"",s))) e:=page.find("</p>",s);
println("<h2>%s</h2>\n%s\n<hr>".fmt(task,page[s,e-s].text));
}
#endif
}
 
newTasks();</lang>
{{out|Concise Output}}
<pre>
$ zkl rs_tasks_without.zkl
Line 275 ⟶ 286:
...
</pre>
 
{{out|Verbose Output}}
 
<h2>15 Puzzle Game</h2>
<p>Implement the <a href="http://en.wikipedia.org/wiki/15_puzzle" class="extiw" title="wp:15 puzzle">Fifteen Puzzle Game</a>.
<br /><br />
</p>
<dl><dt>Related Task</dt>
<dd></dd></dl>
<ul><li> <a href="/wiki/15_puzzle_solver" title="15 puzzle solver">15 Puzzle Solver</a></li></ul>
<p><br /><br />
</p>
 
<hr>
15 puzzle solver
<p>Your task is to write a program that finds a solution in the fewest moves possible single moves to a random <a href="http://en.wikipedia.org/wiki/15_puzzle" class="extiw" title="wp:15 puzzle">Fifteen Puzzle Game</a>.<br />
For this task you will be using the following puzzle:<br />
</p>
15 14 1 6
9 11 4 12
0 10 7 3
13 8 5 2
<p><br />
</p>
Solution:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 0
 
<p>The output must show the moves' directions, like so: left, left, left, down, right... and so on.<br />
There are 2 solutions with 52 moves:<br />
rrrulddluuuldrurdddrullulurrrddldluurddlulurruldrdrd<br />
rrruldluuldrurdddluulurrrdlddruldluurddlulurruldrrdd<br />
finding either one, or both is an acceptable result.<br />
see: <a rel="nofollow" class="external text" href="http://www.rosettacode.org/wiki/15_puzzle_solver/Optimal_solution">Pretty Print of Optimal Solution</a>
</p>
<dl><dt>Extra credit.</dt></dl>
<p>Solve the following problem:
</p>
0 12 9 13
15 11 10 14
3 7 2 5
4 8 6 1
 
<p><br />
</p>
<dl><dt>Related Task</dt>
<dd></dd></dl>
<ul><li> <a href="/wiki/15_Puzzle_Game" title="15 Puzzle Game">15 puzzle game</a></li>
<li> <a href="/wiki/A*_search_algorithm" title="A* search algorithm">A* search algorithm</a></li></ul>
<p><br /><br />
</p>
 
<hr>
2048
<p>The rules are that on each turn the player must choose a direction (up, down, left or right) and all tiles move as far as possible in that direction, some more than others. Two adjacent tiles (in that direction only) with matching numbers combine into one bearing the sum of those numbers. A move is valid when at least one tile can be moved, if only by combination. A new tile with the value of 2 is spawned at the end of each turn at a randomly chosen empty square, if there is one. To win the player must create a tile with the number 2048. The player lo
 
ses if no valid moves are possible.
</p><p>The name comes from the popular open-source implementation of this game mechanic, <a rel="nofollow" class="external text" href="https://gabrielecirulli.github.io/2048/">2048</a>.
</p><p>Requirements:
</p>
 
<b>and so on</b>
Anonymous user