racket / racket/htdp

Need check-random-within

Open
#88 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement teachpack
Dominant language
Racket
Stars
112
Forks
73
Avg merge
9h 41m
Merged PRs (30d)
1

Description

Consider the following function:

Exercise 4 Design a function between that takes two Posns as input and returns a Posn that is almost their midpoint, but randomly moved a little bit. The distance of random movement must be proportional to the distance between the two inputs, so use (drift (* 0.2 (dist ... ...))) twice, once to move the x coordinate and once to move the y coordinate. Here dist is from Assignment 6. So use dist, drift, and midpoint. For testing, remember to use check-random.

This is taken from https://cs.indiana.edu/classes/c211/lab14.html

Testing this function requires check-random, but if the tested Posns don't form a pythagorean triple, then you end up with inexact numbers and check-random refuses to compare. Similarly, you can't use check-within because it doesn't do randomness determinization.

I plan to write a PR to fix this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Exercise 4 requirements and the existing check-random and check-within behavior described in the issue. Determine the intended semantics for comparing randomly generated Posns with inexact coordinates; done means a documented check-random-within capability handles this case without rejecting valid inexact results.

Written by the indexing model from the issue text.

Assessment

Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.