Problem in modelling this because too slow calculation (robot football)

I like to build a component connector view / UML diagram for the given problem but I realized it’s way too slow if you try to do it exactly as it’s given in the following text. My question is what could be optimized? Knowing this I would create the entire diagram myself.


We have 2 teams playing against each other and the aim is that one team scores more goals than the other. Both teams have the same private ressources: 3 robots, a CPU which is able to communicate with each robot bidirectionally but is also able to send broadcasting messages to all robots of its own team. Every robot has its unique circular pattern made up by CMYK colors (4 colors: cyan, magenta, yellow, black) such that it’s impossible they can be confused by the soccer field (green) or with other colors (the ball which is orange).

Both teams share the following shared ressources:

  • soccer field: all actions are executed here which allows fluent robot movements. the field is green except for some white colored marks. a 200cm x 100cm rectangle limits the playing surface where the white marked areas (the midpoint, the gateway signs etc.) aren’t of importance here

  • gateways: on both short sides of the rectangle the middle 40cm-line is covered by invisible sensors. Whenever these sensors detect the ball which crossed the line, the corresponding team gets 1 goal score

  • ball: has orange color, robots run to the ball to shoot it into the opponent goal

  • host computer: detects the game-events such as ball leaves the field or a goal is achieved. All these events are sent to both CPU’s (of the teams) at the same time

  • camera: is recording the entire soccer field und sends them to both CPUs of the team. The camera makes 4 pictures every second (so 1 pic each 250ms)

The task of the team CPUs is to determine all positions of robots and ball and also to develop a strategy for the game to inform the robots about it. In order to determine the positions of robots and ball, the CPU needs to process each picture made by the camera, using 4 filters because there are 4 colors (CMYK). Another filter is needed for the orange colored ball. These filters are available for the CPU. But these filters are smaller than the picture taken by the camer: they can only filter 1/3 of it simultaneously. Additionally, each filter needs 500ms to complete all calculations.


The main problem I see here is that the filter needs 500*4*3=6000ms=6s so much time just to determine the positions of the robots, only for 1 picture…! This makes everything else inefficient and the game seems completely unplayable : / How could this be made much faster? I think if I know that I could create the complete component connector view / UML diagram for the problem.

Wrong calculation of VAT on attributes

enter image description hereHi, hopefully you can help me.

I have a problem with the addition of a product price and a selected attribute (or more) price(s)

In this shop I have entered the prices / TAX setting: ‘excluding VAT’.

The product page is displayed correctly. However, once I select an option, the VAT attribute is added to the product price excluding VAT.

This is not correct. See example; the total sum must be 1185 euros.

See the following URL: http://lectern.ae.mysleeve.hypernode.io/lectern-clear-and-frosted-berlioz

See code below; i think totalprice calculation is incorrect?

{ “#product_addtocart_form”: { “priceOptions”: { “optionConfig”: {“45681”:{“107768”:{“prices”:{“oldPrice”:{“amount”:390,”adjustments”:[]},”basePrice”:{“amount”:390},”finalPrice”:{“amount”:471.900001}},”type”:”fixed”,”name”:”Including microphone”},”107769″:{“prices”:{“oldPrice”:{“amount”:245,”adjustments”:[]},”basePrice”:{“amount”:245},”finalPrice”:{“amount”:296.450001}},”type”:”fixed”,”name”:”Excluding microphone”}},”45547″:{“107610”:{“prices”:{“oldPrice”:{“amount”:0,”adjustments”:[]},”basePrice”:{“amount”:0},”finalPrice”:{“amount”:0}},”type”:”fixed”,”name”:”Legen”},”107611″:{“prices”:{“oldPrice”:{“amount”:0,”adjustments”:[]},”basePrice”:{“amount”:0},”finalPrice”:{“amount”:0}},”type”:”fixed”,”name”:”Frosted”}},”42304″:{“99716”:{“prices”:{“oldPrice”:{“amount”:50,”adjustments”:[]},”basePrice”:{“amount”:50},”finalPrice”:{“amount”:60.500001}},”type”:”fixed”,”name”:”Other colour front panel”},”99717″:{“prices”:{“oldPrice”:{“amount”:125,”adjustments”:[]},”basePrice”:{“amount”:125},”finalPrice”:{“amount”:151.250001}},”type”:”fixed”,”name”:”Logo on front panel”}},”45722″:{“107850”:{“prices”:{“oldPrice”:{“amount”:145,”adjustments”:[]},”basePrice”:{“amount”:145},”finalPrice”:{“amount”:175.450001}},”type”:”fixed”,”name”:”Fitted LED reading lamp”},”107851″:{“prices”:{“oldPrice”:{“amount”:65,”adjustments”:[]},”basePrice”:{“amount”:65},”finalPrice”:{“amount”:78.650001}},”type”:”fixed”,”name”:”Clip on LED reading light”}},”45760″:{“107926”:{“prices”:{“oldPrice”:{“amount”:69,”adjustments”:[]},”basePrice”:{“amount”:69},”finalPrice”:{“amount”:83.490001}},”type”:”fixed”,”name”:”Acrylic tumbler holder”},”107927″:{“prices”:{“oldPrice”:{“amount”:81.25,”adjustments”:[]},”basePrice”:{“amount”:81.25},”finalPrice”:{“amount”:98.312501}},”type”:”fixed”,”name”:”Set of wheels (braked)”}},”45470″:{“107432”:{“prices”:{“oldPrice”:{“amount”:79,”adjustments”:[]},”basePrice”:{“amount”:79},”finalPrice”:{“amount”:95.590001}},”type”:”fixed”,”name”:”Protective cover”},”107433″:{“prices”:{“oldPrice”:{“amount”:150,”adjustments”:[]},”basePrice”:{“amount”:150},”finalPrice”:{“amount”:181.500001}},”type”:”fixed”,”name”:”Wooden transport box”}},”42305″:{“prices”:{“oldPrice”:{“amount”:0,”adjustments”:[]},”basePrice”:{“amount”:0},”finalPrice”:{“amount”:0}},”type”:”fixed”,”name”:”RAL color”},”42306″:{“prices”:{“oldPrice”:{“amount”:0,”adjustments”:[]},”basePrice”:{“amount”:0},”finalPrice”:{“amount”:0}},”type”:”fixed”,”name”:”Upload your logo”}}, “controlContainer”: “.field”, “priceHolderSelector”: “[data-role=priceBox]” } } }

Pixel Size (width and height) calculation formula

I am trying to use the camera matrix to find the location of pixels forming a certain object in an image. Two parameters that I need to calculate, the length and with of the pixel in the image.

As I am working on the synthetic environment (3d max) I have access to: focal length, size of the sensor and resolution of the output image.

I am struggling to find the size of the pixel and already contacted Autodesk support team but no change so far. If anyone can help with the formula of calculating the pixel size I would be grateful. thanks

About error calculation

When I am calculating the branching ratio of any decay then only the central value of the mass term are taken that means no errors are included. Naturally only the central value of branching ratio are found where all errors are excluded. So if I want to write the programming with all errors in the input terms then what command/codding I will use?

Microsoft interview question (percentage calculation) [on hold]

I am new to this group. I have an Microsoft interview question and seeking your help at the earliest

Question here as follows:

“I buy 100 donuts from Shop A , spending 10 Rupees per each – so total expense is 1000 Rupees”

“I see another Shop B and I found some offers such a way that I buy 60 donuts for 8 Rupees -> (60 donuts x 8 Rupees = 480 Rupees) and (40 donuts x 5 rupees = 200 Rupees) . So total expense in shop B is 680 Rupees”

Now I calculate the profit from Shop B to Shop A as 1 – 680/1000 is almost 32%

How much percentage of profit contributed by only 40 donuts (40 x 5 rupees cheaper) from the total savings of 32%?

How to implement difficulty calculation in my code [duplicate]

This question is an exact duplicate of:

  • How is difficulty calculated for miners?

So let’s say we have to produce a hash that start with “0000”

I hash a block over and over by changing the nonce inside it.

Eventualy I will find a hash that start with “0000”.

What is difficulty here? Is it the ammount of zĂ©ros we require the hash to start with? More zero’s would be more difficult? Does it have to do with the nonce?

I understand that the higher the difficulty the more hashes it will take to find it.

If my difficulty is one how do I apply the difficulty in the hashing process.

Right now all im doing is hashihing a block everytime I add 1 to the nonce wich represent the number of hash.

So how do I implement the difficulty in the hash calculation.

I am programming a blockchain from scratch!

Exemple of my code;

generateHash(block) {       let hash = sha256(block.key)       // key contain the block data       while(!hash.startsWith("f07a")) {  // we hash until the hash start with f07a        block.nonce += 1                 // add 1 to nonce for each try        hash = sha256(block.key)         // Trying with the new nonce                 //console.log(hash)                   }       return hash     } 

So how would I implement difficulty here? I know i would have to do more math acording to network hashrate but to understand it in my case how would I use a difficulty of 1 here?