Skip to content

Match3 example #4515

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

Merged
merged 61 commits into from
Nov 5, 2020
Merged

Match3 example #4515

merged 61 commits into from
Nov 5, 2020

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Sep 25, 2020

Proposed change(s)

Work in progress match-3 example.
Match3

The abstract board, sensor, and actuator are in the com.unity.ml-agents.extension package. An example with basic mechanics is in the Match3 scene (and corresponding scripts).

TODO

  • optional color shuffling (as discussed in this paper)

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

Types of change(s)

  • New feature

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the documentation (if applicable)

Other comments

@chriselion chriselion changed the title [WIP] Match3 example Match3 example Oct 30, 2020
Copy link
Contributor

@vincentpierre vincentpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to review more but looks good so far.

}

/// <summary>
/// Check if the "half" of a move is matches 3 or more.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Check if the "half" of a move is matches 3 or more.
/// Check if the "half" of a move matches 3 or more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a half move ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated:

        /// Check if one of the cells that is swapped during a move matches 3 or more.
        /// Since these checks are similar for each cell, we consider the Move as two "half moves".

public Direction Direction;

/// <summary>
/// Construct a Move from its index and the board size.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little more details on this method. Replace a with the since there is a 1 to 1 mapping between index and move and explain that the index corresponds to the index in the list of all potential moves on a board of size (maxRows, maxCols).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rearranged some of the comments and moved them off of the MoveIndex member and into the class summary. I think between that and the comments on the moveIndex argument, it's fairly clear now.

@vincentpierre vincentpierre self-requested a review November 2, 2020 17:16
time_horizon: 1000
summary_freq: 10000
threaded: true
Match3SimpleHeuristic:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange to have a section for a heuristic. If possible, I would remove, if not possible (so the curves can be observed, I would remove all hyperparameters except for max_steps and set it to 0 or 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified

public int MaxMoves = 500;

[Tooltip("If selected, will pick the move that makes the most points. Otherwise, will pick a random valid move.")]
public bool UseSmartHeuristic = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename UseSmartHeuristic to SmartHeuristic. The word Use makes it sound like Heuristic will be used, but this is dependent on the Actuator setting "Force Heuristic".
Ideally, the UseSmartHeuristic checkbox should be next to Force Heuristic in the Actuator.
Also, I think it might confuse users that we now have 3 different places for the Heuristic:
Behavior Parameters (behavior type); Match3Agent(UseSmartHeuristic); and Actuator (ForceHeurisitic)
Not sure what can be done though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to an enum for Greedy vs RandomValidMove, and updated some GameObject and behavior names.

Ideally, the UseSmartHeuristic checkbox should be next to Force Heuristic in the Actuator.

Maybe for this specific case, but Greedy vs RandomValidMove is specific to the Match3Agent

@@ -0,0 +1,67 @@
# Match-3 Game Support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document is not linked anywhere (not that I could see). I think we can link it from the examples page or from the com.unity.ml-agents.extensions.md page in the contents section

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added links from the extensions readme

@chriselion chriselion merged commit f7ef326 into master Nov 5, 2020
@chriselion chriselion deleted the match3-example branch May 25, 2021 18:13
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants