Commit graph

17 commits

Author SHA1 Message Date
e8c1e6ed8b Refactor Engine Methods
Extract method checking for update necessity.
2018-10-19 11:50:34 +02:00
2993b33d9e Add tests for CellPattern & GameOfLife classes 2018-10-19 10:24:40 +02:00
8db9cd6ff1 Move Simulation Accesses to Simulation Class
Everything has been refactored away from engine, which now only controls updating & rendering within a specific timestep. (As well as stepping forward by calling a single update)

Everything regarding grids, patterns and cells has been moved into the simulation and the Services have been updated to reflect that.
2018-10-18 15:21:50 +02:00
2dc1d7fecd Add Grid.fill constructor
Will completely fill the grid with the value passed in.
2018-08-30 10:32:34 +02:00
eef7a23c8f Regroup Instantiation tests 2018-08-30 10:17:31 +02:00
fb481669ed Add Coordinates setter
Sets the corresponding element to the parameter value passed in. Checks against the grid size constraints beforehand and throws RangeError if outside of constraints. Preferred method to set
element via coordinates.
2018-08-30 10:02:29 +02:00
5a72783d57 Add .toCoordinates() method to grid
Calculates the 2-D array coordinates from the corresponding list index passed in. Relies on grid width to calculate coordinates. Does not check against grid size constraints.
2018-08-30 09:53:05 +02:00
6c3fcbe7b0 Add .get method for coordinate element retrieval to grid
Coordinates passed in access the correct index in the internal list.
2018-08-30 09:43:46 +02:00
3f939601b3 Add toIndex method
can be used to get the correct index from coordinates passed in. Will only calculate the index, not take into consideration any grid size constraints etc.
2018-08-30 09:41:43 +02:00
8865af4878 Add tags to Instantiation tests 2018-08-30 09:36:57 +02:00
27ef72014e Add simple Grid - List Wrapper Data Structure 2018-08-29 22:12:19 +02:00
04d61bfa02 Error out on bad gridsize input 2018-08-27 20:18:19 +02:00
873bd9c881 Allow Optional Injection of grid size into engine on creation 2018-08-27 20:13:19 +02:00
7a3fdf3681 Fix Engine Test case 2018-08-25 16:43:47 +02:00
66bf87d9d8 Allow setting a canvas for an engine at any point 2018-08-25 14:36:50 +02:00
4c6dff35c3 Add Canvas nullcheck to render function 2018-08-25 14:10:56 +02:00
842cbeca1f make canvas argument optional on instantiating engine 2018-08-25 09:36:27 +02:00