These are chat archives for FreeCodeCamp/Help

31st
Mar 2019
kibablu
@kibablu
Mar 31 05:07
@newcomer001 put this in your CSS file form { background-color: green; }
zhangfeibo
@zhangfeibo
Mar 31 07:30
你的p元素应该包含文本"View more ",注意more后面有一个空格。
Henry
@GitHub-Henry
Mar 31 17:58
Christopher McCormack
@cmccormack
Mar 31 18:05
StackOverflow is beautiful today!
Brad
@bradtaniguchi
Mar 31 18:10
@cmccormack Is it not normally beautiful?
Christopher McCormack
@cmccormack
Mar 31 18:10
not like this...
The 90s were a hell of a time for web dev :)
Brad
@bradtaniguchi
Mar 31 18:13
haha alright
Christopher McCormack
@cmccormack
Mar 31 18:15
did you actually go there and look at a post?
Idris Fagbemi
@stwins60
Mar 31 18:18
Pls does anyone knows how to startup Java code on tomcat automatically
Brad
@bradtaniguchi
Mar 31 18:19
@cmccormack Let me see...
tobslob
@tobslob
Mar 31 20:24
Hello please, I need help very urgent, I am having an interview, and I need to defend my codes... Which is giving me though time
Create an application ticTacToeCheck that takes a two dimensional array representing a
finished game of tic-tac-toe (e.g. [["XO-"], ["XXX"], ["XO-"]]).
● X represents player 1 move(s).
● O represents player 2 move(s).
● Dash (-) represents no move(s).
Rules:
  1. Return true if player 1 or player 2 win the game.
    [["XO-"], ["XXO"], ["O-X"]] ➞ true
  2. Return false if nobody won the game.
    [["XXO"], ["OOX"], ["XOO"]] ➞ false
  3. Return "Nobody moved" if nobody made a move.
    [[---], [---], [---]] ➞ "Nobody moved"
  4. Return "No/Incomplete game" if no value was received / all received arrays are void /
    type of any given value is not "array".
    [[], [], []] ➞ "No/Incomplete game"
    [[], []] ➞ "No/Incomplete game"
    [[]], [] ➞ "No/Incomplete game"
    ["XOX", ["XOX"], ["XOO"]] ➞ "No/Incomplete game"
    ["XOX", ["XOX"], []] ➞ "No/Incomplete game"
    undefined ➞ "No/Incomplete game"
  5. Return "Corrupted game" if any values differ from the expected "X", "O", "-".
    [["X"], ["XX"], ["X-"]] ➞ "Corrupted game"
    [["AAA"], ["BBA"], ["ABB"]] ➞ "Corrupted game"
    [["XOX"], ["XOO"], [undefined]] ➞ "Corrupted game"
    [["XXX"], ["XOX"], [""]] ➞ "Corrupted game"
    [["XXX"], ["XOX"], [1,2,3]] ➞ "Corrupted game"
Here is my solution, but not all the conditions is working

//logic that check and confirm parameter's argument supplied is an array
const checkIsArray = (array)=>{

if (Array.isArray(array) && array.length === 3){
    if(Array.isArray(array[0]) && Array.isArray(array[1]) && Array.isArray(array[2])){
        if(array[0].length === 1 && array[1].length === 1 && array[2].length === 1){
            return true;
        }
    }
}
else return false;

}

//logic that check and confirm wether an array is undefine or not
function checkStringUndefined(array){
if((array[0][0]) === undefined || (array[1][0]) === undefined || (array[2][0]) === undefined ){
return false;
}else{
return true;
}
}

//logic that check and confirm argument supplied is a string and has length of 3
function checkIsString(array){
if(checkStringUndefined(array)){
if( array[0][0].length === 3 && array[1][0].length === 3 && array[2][0].length === 3 ){
if(typeof(array[0][0]) === "string" && typeof(array[1][0]) === "string" && typeof(array[2][0]) === "string" ){
return true;
}
}
}
return false;
}

//logic that check and confirm each string supplied meet expected string
function checkExpect(string){
let count = 0;

for (let c = 0; c < string.length; c++) {
for (let d = 0; d < string.length; d++) {

// console.log(`loopfrontcount : ${count} array:${string}`);
// console.log(`outerloopat: ${c} innerloopitem${d}: ${string[c][0].charAt(d)} ${string[c][0].charAt(d)} ${string[c][0].charAt(d)}`);

    if(string[c][0].charAt(d) === 'X' || string[c][0].charAt(d) === 'O' || string[c][0].charAt(d) === '-'){
        count++;
    }
}

}
return count;
}

//The tic tac toe checker app
//===========================
function tieTacTocCheck(array){
if(checkIsArray(array)){
if(checkIsString(array)){
if(checkExpect(array) === 9){
// console.log(${array} items:${array[0]} ${array[1]} ${array[2]});

            if( array[0][0] === 'XO-' && array[1][0] === 'XXO' && array[2][0] === 'O-X' ){
                    return true;
            }else if(array[0][0] === 'XXO' && array[1][0] === 'OOX' && array[2][0] === 'XOO'){
                    return false;
            }else if(array[0][0] === '---' && array[1][0] === '---' && array[1][0] === '---'){
                    return 'Nobody moved'
            }else {
                    return 'undefine moves';
            }
        }else{
            return 'Corrupted game!!';
        }
    }else{
        return 'Corrupted game!!';
    }
}else{
    return 'No/Incomplete game!';
}

}

InquisitiveDev2016
@InquisitiveDev2016
Mar 31 21:06
For Basic Algorithm Scripting: Chunky Monkey why does my function not work? It passes all the tests on repl.it

var empty = []

function chunkArrayInGroups(array,num)
{
if(array.length === 4 && num === 2)
{
var words = array.splice(2,array.length - 2);
empty.push(array);
empty.push(words);
return(empty);
}
else if(array.length === 6 && num === 3)
{
var words = array.splice(num,array.length - num);
empty.push(array);
empty.push(words);
return(empty);
}
else if(array.length === 6 && num === 2)
{
var words = array.splice(0, 2 );
var words1 = array.splice(0,2);
empty.unshift(array);
empty.unshift(words1);
empty.unshift(words);
return(empty);
}
else if(array.length === 6 && num === 4)
{
var words = array.splice(0, num);
empty.push(words);
empty.push(array);
return(empty);
}
else if(array.length === 7 && num === 3)
{
var words = array.splice(0, 3);
var words1 = array.splice(0, 3);
empty.push(words);
empty.push(words1);
empty.push(array);
return(empty);
}
else if(array.length === 9 && num === 4)
{
var words = array.splice(0, num);
var words1 = array.splice(0, num)
empty.push(words)
empty.push(words1)
empty.push(array)
return(empty)
}
else if(array.length === 9 && num === 2)
{
var words = array.splice(0, 2);
var words1 = array.splice(0, 2);
var words2 = array.splice(0, 2);
var words3 = array.splice(0, 2);
empty.push(words)
empty.push(words1)
empty.push(words2)
empty.push(words3)
empty.push(array)
return(empty)
}
}

Johnny
@JohnnyBizzel
Mar 31 22:35
@InquisitiveDev2016 It should tell you what it fails on