These are chat archives for FreeCodeCamp/Help

24th
Jan 2018
Stephen James
@sjames1958gm
Jan 24 2018 00:54
@thekholm80 lol
artbohr
@artbohr
Jan 24 2018 01:46
@sjames1958gm the brownie master :D
aRtoo
@artoodeeto
Jan 24 2018 02:25
hey fam! anyone done with there simon game? i cant get the logic right on turns heres my pen:https://codepen.io/artoo/pen/opQZWy
Eric Miller
@ericmiller777
Jan 24 2018 03:01
@artoodeeto its been so long since i did mine
aRtoo
@artoodeeto
Jan 24 2018 03:01
@ericmiller777 its ok bro.
Eric Miller
@ericmiller777
Jan 24 2018 03:01
i cant get yours to start?
Claudio Restifo
@Marmiz
Jan 24 2018 03:07
@artoodeeto it's probably easier if you point us towards the line you think are bugged, otherwise we have to read through the whole JS :)
aRtoo
@artoodeeto
Jan 24 2018 03:07
@ericmiller777 you have to turn it on then start

@Marmiz i think its the code.

document.getElementById('counter').innerText = counter++;

    console.log('c ' + counter , 's ' + simonTurn);
    if(counter === simonTurn){
        clearInterval(randomInterval);  
    } else {

        randomInterval= setInterval(randomMizer, 1000);
    }

from 125 - 133

@Marmiz @ericmiller777 did you guys use setTimeout or setInterval?
Eric Miller
@ericmiller777
Jan 24 2018 03:09
@artoodeeto i used setTimout
not really supposed to look at other peoples code tho
i gtg be back in a bit
aRtoo
@artoodeeto
Jan 24 2018 03:12
@ericmiller777 thanks
CamperBot
@camperbot
Jan 24 2018 03:12
artoodeeto sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @ericmiller777 |http://www.freecodecamp.org/ericmiller777
Claudio Restifo
@Marmiz
Jan 24 2018 03:14
@artoodeeto There's definitely something wrong in your counters, since it will never occurs that counter === simonTurn) thus you keep on calling randomInterval every second
aRtoo
@artoodeeto
Jan 24 2018 03:15
@Marmiz yup. i cant get the logic right. and maybe i need to use setTimeout?
Claudio Restifo
@Marmiz
Jan 24 2018 03:17
@artoodeeto it won't change much. The important difference is that interval execute the function first, and after waiting x ms.
While ssetTimeout will execute the function after x ms has passed
also worth notice that interval is pretty much like a loop, in the sense that it will keep running unless asked to stop, while setTimeout finish its thread after the function is done
aRtoo
@artoodeeto
Jan 24 2018 03:19
right but since setTimeout sill execute once and call another function with interval?
right. i was planning to use setTimeout to trigger a setInterval
Claudio Restifo
@Marmiz
Jan 24 2018 03:21
this project would make a great example of oop :fire:
shivam gupta
@shivamg11000
Jan 24 2018 03:37
Cannot read property 'drop' of undefined ?
https://codepen.io/shivamg11000/pen/NXmwpb?editors=0010
why so?
Claudio Restifo
@Marmiz
Jan 24 2018 03:38

@artoodeeto anyway as far as I can see the animation should have a pattern of:

// assuming that we have an array of some sort of sequence of tiles to animate like: [1, 3, 1, 5 , 7]
function animate() {
  var i === 0; // counter
   var interval = setInterval(function() {
      animate(sequence[i]);  // animate the specific tile
      i++; // increase counter
      //      at the end of the array stop.
      if (i >= sequence.length) {
        clearInterval(interval);
      }
    },  ms);
}

or something like this

aRtoo
@artoodeeto
Jan 24 2018 03:40
@Marmiz mine is just random. i was thinking of calling the function if its not equal to counter.
Marc
@MWBauer
Jan 24 2018 05:07
Hey everyone!
anyone...
Eric Miller
@ericmiller777
Jan 24 2018 06:20
Hello
Eric Miller
@ericmiller777
Jan 24 2018 06:55
beta broke
?
Eric Miller
@ericmiller777
Jan 24 2018 07:33
its working now
im backing up my beta solutions, when its merged I wont be banned for pasting the questions in will I?
Darren
@DarrenfJ
Jan 24 2018 07:37
evening fCC
@ericmiller777 no, they even encourage saving them and then pasting then in
"Beta progress won’t be ported over once the beta challenges become the production challenges. But you will be able to resubmit any projects you’ve built. And the projects are the only requirement for claiming the certificates."
and I think only the projects are mandatory for the certs
"Each of these certificates will have 5 required projects, and all other challenges will be optional. We estimate that each certificate will take around 300 hours to complete."
Eric Miller
@ericmiller777
Jan 24 2018 07:44
Yea ive noticed when it goes public, ill only need to do 2-3 projects and ill get 2 certificicates
@DarrenfJ thanks
CamperBot
@camperbot
Jan 24 2018 07:44
ericmiller777 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2359 | @darrenfj |http://www.freecodecamp.org/darrenfj
Eric Miller
@ericmiller777
Jan 24 2018 07:44
@artoodeeto thanks
Darren
@DarrenfJ
Jan 24 2018 07:47
@ericmiller777 yah if you've done all the basics from the present curriculum there's only a bit to do more for the new certs..
Eric Miller
@ericmiller777
Jan 24 2018 07:48
@DarrenfJ I just submitted a project i had done, and it just completed, so im guessing where it says
"Fulfill the user stories by getting all of the tests to pass. Use whichever libraries you need. Give it your own personal style."
hasnt been added yet?
Claudio Restifo
@Marmiz
Jan 24 2018 07:52
Beta is under heavy management these days, I wouldn't count too much on it :)
but actually if you can report/fix stuff that would be great
Darren
@DarrenfJ
Jan 24 2018 07:53
for the betas they used to have a js file/link you could add that would run the tests... not sure if it's still around since they've changed some stuff in the last 6 months in the push to get it online for Xmas (a weeee bit delayed now ;) )
@ericmiller777 i think it's this.. in your js.. and it puts small box top of page that lists the tests and running them etc...
Eric Miller
@ericmiller777
Jan 24 2018 07:59
@DarrenfJ @Marmiz thanks
CamperBot
@camperbot
Jan 24 2018 07:59
ericmiller777 sends brownie points to @darrenfj and @marmiz :sparkles: :thumbsup: :sparkles:
api offline
:star2: 1131 | @marmiz |http://www.freecodecamp.org/marmiz
Darren
@DarrenfJ
Jan 24 2018 08:06
ok, off for the night... codeOn roomies
Claudio Restifo
@Marmiz
Jan 24 2018 08:17
:wave:
gishy1
@gishy1
Jan 24 2018 10:25

hello world need help

```

```
Daniel
@dkapexhiu
Jan 24 2018 14:36
how to tell when two players are near on a board game click a button then start war
this is the javascript file and search for function processMovement
https://codepen.io/dkapexhiu/pen/WdJGXg.js
Stephen James
@sjames1958gm
Jan 24 2018 14:43
You could use the distance formula?
Distance = √(x2−x1)2+(y2−y1)2
Daniel
@dkapexhiu
Jan 24 2018 14:45
good and how can i implement it in my code?
Stephen James
@sjames1958gm
Jan 24 2018 14:48
@dkapexhiu assuming player1, player2 are objects with coordinates and somevalue can be adjusted to around 1-2?
Math.sqrt(Math.pow(player2.x - player1.x) + Math.pow(player2.y-player1.y)) < somevalue
Daniel
@dkapexhiu
Jan 24 2018 14:54
i have for example this code:
function Player()
{
    this.tileFrom    = [1,1];
    this.tileTo        = [1,1];
    this.timeMoved    = 0;
    this.dimensions    = [30,30];
    this.position    = [45,45];
    this.direction    = directions.up;

}
i need to calculate the distance between tileFrom and tileTo and if they are adjacent call some action?
Stephen James
@sjames1958gm
Jan 24 2018 15:15
Replace player2.x with tileTo[0], etc.
Dimitris Nik.
@dimitrissnk
Jan 24 2018 17:15
Hello there, if I want to get every font on my page to work on every device I have to use @font-face, am I right?
Alexander Køpke
@alexanderkopke
Jan 24 2018 17:45
idk
Joshua Arnett
@josha5
Jan 24 2018 17:49
@sjames1958gm Hey @sjames1958gm you there?
Stephen James
@sjames1958gm
Jan 24 2018 17:51
@josha5 Yes
Joshua Arnett
@josha5
Jan 24 2018 17:51
@sjames1958gm Could you help me out with a bubbling event issue I'm having
Stephen James
@sjames1958gm
Jan 24 2018 17:51
@josha5 Maybe. Not much experience there.
Joshua Arnett
@josha5
Jan 24 2018 17:53
I made a bitcoin widget and my buttons are interacting with each other
the refresh data should just refresh the price of bitcoin if the price has changed. the convert button should convert to EUR and GBP.
My convert buttons functionality is bubbling into my refresh button so I click convert and nothing happens. Then I click the refresh button and it converts the currency and refreshes the bitcoin price
Stephen James
@sjames1958gm
Jan 24 2018 17:56
@josha5 Your currency click handler isn't modifying the DOM so it doesn't re-render. But it does update the variable so when you click the other it shows.
@josha5 Cache the data from the prices and then create and call an update() function in each handler (including after updating currency)
    prices = data.bpi;
    update()
var prices;
function update() {
  price.textContent = prices[currency].rate + " " + currency;
}
Joshua Arnett
@josha5
Jan 24 2018 18:02
@sjames1958gm That makes sense thank you very much!
CamperBot
@camperbot
Jan 24 2018 18:02
josha5 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8892 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Jan 24 2018 18:02
@camperbot :+1:
Darren
@DarrenfJ
Jan 24 2018 20:06
afternoon fCC
Kaz Baig
@kbaig
Jan 24 2018 20:07
hello :wave:
Kyle Holm
@thekholm80
Jan 24 2018 20:17
@DarrenfJ :wave:
Stephen James
@sjames1958gm
Jan 24 2018 20:27
@DarrenfJ :wave: