Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent a point on a graph being placed on the edge of window with invisible label #1179

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lahvak
Copy link
Contributor

@lahvak lahvak commented Sep 7, 2024

The problem generates two random but distinct numbers between 2 and 5.
In order to assure that they are distinct, it increases one of them by
1 if they are equal. This may result in one of the numbers being 6,
which will cause a point on the graph placed on the edge of the graphing
window, with invisible label, which makes it impossible to answer the
problem.

The fix selects the second number repeatedly until the numbers are
distinct.

Also, the problem was converted to PGML.

The problem generates two random but distinct numbers between 2 and 5.
In order to assure that they are distinct, it increases one of them by
1 if they are equal. This may result in one of the numbers being 6,
which will cause a point on the graph placed on the edge of the graphing
window, with invisible label, which makes it impossible to answer the
problem.

The fix selects the second number repeatedly until the numbers are
distinct.
@dlglin
Copy link
Member

dlglin commented Sep 9, 2024

A more efficient way to generate two distinct values would be to use the new random_subset function:

($a,$y) = random_subset(2,[2..5]);

@lahvak
Copy link
Contributor Author

lahvak commented Sep 13, 2024

A more efficient way to generate two distinct values would be to use the new random_subset function:

I was not sure whether this is more efficient with only two elements in the subset, but it is definitely more readable.

Is there a way for a problem to specify the minimum pg version required?

@dlglin
Copy link
Member

dlglin commented Sep 18, 2024

Is there a way for a problem to specify the minimum pg version required?

Not yet. We have talked about it, but it hasn't been implemented. I've opened #1187 to discuss this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants