It's n-not like we want you to join or anything, b-baka!

Join a laid-back, close-knit community of mixed interests Get a free account!

Gargron
99th percentile

No badges yet

Founder of the Colorless

Web developer && Computer Science student

I'm the guy who created the Durarara-eque chat back in March 2010 and later developed the message board and other modules of the site. I refactored the code about 4 times with significant visual and functional changes. I am satisfied with the outcome and as such no longer developing it. I am also no longer the administrator of the site, for that, see @Warlock.

I like tea and calculating statistics. I am a big fan of the scientific method, and as such, an atheist. My Internet identity has its roots in the so-called aniblogosphere, but I am not interested in Japanese animation anymore.

Feel free to message me if you have any questions. Testing.


Gargron joined on Sep 14th, 2011, since that has made 1091 posts that are still accessible today, 159 of which are threads. Helping shape the community, Gargron has given 1977 upvotes, and was last online on May 21st, 2013.


  • In Unpopular Opinions
    • Death is natural, there is no afterlife in the way any "holy" book tells us (I try to imagine that there is still some way to maintain consciousness after death, though)
    • There is no god in the way people depict him (If anything, the Universe itself is "god" as it is omnipresent and omniscient and omnipotent)
    • Religion (or its canonical misinterpretation) is the reason for almost all the wars and conflicts and cruelties
    • I support Israel in the Israeli-Palestinian conflict and all other conflicts. It's a democratic and scientifically advanced, small, brave country. I don't support orthodox ultra-anything anyone, be it Jews or Muslims, but Palestinian Muslims are more aggressive and less educated. An influx of those into a country like Israel would mean the end of all democratic and scientific values there. (There are more Palestinians than there are Jews)
  • In I heard you like Bacon...

    ^These are not the replies we were looking for.

  • In Open call for character design/artist for original project.

    ^I second that. This is gonna be a thing.

  • In Need help with Delphi: Maze generation with Wall objects

    Thanks! There was a code/result update again, but still not working as intended. I think it's the frontier behaviour (it's supposed to be a stack, I believe).

    Code

    And sometimes it returns an access violation error so indexes/lengths aren't always correct. The DeleteArrayItem procedure I got from somewhere on the Internet doesn't help by being so unclear either.

  • IT'S A SNAP (Australian university ad)

    Cross-post from reddit, but man, this was really... strange, and amazing in a way. Good ad, that's for sure.

  • In Need help with Delphi: Maze generation with Wall objects

    Here is what I came up with by porting this JavaScript code into Delphi:

    unit Unit_Lab;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    
    type
      THindernis = record
        x1, y1, x2, y2: Integer;
      end;
    
    type
      TCell = record
        r, c: Integer;
      end;
    
    type
      TCellArray = Array of TCell;
    
    type
      TForm1 = class(TForm)
        procedure FormPaint(Sender: TObject);
        procedure DeleteArrayItem(var X: TCellArray; const Index: Integer) ;
        procedure MarkFrontiers(row, col: Integer);
        procedure CreateBranch(row, col: Integer);
        procedure AttachCellToTree(row, col, direction: Integer);
        procedure RemoveWall(row, col, direction: Integer);
        procedure RemoveCellFromFrontier(row, col: Integer);
        procedure MazeCreate();
        procedure MazeConvert();
        function CellWithinBorders(row, col: Integer): Boolean;
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
      hindernisse: Array [0..3071] of THindernis;
      maze: Array [0..23, 0..23] of Byte;
      frontier: TCellArray;
    
    const
      NO_EXIT  = $00;
    
      EXIT_EAST  = $01;
      EXIT_NORTH = $02;
      EXIT_WEST  = $04;
      EXIT_SOUTH = $08;
    
      CELL_INCLUDED = $10;
      CELL_FRONTIER = $20;
    
      DIR_EAST  = 0;
      DIR_NORTH = 1;
      DIR_WEST  = 2;
      DIR_SOUTH = 3;
    
      DCOL: Array [0..3] of Integer = (1, 0, -1, 0);
      DROW: Array [0..3] of Integer = (0, -1, 0, 1);
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.DeleteArrayItem(var X: TCellArray; const Index: Integer) ;
    begin
       if Index > High(X) then Exit;
       if Index < Low(X) then Exit;
       if Index = High(X) then
       begin
         SetLength(X, Length(X) - 1) ;
         Exit;
       end;
       Finalize(X[Index]) ;
       System.Move(X[Index +1], X[Index],(Length(X) - Index -1) * SizeOf(TCell) + 1) ;
       SetLength(X, Length(X) - 1) ;
    end;
    
    function TForm1.CellWithinBorders(row, col: Integer): Boolean;
    begin
      Result := (row >= 0) and (row < length(maze)) and (col >= 0) and (col < length(maze));
    end;
    
      procedure TForm1.MarkFrontiers(row, col: Integer);
      var k, r, c: Integer;
      begin
        for k := 0 to 3 do begin
          r := row + DROW[k];
          c := col + DCOL[k];
    
          if CellWithinBorders(r, c)
          and (not ((maze[r, c] and CELL_INCLUDED) = CELL_INCLUDED)
          and not ((maze[r, c] and CELL_FRONTIER) = CELL_FRONTIER))
          then begin
            maze[r, c] := maze[r, c] xor CELL_FRONTIER;
            SetLength(frontier, length(frontier) + 1);
            frontier[length(frontier)].r := r;
            frontier[length(frontier)].c := c;
          end;
        end;
      end;
    
      procedure TForm1.CreateBranch(row, col: Integer);
      var
        currRow, currCol, randDir, i, d, r, c: Integer;
        bMoved: Boolean;
      begin
        randomize();
        AttachCellToTree(row, col, -1);
        MarkFrontiers(row, col);
        currRow := row;
        currCol := col;
    
        repeat
          bMoved  := False;
          randDir := random(3);
    
          for i := 0 to 3 do begin
            d := (randDir + i) mod 3;
            r := currRow + DROW[d];
            c := currCol + DCOL[d];
    
            if CellWithinBorders(r, c) and ((maze[r, c] and CELL_FRONTIER) = CELL_FRONTIER) then begin
              AttachCellToTree(r, c, (d + 2) mod 3);
              bMoved  := True;
              currRow := r;
              currCol := c;
              Break;
            end;
          end;
        until not bMoved;
      end;
    
      procedure TForm1.RemoveWall(row, col, direction: Integer);
      begin
        case direction of
          DIR_EAST: begin
              maze[row, col] := maze[row, col] or EXIT_EAST;
              maze[row, col + 1] := maze[row, col + 1] or EXIT_WEST;
            end;
          DIR_NORTH: begin
              maze[row, col] := maze[row, col] or EXIT_NORTH;
              maze[row - 1, col] := maze[row - 1, col] or EXIT_SOUTH;
            end;
          DIR_WEST: begin
              maze[row, col] := maze[row, col] or EXIT_WEST;
              maze[row, col - 1] := maze[row, col - 1] or EXIT_EAST;
            end;
          DIR_SOUTH: begin
              maze[row, col] := maze[row, col] or EXIT_SOUTH;
              maze[row + 1, col] := maze[row + 1, col] or EXIT_NORTH;
            end;
        end;
      end;
    
      procedure TForm1.RemoveCellFromFrontier(row, col: Integer);
      var i: Integer;
      begin
        maze[row, col] := maze[row, col] xor CELL_FRONTIER;
        for i := 0 to length(frontier) do begin
          if (frontier[i].r = row) and (frontier[i].c = col) then begin
            DeleteArrayItem(frontier, i);
            Break;
          end;
        end;
      end;
    
      procedure TForm1.AttachCellToTree(row, col, direction: Integer);
      var randDir, i, d, r, c: Integer;
      begin
        randomize();
        RemoveCellFromFrontier(row, col);
    
        if direction = -1 then begin
          randDir := random(3);
    
          for i := 0 to 3 do begin
            d := (i + randDir) mod 3;
            r := row + DROW[d];
            c := col + DCOL[d];
    
            if CellWithinBorders(r, c) and ((maze[r, c] or CELL_INCLUDED) = CELL_INCLUDED) then begin
              RemoveWall(r, c, d);
              Break;
            end;
          end;
        end
        else begin
          RemoveWall(row, col, direction);
        end;
      end;
    
    procedure TForm1.MazeCreate();
    var
      i, j, t: Integer;
      startR, startC: Integer;
    begin
      randomize();
    
      for i := 0 to length(maze) do begin
         for j := 0 to length(maze) do begin
            maze[i, j] := NO_EXIT;
         end;
      end;
    
      startR := random(length(maze)-1);
      startC := random(length(maze)-1);
    
      maze[startR, startC] := maze[startR, startC] or CELL_INCLUDED;
      MarkFrontiers(startR, startC);
    
      while (length(frontier) > 0) do begin
        t := random(length(frontier)-1);
        CreateBranch(frontier[t].r, frontier[t].c);
      end;
    
      MazeConvert();
    end;
    
    procedure TForm1.MazeConvert();
    var i, j, x0, y0, x1, y1, c: Integer;
    begin
      c := 0;
      for i := 0 to length(maze) do begin
        for j := 0 to length(maze) do begin
          x0 := (j + 1) * 10;
          y0 := (i + 1) * 10;
          x1 := x0 + 10;
          y1 := y0 + 10;
    
          if (maze[i, j] and EXIT_NORTH) = NO_EXIT then begin
             hindernisse[c].x1 := x0;
             hindernisse[c].y1 := y0;
             hindernisse[c].x2 := x1;
             hindernisse[c].y2 := y0;
             c := c + 1;
          end;
          if (maze[i, j] and EXIT_SOUTH) = NO_EXIT then begin
             hindernisse[c].x1 := x0;
             hindernisse[c].y1 := y1;
             hindernisse[c].x2 := x1;
             hindernisse[c].y2 := y1;
             c := c + 1;
          end;
          if (maze[i, j] and EXIT_WEST)  = NO_EXIT then begin
             hindernisse[c].x1 := x0;
             hindernisse[c].y1 := y0;
             hindernisse[c].x2 := x0;
             hindernisse[c].y2 := y1;
             c := c + 1;
          end;
          if (maze[i, j] and EXIT_EAST)  = NO_EXIT then begin
             hindernisse[c].x1 := x1;
             hindernisse[c].y1 := y0;
             hindernisse[c].x2 := x1;
             hindernisse[c].y2 := y1;
             c := c + 1;
          end;
        end;
      end;
      //ShowMessage('N, S, W, E: ' + Format('%d, %d, %d, %d', [n, s, w, e]));
    end;
    
    procedure TForm1.FormPaint(Sender: TObject);
    var
      i: Integer;
    begin
      CANVAS.Brush.Color := RGB(255, 255, 255);
      CANVAS.Rectangle(0, 0, 640, 480);
      CANVAS.Brush.Color := RGB(0, 0, 0);
    
      MazeCreate();
    
      for i:= 0 to length(hindernisse) do begin
        CANVAS.MoveTo(hindernisse[i].x1, hindernisse[i].y1);
        CANVAS.LineTo(hindernisse[i].x2, hindernisse[i].y2);
      end;
    end;
    
    end.
    
    

    Unfortunately, I always get this result:

    Please help!

    Edit: Updated code and result, still not working as intended.

  • In Open call for character design/artist for original project.

    @Jin_sama No no, not because of you. Because of Colorless, mostly.

  • Need help with Delphi: Maze generation with Wall objects

    I made a simple game in which obstacles are saved as TObstacle records with four coordinates x1, y1, x2, y2. The player is a simple rectangle that can move around with the arrow keys. There is collision detection, so the player cannot move over the obstacles.

    Now, I need to generate a maze for the level. I googled a lot, I even bugged @halcy, but to no success. I do not understand how to properly implement Depth-First Search in my use-case, most of the code online is for console applications that output that maze as you go using ASCII.

    Help, me, Colorless!

  • In JumperJack - A game I made for informatics class

    @Sutol Thanks!

  • In JumperJack - A game I made for informatics class

    @PigBoss Originally the prototype for this pig was my best friend from school :3c