Theoretical question about Zobrist hashing and chances of collision with slight modification

I’m using zobrist hashing, but for certain positions I want to put them in the cache but make them unique. This is what I’m doing:

quint64 hash = position.zobristHash(); if (makeItUnique)     hash ^= reinterpret_cast<quint64>(this); 

Is there any reason to suppose that what I’m doing will increase the likelihood of hash collisions?

How to implement a slight skid in a car game

I have a top down car game, where I’m trying to allow a slight skid; I’ve tried the following code to calculate the X and Y, but there is no skid whatsoever:

radians = rotation * Math.PI / 180;  aX = (momentum * Math.cos(radians)); aY = (momentum * Math.sin(radians));  newX = playerX + aX, newY = playerY + aY  

I can get skid by introducing a velocity variable; for example:

radians = rotation * Math.PI / 180;  aX = (momentum * Math.cos(radians)); aY = (momentum * Math.sin(radians));  velocityX = velocityX + aX; velocityY = velocityY + aY;  newX = playerX + velocityX; newY = playerY + velocityY; 

This introduces far too much skid, like the car is on ice. I’ve tried reducing the amount I increase the velocity by:

velocityX = velocityX + (aX / 3); 

Which sort of works initially, but still ends up ice skating and uncontrollable after playing around for a few minutes.

Are there any techniques for introducing a slight skid without this extreme side effect?

Determining the entropy of a string if each character has a slight bias

Let’s say I need to generate a 32-character secret comprised of ASCII characters from the set ‘0’..’9′. Here’s one way of doing it:

VALID_CHARS = '0123456789'  generate_secret_string() {     random = get_crypto_random_bytes(32)     secret = ''     for (i = 0; i < 32; i++) {         secret += VALID_CHARS[random[i] % 10]     }     return secret } 

My concern is that my character selection is biased. Because 10 doesn’t divide evenly into 256, the first 6 VALID_CHARS are slightly more likely to occur.

The secret space is 1032, but my generated secrets have less entropy than that. How can I calculate precisely how much entropy I actually have?

Write a function that takes a list of strings an prints them, one per line, in a rectangular frame. slight change needed

Write a function that takes a list of strings an prints them, one per line, in a rectangular frame. For example the list [“Hello”, “World”, “in”, “a”, “frame”] gets printed as:

  • Hello *
  • World *
  • in *
  • a *
  • frame *



enter code heredef frame(words): enter code here size = len(max(words, key=len)) print(‘*’ * (size + 4)) for word in words: print(‘* {:<{}} ‘.format(word, size)) print(‘‘ * (size + 4)) frame(p.split(” “))

can anyone explain to me this step ‘* {:<{}} *’.format(word, size), and is there any substitution code for it?

Suddenly there is a slight delay when bringing up spotlight

I copied all my data to an external hard drive and used that as my main hard drive for a few days. After that I noticed a slight delay when bringing up spotlight, so that when I search for “Safari”, it searches for “fari” instead, as I am used to being able to start typing close to instantly.

I just associated that with the fact that booting from an external drive is slower, however, even now when I have copied the data to my internal drive and even when boot from that, the delay persists. I have reindexed my drive twice.

Microphone recording has slight static and crackling despite all attempts at solving it

Exactly what the title states. I have a microphone that works well on Windows but regardless of distro, there’s always some slight crackling when using the microphone.

I have tried everything, adding load-module module-hal-detect tsched=0 to /etc/pulse/, fiddling with the voice levels on alsamixer, you name it, I tried it, and it didn’t work. It continues to crackle no matter what I throw at it.

I’d appreciate any solutions you might offer.


Password Outer cover with slight damage

I need to travel to Germany this coming January 14th for an interview. The travel is only for 4 days. I have submitted all the relevant and supporting documents for getting the travel schengen visa. When I submitted my passport to VFS they told me the passport is damaged. But the damage is only to the over cover towards to the edges like as shown below. The tickets are all booked using this passport number so I cannot apply for a new one at this moment of time

enter image description here Like to know whether my application will be accepted or rejected.

Do Nikon sensor jpegs have a very slight yellow cast to them in the image compared to Canon?

I shoot with a Nikon D3400 and I am a beginner casual photographer. I shoot in maximum quality jpeg(NOT RAW) on auto white balance. Recently my friend and I were shooting some same subjects(my friend also shoots on jpeg auto white balance) and I noticed that Canons white color was more white and overall picture seemed more white compared to my Nikon. My Nikon has a very slight yellow cast to every image when compared to Canon. I thought it was my cameras problem but later when I checked jpegs of Canon and Nikon from the internet I saw the same thing. All Nikon jpegs seem to have a slight yellow cast when compared to Canon jpegs. Note- These are not raw to raw comparisons but jpeg to jpeg comparisons.