56 questions
1
vote
1
answer
113
views
C console program not producing correct output [closed]
I am trying to recreate YSAP Terminal Christmas Tree in C instead of in Bash. I know there's a bunch of weird code as I don't do a lot of C programming, so a lot of it is mashed together from what I ...
-1
votes
1
answer
48
views
Runtime error 216 in FreePascal if two‐dimensional array of chars is disposed
I create a Pointer to a two‐dimensional Char Array, fill it with hash signs (#), output it to the console and free up memory of the pointer. If I use Dispose() a runtime error 216 pops up. If I don’t ...
0
votes
0
answers
71
views
Wall Disappears and Infinite Hallway Effect in Raycaster at Specific Player Angles and Positions
Problem
I'm working on a raycaster and have encountered a visual glitch that causes walls to disappear and creates an "infinite hallway" effect under certain conditions. This issue occurs ...
0
votes
1
answer
64
views
How to deal with off-by-one issues in convolution (Python)?
I'm trying to write a function to add two random varibles X1 and X2. In my case, they are both uniform random variables from 0 to a1 and 0 to a2. To compute the random variable Y = X1 + X2, I need to ...
0
votes
0
answers
78
views
Off-by-one Problem with TCP/IP Client Receive Block and Python Server Sender
When I send the first value from my py server to the Simulink TCP/IP Client Receive block (non-blocking-mode), nothing happens and the data and status outputs both remain 0. When I send the second ...
0
votes
0
answers
48
views
Google Apps Script code is targeting 1 row below where it needs to, therefore deleting rows that it shouldn't. How to fix this?
Code is pasted below. Summary:
Search for the searchKey (PUT) in column P on “NWSS Sidecar” sheet
When found, get the corresponding sample ID# from column E
If the sample ID# is not paired up, (doesn’...
0
votes
2
answers
430
views
Why does this reverse loop give me an error in Google Apps Script?
This reverse loop is giving me the error TypeError: Cannot read property '0' of undefined. Why might this happen?
Here's the code part:
function formatBoqPipework() {
const ss = SpreadsheetApp....
0
votes
1
answer
100
views
ascending order check recursively
What I try to do is to check a given array is ordered in an ascending manner by divide-and-conquer approach.
I wonder what the logic behind the additional return case (a⌊n/2⌋−1 ≤ a⌊n/2⌋) is to reach ...
2
votes
0
answers
740
views
How do you spot or avoid committing off-by-one errors? [closed]
When I write code, among the more common classes of bug I create is off-by-one errors (OBO). In "real" code I most often run into this issue while doing complicated pointer/iterator ...
-1
votes
1
answer
83
views
Please, can some one tell me what's wrong with this code?
Please, can some one tell me what's wrong with this code?
#include <iostream>
using namespace std;
int main() {
int a[3], i;
for(i = 0; i <= 3; i++ )
{
a[i] = 0;
...
1
vote
0
answers
27
views
Trouble updating a batch of cells in Google Sheets App Scripts [duplicate]
So, I am running a program that sorts through a large spreadsheet and organizes each row based into other sheets based on properties of individual cells in that row. I got the macro working, but it ...
3
votes
1
answer
160
views
TASM addressing off by one
I'm currently implementing Snake for university, and we have to use TASM for that.
My main game data is laid out like this (using C syntax):
struct GameLine {
uint8_t direction_bits[10]; // 2 ...
-1
votes
1
answer
54
views
Are these two loops equivalent: off-by-one
Are these two loops the same? For some reason the second loop is off-by-one and I cannot figure out why.
while ( !b && ++n < WORD_COUNT ) b = mWords[n];
n++;
while ( !b && n < ...
0
votes
2
answers
83
views
Count how many times an array element is larger than the subsequent element (off-by-one error)
I'm programming in C. I have to make a function called count , that counts how many times is larger than the subsequent element in the same array. For example, if we had a main code looking like this:
...
3
votes
1
answer
931
views
Is there a bug in Algorithm 4.3.1D of Knuth's TAOCP?
You can find the explanation of Algorithm 4.3.1D, as it appears in the book Art of The Computer Programming Vol. 2 (pages 272-273) by D. Knuth in the appendix of this question.
It appears that, in ...