martinsw01 / vitber-bio

0 stars 0 forks source link

2 c) Move polymer in grid #12

Closed martinsw01 closed 2 years ago

martinsw01 commented 2 years ago

There are many ways to computationally mimic how polymers move. In the interest of keeping the programming complexity manageable, in this project we will avoid twisting the polymers. In the following exercises, you are asked to write two functions that can move polymers. The different moves will give the polymers a varying degree of flexibility. See Figure 5 for illustrations of different types of moves. One of these types of moves, is called a rigid move. This move has the following simple rules (We use moving to the right as an example): Every monomer belonging to the polymer is moved one step to the right. If any of these monomers collides with a monomer belonging to a different polymer, the move is prohibited, and the entire polymer remains in its original position.

Implement a function that rigidly moves an input-specified polymer in an input- specified direction. In order to specify direction, one possible choice is to specify the direction by integers: [Right, Left, Up, Down] ⇐⇒ [0, 1, 2, 3]