J A B B Y A I

Loading

I was asking 4o to review my code and I was surprised to see that it couldn’t reason correctly about basic coding logic: whether a simple conditional matched the user’s intentions. 3o-mini-high did just fine and even identified a better way to write it using De Morgan’s Law.

Here is my prompt:

I want to make sure the the user either completes 2 premium games or 3 ad games before being asked for a review, does this code logic accomplish that? It’s confusing with the AND and the negation of less or greater:

// if the player hasn't completed 2 premium games and hasn't completed 3 ad games, don't ask for review if (PlayerPrefs.GetInt(PremiumGamesCompletedKey, 0) < 2 && PlayerPrefs.GetInt(AdGamesCompletedKey, 0) < 3) { Debug.Log("r1 Not enough games completed. Not asking for review."); return; } 

3o-mini-high Answer (I’ll give this first for clarity):

The logic is correct. It ensures that if neither condition is met (i.e., the player has completed fewer than 2 premium games and fewer than 3 ad games), then the review prompt will not appear.

In other words, by using:

if (PlayerPrefs.GetInt(PremiumGamesCompletedKey, 0) < 2 && PlayerPrefs.GetInt(AdGamesCompletedKey, 0) < 3) { Debug.Log("r1 Not enough games completed. Not asking for review."); return; } 

you’re effectively saying: “Only ask for a review if the player has completed at least 2 premium games or at least 3 ad games.” This is equivalent to checking if not (premium games completed is at least 2 or ad games completed is at least 3).

For clarity, you might consider rewriting it using De Morgan’s Law:
Both versions accomplish the same thing.

if (!(PlayerPrefs.GetInt(PremiumGamesCompletedKey, 0) >= 2 || PlayerPrefs.GetInt(AdGamesCompletedKey, 0) >= 3)) { Debug.Log("r1 Not enough games completed. Not asking for review."); return; } 

Here is the 4o response:

Your logic is actually incorrect because the condition will always return early if either condition is true. The issue is with the AND (&&) operator. Let’s break it down:

What your current logic does:

if (PlayerPrefs.GetInt(PremiumGamesCompletedKey, 0) < 2 && PlayerPrefs.GetInt(AdGamesCompletedKey, 0) < 3) { Debug.Log("r1 Not enough games completed. Not asking for review."); return; } 
  • This means: If both of these are true:
    • The user has completed less than 2 premium games.
    • The user has completed less than 3 ad games.
  • If either condition is false, the if check fails, and the review request proceeds.

Why it’s wrong:

  • If a user has played one premium game and two ad games, they haven’t met either threshold, but your condition won’t trigger because the AND condition requires both to be true.
  • The condition should check whether both conditions are not met to prevent early return.

Corrected Logic:

You should use OR (||) instead of AND (&&), so that the check prevents the review request if either condition is still unmet:

if (PlayerPrefs.GetInt(PremiumGamesCompletedKey, 0) < 2 || PlayerPrefs.GetInt(AdGamesCompletedKey, 0) < 3) { Debug.Log("r1 Not enough games completed. Not asking for review."); return; } 

Why this works:

  • If the user has played fewer than 2 premium games, OR they have played fewer than 3 ad games, they will not be asked for a review.
  • The review request will only happen if both conditions are met.

This ensures that at least 2 premium games OR at least 3 ad games must be completed before the user is asked for a review.

submitted by /u/Mr-Canine-Whiskers
[link] [comments]

Leave a Comment