#random position algorithm

40 messages ยท Page 1 of 1 (latest)

brittle starBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

buoyant ether
#

THIS IS THE CODE

#

i tried to comment it as good as i could but

#

im not really good

drifting gorge
#

What is the use case?

#

Are you trying to generate a map of some kind

#

Like a procedurally generated world?

buoyant ether
#

i kinda want to work into that

#

but im not really good

#

and i just started the language

#

its just like basics

drifting gorge
#

The first problem here is that youre doing everything in main

#

The second problem is that youre way out of scope

#

Procedural generation is pretty difficult

#

And no way you can make your own algorithm right now

#

You could learn from the way games do it right now

#

Look into white noise and stuff, thats a keyword for a way games procedurally generate maps

#

Even more relevant to your case is how roguelikes generate their maps

drifting gorge
#

And you will find yourself the answer for this question ๐Ÿ‘

buoyant ether
#

yeah im only on the 7th chapter yet

#

i mean the bit chapter

drifting gorge
#

Wow you didnt even get into classes ๐Ÿ˜…
Is this your first language ever?

#

learncpp.com imo isn't very well geared for people just learning to program because they teach the ins and outs of C++ instead of good programming habits

buoyant ether
drifting gorge
buoyant ether
#

and i didnt want to disrupt like the course

buoyant ether
drifting gorge
#

What language did you know before C++

buoyant ether
#

python

#

and little bit of java, but really little

drifting gorge
#

In python, do you remember what def does and stuff

#

Do you agree its a better idea to "outsource" tasks and stuff to functions?

buoyant ether
#

yes yes

#

i know

#

how to do it

#

but first i wanted to know if i could figure out the logic for this

#

and i kinda wouldnt know what to put in function except the last lines of code starting from the char map[10][10] line, and i could put those lines in drawMap function i guess with some parameters

#

but im not really bright and clever as other people