## 4x4 Puzzle

A 4 by 4 sliding puzzle.

Compatibility: TinyTIM.

### Instructions

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.
@VA 4x4 Puzzle=ABC_KHJEGINDFMLO
@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
@VH 4x4 Puzzle=JBLKENAOHIDMFCG_
@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'.