conflicts
continuous-integration/drone/push Build is passing Details

master
remrem 2 years ago
commit d59ce13b7b

@ -7,6 +7,7 @@
<!-- <base href="https://codefirst.iut.uca.fr/containers/HyperSet-hyperset/"> -->
<link rel="stylesheet" type="text/css" href="./styles/style.css">
<link rel="stylesheet" type="text/css" href="./styles/index.css">
<link rel="icon" type="image/x-icon" href="/resources/favicon.ico">
</head>
<body>

@ -29,8 +29,12 @@ class Deck {
*/
createDeck(nbCards) {//toTest⌛when more than 12c to d't add other cards
if (this.remainingCards.length < this.nbCards) {// no more cards
console.log("PLUS DE CARTES");
return 2;
if(setsCounter(this.outputCards, this.nbCards)==0){
return 2;
}
else{
return 1;
}
}
else {
let nbSets = setsCounter(this.outputCards, this.nbCards);
@ -45,8 +49,6 @@ class Deck {
}
nbSets = setsCounter(this.outputCards, this.nbCards);
console.log("nbSets", nbSets);
// console.log("outputCards.length", this.outputCards.length);
// console.log("remainingCards.length", this.remainingCards.length);
if (nbSets == 0) {
this.createDeck(this.nbCards)
}
@ -70,20 +72,31 @@ class Deck {
* @author Bastien Jacquelin
*/
checkSet(selectedCards) {//toTest⌛
console.log("nb set",setsCounter(this.outputCards, this.nbCards))
if (isSet(selectedCards)){// is a set
if (this.outputCards.length == 0) {
if (this.outputCards.length == 0) {//plus de deck
console.log("C'est win")
return 2;
}
else {
return this.removeFromoutputCards(selectedCards);
else {//encore des cartes sur le deck
if(this.remainingCards.length < this.nbCards){// plus de pile
if(setsCounter(this.outputCards, this.nbCards) == 0){//plus de set mais encore des cartes dans le deck
return 2;
}
else{//encore des set
console.log("plus la pile")
return this.removeFromoutputCards(selectedCards);
}
}
else{// encore de la pile
console.log("encore de la pile")
return this.removeFromoutputCards(selectedCards);
}
}
}
else if (this.remainingCards.length < this.nbCards) {
console.log("C'est win")
return 2;
else{// pas un set
return -1;
}
return 0;
}
/**

@ -14,7 +14,9 @@ function isSet(cards)
for(let j = 0; j < attributesMatrix.length; j++) {
listAttributes.push(attributesMatrix[j][i]);
}
if(!checkAttributes(listAttributes)){
console.log("JE SUIS LES ATTRIBUTS")
console.log(listAttributes)
if(!checkAttributes2(listAttributes,attributesMatrix.length)){
return false;
}
}
@ -23,6 +25,17 @@ function isSet(cards)
}
function checkAttributes2(params,length) {
var tab = []
params.forEach(element => {
if (!tab.includes(element)) {
tab.push(element)
}
});
console.log(tab.length === 1 || tab.length === length)
return tab.length === 1 || tab.length === length;
}
function checkAttributes(attributes){
let orderingMethod = "null"; // Can only take ["null", "same", "different"]
let boolLoop = true;

@ -3,13 +3,13 @@ export default{
props:{
deck:Deck,
idRoom:String,
mode:Boolean//true for chrono
mode:Boolean,//true for chrono
hyperSet:Boolean,
},
data: function(){
return{
card:new Card({"filling":"empty"}),
id:0,
//deck : new Deck([0,1,2],3),
selectedCards:[],
selectedCardsindex:[],
nbCardsSelected:0,

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<title>Room - HyperSet</title>
<link rel='stylesheet' type='text/css' href='/styles/style.css' />
<link rel='stylesheet' type='text/css' href='/styles/room.css' />
<link rel="icon" type="image/x-icon" href="/resources/favicon.ico">
</head>
<body>
<section id="left-section">
<button>Orignal Set Game</button>
<div>
<label>Private</label>
<input type='checkbox' />
</div>
<span id="or">OR</span>
<div class="group">
<span class="subtitle">Game parameters</span>
<div id="game-param">
<label id="chrono-slider-label">js</label><br>
<input type="range" min="1" max="8" value="1" class="slider" id="chrono-slider"><br>
<label id="player-slider-label">js</label><br>
<input type="range" min="0" max="20" value="0" class="slider" id="player-slider"><br>
<span>HyperSet</span> <input type='checkbox' /><br>
</div>
</div>
<div class="group">
<span class="subtitle">Card number to make a set</span>
<div id='card-param' class="param">
<input type='checkbox' /> <span>3</span>
<input type='checkbox' /> <span>4</span>
<input type='checkbox' /> <span>5</span>
</div>
</div>
<div class="group">
<span class="subtitle">Attributes to play with</span>
<div id='attributes-param' class="param">
<input type='checkbox' /> <span>number</span>
<input type='checkbox' /> <span>color</span>
<input type='checkbox' /> <span>shape</span>
<input type='checkbox' /> <span>filling</span>
<input type='checkbox' /> <span>outline (honnêtement c'est nul)</span>
</div>
</div>
</section>
<section id="right-section">
<div>
<span class="subtitle">List of players waiting in the room:</span>
<div id="players">
<span>Aurianus</span>
<span>Basuw</span>
<span>Raph</span>
<span>Remrem</span>
</div>
</div>
<button id="start" class="action-button">Start</button>
<script>
let button=document.querySelector("#start")
button.addEventListener('click', event => {
window.location.href = "/views/game.html";
});
</script>
</section>
</body>
</html>
Loading…
Cancel
Save