Skip to content

Instantly share code, notes, and snippets.

@JacobBennett
Last active May 6, 2017 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JacobBennett/fc43e4c9dc21ac1028403e48fdcbf19c to your computer and use it in GitHub Desktop.
Save JacobBennett/fc43e4c9dc21ac1028403e48fdcbf19c to your computer and use it in GitHub Desktop.
Code Challenge

Code Challenge Premise

Find a point (x,y) on the permiter of a rectangle

the rectangle origin starts at some arbitrary x, y and is maxX wide and maxY high.


Solutions can be written in any lang, although I wrote mine in JS

Click here for my solution

@JacobBennett
Copy link
Author

Instead of putting your solutions in the comments, create a new gist and link to your solution in here. Feel free to include your lang selection in your Link title.

@devcircus
Copy link

I'm still kind of a rookie but here's a long way using PHP
https://gist.github.com/devcircus/2a709f5dc6588d322fd89cf150cf2fb6#file-jakeschallenge-php

@rankogit
Copy link

rankogit commented May 6, 2017

Hey Jacob. I don't understand the challenge. I'll take a stab at writing my understanding of the problem. Please correct me.

You are given minX, minY representing the lower left point of a rectangle. You are given maxX, maxY representing the upper right point of a rectangle. Write a function that takes these 4 parameters and returns a random point on the perimeter of the rectangle.

Your current code doesn't accomplish this but seems to be going in that direction. Correct me if I'm wrong in my understanding. Thanks so much.

@rankogit
Copy link

rankogit commented May 6, 2017

https://gist.github.com/rankogit/4cbdc28c391452c1d61f09998b0f264a

Generates a random point on perimeter of a rectangle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment