Variables are simply names that we can give to values such as strings, numbers, and booleans. We use variables to store information so the computer can keep track of it. Variables are created by using the type of the variable and the name of the variable. Then you can assign that variable to the information that you want to store by using
= and the content.
Look at the variables at the top of of
var Player1 = ArrayList<Int>() var Player2 = ArrayList<Int>() var ActivePlayer = 1 var setPlayer = 1 var colorBlue = Color.rgb(0, 161, 241) // PUZZLE 3 var colorGreen = Color.BLACK
Player1holds the values of Player 1’s moves in the game.
Player2holds the values of Player 2’s moves in the game.
ActivePlayerkeeps track of whose turn it is.
setPlayerholds the value for whether the game is Player vs Player or Player vs Computer.
colorGreenhold the values for the player colors.