twelve-of-code-official / website

The source code for the Twelve of Code website
https://mesure.x10.mx/twelve-of-code
GNU General Public License v3.0
0 stars 0 forks source link

Program challenge 2024/apr/1 #157

Closed Mesure73L closed 7 months ago

Mesure73L commented 8 months ago

Resolves twelve-of-code-official/challenges#2

[!WARNING] Spolier warning

Mesure73L commented 8 months ago

You didn't need to create a new PR when you chose the wrong base, you can just edit it

BeepBot99 commented 8 months ago

Oh, okay, I didn't know that. Thank you!

Mesure73L commented 8 months ago

Oh, okay, I didn't know that. Thank you!

I didn't either, I thought I would have to make a new one but I clicked edit to see if I could change it and I could, it's good to know for the future I guess

netlify[bot] commented 8 months ago

Deploy Preview for m73l-twelve-of-code-dev ready!

Name Link
Latest commit 5a8e027a6b7e2a19fcfc9a429bf48c5c8b1ef9a8
Latest deploy log https://app.netlify.com/sites/m73l-twelve-of-code-dev/deploys/65e8aa5df7a6820008d6d753
Deploy Preview https://deploy-preview-157--m73l-twelve-of-code-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BeepBot99 commented 8 months ago

Remember, you only need to use the code for the GET request. I found how to make it so you can do /api/seed?data=. Would you like me to do that for you?

Mesure73L commented 8 months ago

Remember, you only need to use the code for the GET request. I found how to make it so you can do /api/seed?data=. Would you like me to do that for you?

Sure

BeepBot99 commented 8 months ago

Challenge for March 1st, 2023

Given: An array of chip brands. For example, ["fritos", "lays", "doritos", "mommas"]. The set of chip brands you are given has exactly half the cardinality of the master set, and is a subset of the master set. It is based on your seed. Given: The name of one chip brand in that array. It is based on your seed. Process: Put that chip brand into the API. The API returns the name of another chip brand, based on your seed. The API returns the "owner" of that chip brand, in a fictional context. For example, if calling the API with input "lays" returns "fritos", it means that Fritos has bought Lays. (This is a purely fictional context, I am aware that Lays owns Fritos.) Find: The number of master brands in that streak. For example, if your input you are given is "lays", and your array is ["fritos", "lays", "doritos", "mommas"], the API could return "fritos". Then, "fritos" could return "doritos", then "mommas", then "doritos", and it continues to loop. Therefore, the number of master brands that own each is 2, as your final loop for the starting brand is 2. You may start development on the challenge using JavaScript only, but do not use PHP yet, as I have not yet set that up. In addition, I am going to create a SeedManager class later today, which will generate pseudorandom numbers based on the seed.

BeepBot99 commented 8 months ago

@Mesure73L Is that good for you?

Mesure73L commented 8 months ago

I do not understand.

Mesure73L commented 8 months ago

Please be very specific, including how the seed affects how the program works.

[!WARNING] Spoilers

Mesure73L commented 8 months ago

and what JavaScript do I need to make?????????

BeepBot99 commented 8 months ago

What do you need to be more specific?

BeepBot99 commented 8 months ago

I did say how the seed affects it. The seed affects

The set of chip brands you are given has exactly half the cardinality of the master set, and is a subset of the master set. It is based on your seed.

a) What the array of chip brands is. b) What your starting chip brand is. c) What the API returns for any given chip brand.

Mesure73L commented 8 months ago

I did say how the seed affects it. The seed affects

The set of chip brands you are given has exactly half the cardinality of the master set, and is a subset of the master set. It is based on your seed.

a) What the array of chip brands is. b) What your starting chip brand is. c) What the API returns for any given chip brand.

How does the seed specifically affect how it works, like what is the seed formula?

BeepBot99 commented 8 months ago

I don't understand what you are asking for. Can you please be more specific?

BeepBot99 commented 8 months ago

What "seed formula?" There is no formula involved.

BeepBot99 commented 8 months ago

Okay, so this is what you need to do:

  1. Get a big array of chip companies' names as strings.
  2. Using the SeedManager class, randomly select three quarters of the big array to create a new array.
  3. That new array is part of the user's input. It is given to them on the 12oC website.
  4. Using the SeedManager class, randomly select one string from the user's input. This is their starting value. It is also given to them on the 12oC website.
  5. Create an API so that when it is called given a seed and the name of a chip company, it returns the name of another chip company. It returns the chip company that owns the company it was called with. For example, if it is called with Lays and returns Fritos, it means that Fritos owns Lays.
  6. The user will call it with the starting chip company. Then, they will call it again with the chip company that was returned.
  7. The user will keep doing that until it loops back around and returns one that it has already returned. The user needs to answer the number of "master chip companies", or the ones that all own each other and are not owned by another, bigger chip company. Mathematically, this is the total number of chip companies in the loop.
BeepBot99 commented 8 months ago

What I meant by doing the JavaScript is doing steps 1-4.

Mesure73L commented 8 months ago

Ok 👍 I'll ask if I need any help (probably will)

Mesure73L commented 8 months ago

@BeepBot99 Please do not make duplicates

Mesure73L commented 8 months ago

How many brands do I need?

Mesure73L commented 8 months ago

I only have 51 brands, I don't think that will be enough.

Mesure73L commented 8 months ago

We need something else besides chips. Maybe add candies?

BeepBot99 commented 8 months ago

How about salsa?

Mesure73L commented 8 months ago

Yes, I'll add that

BeepBot99 commented 8 months ago

Done, merged.

Mesure73L commented 8 months ago

Could we add hot sauce too?

BeepBot99 commented 8 months ago

Sure! Also, you can do sour cream if you want. How many total brands do you want?

BeepBot99 commented 8 months ago

Wait actually no, let's do nacho toppings only.

BeepBot99 commented 8 months ago

But sure, if you want to, you can add whatever you want. You're making the challenge, not me. Just tell me if you need any help.

Mesure73L commented 8 months ago

How many total brands do you want?

Enough to make it really time consuming to try to do the challenge manually

Mesure73L commented 8 months ago

Wait actually no, let's do nacho toppings only.

Can you give me some other things that I could add?

BeepBot99 commented 8 months ago

Tomatoes, cheese, guacamole, refried beans, etc.

BeepBot99 commented 8 months ago

Nice.

Mesure73L commented 8 months ago

@BeepBot99 Please answer #166.

Mesure73L commented 8 months ago

@BeepBot99 Can you make the challenge iframe look better?

BeepBot99 commented 8 months ago

@BeepBot99 Please answer #166.

Done.

BeepBot99 commented 8 months ago

@BeepBot99 Can you make the challenge iframe look better?

What do you mean by that?

BeepBot99 commented 8 months ago

@BeepBot99 Can you make the challenge iframe look better?

I think putting it in a modal that takes up 90% of the width of the screen would look better. Do I have permission to do that in this branch, or should I do it in another branch?

Mesure73L commented 8 months ago

This is a draft, I was not ready for it to be reviewed yet. You can try the modal thing but I might not accept it.

BeepBot99 commented 8 months ago

This is a draft, I was not ready for it to be reviewed yet. You can try the modal thing but I might not accept it.

I know, I just wanted to let you know now because it is best changed early on, before you make it dynamic.

Mesure73L commented 8 months ago

This is a draft, I was not ready for it to be reviewed yet. You can try the modal thing but I might not accept it.

I know, I just wanted to let you know now because it is best changed early on, before you make it dynamic.

Then just say that without requesting changes. You requested me to not review it while it was a draft, so do the same yourself.

BeepBot99 commented 8 months ago

No, I am fine with you reviewing it while it is a draft, and I will continue to review it. I didn't like when you merged it as a draft.

Mesure73L commented 8 months ago

No, I am fine with you reviewing it while it is a draft, and I will continue to review it. I didn't like when you merged it as a draft.

No, one time I reviewed it while it was a draft and you didn't like that.

Mesure73L commented 8 months ago

Thank you for making that.

BeepBot99 commented 8 months ago

You're welcome, no problem.

Mesure73L commented 8 months ago

One question: How do I fix this returning undefined?

let randomValues2024mar1 = [];

for (i = 0; i > Math.floor(nachoToppingBrands.length / 4 * 3); i++) {
    randomValues2024mar1.push(`randomValue${i}`);
}

const sman2024mar1 = new SeedManager(window.parent.seed, randomValues2024mar1);

alert(sman2024mar1.randomValue2);
BeepBot99 commented 8 months ago

Try alerting randomValues2024mar1 right before that alert to make sure it exists.

Mesure73L commented 8 months ago

First alert: image

Second alert: image

BeepBot99 commented 8 months ago

Okay, so first make sure your array has stuff in it. That's your problem, not mine.