Commit 96f8c8bb authored by quentin.vrel's avatar quentin.vrel

testing chow

parent d6504fda
......@@ -21,12 +21,13 @@ export default {
}
},
mounted(){
let startingHand = [8,11,11,14,16,7,4,5,20,21,22,6,0];
let startingHand = [0,1,2,3,4,5,6,7,8,9,10,25,26,27,28,29,30,31,32,8,11,11,14,16,7,4,5,20,21,22,6,0];
this.Hand= new Hand();
startingHand.forEach(tile => {
this.Hand.draw(new TileModel(tile));
});
this.Hand.sort();
console.log(this.Hand.checkChow());
},
updated(){
},
......@@ -34,6 +35,7 @@ export default {
tileClickedListener: function(event){
let dicarded = this.Hand.discard(event.id_tuile);
console.log(dicarded);
console.log(this.Hand.checkChow());
}
}
}
......
......@@ -34,14 +34,17 @@ export default class Hand{
//
checkChow(){
this.sort();
let chowArray = [];
const tile_ids = this.tiles_left.map(tile => tile.id_tuile);
let current_tile = -1;
tile_ids.forEach(tile_id => {
if(tile_id>current_tile){
current_tile=tile_id;
tile_ids.forEach( unique_tile => {
if (unique_tile<7 || (8<unique_tile && unique_tile<16) || (17<unique_tile && unique_tile<25)) { //bamboo <8 || char <8 || dot <8
if ((tile_ids.indexOf(unique_tile+1) && tile_ids.indexOf(unique_tile+2)) != -1) {
chowArray.push(unique_tile)
}
}
//WIP
});
return chowArray;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment