knight lesson WIP

pull/2069/head
Thibault Duplessis 2016-06-29 11:15:00 +02:00
parent 084b1e01a3
commit 2082184110
8 changed files with 38 additions and 79 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,4 @@
var m = require('mithril');
var util = require('../util');
var arrow = util.arrow;
@ -5,80 +6,41 @@ module.exports = {
title: 'The knight',
subtitle: 'It moves in a L shape.',
image: util.assetUrl + 'images/learn/pieces/N.svg',
intro: "Here's a challenge for you. The knight is... a tricky piece.",
illustration: m('div.is2d.no-square',
m('piece.knight.white')
),
stages: [{
goal: 'Knights have a fancy way<br>of jumping around!',
fen: '8/8/8/8/4N3/8/8/8 w - - 0 1',
items: {
c5: 'apple',
d7: 'flower'
},
apples: 'c5 d7',
nbMoves: 2,
shapes: [arrow('e4c5'), arrow('c5d7')]
}, {
goal: 'Get the hang of it!',
goal: 'Grab all the stars!',
fen: '8/8/8/8/8/8/8/1N6 w - - 0 1',
items: {
c3: 'apple',
d4: 'apple',
e2: 'apple',
e5: 'apple',
f3: 'apple',
g4: 'apple',
f6: 'apple',
h5: 'apple',
g7: 'flower'
},
nbMoves: 10
apples: 'c3 d4 e2 f3 f7 g5 h8',
nbMoves: 8
}, {
goal: 'Knights don\'t like long distances!',
fen: '8/8/8/8/8/8/8/N7 w - - 0 1',
items: {
a8: 'apple',
g7: 'apple',
g2: 'flower'
},
nbMoves: 11
goal: 'Grab all the stars!',
fen: '8/2n5/8/8/8/8/8/8 b - - 0 1',
apples: 'b6 d5 d7 e6 f4',
nbMoves: 5
}, {
goal: 'Star party!',
fen: '1n6/8/8/8/8/8/8/8 b - - 0 1',
items: {
a4: 'apple',
a5: 'apple',
a6: 'apple',
b4: 'apple',
b6: 'apple',
c4: 'apple',
c5: 'apple',
c6: 'apple',
e6: 'apple',
e7: 'apple',
e8: 'apple',
f6: 'apple',
f8: 'apple',
g6: 'apple',
g7: 'apple',
g8: 'apple',
f2: 'apple',
f3: 'apple',
f4: 'apple',
g2: 'apple',
g4: 'apple',
h2: 'apple',
h3: 'apple',
h4: 'apple',
d2: 'flower'
},
nbMoves: 28
goal: 'Knights can jump over obstacles!<br>Escape and vainquish the stars!',
fen: '8/8/8/8/5n2/8/8/8 b - - 0 1',
apples: 'e3 e4 e5 f3 f5 g3 g4 g5',
nbMoves: 9
}, {
goal: 'Does this look easy?<br>It\'s not :)',
fen: '1N6/8/8/8/8/8/8/8 w - - 0 1',
items: {
b7: 'apple',
d5: 'apple',
f3: 'apple',
h1: 'flower'
},
nbMoves: 15
goal: 'Grab all the stars!',
fen: '8/8/8/8/8/3N4/8/8 w - - 0 1',
apples: 'c3 e2 e4 f2 f4 g6',
nbMoves: 6
}, {
goal: 'Grab all the stars!',
fen: '8/2n5/8/8/8/8/8/8 b - - 0 1',
apples: 'b4 b5 c6 c8 d4 d5 e3 e7 f5',
nbMoves: 9
}].map(util.toStage),
complete: 'Congratulations! You have mastered the knight.'
};

View File

@ -1,3 +1,4 @@
var m = require('mithril');
var util = require('../util');
var arrow = util.arrow;
@ -5,24 +6,20 @@ module.exports = {
title: 'The pawn',
subtitle: 'It moves forward only.',
image: util.assetUrl + 'images/learn/pieces/P.svg',
intro: "Pawns are weak, but they pack a lot of potential.",
illustration: m('div.is2d.no-square',
m('piece.pawn.white')
),
stages: [{
goal: 'Pawns move one square only.<br><br>But when they reach the other side of the board, they become a stronger piece!',
fen: '8/8/8/P7/8/8/8/8 w - - 0 1',
items: {
f3: 'flower'
},
apples: 'f3',
nbMoves: 4,
shapes: [arrow('a5a6'),arrow('a6a7'),arrow('a7a8'),arrow('a8f3')]
}, {
goal: 'Most of the time, promoting to a queen is the best.<br><br>But sometimes a knight can come in handy!',
fen: '8/8/8/5P2/8/8/8/8 w - - 0 1',
items: {
b6: 'apple',
c4: 'apple',
d7: 'apple',
e5: 'apple',
a8: 'flower'
},
apples: 'b6 c4 d7 e5 a8',
nbMoves: 8
}, {
goal: 'A pawn on the second rank can move 2 squares at once!',

View File

@ -32,7 +32,7 @@ module.exports = {
apples: 'a2 b5 d3 g1 g8 h2 h5',
nbMoves: 7
}, {
goal: 'The queen is the strong!',
goal: 'Grab all the stars!',
fen: '8/8/8/8/8/8/8/4q3 b - - 0 1',
apples: 'a6 d1 f2 f6 g6 g8 h1 h4',
nbMoves: 9

View File

@ -18,6 +18,6 @@ var make = function(file, volume) {
module.exports = {
move: make('standard/Move'),
take: make('sfx/Tournament3rd'),
stageEnd: make('piano/Berserk'),
stageEnd: make('win'),
lessonEnd: make('sfx/Tournament1st')
};

View File

@ -65,10 +65,10 @@ module.exports = function(blueprint, opts) {
starTaken = true;
}
});
sound.move();
if (starTaken) sound.take();
if (!items.hasItem('apple')) complete();
else {
else if (starTaken) sound.take();
else sound.move();
if (!vm.completed) {
chess.color(blueprint.color);
ground.color(blueprint.color, chess.dests());
}