Prayers to Proglodite
1
Name:
Anonymous
2009-10-10 0:51
So I want to represent a grid of cells containing x,y values.
I don't know a better way to do this than arrays of arrays of two-item arrays. Obviously this is a bad idea.
I'm sorry, /prog/. I've been reading Hobbes.
2
Name:
Anonymous
2009-10-10 1:19
A two dimensional arrays of tuples/structs/objects?
3
Name:
lattdddie
2009-10-10 1:31
4
Name:
Anonymous
2009-10-10 1:45
Depends mostly on what language you're using, but yeah, that's pretty much it.
5
Name:
Anonymous
2009-10-10 4:19
Obviously this is a bad idea.
Why?
6
Name:
Anonymous
2009-10-10 4:28
datatype variable_name[x_size][y_size]
HOLY SHIT, AM I BLOWING YOUR MIND YET?
7
Name:
Anonymous
2009-10-10 23:00
>>5
Because I feel like there has to be something more clever than arrays of arrays of arrays that I didn't think of.
I liked it better when /prog/ made me feel dumb
8
Name:
Anonymous
2009-10-10 23:38
>>7
Like, for coming here?
9
Name:
Anonymous
2009-10-10 23:48
>>8
No, we used to have intelligent posts on /prog/ instead of the meme recycling project it's turned into
10
Name:
HAXUS THE RECYCLER
2009-10-11 0:12
>>9
No meme shall go to waste
!
11
Name:
Anonymous
2009-10-11 0:13
use a linked list.
linked lists are awesome.
struct node{
struct node *prev;
struct node *next;
int x;
int y;
};
delicious ◔ ◡ ◔
12
Name:
Anonymous
2009-10-11 0:16
or an array of structures.
struct xy{
int x;
int y;
}x[ARRAY_LEN];
i love structures and meaningless variable names(♥‿♥ )
13
Name:
Anonymous
2009-10-11 10:27
>>1
What are you going to achieve, what are you actually going to use the grid for?
14
Name:
Anonymous
2009-10-11 11:42
typedef struct {
int x;
int y;
} cell;
cell[][] anus;
15
Name:
Anonymous
2009-10-11 11:56
>>13
An ecology sim
Basically a grid of squares containing resources(x) and waste(y)
Actors move around making resources and leaving waste. Too much waste, death. Etc.
At some point I'll have two opposing actors, eating the other's waste and excreting the other's food.
16
Name:
Anonymous
2009-10-11 12:01
17
Name:
Anonymous
2009-10-11 12:44
18
Name:
Anonymous
2009-10-11 13:24
>>17
Well, I could have static resources and model the problem of accumulating waste with only one actor
ANYWAY.
19
Name:
Anonymous
2009-10-11 13:49
You all suck!
20
Name:
Anonymous
2009-10-11 13:52
Yes you do
--
Hello world
21
Name:
Anonymous
2009-10-11 15:22
>>15
So
why the fuck did you say in
>>1 that you needed
x,y values?
(x,y) implies coordinates, it would be easier to understand if you at least changed the letters to
(a,b).
inb4 FV comes and starts talking about “nonconformism”
22
Name:
Anonymous
2009-10-11 16:39
23
Name:
TRUE TRUTH EXPERT
!!TthtFzrtPXElUy7
2009-10-11 16:43
sTOP CALLING ME fv!
24
Name:
Anonymous
2009-10-11 20:52
>>21
YOU KNOW WHAT THEY SAY ABOUT ASSUMING.
25
Name:
Anonymous
2009-10-11 20:59
>>21
Yeah, sorry. But how much difference does it make being a pair of coordinates versus a pair of generic integers?
I'll try not to post ideas after eating painkillers again
26
Name:
Anonymous
2009-10-11 21:25
OKAY YOU FUQIN ANGERED AN EXPERT PROGRAMMER
GODFUCKIGNDAMN
FIRST OF ALL, YOU DONT FUQIN KNOW WHAT A MAN PAGE IS
SECONDLY, THIS IS /prog/ DO NOT DEMAND USEFUL ANSWERS THE WAY YOU WANT THEM TO BE
THIRDLY PROGRAMMING IS ALL ABOUT PHILOSOPHY AND ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
AND FUQIN LASTLY, FUCK OFF WITH YOUR BULLSHYT
EVERYTHING HAS ALREADY BEEN ANSWERED IN >>3,4,10
27
Name:
Anonymous
2009-10-11 21:34
Damnit
/prog/ , why is this thread still here when
>>2 answered it already.
28
Name:
Anonymous
2009-10-12 0:55
>>27
That's a worse answer than
>>10
29
Name:
Anonymous
2009-10-12 5:20
出会い福岡
30
Name:
Anonymous
2009-10-12 5:30
What R7RS needs is a good n-dimensional vector type.
31
Name:
Anonymous
2009-10-12 5:35
CL already has one:
CL-USER> (make-array '(3 2 4) :initial-element 'lisp)
#3A(((LISP LISP LISP LISP) (LISP LISP LISP LISP))
((LISP LISP LISP LISP) (LISP LISP LISP LISP))
((LISP LISP LISP LISP) (LISP LISP LISP LISP)))
32
Name:
Anonymous
2009-10-12 5:51
>>30
SRFI 25. Written in 2001, so anything other than PLT should have them out of the box. (there's a package on PLaneT somewhere for that, though)
33
Name:
Anonymous
2009-10-12 5:54
>>32
PLT has it, just
(require srfi/25)
34
Name:
Anonymous
2009-10-12 6:01
35
Name:
Anonymous
2009-10-12 7:03
>>1
Just use a one dimensional array..
Use a macro (x,y,rowlength) to calculate offset.
36
Name:
Anonymous
2011-02-03 0:30