4x4 Puzzle


Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for 4x4 Puzzle

@create 4x4 Puzzle
@desc 4x4 Puzzle=This is one of those 15 tile slide puzzles (this on made of finely crafted bronze. In order to win you are supposed to align the letter tiles in alphabetical order from upper-left to lower-right corner so that the blank _ is in the final position. To get further instructions, type 'instructions'.
@Osucc 4x4 Puzzle=feels adventurous and picks up the puzzle.
@Odrop 4x4 Puzzle=has had enough with the puzzle and puts it down.
@Drop 4x4 Puzzle=You discard the puzzle.
@VB 4x4 Puzzle=$view puz:@trigger me/vd
@VC 4x4 Puzzle=$sl *:@vz me=v(#);@vx me=capitalize(v(0));@ve me=[sub(instr(v(va),_),instr(v(va),v(vx)))];@vf me=mod(instr(v(va),_),4);@if eq(or(and(eq(v(ve),1),ne(v(vf),0)),and(eq(v(ve),-1),ne(v(vf),3)),eq(v(ve),4),eq(v(ve),-4)),1)={@edit me/va=v(vx),Z,_,v(vx),Z,_;@emit Click!;@trigger me/vd},{@emit That's not a legal move!!}
@VD 4x4 Puzzle=@switch v(va)={ABCDEFGHIJKLMNO_},{@emit The puzzle is solved, [name(v(vz))]!!;@emit ;@dolist 0 4 8 12=@emit mid(v(va),##,4);@trigger me/vw},{@emit ;@dolist 0 4 8 12=@emit mid(v(va),##,4)}
@VE 4x4 Puzzle=4
@VF 4x4 Puzzle=3
@VG 4x4 Puzzle=$scramble puz:@emit;@emit The puzzle begins scrambling itself (Click... click... click...);@trigger me/vk
@VI 4x4 Puzzle=@if eq(mod(v(vl),2),0)={@va me=edit(v(vm),spaces(1),,+,_);@trigger me/vd},{@vm me=concat(extract(v(vm),2,1),extract(v(vm),1,1),extract(v(vm),3,13));@va me=edit(v(vm),spaces(1),,+,_);@trigger me/vd}
@VJ 4x4 Puzzle=$instructions:@emit To move a letter into the adjacent blank spot, type 'sl *' where * is the letter to be moved. To see the puzzle's current configuration, type 'view puz'.
@VK 4x4 Puzzle=@vm me=pick(genlist(A,O),15);@vl me;@dolist genlist(A,O)={@vs me=except(extract(v(vm),add(match(v(vm),##),1),15),genlist(##,P));@vl me=add(v(vl),words(v(vs)))};@trigger me/vi
@VL 4x4 Puzzle=54
@VM 4x4 Puzzle=M J D N B G A I L C K F O E H
@VS 4x4 Puzzle=E H
@VW 4x4 Puzzle=@trigger #69927/vb;@trigger me/vg
@VX 4x4 Puzzle=E
@VZ 4x4 Puzzle=#80699
@XC 4x4 Puzzle=Credits: Non-Prophet@TinyTIM