Questions tagged [puzzle]

DO NOT USE - prefer constructive questions, or use more descriptive tags. Otherwise, your question might be appropriate for codegolf.stackexchange.com.

DO NOT USE - prefer constructive questions, or use more descriptive tags. Otherwise, your question might be appropriate for CodeGolf.


The questions tagged "puzzle" are essentially programming questions, that are as good as solving puzzles. These can be contrasted to the real-life problems, which are comparatively easy to solve.

859 questions
-2
votes
4 answers

How to get Nth Power of any number

I faced an interview. where I was asked the following question Write a function in any of programming language that computes the nth power of a number w/o using + * or ^ or declaring a new variable inside the function or using any library function…
Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243
-2
votes
1 answer

solving 8-puzzle with BFS algorithm using Python

I want to solve 8-puzzle problem with bfs algorithm and using Python this is my code, I don't get what exactly is the problem with my code. But it keeps running and doesn't stop and does not solve the problem. list =…
Sahar
  • 49
  • 2
  • 10
-2
votes
3 answers

How to generate puzzles to 'crack the code'?

In a puzzle book I found the following puzzle: The caption is in Dutch, but I can shortly describe it: There is a sequence of numbers in the range 0...6, which is not given There are 6 mathematical statements (listed below) that are true By using…
knart
  • 311
  • 2
  • 13
-2
votes
2 answers

[Puzzle Game]Finding Combination of squares in a 2D Grid

I am making a game like Lumines Remastered (https://www.youtube.com/watch?v=8aJqNGjLtaY&t=358s) and I was pretty much successful in it. But, I got stuck in one place in clearing the pieces. I have a 2d Array grid of 16x10 and each individual pieces…
-2
votes
3 answers

Puzzle on looping statement

Possible Duplicate: Not able to solve the puzzle regarding this code… The following is a piece of C code, whose intention was to print a minus sign 20 times. But you can notice that, it doesn't work. #include int main() { …
-2
votes
3 answers

Reducing the weight of this Function by means of Code

Consider the Following Function taking into account addition costs you 4 Operations assignment costs 1 Operations Comparision costs 1 Operations Calculation of the above function will cost 14 Operations int function1(int a,int b,int c, int d, int…
del_champ
  • 179
  • 1
  • 9
-2
votes
1 answer

I need help getting my simple 2D puzzle to work

The idea is that the permutation puzzle is in the surface of a torus. I set it so that you move the pieces by pressing Q, W, E, D. The problem I have is that when you combine horizontal and vertical moves the numbers (representing colors) overlap.…
-2
votes
1 answer

JQuery: Why is my puzzle not working on mobiles?

I'm new here and try to get arround the forum a bit. I've just finish a programming class (webforce3) and test all I can to review my classes. My first question is about a little program/game that seems not to work on mobile devices. Can anyone give…
-2
votes
1 answer

Finding unique solution puzzle python

x = np.array([[0,1,11],[0,2,11],[0,3,10],[0,4,10],[0,5,9],[0,6,9],[1,7,9], [1,5,11],[1,6,11],[2,7,11],[2,8,10]]) I'm pretty new to this so i'm gonna call things like this [element1,element2,element3] i have an array as shown above,…
Arohi Gupta
  • 95
  • 1
  • 8
-2
votes
2 answers

output of code snippet

What should be the value of final_answer in this Js code snippet and why? function weird(x) { var tmp = 3; return function(y) { return x + y + ++tmp; } } var funny = weird(2); var final_answer = funny(10); I think value of…
Lucy
  • 1,812
  • 15
  • 55
  • 93
-2
votes
1 answer

How To Scramble Image in Java

I found this source code from http://zetcode.com/tutorials/javagamestutorial/puzzle/ And I wanted to play around with it. It's a picture puzzle game, however when I run the program, it doesn't show up scrambled and I was wondering how will I go…
James
  • 11
  • 5
-2
votes
1 answer

Binary Tree Puzzle

Recently I came across this interview puzzle. Can Someone Explain me what this puzzle means.. You are given a binary tree. A light source is placed on the right of the tree. Print the list of all the nodes over which the light is falling…
Nitin Pandey
  • 649
  • 1
  • 9
  • 27
-2
votes
1 answer

Python algorithm to solve triomines puzzle with backtracking

Let's say I have a board like this . . x . . . . . . . . . . . x . . x x is used box and '.' are free. I need to put triomines to fill all the area, so there will be no free cells. Triomines are L-shaped, and I mark same triomino with the same…
lenik
  • 23,228
  • 4
  • 34
  • 43
-2
votes
1 answer

How to solve a puzzle using breadth first search?

I took a class on this a few semesters ago, but I didn't learn much at the time. I watched a lecture by MIT on Breadth First Search. I learned quite a bit from it, however it only taught me that BFS is a good algorithm for searching a graph,…
-2
votes
0 answers

Jigsaw Puzzle Solver

Ok, so I have a 3 x 3 jig saw puzzle game that I am writing and I am stuck on the solution method. public Piece[][] solve(int r, int c) { if (isSolved()) return board; board[r][c] = null; for (Piece p : pieces) { if…
abaratham
  • 445
  • 1
  • 5
  • 19