An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.
Questions tagged [infinite-loop]
3528 questions
1
vote
2 answers
Seeking Feedback, Infinite loop
I'm practicing some newly acquired skills and wanted to tap the community for some feedback on the code below.
The goal: create a simple program to help an imaginary cashier return the right change by deconstructing the components of the change…

Merv Merzoug
- 1,149
- 2
- 19
- 33
1
vote
1 answer
C++ MiniMax Algorithm getting stuck in an infinite loop for Tic Tac Toe Board
I'm currently implementing a MiniMax Algorithm with Alpha Beta Pruning for a Tic Tac Toe game.
My algorithm takes in an empty board and, at the end has that board contain the same state as the current board, along with the next move made. Then, I…
user3126362
1
vote
2 answers
how to consider regex expression as block to apply lookbehids and lookaheads?
I'm trying to turn a string of this type:
http://example.com/mypage/272-16+276-63+350-02
where aaa-bb are product codes and their numbers may vary from 2 to anything, but I doubt there will ever be more than 5…

tao
- 82,996
- 16
- 114
- 150
1
vote
2 answers
MATLAB: exiting infinite loop without using global variable in GUI
Background: I have several portion in an GUI to handle different tasks. In 1 portion (portion1) I have text input and send button. So once I will click send it would send one data to my serial port. Another portion (portion2) would receive signal…

Bee
- 175
- 1
- 10
1
vote
1 answer
(C++) Does not stop on std::cin and goes into infinity loop?
I have a wird problem. Im using Visual Studio 2012, thats my code: (something is in polish but i hope you will understand how it works).
#include
#include
#include
#include
using namespace std;
#pragma…

wiwo
- 721
- 1
- 13
- 18
1
vote
2 answers
fgets() goes into infinite loop reading from stdin
I wrote the following code, but it gets stuck into an infinite loop. Can somebody help me out at this topic?
#include
#include
#include
#include
void main()
{
FILE *fp;
char s[10];
…

user3169322
- 9
- 1
- 4
1
vote
1 answer
I am making an android metronome app. However, the program stop when the sound is playing
When I click the button in the app, it play the sound perfectly. However, the button that trigger start and stop and the back button of the phone is able to click again, but the sound keeps playing. There is no error message show up in both ellipse…

K.Hui
- 153
- 1
- 13
1
vote
0 answers
Javascript realtime user code execution in WebWorker
Suppose you are building a robot simulator in HTML/JavaScript in which you have a robot that is controlled by the user's JavaScript code. You also want the user to be able to interact with the webpage so you send the user's code to a WebWorker where…

mr.Shu
- 478
- 5
- 9
1
vote
1 answer
Trying to reprocess picture in after_update callback leads to infinite loop
I have this model for pictures attached to another model (Work):
class WorkPicture < ActiveRecord::Base
after_initialize :default_values
after_update :reprocess_picture, if: :cropping_changed?
belongs_to :work, inverse_of: :pictures
…

kettlepot
- 10,574
- 28
- 71
- 100
1
vote
1 answer
Beginner: Number Guessing Game
I am a new bee trying my hand at Java.
I am trying to write a small number guessing game where computer picks a number and then 3 players take turns at guessing the number. A number can be guessed only once irrespective of the player who guessed it.…

user3135162
- 11
- 1
1
vote
5 answers
JAVA: Menu Infinite-loop
This is a follow up to a question I have asked previously that did get answers that should have fixed my problem, but unfortunately did not. My program reads in a text file and organises data before giving the user a number of options. When the…

user2941526
- 497
- 3
- 6
- 17
1
vote
1 answer
TSQL infinite loop in cursor when joining temp table only
I have a SP that updates prices in a table using a CURSOR and FETCH NEXT.
The cursor's query is a simple "select', and instead of a WHERE - I'm joining a function who brings all the related User IDs.
Now, due to the fact the my SP updates a lot of…

user3115892
- 11
- 1
1
vote
1 answer
Why do I appear to have an infinite loop?
This is part of a tutorial. My goal was to take an input from user and then increment it while a condition is true.
inputNum = raw_input("What is max number?")
def incrementF(greatest):
i = 0
numbers = []
while i < greatest:
…

Doug Fir
- 19,971
- 47
- 169
- 299
1
vote
1 answer
infine windows message loop - c++
I tried to create this window class which creates and shows a window. When I run this class, GetMessage keep on sending WM_PAINT message, and task manager shows me about 50% CPU usage just from my process.
main.cpp:
#include "Window.h"
int WINAPI…

user3048787
- 31
- 2
1
vote
1 answer
Why doesnt my code end
it suppose to be function composition.
I think that the problem is when there is only one function left in funcs. I wanted it to be an empty tuple but it didn't recognize it like that and enters an infinity loop
Thank you! :)
def compose(*funcs):
…

Hila
- 11
- 2