logo
Solve the Module Without Help

Overview:

In order to complete this module, you will have to write three functions:

  1. verify_slopes, which has two parameters slopes_arr and slopes_len and returns one felt is_valid which is 1 if true or 0 if false. What makes a pyramid valid? If an array of slopes of the sides of a pyramid are all in the range of [51, 52] then the pyramid is valid and up to the mummies' architectural standards. (The great pyramid at Giza has all of its sides exactly at 51.5 degrees).
  2. double_verify_slopes, which has four parameters - first_arr, first_arr_len, second_arr, second_arr_len - and returns one felt res. It will run the verify_slopes method once on the first array and then once on the second array, returning 1 if both the pyramids are valid and 0 otherwise.
  3. is_silly_pyramid, which has two parameters slopes_arr and slopes_len and returns two felts is_negative_pyramid and is_never_ending_pyramid, each of which is 1 if true or 0 if false. What makes a negative pyramid? Each of the slopes of the sides of the pyramid must be in the range [-89, -1], this would make a pyramid that closes and is upside down. What makes a never ending pyramid? Each of the slopes of the sides of the pyramid must be in the range [90, 179], as this would make the walls of the pyramid extend to the heavens forever.



Your turn:

Your goal is to make the script compile and run successfully. Good luck! If you understand what a local variable is, you can use it in your functions, but try to achieve this just using let to build your craftiness in Cairo.



References:

For official Cairo Docs: $ https://www.cairo-lang.org/docs/$ 


Back

6 / 6


Twitter