16 puzzle game: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 43:
 
=={{header|Go}}==
<syntaxhighlight lang="go">package main
 
import (
Line 293:
 
=={{header|J}}==
Assumes a recent release of jqt:<syntaxhighlight lang=J"j">require'ide/qt/gl2'
coinsert'jgl2'
 
Line 460:
}
</pre>
<syntaxhighlight lang="javascript">
class Puzzle {
constructor() {
Line 617:
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">using Gtk, Random
 
function puzzle16app(bsize)
Line 733:
{{libheader|gintro}}
Not a direct translation as there are a lot of differences, but, at least, the graphical interface is similar and the logic is the same.
<syntaxhighlight lang=Nim"nim">import random, sequtils, strutils
import gintro/[glib, gobject, gtk, gio]
 
Line 929:
 
=={{header|Perl}}==
<syntaxhighlight lang="perl">#!/usr/bin/perl
 
use strict; # http://www.rosettacode.org/wiki/16_Puzzle_Game
Line 1,021:
NB arrow keys not tested on linux, but "UDLR" should work...
 
<!--<syntaxhighlight lang=Phix"phix">-->
<span style="color: #008080;">constant</span> <span style="color: #000000;">level</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">5<span style="color: #0000FF;">,</span>
<span style="color: #000000;">ESC<span style="color: #0000FF;">=<span style="color: #000000;">27<span style="color: #0000FF;">,</span> <span style="color: #000000;">UP<span style="color: #0000FF;">=<span style="color: #000000;">328<span style="color: #0000FF;">,</span> <span style="color: #000000;">DOWN<span style="color: #0000FF;">=<span style="color: #000000;">336<span style="color: #0000FF;">,</span> <span style="color: #000000;">LEFT<span style="color: #0000FF;">=<span style="color: #000000;">331<span style="color: #0000FF;">,</span> <span style="color: #000000;">RIGHT<span style="color: #0000FF;">=<span style="color: #000000;">333</span>
Line 1,123:
For brevity, changed to zero-based and skipped some error handling.
{{trans|Go}}
<syntaxhighlight lang=perl6"raku" line># 20210914 Raku programming solution
 
my (\easy,\hard) = 1,4 ; my @n = ^16; my \level = $ = easy ; my \moves = $ = 0;
Line 1,192:
and the answer can be in any case (lower or uppercase).
<br>Not all errors are checked so as to keep the program simpler.
<syntaxhighlight lang="rexx">/*REXX pgm implements the 16 game; displays game grid, prompts for a move, game won? */
sep= copies("─",8); pad=left('',1+length(sep) ) /*pad=9 blanks. SEP is used for msgs.*/
parse arg N hard seed . /*obtain optional arguments from the CL*/
Line 1,333:
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
# Project : Sixteen Puzzle Game
 
Line 1,872:
{{libheader|Wren-ioutil}}
{{libheader|Wren-str}}
<syntaxhighlight lang="ecmascript">import "random" for Random
import "/trait" for Stepped
import "/fmt" for Fmt
10,333

edits