-
Notifications
You must be signed in to change notification settings - Fork 0
/
ram3d.c
65 lines (56 loc) · 1.01 KB
/
ram3d.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//https://wasdk.github.io/WasmFiddle/
#include<string.h>
#include<stdio.h>
#define xx 8
#define yy 8
#define zz 8
int i[xx*yy*zz+2];
int ram3d(int x,int y,int z,int writes,int value){
int ii=0;
int l=xx*yy*zz;
int indexs=0;
indexs=x+(y*xx)+(xx*yy*z);
if(indexs>2 && indexs<l+3){
if(writes!=0)i[indexs-3]=value;
ii=(int)i[indexs-3];
}else{if(indexs==0){
ii=xx;
}else{
if(indexs==1){
ii=yy;
}else{if(indexs==2){
ii=zz;
}
}
}}
return ii;
}
int main(){
int x=0;
int y=0;
int z=0;
int dx=0;
int dy=0;
int dz=0;
int errs=0;
x=ram3d(0,0,0,0,0);
y=ram3d(0+1,0,0,0,0);
z=ram3d(0+2,0,0,0,0);
printf("\033[43;37m\n");
for(dz=0;dz<z;dz++){
for(dy=0;dy<y;dy++){
for(dx=0;dx<x;dx++){
ram3d(dx+3,dy,dz,1,dx+(dy*xx)+xx*yy*dz);
}
}
}
for(dz=0;dz<z;dz++){
for(dy=0;dy<y;dy++){
for(dx=0;dx<x;dx++){
errs=ram3d(dx+3,dy,dz,0,0);
if(errs!=dx+(dy*xx)+xx*yy*dz)puts("---error");
printf("x %d,y %d ,z %d =%d\n",dx,dy,dz,errs);
}
}
}
}