For prospective QC coders - Printable Version +- Xonotic Forums (https://forums.xonotic.org) +-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10) +--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12) +--- Thread: For prospective QC coders (/showthread.php?tid=3324) |
For prospective QC coders - divVerent - 08-01-2012 Here is a code example for prospective QuakeC coders, as well as some "interview questions" for it: Code: .string classname; And now the questions:
If you can figure this out without knowing QuakeC, you may be a good match for our team! RE: For prospective QC coders - machine! - 08-01-2012 Okey, I'm probably completly wrong, I got only a very tiny experience with coding. and that was with Lua. But I'll try! 1. Nothing. 2. Code: while (e = world; (e = find(e, classname, "foo")); ) 3. I think find does find what each variable is equal to or something, I don't know what it return though. this was harder than i though -.- 4. no idea... *ordering The C Programming Language (second edition) from amazon* RE: For prospective QC coders - divVerent - 08-01-2012 None are correct. I will add ONE solution: TO QUESTION 1: It outputs: Code: This is working. RE: For prospective QC coders - machine! - 08-01-2012 Lol, I misunderstood that... fuu, amazon have 20 day shipping. RE: For prospective QC coders - Micha - 08-01-2012 I only know normal C. I guess spawn() works like the C++ new() and puts a data object on the heap, and "entity e;" only puts a pointer on the stack. Looks like each heap element has a reference to the previously created element. So: 1) "This is working." 2) Code: e = world; 4) "This is working." "This is working." 4.1) Because the list start element is world, and the first call already spawned 4 entities without removing them. 4.2) Not necessarily. Since the spawned elements can always be retrieved by a find with "world" as starting point, they might be used by other functions. If it is not intended, further calls to func() will finally deplete the heap and further spawn() will fail. 4.3) If the entities are not used by other functions, func() should remove() them at the end. RE: For prospective QC coders - Mr. Bougo - 08-01-2012 (08-01-2012, 07:49 AM)machine! Wrote: Lol, I misunderstood that... fuu, amazon have 20 day shipping. QuakeC and C share a similar syntax, but you won't learn QC from a C book. In fact, you don't need to know any C to learn QC. RE: For prospective QC coders - machine! - 08-01-2012 Okey, but I've already order it. EDIT: 4. I guess it outputs: Code: This is not working RE: For prospective QC coders - Samual - 08-03-2012 OOOOOOOOOOOOH GAMES GAMES GAMES *grabs popcorn and watches closely* p.s.: Good job Micha RE: For prospective QC coders - Micha - 08-03-2012 (08-03-2012, 11:46 AM)Samual Wrote: p.s.: Good job Micha Thanks |