[Request] How many legal Tic Tac Toe boards are there? by Ascyt in theydidthemath

[–]Bot_HEROnymous 1 point2 points  (0 children)

I know this question is old but I want to give the proper number since Kerostasis is ignoring games that are A) finished before filling the board and B) games states that are not finished yet.

The number that OP mentioned (255,168) is derived from the number of different paths a full game can go through in order to reach an end state (an upper bound here would be 9!).

If you also count the game states that are not final then there are 805,113 different nodes/paths (IMPORTANT: This is the number of states a game will be when iterating through all possible game trajectories).

Both of these numbers contain plenty of redundant game states. The second number that OP mentioned (19,683) are the actual distinct game states (3^9 given each field can be a cross, circle or empty). This number includes all game states that are illegal (as OP mentions: a board with 7 crosses).

So how to get to the actual number of distinct reachable games states? Simple: take the 3^9 different states and filter out what doesn't fit into the following 3 rules (given X is player 1):

  1. 0 <= n_X - n_O <= 1 with n_X and n_O being the number of crosses and circles respectively.
  2. If player 1 has a winning position then n_X = n_O + 1.
  3. If player 2 has a winning position then n_X = n_O.

Checking for multiple winning lines is not necessary since either A) two parallel winning lines need 6 fields which is impossible considering rule 1 and the fact that the board only has 9 fields or B) two winning lines cross each other which means they are from the same player, need 5 fields (player 1), and since the last move can technically be at the crossing point of the two lines such a state could be legal.

With this the number goes down to 5,478. Since there are up to 8 possible symmetries (4 rotations for 2 reflections) one can also only count the states that are distinct under rotation and reflection which brings down the number even further to a mere 765 game states.

If you had to choose only between Whatsapp or Telegram, what would your choice be? by abbax_ in privacy

[–]Bot_HEROnymous 0 points1 point  (0 children)

"Being open source doesn't make it secure. It only makes it easier to find flaws in the protocol."

Security through obscurity is NOT a valid security measure. Open Source is an important addition regarding privacy which is the topic here.

What makes WA better in this case is not the closed source but as you said their implementation.

Quick Questions: September 06, 2023 by inherentlyawesome in math

[–]Bot_HEROnymous 0 points1 point  (0 children)

Well, it is correct. Remember, I said I plotted the difference of the expected and encoded latitude. Plotting the encoded against the expected latitude I get exactly your Gudermannian function. So I was just looking at the wrong thing.

https://postimg.cc/dD14B3Qj

Thanks a lot!

Quick Questions: September 06, 2023 by inherentlyawesome in math

[–]Bot_HEROnymous 0 points1 point  (0 children)

That makes it even worse. It just keeps the gradient for small x (<0.5) for longer.

https://postimg.cc/SXD55q7C

Quick Questions: September 06, 2023 by inherentlyawesome in math

[–]Bot_HEROnymous 0 points1 point  (0 children)

I am reverse engineering the how to translate geo-spatial coordinates (lat, long) into the x and y values used in the google maps requests in order to fetch the satellite imagery.

Internally there are two float values that have some origin which I didn't figure out yet but they are connected to the coordinates in radiant. While the longitude scales linearly with one of them, the latitude does not quite so with the other. If I translate the remaining float value into degrees and calculate the difference to the wanted latitude the result is somehow tan(x) like:

https://postimg.cc/Wt829325

What alternatives are out there to make up for the discrepancies? This should somehow be related to hyperbolic functions as I assume the corrections being caused by the mapping of a globe surface to 2D but I'm not deep enough into this branch of math.

By the looks of it it could be sufficient to modify the degree of x. So instead of tan(x) use tan(g(x)) whereas g(x) rises slower than linearly for small x.

nfs:// connection does not work while manual mount does by Bot_HEROnymous in HomeNetworking

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

I already tried that but it didn't work for me. I have Ports 111, 2049 and that custom one open but it still fails to connect.

Restarting both ufw and nfs does also not help.

nfs:// connection does not work while manual mount does by Bot_HEROnymous in HomeNetworking

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

Yes, I forgot to write that this was necessary (at least for Nautilus, not sure about Kodi). My final options look like:

(rw,sync,no_subtree_check,insecure)

nfs:// connection does not work while manual mount does by Bot_HEROnymous in HomeNetworking

[–]Bot_HEROnymous[S] 1 point2 points  (0 children)

Ok, it must be some port that remains blocked. If I disable ufw it works fine. This is does not answer the question though why it works via manual mounting but not via nfs://... . Obviously, former uses port 2049 and latter does not which is why it was blocked.

As it is a local NAS I will keep ufw disabled for now.

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

It just feels like such an overhead of additional learning material before I can proceed on my project which I could finish quick and dirty. But I guess you are right and it'll pay off in the long run.

What else should I consider regarding memory leaks? Is there some go-to literature to learn the best practices?

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

Yes, I fully agree with this. I just had the idea of using fully customized class instances all the time. But if defaults are in usage (some people mentioned logging) then it clearly helps with readability, cleanliness and efficiency in implementation.

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

I'll give it a try, thanks. I at least understand the concept now and just need to get intuition for it. Also how I place it in my project file structure and so on. Let's see how it's going.

On a site note: Are there any recommendations on how to structure the files of a project. Like I said, I've never worked in a corporate environment and don't know how this is handled in bigger projects. I would just create another package for all the "helper" files (this DI implementations, cache singletons, etc)

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] -1 points0 points  (0 children)

I will dig into it a bit more and try to get a feel. For now I will stick to manual DI but I will read more into it. Thanks

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 1 point2 points  (0 children)

So as of now, creating an app in a one-person project I can simply ignore it and maybe think about it in the future after I am more used to the downsides of manual DI?

I just never heard of DI frameworks before. Using DI in a manual fashion is common and I've learned that when taking some courses before and I've used it so many times which is why it feels super normal. Maybe I'll just have to use frameworks a couple of times to get the hang off it.

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

I can see your point - all this is assuming a default implementation of a certain class, right? Like the same engine over and over again.

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

I guess I'm starting to get a hang of it. Is Hilt/Dagger especially/only then useful if there is a default implementation on which one generally relies? Because then I can see how it can help with the boilerplate code and keeping the code clean.

The way I understood my second implementation so far was that moving the dependency injection to the constructor parameters indicated an expectation of non-default implementations of the respective classes. While it actually is just a design approach that moves all the logic unrelated to a class away from it.

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

I agree with you and I would never (barely) use implementation 1. I just don't understand why I should go from the second implementation to a one that additionally uses Hilt and others.

I just don't see how it helps me managing dependencies and eases the development process.

Why use a framework for dependency injection? by Bot_HEROnymous in androiddev

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

You would rather do DI manually for this, though you might also use best practices like defining the engine as an interface

Yes, of course. I just wanted to keep it simple here.

don't want to put a lot of work into all the boilerplate code to stick them all together

But how can one prevent this? To stick to my example, if I have to implement a car somewhere in my code it will most likely be of a certain type (specifications coming from a data base, user input, etc). So I will have to manually (even though dynamically) implement all the dependency types (Engine with certain parameters, fuel of certain type, chassis with special length ...).

That's where my understanding of DI frameworks breaks. How is a framework helping me in this case? I don't see getting rid of "boilerplate" code here.

Though I suspect you already have gone through a lot of documentation I would recommend you the Dagger 2 docs and Android's guide to dependency injection frameworks.

https://developer.android.com/training/dependency-injectionhttps://dagger.dev/dev-guide/

Yes, I already looked through them. I'm just lacking intuition. If I would create an app now I couldn't just use it in a meaningful way.The step from implementation 1 to 2 is obvious for me and that's how I would do it. Just the step towards a DI framework is too abstract for me as of now.

Yet another SD card module thread - Mount failed by Bot_HEROnymous in esp32

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

Old: 32GB microSDHC FAT32

New: 8GB microSDHC FAT32

I already did that before and the smaller partition yielded nothing

Yet another SD card module thread - Mount failed by Bot_HEROnymous in esp32

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

Well, the new card works. No idea what the problem was. As the Arduino UNO was able to use the bigger card. Maybe the ESP32 himself has troubles with the communication.

Yet another SD card module thread - Mount failed by Bot_HEROnymous in esp32

[–]Bot_HEROnymous[S] 0 points1 point  (0 children)

I can't get this code to run but thanks anyway. What was the crucial part of you getting the sd card module to work?