Re: Free Code Camp.org Challenges

2020-05-11 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Free Code Camp.org Challenges

Not to double post, but that said you will probably also have to figure out how to walk through the permutations of the parens (since you can sum 3 numbers and divide by only one), but it's always 4 numbers and 3 operators, so it's jsut a matter of figuring out what representation you want to use so that you can move the parens around as well.There is probably a faster way: for example, you can immediately eliminate any solution where the product of the 4 digits is lless than 24.  And it should be noted that why I never personally kept bothering with the code challenge sites is that they like to be more about math than about programming, so it's quite probable there's a bunch of other shortcuts that eliminate things you have to try that make this horrendously slow.  but the idea of this sort of problem is you figure out how to walk through all the permutations and then you figure out what shortcuts can immediately rule out certain combinations.  For example I see the beginning of a line of thinking where you figure out what combinations of odd and even numbers can sum to 24 (because there is a lot of stuff you can do, with respect to parity, when it comes to this stuff).  So.  But if you're wondering is this nontrivial, as someone who does nontrivial things, yes, it's nontrivial.

URL: https://forum.audiogames.net/post/528324/#p528324




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Free Code Camp.org Challenges

2020-05-11 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Free Code Camp.org Challenges

I don't have the time for the long form explanation of this at the moment, but they're asking you to build an _expression_ tree and walk through the permutations.  If you realize that any result is of the form:(d1 op1 d2) op2 (d3 op3 d4)Then all you do is iterate over all permutations of the digits, and for each of those you iterate over all possible combinations of the operators, and you build that _expression_, and you evaluate.  Python and (I think) C++ both have stuff for walking through all possible permutations of a list.

URL: https://forum.audiogames.net/post/528322/#p528322




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Free Code Camp.org Challenges

2020-05-11 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Free Code Camp.org Challenges

I'll revive this because ironically now I need help:Problem text:The 24 Game tests a person's mental arithmetic.The aim of the game is to arrange four numbers in a way that when evaluated, the result is 24Implement a function that takes a string of four digits as its argument, with each digit from 1 to 9 (inclusive) with repetitions allowed, and returns an arithmetic _expression_ that evaluates to the number 24. If no such solution exists, return "no solution exists".Rules:• Only the following operators/functions are allowed: multiplication, division, addition, subtraction.• Division should use floating point or rational arithmetic, etc, to preserve remainders.• Forming multiple digit numbers from the supplied digits is disallowed. (So an answer of 12+12 when given 1, 2, 2, and 1 is wrong).• The order of the digits when given does not have to be preserved.Example inputExample outputsolve24("4878");(7-8/8)*4solve24("1234");3*1*4*2solve24("6789");(6*8)/(9-7)solve24("1127");(1+7)*(2+1)SourceI do not want a full-fledged solution, but I do want some tips as to how to even attempt this one. I thought of storing the factors of 24 and trying to make the numbers equal those, but that doesn't really solve my issue with trying all the possible combinations

URL: https://forum.audiogames.net/post/528299/#p528299




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Free Code Camp.org Challenges

2020-05-11 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Free Code Camp.org Challenges

I'll revive this because ironically now I need help:Problem text:FreeCodeCamp.org wrote:The 24 Game tests a person's mental arithmetic.The aim of the game is to arrange four numbers in a way that when evaluated, the result is 24Implement a function that takes a string of four digits as its argument, with each digit from 1 to 9 (inclusive) with repetitions allowed, and returns an arithmetic _expression_ that evaluates to the number 24. If no such solution exists, return "no solution exists".Rules:• Only the following operators/functions are allowed: multiplication, division, addition, subtraction.• Division should use floating point or rational arithmetic, etc, to preserve remainders.• Forming multiple digit numbers from the supplied digits is disallowed. (So an answer of 12+12 when given 1, 2, 2, and 1 is wrong).• The order of the digits when given does not have to be preserved.Example inputExample outputsolve24("4878");(7-8/8)*4solve24("1234");3*1*4*2solve24("6789");(6*8)/(9-7)solve24("1127");(1+7)*(2+1)SourceI do not want a full-fledged solution, but I do want some tips as to how to even attempt this one. I thought of storing the factors of 24 and trying to make the numbers equal those, but that doesn't really solve my issue with trying all the possible combinations

URL: https://forum.audiogames.net/post/528299/#p528299




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Free Code Camp.org Challenges

2020-05-11 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Free Code Camp.org Challenges

I'll revive this because ironically now I need help:Problem text:The 24 Game tests a person's mental arithmetic.The aim of the game is to arrange four numbers in a way that when evaluated, the result is 24Implement a function that takes a string of four digits as its argument, with each digit from 1 to 9 (inclusive) with repetitions allowed, and returns an arithmetic _expression_ that evaluates to the number 24. If no such solution exists, return "no solution exists".Rules:• Only the following operators/functions are allowed: multiplication, division, addition, subtraction.• Division should use floating point or rational arithmetic, etc, to preserve remainders.• Forming multiple digit numbers from the supplied digits is disallowed. (So an answer of 12+12 when given 1, 2, 2, and 1 is wrong).• The order of the digits when given does not have to be preserved.Example inputExample outputsolve24("4878");(7-8/8)*4solve24("1234");3*1*4*2solve24("6789");(6*8)/(9-7)solve24("1127");(1+7)*(2+1)SourceI do not want a full-fledged solution, but I do want some tips as to how to even attempt this one. I thought of storing the factors of 24 and trying to make the numbers equal those, but that doesn't really solve my issue with trying all the possible combinations

URL: https://forum.audiogames.net/post/528299/#p528299




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Free Code Camp.org Challenges

2020-05-10 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Free Code Camp.org Challenges

For anyone interested, I have started to work on the challenges at Free Code Camp. I haven't gotten far, but I figure that if anyone is stuck or is confused as to how the solutions work could post on here and I or anyone else could try and assist with an explanation or clarification.Currently I worked through This one about 100 doors. Turns out that they wanted the actual index rather than the zero-based one I was returning. Great. For the reference, the text is below:There are 100 doors in a row that are all initially closed. You make 100 passes by the doors. The first time through, visit every door and 'toggle' the door (if the door is closed, open it; if it is open, close it). The second time, only visit every 2nd door (i.e., door #2, #4, #6, ...) and toggle it. The third time, visit every 3rd door (i.e., door #3, #6, #9, ...), etc., until you only visit the 100th door.I will update this with more challenge notifications as I work them out.

URL: https://forum.audiogames.net/post/528041/#p528041




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Free Code Camp.org Challenges

2020-05-10 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Free Code Camp.org Challenges

For anyone interested, I have started to work on the challenges at Free Code Camp. I haven't gotten far, but I figure that if anyone is stuck or is confused as to how the solutions work could post on here and I or anyone else could try and assist.Currently I worked through This one about 100 doors. Turns out that they wanted the actual index rather than the zero-based one I was returning. Great. For the reference, the text is below:There are 100 doors in a row that are all initially closed. You make 100 passes by the doors. The first time through, visit every door and 'toggle' the door (if the door is closed, open it; if it is open, close it). The second time, only visit every 2nd door (i.e., door #2, #4, #6, ...) and toggle it. The third time, visit every 3rd door (i.e., door #3, #6, #9, ...), etc., until you only visit the 100th door.I will update this with more challenge notifications as I work them out.

URL: https://forum.audiogames.net/post/528041/#p528041




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector