Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/PROUG/LIKE

Name: Anonymous 2009-05-06 2:50

/PROG/ has decided to worktogether to make a telnet based multiplayerp

Name: Anonymous 2009-05-08 3:15

>>38
Oh. I'd think with all of those extra letters and pointless idiomatic phrases such as "full stop," you would be hurting your fingers.

The more you know (TM).

Name: Anonymous 2009-05-08 3:38

Here's a new, better start (autotools stuff left as an excercise to the reader):

/* TODO: Insert GNU GPL version 3 header. */
#include "config.h"
/* FUCK THE ESTABLISHMENT, YEAH, STICK IT TO THE MAN !! */
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <getopt.h>

static void
print_help()
{
    printf("Usage: %s [OPTION]\n", program_invocation_short_name);
    puts("OPTION can be:");
    puts("  --help     Display help.");
    puts("  --version  Display version information.");
}

static void
print_version()
{
    puts("This is " PACKAGE_NAME " version " PACKAGE_VERSION ".");
}

int
main(int argc, char* argv[])
{
    for (;;) {
        static const struct long_options[] = {
            { "help", 0, NULL, 'h' },
            { "version", 0, NULL, 'v' },
            { 0, 0, 0, 0 }
        };
        int option_index = 0;
        int c = getopt_long(argc, argv, "hv", long_options, &option_index);
        if (c == -1)
            break;

        switch (c) {
        case 'h':
            print_help();
            return EXIT_SUCCESS;
        case 'v':
            print_version();
            return EXIT_SUCCESS;
        default:
            print_help();
            return EXIT_FAILURE;
        }
    }

    if (optind < argc) {
        print_help();
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}


N.B. that I've never used getopt_long before, and that I didn't try to compile this code.

Name: Anonymous 2009-05-08 15:03

>>42
Insert this at the TODO:
/*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>;.
*/

Name: Anonymous 2009-05-08 15:15

I fixed you're program

/*
Copyright (c) 2009 >>42

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
/* FUCK THE ESTABLISHMENT, YEAH, STICK IT TO THE MAN !! */
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <getopt.h>

static void
print_help()
{
    printf("Usage: %s [OPTION]\n", program_invocation_short_name);
    puts("OPTION can be:");
    puts("  --help     Display help.");
    puts("  --version  Display version information.");
}

static void
print_version()
{
    puts("This is " PACKAGE_NAME " version " PACKAGE_VERSION ".");
}

int
main(int argc, char* argv[])
{
    for (;;) {
        static const struct long_options[] = {
            { "help", 0, NULL, 'h' },
            { "version", 0, NULL, 'v' },
            { 0, 0, 0, 0 }
        };
        int option_index = 0;
        int c = getopt_long(argc, argv, "hv", long_options, &option_index);
        if (c == -1)
            break;

        switch (c) {
        case 'h':
            print_help();
            return EXIT_SUCCESS;
        case 'v':
            print_version();
            return EXIT_SUCCESS;
        default:
            print_help();
            return EXIT_FAILURE;
        }
    }

    if (optind < argc) {
        print_help();
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}

Name: Anonymous 2009-05-08 15:18

>>44
You fucked you miner indentation.

Name: Anonymous 2009-05-08 15:19

I like this idea alot.  We should have scheme for an in game scripting language to program the objects.

Name: Anonymous 2009-05-08 15:34

>>44-45
Fixed.

/*  Copyright (c) 2009 >>42
   
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are
    met:
   
       1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
       2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
       3. All advertising materials mentioning features or use of this
    software must display the following acknowledgement:
   
              For God so loved the world, that he gave his only begotten Son,
    that whosoever believeth in him should not perish, but have everlasting
    life. (John 3:16, King James Bible)
   
       4. Neither the name "Jesux" nor the names of its developers may be
    used to endorse or promote products derived from this software without
    specific prior written permission.
   
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
    NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
/* FUCK THE ESTABLISHMENT, YEAH, STICK IT TO THE MAN !! */
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <getopt.h>

static void
print_help()
{
    printf("Usage: %s [OPTION]\n", program_invocation_short_name);
    puts("OPTION can be:");
    puts("  --help     Display help.");
    puts("  --version  Display version information.");
}

static void
print_version()
{
    puts("This is " PACKAGE_NAME " version " PACKAGE_VERSION ".");
}

int
main(int argc, char* argv[])
{
    for (;;) {
        static const struct long_options[] = {
            { "help", 0, NULL, 'h' },
            { "version", 0, NULL, 'v' },
            { 0, 0, 0, 0 }
        };
        int option_index = 0;
        int c = getopt_long(argc, argv, "hv", long_options, &option_index);
        if (c == -1)
            break;

        switch (c) {
        case 'h':
            print_help();
            return EXIT_SUCCESS;
        case 'v':
            print_version();
            return EXIT_SUCCESS;
        default:
            print_help();
            return EXIT_FAILURE;
        }
    }

    if (optind < argc) {
        print_help();
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}

Name: Anonymous 2009-05-08 15:36

(define (insult) "boil ridden wretch")
(define (main)
 
(let ((name #f))
 
(display "WELCOME TO /PROUG/LIKE!") (newline)
 
(display "Enter your name you") (display (insult)) (newline)
 
(set! name (read))
 
(enter-game name)))

Name: Anonymous 2009-05-08 16:14

TO THE C FAGGOT: NO

Name: Anonymous 2009-05-08 16:51

There will be no 'in game scripting engine' you can use scheme in game because it's thue true language

Name: Anonymous 2009-05-09 3:38

>>48
Fabulous parentheses.

Name: Anonymous 2009-05-09 6:27

Patch for >>47 which adds some Curses stuff.

87a
    atexit(curses_cleanup);

    initscr();
    cbreak();
    noecho();
    nonl();
    keypad(stdscr, TRUE);

.
39a
#include <curses.h>

static void
curses_cleanup()
{
    endwin();
}
.

Name: Anonymous 2009-05-09 8:15

>>52
gtfo

Name: Anonymous 2009-05-09 8:36

STOP PROGRAMMING IN C

Name: Anonymous 2009-05-09 9:14

>>54
Why don't you start programming in C, faggot.

Name: Anonymous 2009-05-09 9:16

>>55
It's too hard for him.

Name: Anonymous 2009-05-09 9:30

>>56
I find your use of BBCode questionable. I suggest changing your post to:
>>55
It's too hard for him.

Name: Anonymous 2009-05-09 9:31

>>55
>>56
>>57
READ SICP

Name: Anonymous 2009-05-09 9:46

>>58
>>55
>>56
>>57

READ SIBP

Name: Anonymous 2009-05-09 11:20

>>59
Structure and Interpretation of Butt Plugs?

Name: Anonymous 2009-05-09 11:51

>>60
No.

Name: Anonymous 2009-05-09 12:43

commit c50f8d266cf4757758c952f8fcc721f6a88208c8
tree f03eaf59cfaa8a62ca9d5ecc6f71b7bbc46bebb6
parent 246007a0e71a4d04ea7304c76485ccf45195f63d
author Anonymous <anonymous@world4ch.org>; 1241886665 +0200
committer Anonymous <anonymous@world4ch.org>; 1241886665 +0200

    Correct two small errors to make the code compile.

diff --git a/test.c b/test.c
index 533104c..5c465dc 100644
--- a/test.c
+++ b/test.c
@@ -38,6 +38,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <curses.h>
+#include <stdlib.h>
 
 static void
 curses_cleanup()
@@ -64,7 +65,7 @@ int
 main(int argc, char* argv[])
 {
     for (;;) {
-        static const struct long_options[] = {
+        static const struct option long_options[] = {
             { "help", 0, NULL, 'h' },
             { "version", 0, NULL, 'v' },
             { 0, 0, 0, 0 }

Name: Anonymous 2009-05-09 13:40

>>62
Forgetting the type declaration is a mistake only beginners would make.

Name: Anonymous 2009-05-09 13:46

>>63
I still have much to learn, but I copied word by word from the manual page so it shouldn't have happened.

Name: Anonymous 2009-05-09 15:13

From 0722d41fac095219e008bffd5b8b509bf9274708 Mon Sep 17 00:00:00 2001
From: Anonymous <anonymous@world4ch.org>;
Date: Sat, 9 May 2009 18:33:26 +0200
Subject: [PATCH 1/2] Add a little player at 0,0.

---
 test.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test.c b/test.c
index 5c465dc..db14c39 100644
--- a/test.c
+++ b/test.c
@@ -61,6 +61,10 @@ print_version()
     puts("This is " PACKAGE_NAME " version " PACKAGE_VERSION ".");
 }
 
+static struct {
+    int x, y;
+} u;
+
 int
 main(int argc, char* argv[])
 {
@@ -101,5 +105,10 @@ main(int argc, char* argv[])
     nonl();
     keypad(stdscr, TRUE);
 
+    mvaddch(u.y, u.x, '@');
+    move(u.y, u.x);
+
+    getch();
+
     return EXIT_SUCCESS;
 }
--
1.6.2.4


From 6fa74b541bbacfbc3fc43fc261021e21e815710e Mon Sep 17 00:00:00 2001
From: Anonymous <anonymous@world4ch.org>;
Date: Sat, 9 May 2009 18:34:25 +0200
Subject: [PATCH 2/2] Add config.h for easier compilation.

---
 config.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 config.h

diff --git a/config.h b/config.h
new file mode 100644
index 0000000..14f875a
--- /dev/null
+++ b/config.h
@@ -0,0 +1,2 @@
+#define PACKAGE_NAME "/PROUG/LIKE"
+#define PACKAGE_VERSION "1.0"
--
1.6.2.4

Name: Anonymous 2009-05-09 15:24

>>64
You should probably send an email to whoever wrote that man page and get it fixed.

Name: Anonymous 2009-05-09 15:46

>>66
No, the manual page is right.  I managed to skip that one keyword when copying.

Name: Anonymous 2009-05-09 17:43

[m]From a571bec267c3212cc5631fc425a2e0b7638e5b81 Mon Sep 17 00:00:00 2001
From: Anonymous <anonymous@world4ch.org>;
Date: Sat, 9 May 2009 20:33:21 +0200
Subject: [PATCH 1/4] Add a randomly generated dungeon.

---
 test.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/test.c b/test.c
index db14c39..5bf487a 100644
--- a/test.c
+++ b/test.c
@@ -65,6 +65,46 @@ static struct {
     int x, y;
 } u;
 
+#define LEVEL_W 40
+#define LEVEL_H 20
+
+static unsigned int level[LEVEL_W * LEVEL_H];
+
+static void
+generate_level()
+{
+    unsigned int i;
+
+    for (i = 0; i < LEVEL_W * LEVEL_H; ++i)
+        level[i] = '.';
+
+    for (i = 0; i < LEVEL_W; ++i)
+        level[i] = level[LEVEL_W * (LEVEL_H - 1) + i] = '#';
+
+    for (i = 0; i < LEVEL_H; ++i)
+        level[i * LEVEL_W] = level[(i + 1) * LEVEL_W - 1] = '#';
+
+    unsigned int downx, downy, upx, upy;
+
+    downx = 1 + rand() % (LEVEL_W - 2);
+    downy = 1 + rand() % (LEVEL_H - 2);
+    upx = 1 + rand() % (LEVEL_W - 2);
+    upy = 1 + rand() % (LEVEL_H - 2);
+
+    if (upx == downx && upy == downy) {
+        if (upx == 1)
+            upx++;
+        else
+            upx--;
+    }
+
+    level[upy * LEVEL_W + upx] = '<';
+    level[downy * LEVEL_W + downx] = '>';
+
+    u.x = upx;
+    u.y = upy;
+}
+
 int
 main(int argc, char* argv[])
 {
@@ -105,6 +145,18 @@ main(int argc, char* argv[])
     nonl();
     keypad(stdscr, TRUE);
 
+    unsigned int x, y;
+
+    srand(0);
+
+    generate_level();
+
+    for (y = 0; y < LEVEL_H; ++y) {
+        for (x = 0; x < LEVEL_W; ++x) {
+            mvaddch(y, x, level[y * LEVEL_W + x] & 0xff);
+        }
+    }
+
     mvaddch(u.y, u.x, '@');
     move(u.y, u.x);
 
--
1.6.2.4


From 2cfe10b6966a7138f344c9db3f79b39aee8a9831 Mon Sep 17 00:00:00 2001
From: Anonymous <anonymous@world4ch.org>;
Date: Sat, 9 May 2009 20:43:42 +0200
Subject: [PATCH 2/4] Read user input.

---
 test.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/test.c b/test.c
index 5bf487a..c1b7bfc 100644
--- a/test.c
+++ b/test.c
@@ -151,16 +151,28 @@ main(int argc, char* argv[])
 
     generate_level();
 
-    for (y = 0; y < LEVEL_H; ++y) {
-        for (x = 0; x < LEVEL_W; ++x) {
-            mvaddch(y, x, level[y * LEVEL_W + x] & 0xff);
+    int run = 1;
+
+    while (run) {
+        for (y = 0; y < LEVEL_H; ++y) {
+            for (x = 0; x < LEVEL_W; ++x) {
+                mvaddch(y, x, level[y * LEVEL_W + x] & 0xff);
+            }
+        }
+
+        mvaddch(u.y, u.x, '@');
+        move(u.y, u.x);
+
+        int c = getch();
+
+        switch (c) {
+        case 'q':
+            run = 0;
+            break;
+        default:
+            break;
         }
     }
 
-    mvaddch(u.y, u.x, '@');
-    move(u.y, u.x);
-
-    getch();
-
     return EXIT_SUCCESS;
 }
--
1.6.2.4


From c7aa25f01cb01c453bccc52c34eecf6e45ff197a Mon Sep 17 00:00:00 2001
From: Anonymous <anonymous@world4ch.org>;
Date: Sat, 9 May 2009 23:33:39 +0200
Subject: [PATCH 3/4] Allow movement.

---
 test.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/test.c b/test.c
index c1b7bfc..245dd15 100644
--- a/test.c
+++ b/test.c
@@ -39,6 +39,7 @@
 #include <getopt.h>
 #include <curses.h>
 #include <stdlib.h>
+#include <string.h>
 
 static void
 curses_cleanup()
@@ -164,14 +165,30 @@ main(int argc, char* argv[])
         move(u.y, u.x);
 
         int c = getch();
+        int movex = 0, movey = 0;
 
         switch (c) {
+        case 'h': movex--; break;
+        case 'j': movey++; break;
+        case 'k': movey--; break;
+        case 'l': movex++; break;
+        case 'y': movex--; movey--; break;
+        case 'u': movex++; movey--; break;
+        case 'b': movex--; movey++; break;
+        case 'n': movex++; movey++; break;
         case 'q':
             run = 0;
             break;
         default:
             break;
         }
+
+        if (movex || movey) {
+            if (strchr(".<>", level[(u.y + movey) * LEVEL_W + (u.x + movex)] & 0xff)) {
+                u.x += movex;
+                u.y += movey;
+            }
+        }
     }
 
     return EXIT_SUCCESS;
--
1.6.2.4


From f40bb99b1436deb3bcf80d56c58d08b9c98abc74 Mon Sep 17 00:00:00 2001
From: Anonymous <anonymous@world4ch.org>;
Date: Sat, 9 May 2009 23:33:54 +0200
Subject: [PATCH 4/4] Allow changing levels.

---
 test.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/test.c b/test.c
index 245dd15..36b62f3 100644
--- a/test.c
+++ b/test.c
@@ -176,6 +176,11 @@ main(int argc, char* argv[])
         case 'u': movex++; movey--; break;
         case 'b': movex--; movey++; break;
         case 'n': movex++; movey++; break;
+        case '<':
+        case '>':
+            if (level[u.y * LEVEL_W + u.x] & 0xff == c)
+                generate_level();
+            break;
         case 'q':
             run = 0;
             break;
--
1.6.2.4[/m]

Name: Anonymous 2009-05-09 17:44

The [i] must have pissed ABBC off.  I should use [code] instead.

Name: Anonymous 2009-05-09 18:11

are you people writing in C just to piss me off?

Name: Anonymous 2009-05-09 18:13

>>70
It always isn't about you...

Name: Anonymous 2009-05-09 18:30

>>70
That's right!  You can shove that cudder up your anus!

Name: Anonymous 2009-05-09 19:24

>>70
yes, that's why they invented c

Name: Anonymous 2009-05-10 1:30

Im the project leader ok,
What I say goes and here's what I say
LISP SICP SCHEME CALL-WITH-CURRENT-CONTINUATION

Name: Anonymous 2009-05-10 4:24

>>74
I don't think you're a very good leader, if you don't mind me saying so.

Name: Anonymous 2009-05-10 4:35

C - no thanks

Name: Anonymous 2009-05-10 5:38

What's up with this irrational C hate?  I guess you guys haven't read your SICP enough times.  Away with thee!

Name: Anonymous 2009-05-10 8:00

What's up with this irrational C hate?
It's not irrational, infact it's not even odd.

Name: Anonymous 2009-05-10 9:32

>>78
I see you haven't attained the magical power of satori either.  Hopefully you will end up with it in one of your future lives.

Name: Anonymous 2009-05-10 9:34

>>79
C...Satori
You're confused.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List