In many ways, I am atypical in the way that I approach a problem, but it works for me. Specifically, I try to understand an example in as much detail as I possibly can. If the example, is too complicated, then I make a simpler example. As much of the intricate detail that I can bring to bear on the example is brought.
For example, instead of trying to understand Lie groups and Lie algebras in general, start with the circle and the line that is tangent at the point (1,0). What is the exponential map? Oh, OK. Now how about $SU(2)$ and $su(2)$? Can you understand that the Lie group is the $3$-dimensional sphere? Can you understand the coordinates? Can you understand the equators? How do $i,j$ and $k$ really work?
What is the difference between the multiplication rule $i\times i =0$ and $i^2=-1$?
I spend time pondering. And often my notebooks will contain tangential problems or specific computations. I will keep doing the computation until I get it right! If necessary, I will write a program to complete the computation. When I understand the example completely, it is usually easy to abstract.
Then I follow up, usually writing in a notebook or several notebooks before I begin writing on the computer. I have an advantage in that I have long-distance collaborators, so it becomes necessary to explain the idea to the collaborator(s). That is the first writing stage: write for someone who knows your short-hand and your metaphors. the second stage is to write for someone who does not. Then I write with a set of colleagues in mind, but I assume the colleagues do not remember anything from the previous work. I also try to explicate the notation writing for example "the function $f$, the knot $k$, or the tubular neighborhood $N$.
A complex analytical colleague only uses $z$ for a complex number, $x$ for a real variable, and $n$ for an integer. These variable choices are culturally determined, and so one keeps with the culture of the discipline unless there is good reason to deviate. As a final example of this, the variable $A$ in the bracket polynomial is known to everyone in the field. The variables $q$, $t$, $X$ etc. are less known and involve different normalizations. So it is the burden of the author to relate these to the more well known choices.
This is a long comment; hence, community wiki status.
Gamification is not the embedding of educational content into a game. Gamification is the construction of elements typically found in games around a traditional paradigm, whether it be education, training, marketing, etc. This mistaken understanding is a common fallacy and a big reason why there are so many failed attempts at "making learning fun."
Believe it or not, games aren't fun because they're interactive, or have good graphics, or involve knocking things over or shooting things, or anything else like that.
Games are fun because they happen to satisfied a user's intrinsic psychological needs. In fact, most gamers will encounter exceptional frustration at their favorite games. This is certainly not the description of "fun" that most people have!
What games do is they create a framework in which self-actualization is possible. Games synthesize a progression structure in which a user is able to demonstrate competence. Good games also allow a user to dictate their own courses of action, giving them autonomy. And great games allow us to be social with them, creating a sense of relatedness.
Consider any great student: aren't they proud of themselves when they solve a hard problem, even if it frustrated them for hours? Aren't they the ones that like to read three chapters ahead and stay with you after class? Aren't they the ones that like to show their peers the "tricks" they've discovered?
This is what games do. Any mathematical area can be gamified if you do it right. Doing it right is exceptionally hard, which is why most math games are exceptionally boring.
Does adding a colorful graphic make a cosine more fun? No. Does spinning a graph with a mouse make learning about graph theory more fun? No.
None of these things are fun and interesting unless the user is already motivated to see where it goes. To most students, they don't care, so a video game is just a different flavor of worksheet.
If you want to gamify math, don't make the game math. Make the game something else. Make it a story. Give them something to care about, and make mathematics the gateway. Gate rewards behind problems. Scale rewards based on difficulty. The game should have almost nothing to do with mathematics, but rather should motivate students to use the mathematics to uncover the things they're intrigued about.
The star pupil is motivated by learning, and that's great. But the average student doesn't have this motivation, so we need to give it to them somehow. And if you're really clever, you can then tie that story into math, but don't feel like it has to be math. Make it feel like the student can achieve their own goals. Make them want to solve difficult problems and overcome frustration.
If the student hates math, the solution isn't to make the reward more math.
Best Answer
In general, this is a hard problem. For classes of expressions for which there is a canonical form, such as polynomials (in any number of variables), the answer is straightforward: two expressions are equal if and only if they have the same canonical form. (A canonical form means that for each expression there is one and only one canonical expression to which it is equal, and there is an effective procedure for calculating the canonical form of any given expression.) Then you can get an algorithm for comparing two expressions: calculate the canonical form for each expression and check to see if the canonical forms are identical.
Algebra students learn to do exactly this in order to decide themselves if two polynomials are equal. (Students of arithmetic learn an analogous method for deciding if two arithmetic expressions are equal, for example converting the expression $2\cdot(3+4)$ into the canonical form $14$; this algorithm is a subroutine of the one that reduces polynomial expressions to canonical form.) A canonical form for polynomials is to combine all the like terms, list the terms in descending order of degree, with the terms of equal degree listed in lexicographic order by the variables they contain, or something of that sort. Calculating a canonical form for an arbitrary polynomial is not a difficult matter. It is the sort of thing a competent programmer can produce in a couple of hours; or as several other people here have suggested you could put the solutions into a computer algebra system, which will contain exactly this sort of algorithm for several different sorts of expressions.
But for more general expressions it can be extremely difficult, or even impossible, to decide of the two expressions are equal. There is no canonical form, and recognizing when two particular expressions are equal can be a major theorem. For example, consider the expressions $\cos 2x$ and $\left(\cos x\right)^2 - \left(\sin x\right)^2$. These are equal, but not obviously so. Or for a more difficult example, consider the two expressions $$0$$ and $$\sum_{a,b,c > 1\atop n>2} I(a^n + b^n - c^n)$$ (where $I(x)$ denotes the function which has $I(0)=1$ and $I(x)=0$ for $x\ne 0$). It was conjectured for some time that these two expressions were equal, but the proof turned out to be somewhat tricky.
The previous paragraph was a joke, but it is a serious joke: a substantial part of mathematics is precisely how to perform such calculations and to recognize when two different-seeming expressions are equal. Euler is famous (among other things) for recognizing that $e^{ix}$ and $\cos x + i\sin x$ are equal expressions. Leaving aside jokes, a theorem of Daniel Richardson says that for a fairly small, fairly natural class of expressions, there is no method that can reliably determine equality in all cases.
So to get an answer, you need to be more specific about what your question is. If you only need to compare polynomials, the answer is fairly straightforward. If your expressions are more complicated than that, there may or may not be an answer; it depends on what is in them.
[ Addendum: I see that you have added comments saying that you are only interested in polynomials, and that you want to know if your idea of substituting test values for $x$ is sound. It is sound, but plugging in one number is not enough, even for the simples polyomials. The polynomials $x+1, 3x-1$, and $3-x$ all have the same value at $x=1$. But you can easily avoid false positives by checking $n+1$ different values for an $n$th-degree polynomial. A polynomial of degree $n$ is completely determined by its values at $n+1$ points, so if two polynomials of degree $n$ agree at $n+1$ different points you can be sure they are identical; it does not even matter which $n+1$ values you sample. (In the example above, any value of $x$ other than $x=1$ is sufficient to distinguish the three polynomials.) Similarly if the polynomial has three variables $x$, $y$, and $z$, of degrees $n_x, n_y, $ and $n_z$, it suffices to select $n_x+1$ values for $x$, $n_y+1$ values for $y$, and $n_z+1$ values for $z$, and then check all $(n_x+1)(n_y+1)(n_z+1)$ triples of those values. ]