I don't think the whole spreadsheet is relevant here (Hope I am not wrong) but essentially I am working with some financial figures and need to work out a "Cumulative Cost". The spreadsheet is correct, but I don't understand the maths...

If I have a line, with the points x,y,endx and endy how can I detect if another point is on the line? A simple equation, or example functions in JavaScript or pseudocode will be most helpful. EDIT: This is for a game I'm working on, I'm tryi...

Let's say I have the color rgba(255, 0, 0, 0.5) on a white background. The color that can bee seen is almost identical to rgba(255, 140, 140, 1) which is a solid color. I'm looking for an algorithm that converts a semi-transparent color (over...

Say you got a rectangle, width=10, height=20 and want to get the coordinates of every pixel in the perimeter. You could have done it with 4 for loops, but isn't there a better, neater way? for(x=0; x<width; x++){ doSomethingWith(x,0) } fo...

What is the best way to check 4 in a row in connect 4? I won't copy the code for the array but it is basically an array of length 42. Each array element holds the X, Y position for drawing and the color var board_array = [{x:60, y:55, c:"Re...

I am having trouble converting this pseudocode statement to javascript i am new to javascript and i am confused on labling the string and i want to make sure i am on the right track // Date validation function Function Boolean isValidDateFormat(St...

I'm currently working on some private project on my spare time, and I've been stuck on a particular math problem. I know that bin packing is a NP-HARD problem, but that's not exactly the problem I'm facing here. What I must do is to...

I've recently seen a challenge picture on brillant.org's Instagram account: The instructions: The robot takes 4 random steps (can't go diagonal). In which area is it most likely to land? Obviously there are 44 = 256 possible paths fo...

I am creating a CSS selector for homework. I have managed to extract and get single selectors - e.g. #_id, but I cannot work out how to get a result for nested ones such as : div#_id._class [NOTE: I cannot use any libraries to do this or querySelecto...

In this exercise, you will roll a pair of dice until the numbers add up to a given number. You can assume that the given number is 2, 3, 6, or 12. Using pseudocode, write an algorithm that returns the number of times the dice i...

©2020 All rights reserved.