2D lists: Difference between revisions

From Fancade Wiki
(Added a link to the List page)
(Improved wording)
Tags: Mobile edit Mobile web edit
 
Line 1: Line 1:
'''Two-dimensional [[list]]''' is mostly used in creating a game that involves a board or a grid such as [[Chess]], [[Reversi]], Checkers, Tetris, Battleship, [[1024|2048]] and so on.
'''Two-dimensional [[list]]''' is often used in creating a game that involves a board or a grid such as [[Chess]], [[Reversi]], Checkers, Tetris, Battleship, [[1024|2048]] and so on.


In a technical term, 2D list is called as an '''array of arrays''' or also known as a '''matrix''' which can be represented as a table of columns and rows.
In a technical term, 2D list is called as an '''array of arrays''' or also known as a '''matrix''' which can be represented as a table of columns and rows.

Latest revision as of 19:08, 26 July 2025

Two-dimensional list is often used in creating a game that involves a board or a grid such as Chess, Reversi, Checkers, Tetris, Battleship, 2048 and so on.

In a technical term, 2D list is called as an array of arrays or also known as a matrix which can be represented as a table of columns and rows.

The way List Element functions do not provide a convenient way of creating such. Beginners are sometimes misled that plugging the Element input from the output of another List Element works. But fear not, for there is a simple workaround to make it by using simple math. See image below on how to make it!

2D list pictured. Columns is equal to 4.

Variables:

  • X: the index column of a 2D list. It must be noted that this value must not be greater than Columns nor be lesser than 0, as it may read the wrong value.
  • Y: the index row of a 2D list. A value lesser than 0 produce a sentinel value equivalent to None, which may be useful if all
  • Columns: the total columns of a 2D list.
Demonstration of 2D list.