Questions tagged [less]
The less tag has no usage guidance.
51
questions
2
votes
1
answer
824
views
Questions regarding pset4 Blur filter (less comfortable)
After tinkering for a while with why my filter didn't work, I finally succeded with the following code:
// Blur image
void blur(int height, int width, RGBTRIPLE image[height][width])
{
//make copy ...
0
votes
1
answer
72
views
filter less: Reflection : image is reflected correctly but does not pass check50
void reflect (int height, int width, RGBTRIPLE image[height][width])
{
RGBTRIPLE invert[height][width];
for (int i=0; i<height; i++)
{
for (int j=width,s=0; j>=0; j-...
1
vote
1
answer
1k
views
My CS50 PSET4 Filter (Less) Blur function doesn't pass check50 despite seemingly working fine
I've been working on CS50 PSET4 Filter (Less) and finally got a working blur function (or so I thought!)
// Blur image
void blur(int height, int width, RGBTRIPLE image[height][width])
{
RGBTRIPLE ...
0
votes
1
answer
161
views
Mario (less) PSET6 Python Spacing help
Slightly embarrassed to be posting this as I could succesfully complete mario(less) in pset1 but apparently cannot replicate it in Python. My code is as follows:
h = int(input("h: ")) # get ...
1
vote
2
answers
95
views
What's my error?
I am having some errors with my code in check50.
All of my code is on this gist.
Grayscale - expected "28 28 28\n", not "27 27 27\n" in without whole number average. I am using ...
0
votes
2
answers
212
views
pset1 cash less, problem using for loops
I tried to use for loops to solve the cash (less) problem set, not sure if thats possible. Can this code be fixed or do I need to use while loops instead?
the code compiles, but the output is either (...
1
vote
3
answers
79
views
PSET 1 Can't implement loop at the prompt
I'm still on my prompt part, couldn't get to the pyramid yet, my code compiles but I can't make the loop recursive, that is, after the first entry it goes back to the prompt $.
Here is the code:
#...
0
votes
1
answer
143
views
Help with Problem Set 1 Mario (less)
I have no idea what I am doing wrong here. Everything works just as specified, but for some reason I am still getting error messages.
Please do not look at this if you have not already solved the it ...
0
votes
1
answer
268
views
Unable to compile pset1. Mario (Less comfortable)
I am unable to compile my file and get many errors.
INPUT
#include <cs50.h>
#include <stdio.h>
int main(void)
//Prompt for the height of the pyramid
int height;
height = get_int (...
0
votes
1
answer
574
views
pset4 problem with blur, can't find what's wrong
I can't seen to find what is wrong with blur in my code. My code seems fine and it compiles too but the image doesn't get as blurred as it should. I've surfed through almost all the blur related ...
0
votes
2
answers
785
views
pset4 blur filter
I've been working for like a week on cs50/pset/filter/blur question, but this doesn't seem to be working.
My code is like this, and the resulting "blur filtered" image is not any close to what is ...
0
votes
1
answer
35
views
Unexpected results on resize(less). I could not figure out how is not working the way it suppose to be. Please help
// Copies a BMP file
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
if (argc != 4)
{
fprintf(...
1
vote
0
answers
27
views
What's wrong with saving the scanline array elements in my code for resize (less), Pset3 problem?
I've solved the problem by recopy method successfully and thanks to many helpful answers to others' questions.
Now I'm trying to solve be rewrite method and I think I have a problem with storing ...
0
votes
1
answer
57
views
help with pset3: resize (less) resizing horizontally
I am following the pset3 walkthrough and currently at the point where I have to resize horizontally.
https://pastebin.com/fHeaYgze
My approach is to currently rewrite the resized bi headers as bir (...
0
votes
1
answer
35
views
PSet 3 resize (less)
I'm just trying the "resize horizontally" step for now, but I'm dreadfully confused and can't get it to work. Could someone take a look at my code and nudge me in the right direction? Thank you:
/...
0
votes
1
answer
38
views
PSet3 Resize (Less) = Random Colors when not 1:1
I saw others posted about the same phenomena I am experiencing, but none of their solutions were what I needed.
n = 1 works perfectly. This is large.bmp with an n = 2.
I realize the first line of my ...
0
votes
1
answer
24
views
Resize less confortable pset3. Result seems ok if open as hexadecimal but the print result is cropped
After a long struggle with this one I finally got close to completing it. When I open the enlarged file, the lower rows are missing. However I can see these seem to be ok when I open the file as ...
0
votes
1
answer
65
views
PSET3 - Resize (Less) : Random colours being printed?
Going through the walkthrough of 'Resize (less)' and currently trying to resize horizontally. When running resize, only a few pixels have the correct colour and others have completely random colours.
...
0
votes
1
answer
78
views
pset3 Resize - Invalid or unsupported Image Format
So i think i finished resizing horizontally but when i try to open the output image
to check i get an error saying "Invalid or unsupported Image Format",
I read other similar questions here and i ...
0
votes
1
answer
84
views
Why is my code not working? resize (less comfortable)
So what I tried to do here is to copy every pixel in each of infile's scanlines as many times as the factor provided, then go back to the start of the scanline and do it again but on the next row, so ...
0
votes
1
answer
167
views
Pset 1 Less comfortable - Number of Hashes
Sorry for the beginners's question. When I try to compile to following code for the Mario - Less Comfortable problem, I am printing the same number of hashes for each row and am unsure why. Code is ...
0
votes
1
answer
72
views
pset3 resize (less) compiles but doesn't write into new file for factor != 1
I've been stuck with the pset3 for a long time now and can't figure out why my code isn't working; it compiles fine but doesn't produce an image except for the factor 1. Could someone point me in the ...
1
vote
1
answer
283
views
One fail for check50 on pset6 similarities --less
All of my code passes check50 except for the last one. I come up with 5 matches and not 4 (ba, ar, rb, ba, az).
:) helpers.py exists
:) helpers.py compiles
:) detects no lines in common
:) detects ...
0
votes
1
answer
69
views
Why is my program not entering the while loop in greedy? Pset1
While I was trying to solve the greedy less comfortable problem in pset1, I ran into a slight problem on the last loop in my program. Here is my code: (the reason why I have some random print ...
0
votes
2
answers
320
views
Need help in pset1: mario.c
I've been trying to do the less comfortable version of mario.c for a while, here is what I've been able to put together so far:
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// ...
0
votes
1
answer
74
views
pset4 resize less - starting to despair!
I'm utterly stuck on this pset. I don't want to give up on the course, but I've spent weeks and weeks looking on forums for help and I still have no idea where my code is going wrong. I'd really ...
0
votes
1
answer
41
views
running into a do...while loop issue
I am having an issue with output from a do while loop. Code is below
do
{
printf ("Height:");
height=get_int();
}
while (height < 0 || height > 23);
it works for negative numbers ...
0
votes
1
answer
28
views
Another question about how my 'for' parameters are affecting my output?
After some manipulation and trial/error, I finally got my code to output the desired spacing for the half pyramid. However, I am having trouble understand one of the relationship between my condition ...
0
votes
1
answer
206
views
resize.c (less) using the rewrite method
My issue is that the BMP appears to resize properly (in terms of size, that is) - so I don't think I have any problems with changing and updating the Bitmap Info/File-Headers (I probably do...), and ...
0
votes
1
answer
50
views
Can someone help me understand what I am manipulating in the for statement?
Through trial and error, I have been able to get my pyramid close but not quite where it needs to be. I started with the hashes because it was difficult to interpret spaces in the output terminal and ...
-1
votes
1
answer
71
views
pset1 ------------ mario less
I am not understanding as to what is expected when it says
" rejects a height of -1
expected program to reject input, but it did not"
what is "reject input"?
please help
1
vote
2
answers
289
views
Pset6 similarities less substrings I get wrong output
I’m super close. But I cannot figure out right formula. It doesn’t count amount of the similar substrings correctly. I mean the output is wrong.
https://pastebin.com/gEvxAS1X
0
votes
1
answer
80
views
resize less comfortable recopy - issues
been on this problem for over a month now. Still cannot resize images as required. When I run code, only the first row is resized. Other pixels return unmatched pixel colours. I would appreciate any ...
0
votes
1
answer
107
views
Final bfSize calculated does not match output file size
Hi, everyone!
I am currently finishing (after quite some thought and a lot of trial-and-error) the less comfortable version of the resize problem from pset4, which, as you probably know, resizes BMP ...
0
votes
1
answer
527
views
CS50 Mario less hashtags printing in reverse order
so I have absolutely no experience with coding. I've been trying to solve the mario less exercise from week 1 on CS50 but my hashtags keep printing in reverse order, so I get an inverted pyramid. I've ...
0
votes
1
answer
76
views
can someone please tell me whats wrong with my code ? on clicking the compare button on my website , its showing me some error
from nltk.tokenize import sent_tokenize
def lines(a, b):
s = set()
a1 = set(a.split('\n'))
b1 = set(b.split("\n"))
for i in a1:
if i in b1:
s.add(i)
return [...
0
votes
1
answer
446
views
PSET4 resize (less) check50 error
This code works as expected visually, however when going through check50, it returns an error (resizing with a factor of 2 for example)
"Header field bfSize doesn't match. Expected 0xae, not 0x126"
...
0
votes
1
answer
36
views
Spoiler Pset 4 Resize less, 2nd go around
I have worked on this so many hours. Thought I had fixed things up but still not resizing correctly. Can someone check my code and let me know where I am messing up ??
#include <stdlib.h>
#...
0
votes
1
answer
337
views
Need help in Pset4 resize less. Compiles but biSize headers not sizing correctly
[solution code removed]
) resize.c and bmp.h exist.
:) resize.c compiles.
:( doesn't resize small.bmp when n is 1
Header field bfSize doesn't match. Expected 0x5a, not 0x48
:( resizes small.bmp ...
0
votes
2
answers
119
views
Pset4 (less) - vertical resizing
I have resized horizontally successfully but am having trouble with vertical resizing. I have done a header check against the staff headers and they are the same so I don't think the problem is there. ...
0
votes
1
answer
550
views
pset6 similarities substrings fails check50 in 3 cases, but not sure what's wrong with logic
My code isn't efficient, but it's not convoluted which is rare for me. I wrote a helper function, 'slicer', which iterates over the length of a and slices a into length n substrings. 'Substrings' ...
0
votes
1
answer
173
views
tried to import windowed from more_itertools (for pset6 similarities less), but module not found
I stumbled on windowing in the more_itertools library which appealed to me as an interesting alternative approach to the substrings functions if I could get it to work:
Windowing More Itertools
I ...
0
votes
1
answer
18
views
substing function is not working correktly
def substrings(a, b, n):
"""Return substrings of length n in both a and b"""
line_a = []
i = 0
while i + n < len(a):
sub_a = a[i:i+n]
line_a.append(sub_a)
i += 1
line_b = []
j = 0
...
0
votes
1
answer
347
views
Pset6 similarities (less) works but doesn't pass check50
I tested and compiled my code and it is working well as per the requirements. However, it does not pass the requirements in check50. For instance, check50 claims that my code doesn't handle duplicate ...
0
votes
0
answers
1k
views
Extra Space Printing in CS50 Pset6 Mario Less - Python Version
Looks like similar questions were asked but I'm having problems with the Python version. Output looks fine on the surface but apparently the program is printing an extra spaces. I have played with the ...
0
votes
1
answer
143
views
CS50x - Problem Set 2 - Initials (less)
I've managed to whip up a solution in Python 3 that seems to work.
name = input("")
initials = name[0]
for i in range(0, len(name)):
if (name[i].isspace()):
initials += name[i + 1]
...
0
votes
1
answer
161
views
Pset4 Resize (less) vertically re-copy not working - no idea why, help badly needed
/**
* Copies a BMP piece by piece, just because.
*/
include
include
include "bmp.h"
int main(int argc, char *argv[])
{
// ensure proper usage
if (argc != 4)
{
fprintf(...
0
votes
1
answer
65
views
CS50 Pset3/less check errors
Hi I am very frustrated since 5 days that I cannot pass check50 that keeps giving me error as:
Does anyone have any suggestions?
:) helpers.c exists.
:) helpers.c compiles.
:( sorts {5,4,3,2,1}
...
0
votes
1
answer
351
views
pset4 resize less output issues
Have been trying to figure out what's wrong with my code, but having issues with it. Can someone please point me in the right direction?
What I'm getting with check50
:) resize.c and bmp.h exist.
...
0
votes
1
answer
194
views
Week 4. Resize - Less Comfortable
I hit a wall a while ago on 'more comfortable' and since downgrading have been trying attempts on this for a few days - fully aware i'll be missing something, either in my logic or implementation but ...