Towers of Hanoi Variant
Reddit » Algorithms
by /u/FryyedLiverz
10h ago
From Sedgewick's Computer Science: An Interdisciplinary Approach, exercise 2.3.25: ​ There are 2n discs of increasing size stored on three poles. Initially, all of the discs with odd size (1, 3, ..., 2n - 1) are piled on the left pole from top to bottom in increasing order of size; all of the discs with even size (2, 4, ..., 2n) are piled on the right pole. Write a program to provide instructions for moving the odd discs to the right pole and the even discs to the left pole, obeying the same rules as for towers of Hanoi. ​ Any ideas on how to approach this problem? I'm struggling to come up w ..read more
Visit website
Algorithm to solve minesweeper
Reddit » Algorithms
by /u/_dwightshrute
1d ago
I'm trying to make a minesweeper bot using selenium. github link - https://github.com/cs22b047/minesweeper_bot right now i'm using a basic algorithm that checks if the empty places around a cell is equal to cell value and places flags. But this approach cannot completly solve the game, the bot gets stuck at some point. I'm looking for some ideas on a better algorithm that completes the game. submitted by /u/_dwightshrute [visit reddit] [comments ..read more
Visit website
Algorithm for Even Distribution of Overlapping Bounding Boxes in JavaScript
Reddit » Algorithms
by /u/foxScripts
1d ago
Hey there! I'm a part-time JavaScript programmer. I'm looking for an algorithm to evenly distribute bounding boxes that may overlap in different kinds and should keep their position as close as possible but still be distributed in a consistent manner. By consistent, I mean the distances in between the individual boxes. They should not be aligned to a grid but keep a consistent distance inbetween each other. I'll attached a sketch of what I mean. Two objects / bounding boxes may overlap partially or even completely. So there may be some bounding boxes with the exact same size & position th ..read more
Visit website
What algorithm is best for this
Reddit » Algorithms
by /u/krypton_009
3d ago
'The player starts at the location labelled “S” and wants to reach the finish, labelled “F”. Each turn they choose one of the four cardinal directions to move. However, except for S and F the floor is covered in frictionless ice, so they will keep sliding in the chosen direction until they hit the wall surrounding the area, or one of the rocks (labelled “0”).' .....0...S ....0..... 0.....0..0 ...0....0. .F......0. .0........ .......0.. .0.0..0..0 0......... .00.....0 I was going ahead with a* but due to the fact that we have to turn only after hitting the block, i'm getting confused now. solu ..read more
Visit website
Passive income / farming - DePIN & AI
Reddit » Algorithms
by /u/guapmuffin
3d ago
The leading DePIN start up is GRASS, and their community is growing by thousands each day. They just announced they will be the First ever Layer 2 Data Rollup on Solana - aka gaming use cases and airdrops are on the way ?? These guys behind Grass, Wynd Network, raised $4.5M, and farming $GRASS is free and takes 2 mins to set up. Their disc is at 350K and grows a few thousand each day Market seems to be picking up so just been doing some research on anything that looks promising Pretty much $GRASS is this thing you can stack up points by just using your computer regularly. And the points will ..read more
Visit website
Given 2 numbers X and Y, want to find largest value of P such that (X mod 2^P) = (Y mod 2^P)
Reddit » Algorithms
by /u/ybot01
4d ago
this is to be done on large dataset by a computer so most efficient possible please Simple and inefficient algorithm would be (pseudocode): function greatest_common_power_2_mod(int X, int Y) -> int{ int P = 1; loop{ if ((X mod 2^P) != (Y mod 2^P)){ return (P-1); } P++; } } but i expect there is more efficient way to check this? submitted by /u/ybot01 [visit reddit] [comments ..read more
Visit website
Jeff Erickson Chapter 11 Exercise Question 10
Reddit » Algorithms
by /u/akshatrajsaxena
5d ago
Please provide the accurate solution of the Below problem Statement Based on Netwrok Flow. Suppose we are given a set of boxes, each specified by its height, width, and depth in centimeters. All three side lengths of each box lie strictly between 10cm and 20cm. As you should expect, one box can be placed inside another if the smaller box can be rotated so that its height, width, and depth are respectively smaller than the height, width, and depth of the larger box. Boxes can be nested recursively. Call a box is visible if it is not inside another box. Describe and analyze an algorithm to nest ..read more
Visit website
Pathing/Travelling Salesman Problem for Risk AI.
Reddit » Algorithms
by /u/-Itz-Ginge
5d ago
Hey guys! I'm coding an AI for Risk: Global dominations which is a popular online implementation of the board game Risk. I'll be writing a symbolic AI which will manually calculate paths for capturing territories and bonuses. Currently I have been stuck on finding a method to find the paths which the AI should take to capture a territory bonus (pics if you are unfamiliar with the game). I am intending to represent the board as a graph, with nodes representing territories (and their troop/player data) and edges representing the connections between these territories. Examples of the AI pathing ..read more
Visit website
Reducing A to B in polynomial time.
Reddit » Algorithms
by /u/Big-Culture-1859
5d ago
Im starting to sort of understand this but if B were know to be NP-Complete would that prove anything about A? I know that it doesn't prove A to be NP-Complete but could I say that A is at least NP-Hard for sure? submitted by /u/Big-Culture-1859 [visit reddit] [comments ..read more
Visit website
Algorithm to Efficiently Search a Solution Space
Reddit » Algorithms
by /u/T_B_Denham
5d ago
I'm looking for advice on how to efficiently search a solution space under certain conditions. The solution space is a multidimensional array of positive integers. At each point in the array I run a function that either fails or passes. Importantly, if the function passes at a point, then every point "under" it will also pass and doesn't need to be tested. To illustrate, a 2D example would be an array of X and Y where X is 0 - 10 and Y is 0 - 15. If the point (2,3) passes then I know that (2,2), (2,1), (2,0), (1,3), (1,2), (1,1), (1,0), (0,3), (0,2) (0,1), (0,0) will also pass. Each of those ..read more
Visit website

Follow Reddit » Algorithms on FeedSpot

Continue with Google
Continue with Apple
OR