unit – Calculation of the correct scale for the game object

I'm currently trying to create my own custom grid tile system for my game.
I am making sure that all the tiles generated in the grid fill exactly half the width of the screen, but I am currently having problems with this step indicated.

Image to view the problem:

Problem picture

Here is what I have tried so far:

    public class TileGrid : MonoBehaviour {
        public const int ROWS = 24;

        public const int COLUMNS = 10;

        (SerializeField, Tooltip("The default tiles this grid spawns with"), MustBeAssigned)
        private Tile defaultTile;

        (SerializeField, Tooltip("The default block the tiles gets occupied with"), MustBeAssigned)
        private Block defaultBlock;

        (SerializeField, Tooltip("Offset distance between each tile"), PositiveValueOnly)
        private float placementOffset;

        private float DefaultBlockSize { 
           get => defaultBlock.BlockSprite.bounds.size.x;
        }

        private Tile(,) tiles;

        private void Start() {
            tiles = new Tile(COLUMNS, ROWS);

            SpawnTiles();
        }

        private void SpawnTiles() {
            Camera mainCam = Camera.main;

            Vector2 topLeftPosition = mainCam.ViewportToWorldPoint(new Vector2(0, 1));
            float blockSize = DefaultBlockSize;

           Vector2 tileVectorScale = GetTileScale();

            for (int x = 0; x < COLUMNS; ++x) {
                for (int y = 0; y < ROWS; ++y) {
                    Tile currTile = CreateNewTileOnGridPosition(x, y);

                    Vector2 currTileWorldPosition = GridPositionToWorldPosition(x, y);
                    currTile.transform.position = currTileWorldPosition;

                    tiles(x, y) = currTile;
                }
            }

            #region LOCAL_FUNCTION

            Tile CreateNewTileOnGridPosition(int x, int y) {
                Tile newTile = Instantiate(defaultTile);
                newTile.transform.localScale = tileVectorScale;

                Vector2Int currGridPos = new Vector2Int(x, y);
                newTile.Initalize(defaultBlock, currGridPos);

                return newTile;
            }

            Vector2 GridPositionToWorldPosition(int x, int y) {
                float scaledBlockSize = blockSize * tileVectorScale.x;

                float xPos = (topLeftPosition.x + (x * scaledBlockSize)) + scaledBlockSize + placementOffset;
                float yPos = (topLeftPosition.y - (y * scaledBlockSize)) - scaledBlockSize - placementOffset;

                return new Vector2(xPos, yPos);
            }

            ///Get the scale size of each tile.
            ///Such that the grid fills half of the camera's width.
            Vector2 GetTileScale() {
                // This function seems to be the issue...

                float screenSizeHalfed = Screen.width / 2f;

                // How much one tile needs to scale in order to fill the entire half of the camera's width.
                float scaleToFillHalf = screenSizeHalfed / defaultBlock.BlockSprite.texture.width;

                // Now calculate for individual tiles in a grid.
                float scale = scaleToFillHalf / COLUMNS;

                return new Vector2(scale, scale);
            }

            #endregion
        }
    }

GetTileScale() is the local function where I tried to calculate the scale for each tile, which seems not to have been the case.

Note: for these particular lines:

Vector2Int currGridPos = new Vector2Int(x, y);
newTile.Initalize(defaultBlock, currGridPos);

That made do not affect the world position of the tile. the Initalize The function simply stores a reference to where the tile exists in the grid in the back-end.
The modification of the world position of the tile is done in the double-for loop.

In addition, I am currently using the Unity version 2019.3.xfx if that matters.

terminology – What exactly are the calculation effects?

I am really confused with the definition of calculation effects. What I knew and understood about the calculating effect, it was only that it was an impure calculation, but somebody was a bad one. ; noticed that the calculation effects include the continuation which does not seem to be impure. please someone reason these things.

Sorry to babble, here are my real questions:

  1. What is the formal (or at least precise) definition of calculation effects?

  2. If the calculating effects are unclean things, then why is the pursuit included? is the result impure?

THX.

Use of Bijection for the calculation

Calculate the last three digits of
$$ sum_ {k = 1} ^ {2017} k ^ 3 * binom {2017} {k} $$

I'm looking for a combinatorial way to "translate" this into something much easier to calculate. The sum is the number of ways to choose one $ k $– member committee with three jobs within them (can all be the same person).
I think we could do this by choosing jobs first and then the committee. We proceed by processing the files.

A person has three jobs:
$ 2017 * 2 ^ {2016} $

A person has two jobs:
$ 2017 * 2016 * 2 ^ {2015} $

Each job is occupied by a different person
$ 2017 * 2016 * 2015 * 2 ^ {2014} $

However, if we add up these cases, it is not equal to our original sum. How can I fix this?
Thank you!

javascript – Calculation of the disappearing value JS

Hello, I have a problem in the design of a calculator that I am developing, just to practice JS. Everything on the calculator works except when printing the values ​​on the screen: the values ​​appear and disappear in less than 1 second, leaving the entry empty.

follows the code used:




    
    
    Calculator with buttons
    


  
function putNum(num){
    document.getElementById('tela').value = document.getElementById('tela').value + num;
}

function limpar(){
   document.getElementById('tela').value = document.getElementById('tela').value = " ";
}

function oper(oprt){
    if(document.getElementById('tela').value != ""){
        document.getElementById('tela').value = document.getElementById('tela').value + oprt;
    } else {
        alert('Antes de realizar operações, digite um número')
    }
}

function result(){
    document.getElementById('tela').value = eval(document.getElementById('tela').value);
}

memory management – Size of the table of pages on 2 levels: is my calculation correct?

Assume 32-bit addresses, 4 GB of addressable memory, and 4 KB size pages.

Using a single level page table:
To address 4 GiB of physical memory, we need 32 bits. But since we are splitting into 4K frames, we only need 20 bits to address the 2 ^ 20 frames. Including the control bits, we then need around 4 bytes for each page entry. The approximate size of a page table is then 4 bytes * 2 ^ 20 [frames] = 4 MiB.

Using a two-level page table:
We divide the 20 address bits into two times 10. In the external level page table, we need to address 2 ^ 10 internal level page tables, for which we need 10 bits + control bits, so let's say 2 bytes. Then, the external level page table is 2 bytes * 2 ^ 10 [internal level page tables] = 2 KB. Then, each of the internal level page tables takes 2 bytes * 2 ^ 10 [frames] = 2 KB. Of these internal level page tables, we have 2 ^ 10, so overall we need 2 MiB. Then, our overall requirements are 2 KB [external level page table] + 2 MiB [internal level page tables].

Cobordism and Kirby's calculation

It may be a simple question but I wonder to ask:

Is it possible to trace a cobordism of homology between $ 3 $-Collectors using Kirby calculation techniques?

At least, for example, the Brieskorn spheres?

terminology – trace vs calculation vs run

Many people use the terms "trace", "run", "compute", "run", "walk" … interchangeably when talking about state machines with labeled transitions. Do studies distinguish these concepts? For example, whose work says that XXX is a sequence of states, YYY is a sequence of labels and ZZZ is a sequence of states and labels between them, for two different pairs XXX, YYY, ZZZ in {trace, execution, computation, run, walk, …}?

Here, a state machine is simply an ingrained directed graph (where arbitrarily many roots are allowed, which are interpreted as initial states) with edges labeled by letters of a fixed alphabet.

Calculation II: integral property

enter description of image here
Given the following property
Z c
a
f (x) dx + Z b
vs
f (x) dx =
Z b
a
f (x) dx (1)
for the case a <c <b, show that we obtain the same property (1) (ie. result) for the cases: b <c <a

calculation and analysis – Is there a shortcut entry for FactorialPower?

Very simple question, there are nice shortcut entries for the following discrete calculation concepts:

!(
*SubscriptBox(((DifferenceDelta)), (k))(
*SubscriptBox(((DiscreteShift)), (k))(
*SubscriptBox(((Sum)), (k))f(k))))

In discrete calculation, the power of fall is essential and is well shown by Mathematica in TraditionalForm when FactorialPower is used:

 x^(n)

But is there a shortcut entry for this function?

calculation geometry – Points evenly spaced on a smooth surface

I want to space the points evenly (i.e. maximize the minimum distance between two points) on a smooth surface $ S subseteq mathbf {R} ^ n $ (D & # 39; habit $ n = $ 3), where I have a projection operator $ p: mathbf {R} ^ n to S $ which approaches the nearest point on the surface. My idea is to place them at random first, then let a repulsive force act between them and re-project them on the surface after each iteration of the action. This can be quite expensive if there is $ 10 ^ $ 3 points I have to calculate the distance between $ 10 ^ $ 6 points in a single iteration, and I need a few iterations until everything stabilizes.

How can I improve this process? My ideas:

  • Measure the distance between each pair of points but calculate the force only when the distance is less than some $ a $, then do a few iterations (assuming the points don't move too far in one iteration) and recalculate the distance after $ k $ not.
  • Choose a partition of the surface where each part has a set of "neighbors" (including itself), calculate for each point the location in the partition, i.e. the part in which it is found, then let only the points of the neighboring parts act on each other, recalculate the location after $ k $ not.