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

Pages: 1-4041-8081-120121-160161-200201-

Challenge: 2D Tank

Name: Anonymous 2010-05-14 15:43

The Challenge:
|---->Program a 2d tank application in the language of your choice that adheres to the following:

#-The tank must rotate using the left and right directional keys.
#-The tank must loosely resemble a tank.
#-The tank must move forward or backward respectively from the direction it is facing using the up and down directional keys.
#-Pressing spacebar must fire a 'shot' in the direction the tank is facing.
#-The perspective of the user must be fixed and facing down at the tank.
#-The tank, shot, and ground must each have their own color. (all shots may have the same color)


<------You have 24 hours!------>
GET TO WORK!

Name: Anonymous 2010-05-14 15:48

But /prog/ has... NO PROGRAMMERS.

Name: Anonymous 2010-05-14 15:50

Mosikasite, this is your homework?

Name: Anonymous 2010-05-14 15:51

I'm an artist.
I can paint you a smiling tank crushing little children in Africa.

Name: Anonymous 2010-05-14 15:56

OP this is too hard.

Name: Anonymous 2010-05-14 15:58

MAKE US PROGRAM SOMETHING EASY, LIKE A BUTTSORTER.

Name: Anonymous 2010-05-14 16:00

>>6
I am 12 and what is a buttsorter?

Name: Anonymous 2010-05-14 16:38

>>3
You're an eleven, aren't you
Western romanizers use shi.

Name: Anonymous 2010-05-14 16:47

this almost looks like it would be fun to program, until realizing that graphics are annoying and CLI interfaces are so much better

Name: Anonymous 2010-05-14 17:08

>>9
That didn't stop roguelikes!

Name: Anonymous 2010-05-14 17:14

do your own tank homework

Name: Anonymous 2010-05-14 17:24

>>11
Everyone in /prog/ has been assigned tank homework, but nobody will be doing it.

Name: Anonymous 2010-05-14 17:38

sounds cool op. if I didn't have to much homework I would do this.

Name: Anonymous 2010-05-14 17:46

>>9
For a moment there you had me thinking that someone would consider something other than curses for this problem.

Name: Anonymous 2010-05-14 17:49

>>12
ah, this reminds me of my school time.
it was terrible!
needless to say i was the geekiest kid in school.

Name: Anonymous 2010-05-14 18:04

>>1
I finished early, what do I get?

/* gcc -o susstank -ansi susstank.c -lm `allegro-config --libs` */

/* Copyright (c) 2010 Xarn
 *
 * 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 <stdio.h>
#include <math.h>
#include <allegro.h>

#define WIDTH  729
#define HEIGHT 729

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

int main(void)
{
    int tx = WIDTH / 2, ty = HEIGHT / 2, mx = tx, my = ty, firing = 0;
    fixed tangle = 0, mangle = 0;
    double rtangle = 0, rmangle = 0;
    BITMAP *background, *tank, *miss, *buffa;

    allegro_init();
    install_keyboard();
    install_timer();

    set_color_depth(32);
    if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, WIDTH, HEIGHT, 0, 0) != 0) {
        fprintf(stderr, "Couldn't initialise Allegro!\n");
        return 1;
    }
    set_window_title("SUSSTANK");

    buffa = create_bitmap(WIDTH, HEIGHT);
    background = load_pcx("back.pcx", NULL);
    tank = load_pcx("tank.pcx", NULL);
    miss = load_pcx("miss.pcx", NULL);
    if (!background || !tank || !miss) {
        fprintf(stderr, "Couldn't load images!\n");
        return 2;
    }

    for (;;) {
        int k;

        blit(background, buffa, 0, 0, 0, 0, WIDTH, HEIGHT);
        if (firing)
            pivot_sprite(buffa, miss, mx, my, miss->w / 2, miss->h / 2, mangle);
        pivot_sprite(buffa, tank, tx, ty, tank->w / 2, tank->h / 2, tangle);
        blit(buffa, screen, 0, 0, 0, 0, WIDTH, HEIGHT);

        if (keypressed()) {
            k = readkey();

            if ((k & 0xff) == 'q')
                break;

            switch (k >> 8) {
            case KEY_SPACE:
                if (!firing) {
                    mx = tx;
                    my = ty;
                    mangle = tangle;
                    rmangle = rtangle;
                    firing = 1;
                }
                break;
            case KEY_LEFT:
                tangle -= 8 << 16;
                rtangle = (tangle >> 16) * M_PI / 128;
                break;
            case KEY_RIGHT:
                tangle += 8 << 16;
                rtangle = (tangle >> 16) * M_PI / 128;
                break;
            case KEY_UP:
                tx += 8 * cos(rtangle);
                ty += 8 * sin(rtangle);
                break;
            case KEY_DOWN:
                tx -= 8 * cos(rtangle);
                ty -= 8 * sin(rtangle);
                break;
            }
        }

        if (firing) {
            mx += 20 * cos(rmangle);
            my += 20 * sin(rmangle);
            if (mx < -50 || mx > WIDTH + 50 || my < -50 || my > HEIGHT + 50)
                firing = 0;
        }

        rest(20);
    }

    return 0;
} END_OF_MAIN()


Get images from http://cairnarvon.rotahall.org/susstank/

Name: Anonymous 2010-05-14 18:26

Disclaimer: this code has many examples of "bad practices" because I was 100% focused on minimize coding time while  meeting the requirements

import java.awt.*;
import java.applet.*;
import java.util.*;
import java.awt.event.*;
import java.awt.image.*;

public class a extends Applet implements Runnable,KeyListener{
    double x,y;
    double r,sdx,sdy;
    boolean left,right,down,up;
    double sx=-5,sy=-5;
    int TANK_SIZE=20;
    BufferedImage buf;   
    public void init(){
        x=getWidth()/2;
        y=getHeight()/2;
        addKeyListener(this);
        buf=new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_3BYTE_BGR);
        new Thread(this).start();
    }
    public void update(Graphics g){
        paint(buf.getGraphics());
        g.drawImage(buf, 0,0,null);
    }
    public void paint(Graphics g){
        int[] xpoints=new int[8];
        int[] ypoints=new int[8];
        for(int i=0;i<4;i++){
            xpoints[i]=(int)(x+TANK_SIZE*Math.cos(r+i*Math.PI/2));
            ypoints[i]=(int)(y+TANK_SIZE*Math.sin(r+i*Math.PI/2));           
        }
        xpoints[4]=(4*xpoints[0]+5*xpoints[3])/9;
        ypoints[4]=(4*ypoints[0]+5*ypoints[3])/9;
        xpoints[5]=(int)(x+1.5*TANK_SIZE*Math.cos(r-3*Math.PI/11));
        ypoints[5]=(int)(y+1.5*TANK_SIZE*Math.sin(r-3*Math.PI/11));   
        xpoints[6]=(int)(x+1.5*TANK_SIZE*Math.cos(r-3*Math.PI/13));
        ypoints[6]=(int)(y+1.5*TANK_SIZE*Math.sin(r-3*Math.PI/13));   
        xpoints[7]=(5*xpoints[0]+4*xpoints[3])/9;
        ypoints[7]=(5*ypoints[0]+4*ypoints[3])/9;
        g.setColor(Color.gray);
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(Color.green);
        g.fillPolygon(xpoints,ypoints,8);
        if(left)
            r-=.1;
        if(right)
            r+=.1;
        double dx=Math.cos(r-Math.PI/4);
        double dy=Math.sin(r-Math.PI/4);
        if(up){
            x+=dx*10;
            y+=dy*10;
        }
        if(down){
            x-=dx*10;
            y-=dy*10;
        }
        g.setColor(Color.yellow);
        if(sx!=-5&&sy!=-5){
            sx+=sdx;
            sy+=sdy;
        }
        if(sx<-3||sx>getWidth()||sy<-3||sy>getWidth()){
            sx=-5;
            sy=-5;
        }
        g.fillOval((int)sx-1, (int)sy-1,3, 3);
    }
    public void run() {       
        while(true){
            Graphics g=getGraphics();
            if(g!=null)
            update(getGraphics());
            try{
                Thread.sleep(30);
            }catch(Exception e){}           
        }
    }
    public void keyPressed(KeyEvent e) {   
        switch(e.getKeyCode()){
        case KeyEvent.VK_UP:
            up=true;
            break;
        case KeyEvent.VK_DOWN:
            down=true;
            break;
        case KeyEvent.VK_LEFT:
            left=true;
            break;
        case KeyEvent.VK_RIGHT:
            right=true;
            break;   
        case KeyEvent.VK_SPACE:
            if(sx==-5&&sy==-5){
                sx=x;
                sy=y;
                sdx=Math.cos(r-Math.PI/4)*20;
                sdy=Math.sin(r-Math.PI/4)*20;
            }
            break;
        }
    }
    public void keyReleased(KeyEvent e) {
        switch(e.getKeyCode()){
        case KeyEvent.VK_UP:
            up=false;
            break;
        case KeyEvent.VK_DOWN:
            down=false;
            break;
        case KeyEvent.VK_LEFT:
            left=false;
            break;
        case KeyEvent.VK_RIGHT:
            right=false;
            break;           
        }
    }
    public void keyTyped(KeyEvent e){}   
}

Name: Anonymous 2010-05-14 18:30

>>16
Anyone else get the feeling that Xarn sets these challenges himself, just so that he can be the first to respond

Name: Anonymous 2010-05-14 18:33

>>16
disqualified since suss-mans head does not vaguely resemble a tank. I win.


I didn't know allegro was so clean, nice.

Name: Anonymous 2010-05-14 18:45

>>19
CLEAN MY ANUS

Name: Anonymous 2010-05-14 19:02

>>19
The Sussman's head is actually the missile. The tank is the /prog/snake head.

Name: Anonymous 2010-05-14 19:21

>>17
You know your language sucks when the C version of your program manages to be shorter and more readable. Friends don't let friends use Java.

Name: Anonymous 2010-05-14 19:53

>>16
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

This is unnecessary if you define _BSD_SOURCE or _XOPEN_SOURCE=500. The math.h man page doesn't tell you this for some reason, but M_PI isn't part of ANSI C, so compiling with -ansi undefines it (along with a bunch of other constants).
I initially thought glibc was being retarded, but it turns out it was just poor documentation.

Name: Anonymous 2010-05-14 20:05

>>22
It wasn't written for shortness or readability thus the disclaimer, 100% code time. Also the ugliest part is the tank drawing which the C version sidesteps by using images.

Name: Anonymous 2010-05-14 22:02

>>19
Crap like END_OF_MAIN() is what you consider "clean"? Sorry dude.

Name: Anonymous 2010-05-14 22:14

>>25

compared to the boilerplate needed for win32, opengl or directx to do the same? yes, no contest

Name: Anonymous 2010-05-14 22:17

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

static class Program
{
    static void Main(string[] args)
    {
        using (TankGame game = new TankGame()) game.Run();
    }
}

public class Entity
{
    public Texture2D Texture;
    public Vector2 Location;
    public float Facing;
    public float Velocity;

    public Vector2 Origin { get { return new Vector2(this.Width / 2, this.Height / 2); } }
    public int Height { get { return Texture.Height; } }
    public int Width { get { return Texture.Width; } }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(this.Texture, this.Location, null, Color.White, this.Facing, this.Origin, 1.0f, SpriteEffects.None, 0.0f);
    }

    public void Update()
    {
        Location.X += this.Velocity * (float)Math.Cos(Facing);
        Location.Y += this.Velocity * (float)Math.Sin(Facing);
    }

    public Entity(Texture2D Texture, Vector2 Location, float Facing, float Velocity)
    {
        this.Texture = Texture;
        this.Location = Location;
        this.Facing = Facing;
        this.Velocity = Velocity;
    }
}

public class TankGame : Microsoft.Xna.Framework.Game
{
    const int screenWidth = 420;
    const int screenHeight = 320;

    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    Texture2D tankTexture;
    Texture2D shotTexture;

    Entity tank;
    List<Entity> shots;

    public TankGame()
    {
        graphics = new GraphicsDeviceManager(this);
        this.graphics.PreferredBackBufferHeight = screenHeight;
        this.graphics.PreferredBackBufferWidth = screenWidth;
        Content.RootDirectory = "Content";
    }

    protected override void LoadContent()
    {
        this.spriteBatch = new SpriteBatch(GraphicsDevice);
        this.tankTexture = base.Content.Load<Texture2D>("tank");
        this.shotTexture = base.Content.Load<Texture2D>("shot");

        this.tank = new Entity(tankTexture, new Vector2(screenWidth / 2, screenHeight / 2), 0, 0);
        this.shots = new List<Entity>();
    }

    protected override void Update(GameTime gameTime)
    {
        KeyboardState keyboard = Keyboard.GetState();

        if (keyboard.IsKeyDown(Keys.Space))
            this.shots.Add(new Entity(this.shotTexture, this.tank.Location, this.tank.Facing, 16f));
        if (keyboard.IsKeyDown(Keys.Left))
            this.tank.Facing += (float)Math.PI / 64;
        if (keyboard.IsKeyDown(Keys.Right))
            this.tank.Facing -= (float)Math.PI / 64;
       
        if (keyboard.IsKeyDown(Keys.Up))
            this.tank.Velocity = 4.0f;
        else if (keyboard.IsKeyDown(Keys.Down))
            this.tank.Velocity = -4.0f;
        else
            this.tank.Velocity = 0f;

        this.tank.Update();
        foreach (Entity shot in shots) shot.Update();

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.DarkGreen);

        spriteBatch.Begin();
        this.tank.Draw(this.spriteBatch);
        foreach (Entity shot in shots) shot.Draw(this.spriteBatch);
        spriteBatch.End();

        base.Draw(gameTime);
    }
}

Name: Anonymous 2010-05-14 22:28

>>25
I can only assume you've never used a game programming or graphic library yourself.
You can even leave out END_OF_MAIN(), if you like. It's only there for the retarded platforms. It saves you the effort of having to write a WinMain by hand.

Name: Anonymous 2010-05-14 22:42

>>28
SDL doesn't have to put up with that shit.

Name: Anonymous 2010-05-14 22:46

>>29
But with SDL you're coding with shit.

Name: Anonymous 2010-05-14 23:22

>>30
So why not do the same WinMain hack in Allegro that SDL is using? All they do is #define main to SDLmain or something, and link the "real" main in the library itself.

Name: Anonymous 2010-05-14 23:22

>>25
The people making fun of you are right to do so, but I just wanted to add that END_OF_MAIN() looks very natural in combination with <void.h>

Name: Anonymous 2010-05-15 0:35

a dozen digits of precision for pi

IHBT

Name: Anonymous 2010-05-15 0:38

>>33
Are you one of those "pi = 3" religious nutjobs?

Name: Anonymous 2010-05-15 0:46

>>33
Copy/pasted from math.h.

Name: Anonymous 2010-05-15 1:13

>>33-35
#define M_PI (4*atan(1))

Name: Anonymous 2010-05-15 1:47

>>33
How many is enough? Engineers and physicists usually claim to need about 3-5. I need about 7. Almost no one needs as much as 12, but since it's a constant: why not?

>>36
YOU MENA HASKAL

Name: Anonymous 2010-05-15 1:58

Name: Anonymous 2010-05-15 2:11

I am an Enterprize Java Developer


import java.awt.*;
import java.awt.event.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.lang.Math;


public class tankApp extends java.applet.Applet implements MouseListener, KeyListener {

    private static final long serialVersionUID = 1L;
    boolean start = false;
    double xpos = 0;
    double ypos = 0;
   
    final int distance = 200;
    double counter = 0;
    burret[] shots = new burret[3];
   
    boolean mouseEntered;
    boolean up = false;
    boolean down = false;
    boolean left = false;
    boolean right = false;
   
    Graphics bufferGraphics;
    Image offscreen;
    Image offscreen2;
    Dimension dim;
    Graphics2D g2;
   
    AffineTransform aT;
    AffineTransform rotate;
    Rectangle2D rect = new Rectangle2D.Float(15, 15, 10, 10);
       
    public void init()  {
        int i;
        setBackground(Color.white);
        setSize(640, 480);
        dim = getSize(); 
        offscreen = createImage(dim.width,dim.height);
        bufferGraphics = offscreen.getGraphics();
        offscreen2 = createImage(40,40);
        for(i = 0; i < 3; i++)
        {
            shots[i] = new burret(0, 0, 0);
        }
        g2 = (Graphics2D) offscreen2.getGraphics();
       
        xpos = 0;
        ypos = 0;
               
            addMouseListener(this);
            addKeyListener(this);
            repaint();
    }
       
    public void paint( Graphics g ) {
        int i;
        if(getSize().height != dim.height || getSize().width != dim.width)
        {
            System.out.println(dim + " " + getSize());
            dim = getSize(); 
            offscreen = createImage(dim.width,dim.height);
            offscreen2 = createImage(40,40);
           
            g2 = (Graphics2D) offscreen2.getGraphics();
           
        }
       
        bufferGraphics.clearRect(0,0,dim.width,dim.height);
        g2.clearRect(0, 0, 40, 40);
        g2.setColor(new Color(255, 0, 0, 10));
        g2.fillRect(0,0,40,40);
        g2.setColor(Color.black);
        bufferGraphics.setColor(Color.BLUE);
       
        if(!start)
        {
            bufferGraphics.drawString("Click to start!", dim.width/2 - 100, dim.height/2 - 20);
            bufferGraphics.setColor(Color.white);
        }
       
        aT = g2.getTransform();
        rotate = AffineTransform.getRotateInstance(counter,20,20);
        
        g2.transform(rotate);
        g2.draw(rect);
        g2.drawLine(30, 20, 20, 20);
        g2.setTransform(aT);
        bufferGraphics.drawString("Angle: " + Math.round(180*counter/Math.PI), 5, dim.height - 20);
        bufferGraphics.drawImage(offscreen2,(int)xpos, (int)ypos,this);
      
        for(i=0; i < 3; i++)
       {
           if(shots[i].active == true)
               bufferGraphics.drawRect((int)shots[i].xPos, (int)shots[i].yPos, 5, 5);
       }
      
       g.drawImage(offscreen,0,0,this);
       cont();
    } 
       
   
    private void cont() {
        int i;
        if(xpos > 0 - 20 && ypos > 0 - 20 && ypos < dim.height && xpos < dim.width)
        {
            for(i = 0; i < 3; i++)
            {
                if(shots[i].active == true)
                {
                    shots[i].travel();
                    if(shots[i].timeCounter > distance && shots[i].active == true)
                        shots[i].active = false;
                }
            }
           
            if(up)
            {
                xpos = xpos + Math.cos(counter);
                ypos = ypos + Math.sin(counter);
            }
            if(down)
            {
                xpos = xpos - Math.cos(counter);
                ypos = ypos - Math.sin(counter);
            }
           
            if(right)
            {
                counter = counter + Math.PI/180;
                if(counter >= 2*Math.PI)
                    counter = counter - 2*Math.PI;
               
            }
            if(left)
            {
                counter = counter - Math.PI/180;
                if(counter < 0)
                    counter = counter + 2*Math.PI;
            }
        }
        else
        {
            xpos = dim.width / 2;
            ypos = dim.height / 2;
        }
        repaint();
    }


    public void mouseClicked (MouseEvent me) {  
       
    }
    public void mousePressed (MouseEvent me) {
       
        start = true;
        repaint();
    }

      public void mouseReleased (MouseEvent me) {
         
      }

       public void mouseEntered (MouseEvent me) {
       mouseEntered = true;
       repaint();
      }

       public void mouseExited (MouseEvent me) {
      
       mouseEntered = false;
       repaint();
      } 
      
      public void update(Graphics g)
      {
       paint(g);
      }

    public void keyPressed(KeyEvent e) {
        int key = e.getKeyCode();
        //System.out.println("test ");
          if ( key == KeyEvent.VK_UP )
              up = true;
          if ( key == KeyEvent.VK_LEFT )
              left = true;
          if ( key == KeyEvent.VK_DOWN )
              down = true;
          if ( key == KeyEvent.VK_RIGHT )
              right = true;
             repaint();
             e.consume();
       
    }
   
    public void keyReleased(KeyEvent e) {
        int key = e.getKeyCode();
        int i;
       
          if ( key == KeyEvent.VK_UP )
              up = false;
          if ( key == KeyEvent.VK_LEFT )
              left = false;
          if ( key == KeyEvent.VK_DOWN )
              down = false;
          if ( key == KeyEvent.VK_RIGHT )
              right = false;
          if ( key == KeyEvent.VK_SPACE)
          {
              for(i = 0; i < 3; i++)
              {     
                  if(shots[i].active == false)
                  {
                      shots[i] = new burret(xpos, ypos, counter);
                      shots[i].active = true;
                      i = 3;
                  }
              }
             
          }
       
    }

    public void keyTyped(KeyEvent e) {
    }
}

public class burret {
   
    double xPos;
    double yPos;
    double angle;
    double xComp;
    double yComp;
    double timeCounter;
    boolean active;
   
    public burret(double x, double y, double a)
    {
        xPos = x + 20 - 2.5;
        yPos = y + 20 - 2.5;
        xComp = Math.cos(a);
        yComp = Math.sin(a);
        active = false;
    }
   
    public void travel()
    {
        xPos = xPos + xComp*2;
        yPos = yPos + yComp*2;
        timeCounter++;
    }
   
}

Name: Anonymous 2010-05-15 2:13

>>38
U MENA QUOTE FAILURE

Name: Anonymous 2010-05-15 2:22

>>37
POSIX says that it "shall have type double and shall be accurate within the precision of the double type."
any compiler that isn't horribly broken will turn (4*atan(1)) into a constant at compile time, so there's really no reason not to use that.

Name: Anonymous 2010-05-15 2:48

>>39
WTF is this shit?

Name: Anonymous 2010-05-15 2:49

Another one, just because.
Images here: http://cairnarvon.rotahall.org/pytank/

#!/usr/bin/python

import pyglet
from pyglet.window import key

import math

window = pyglet.window.Window(640, 640, caption="PYTANK")


tank_img = pyglet.image.load('tank.png')
tank_img.anchor_x = tank_img.width / 2
tank_img.anchor_y = tank_img.height / 2

tank = pyglet.sprite.Sprite(tank_img)
tank.x = window.width / 2
tank.y = window.height / 2
tank.rotation = -90

tank.angling, tank.speed = 0, 0

background = pyglet.image.load('background.png').get_texture()
background.offset = [0, 0]

missile_img = pyglet.image.load('missile.png')
missile_img.anchor_x = missile_img.width / 2
missile_img.anchor_y = missile_img.height / 2

missilen = pyglet.graphics.Batch()
missiles = []


def rotate_left():   tank.angling = -3
def rotate_right():  tank.angling = 3
def stop_rotation(): tank.angling = 0
def move_forward():  tank.speed = 4
def move_backward(): tank.speed = -4
def stop_moving():   tank.speed = 0
def fire():
    missiles.append(pyglet.sprite.Sprite(missile_img,
                                         window.width / 2,
                                         window.height / 2,
                                         batch=missilen))
    missiles[-1].angle = (tank.rotation - 180) * math.pi / 180


@window.event
def on_key_press(symbol, modifiers):
    try:
        { key.LEFT: rotate_left,
          key.RIGHT: rotate_right,
          key.UP: move_forward,
          key.DOWN: move_backward,
          key.SPACE: fire,
          key.Q: pyglet.app.exit }[symbol]()
    except:
        pass

@window.event
def on_key_release(symbol, modifiers):
    try:
        { key.LEFT: stop_rotation,
          key.RIGHT: stop_rotation,
          key.UP: stop_moving,
          key.DOWN: stop_moving }[symbol]()
    except:
        pass

@window.event
def on_draw():
    window.clear()
    background.blit(*background.offset)
    missilen.draw()
    tank.draw()


def update(tic):
    dx, dy = 0, 0

    if tank.speed:
        dx = tank.speed * math.sin(tank.rotation * math.pi / 180)
        dy = tank.speed * math.cos(tank.rotation * math.pi / 180)

        background.offset[0] += dx
        while background.offset[0] <= -128:
            background.offset[0] += 128
        while background.offset[0] > 0:
            background.offset[0] -= 128

        background.offset[1] += dy
        while background.offset[1] <= -128:
            background.offset[1] += 128
        while background.offset[1] > 0:
            background.offset[1] -= 128

    for miss in missiles:
        miss.x += dx + 8 * math.sin(miss.angle)
        miss.y += dy + 8 * math.cos(miss.angle)
        miss.rotation += 6

    tank.rotation += tank.angling

pyglet.clock.schedule_interval(update, 1 / 60.)
pyglet.app.run()


(Spot the memory leak.)

Name: niggerballs 2010-05-15 3:02

Why don't you just code this shit in Visual .NET nigger? Goddamn

Name: >>37 2010-05-15 3:17

I didn't mean anything contradictory to that. You might not want to bother wasting compilation time though.

Name: Anonymous 2010-05-15 3:37

There's more code posted in this thread than in all threads of the previous 6 months combined.

Name: Anonymous 2010-05-15 3:37

>>45
the amount of time "wasted" is less than a millisecond, even on hardware that's 15 years old.

Name: Anonymous 2010-05-15 3:38

>>44
* African American

Name: Anonymous 2010-05-15 3:43

>>48
Australian Native American detected.

Name: Anonymous 2010-05-15 3:59

>>47
That's cool and all but you just know that besides causing mass confusion among people who just can't stand it on principle, some shit at Google is going to throw a tantrum over it and advocate the removal of language features if you do something like that. I wish I was joking.

There is also the practical matter that not all FPUs are created equal, and you can end up with (even more) inaccurate values this way. I know it doesn't matter much when your FPU is in a bad way, I'm just saying that for every reason to use the function call, there are two equally insignificant reasons not to. Honestly the only really good reason I can think of not to is inertia.

Name: Anonymous 2010-05-15 4:10

There is also the practical matter that not all FPUs are created equal, and you can end up with (even more) inaccurate values this way.
If your FPU is that broken, you're screwed no matter what you do.

Name: Anonymous 2010-05-15 4:20

>>51
Great job reading all of the words. Also, your statement is pointless: I did not say broken.

Name: Anonymous 2010-05-15 4:24

>>52-50
three troll posts in a row.
similar writing style.
almost exactly 10 minutes between posts.
same person?

Name: Anonymous 2010-05-15 4:46

>>50
some shit at Google

Yeah, fuck you Guido!

Name: Anonymous 2010-05-15 5:52

>>54
Haha, no Guido doesn't count.

Name: Anonymous 2010-05-15 6:04

>>56,53
two troll posts in the same thread.
similar writing style.
almost exactly 1 hour 40 minutes between posts.
HIBT?

Name: Anonymous 2010-05-15 6:17

>>39
The code! It never ends!

Name: Anonymous 2010-05-15 7:37

2D is PIG DISGUSTING

fluxus is superior


(define-struct tank ((pos #:mutable) (rot #:mutable)))

(define player (make-tank (vector 0 0 0) (vector 0 0 0)))

(define shell null)

(define timefired 0)

(define ground-texture (load-texture "green.png"))

(define (draw-ground)
  (with-state
   (translate (vector 0 -2 0))
   (scale (vector 60 60 60))
   (rotate (vector 90 0 0))
   (texture ground-texture)
   (draw-plane)))

(define (tank-paint tank)
  (with-state
   (colour (vector 0.0 0.3 0.0))
   (translate (tank-pos tank))
   (rotate (tank-rot tank))
   (scale (vector 2.0 1.0 2.0))
   (draw-cube)
   (with-state
    (translate (vector 0.0 0.0 -1.0))
    (scale (vector 0.3 0.3 1.0))
    (draw-cube))
   (translate (vector 0.0 -1.0 0.0))
   (scale (vector 1.5 1.0 2.0))
   (draw-cube)))

(define (handle-input)
  (when (key-special-pressed 100)
    (tank-turn player (* 100 (delta))))
  (when (key-special-pressed 102)
    (tank-turn player (* -100 (delta))))
  (when (key-special-pressed 101)
    (tank-drive player (* 4 (delta))))
  (when (key-special-pressed 103)
    (tank-drive player (* -4 (delta))))
  (when (key-special-pressed 8)
    (shoot)))

(define (shoot)
  (cond ((null? shell)
         (set! shell (make-tank (tank-pos player) (tank-rot player)))
         (set! timefired (time))
         (tank-drive shell 3))))

(define (handle-shell)
  (cond ((> (- (time) timefired) 1)
         (set! shell null))
        ((not (null? shell))
         (tank-drive shell (* 30 (delta)))
         (paint-shell))))

(define (paint-shell)
  (with-state
   (colour (vector 1.0 0.0 0.0))
   (translate (tank-pos shell))
   (scale (vector 0.3 0.3 0.3))
   (draw-sphere)))

(every-frame (begin
               (draw-ground)
               (handle-input)
               (handle-shell)
               (tank-paint player)))

(define (tank-turn tank degrees)
  (set-tank-rot! tank (vadd (tank-rot tank) (vector 0 degrees 0))))

(define (tank-drive tank distance)
  (set-tank-pos! tank
                 (vadd
                  (tank-pos tank)
                  (vtransform
                   (vector 0 0 (- distance))
                   (mrotate (tank-rot tank))))))

Name: Anonymous 2010-05-15 7:39

>>1-57
57 troll posts in the same thread.
similar writing style.
variable amounts of time between posts.
trolls trolling trolls

Name: Anonymous 2010-05-15 11:56

>>59
You're not very good at haikus, are you?

Name: Anonymous 2010-05-15 12:50

Is anyone actually trying any of these? >>43 is nice because it's a slightly different interpretation of the assignment.

Name: Anonymous 2010-05-15 12:55

i feel sad that I cant do thi

Name: Anonymous 2010-05-15 13:23

#-The perspective of the user must be fixed and facing down at the tank.

If I am interpreting this correctly, it means that the position of the tank on the screen should be fixed in the centre, and everyone who has tried so far has failed?

Name: Anonymous 2010-05-15 13:40

>>63
Protip: >>43.

Name: Anonymous 2010-05-15 14:30

>>63
Unless you are a lawyer, 'facing down' doesn't mean 'perfectly vertical'.

Name: Leah Culver !1LEahRIBg. 2010-05-15 15:01

I wrote this earlier as a half OO/ half imperative piece of spaghetti. I had planned to give this a proper refactoring, but I got bored halfway through. If anyone else wants to sort it out, you can.

To run, save as tanks.ss, and use the command mred tanks.ss. You have to use mred instead of mzscheme because I used the scheme/gui library.

Also, thanks to the OP for the contest thread, they are always welcome.


#lang scheme/gui
(require scheme/set)
;;;BEGIN LICENSE: Goatse Prostate License (GPL)
;;;g                                               g 
;;;o /     \             \            /    \       o
;;;a|       |             \          |      |      a
;;;t|       `.             |         |       :     t
;;;s`        |             |        \|       |     s
;;;e \       | /       /  \\\   --__ \\       :    e
;;;x  \      \/   _--~~          ~--__| \     |    x 
;;;*   \      \_-~                    ~-_\    |    *
;;;g    \_     \        _.--------.______\|   |    g
;;;o      \     \______// _ ___ _ (_(__>  \   |    o
;;;a       \   .  C ___)  ______ (_(____>  |  /    a
;;;t       /\ |   C ____)/      \ (_____>  |_/     t
;;;s      / /\|   C_____)       |  (___>   /  \    s
;;;e     |   (   _C_____)\______/  // _/ /     \   e
;;;x     |    \  |__   \\_________// (__/       |  x
;;;*    | \    \____)   `----   --'             |  *
;;;g    |  \_          ___\       /_          _/ | g
;;;o   |              /    |     |  \            | o
;;;a   |             |    /       \  \           | a
;;;t   |          / /    |         |  \           |t
;;;s   |         / /      \__/\___/    |          |s
;;;e  |           /        |    |       |         |e
;;;x  |          |         |    |       |         |x
;;;Viewing this goatse gives you the right to freely
;;;use, modify, and distribute this code, as long as
;;;this GPL license comment, ASCII graphic included,
;;;continues to appear in its entirety alongside the
;;;GPL protected code.
;;;jagoffhour.appspot.com/goatse-prostate-license
;;;END LICENSE

;various utilities
(define no-pen       (make-object pen% "BLACK" 1 'transparent))
(define black-pen    (make-object pen% "BLACK" 2 'solid))
(define no-brush     (make-object brush% "BLACK" 'transparent))
(define yellow-brush (make-object brush% "YELLOW" 'solid))
(define green-brush  (make-object brush% "GREEN" 'solid))
(define blue-brush   (make-object brush% "BLUE" 'solid))

(define (pythagoras x y)
  (sqrt (+ (expt x 2) (expt y 2))))

; scheme/class doesn't support monkey patching :(
(define augmented-frame%
  (class frame%
    (define/augment (on-close)
      (send game timer-stop))
    (super-new)))

(define augmented-canvas%
  (class canvas%
    (init-field on-char-callback)
    (define/public (in-canvas? object)
      (let-values (((width height) (send this get-size)))
        (and (<= 0 (get-field x object) width)
             (<= 0 (get-field y object) height))))
    (define/override (on-char ch)
      (on-char-callback ch))
    (super-new)))

(define bullet%
  (class object%
    (init-field canvas x y direction (size 5) (speed 10))
    (super-new)
    (define/public (draw dc)
      (send dc set-pen black-pen)
      (send dc set-brush blue-brush)
      (send dc draw-ellipse x y size size))
    (define/public (update)
      (unless (send canvas in-canvas? this)
        (send game remove-updatee! this))
      (set! x (+ x (* speed (sin direction))))
      (set! y (- y (* speed (cos direction)))))))

(define tank%
  (class object%
    (init-field canvas x y (direction 0) (speed 20) (barrel-length 25) (barrel-width 10))
    (super-new)
    (define (draw-rectangle dc x y width height angle)
      ; ideally this would be a method of a class that implements dc<%>
      ; but since I'm only using it in the tank% class, I'm just making it private
      ; and keeping it here
      (let* ((p1 (make-object point% x y))
             (p2 (make-object point% (- x (* height (sin angle)))
                   (+ y (* height (cos angle)))))
             (p3 (make-object point% (+ x (* width (cos angle)))
                   (+ y (* width (sin angle)))))
             (diagonal-length (pythagoras width height))
             (theta (atan (/ height width)))
             (p4 (make-object point% (+ x (* diagonal-length (cos (+ theta angle))))
                   (+ y (* diagonal-length (sin (+ theta angle)))))))
        (send dc draw-polygon (list p1 p2 p4 p3))))
   
    (define/public (turn amount)
      (set! direction (+ direction amount)))
    (define/public (turn-left)
      (turn (- (/ pi 4))))
    (define/public (turn-right)
      (turn (/ pi 4)))
   
    (define/public (move speed)
      (set! x (+ x (* speed (sin direction))))
      (set! y (- y (* speed (cos direction)))))
    (define/public (move-forward)
      (move speed))
    (define/public (move-backward)
      (move (- speed)))
   
    (define (front-left-corner)
      (let ((hyp (pythagoras 20 10))
            (angle (atan (/ 20 10))))
        (values (+ x (* hyp (sin (- direction angle))))
                (- y (* hyp (cos (- direction angle)))))))
    (define (barrel-front-left)
      (values (+ x (* barrel-length (sin direction)))
              (- y (* barrel-length (cos direction)))))
   
    (define (draw-barrel dc)
      (let-values (((x y) (barrel-front-left)))
        (draw-rectangle dc x y barrel-width barrel-length direction)))
    (define (draw-body dc)
      (let-values (((x y) (front-left-corner)))
        (draw-rectangle dc x y 40 20 direction)))
    (define/public (draw dc)
      (send dc set-pen black-pen)
      (send dc set-brush yellow-brush)
      (draw-body dc)
      (draw-barrel dc))
   
    (define/public (shoot)
      (let-values (((x1 y1) (barrel-front-left)))
        (send game add-updatee! (new bullet% [canvas canvas][x x1] [y y1] [direction direction]))))))

(define game%
  (class object%
    (init-field title width height [updatees (set)])
   
    (define timer (new timer% [interval 100] [just-once? #f]
                       [notify-callback
                        (lambda ()
                          (set-for-each updatees (lambda (x) (send x update)))
                          (redraw))]))
   
    (define/public (add-updatee! object)
      (set! updatees (set-add updatees object)))
    (define/public (remove-updatee! object)
      (set! updatees (set-remove updatees object)))
    (define/public (timer-stop)
      (send timer stop))
   
    (define frame (new augmented-frame% [label title] [width width] [height height]))
    (define (redraw)
      (draw-background )
      (send tank draw dc)
      (set-for-each updatees (lambda (x) (send x draw dc))))
   
    (define canvas
      (new augmented-canvas% [parent frame]
           [paint-callback (lambda (canvas dc)
                             (redraw))]
           [on-char-callback
            (lambda (ch)
              (case (send ch get-key-code)
                ((left) (send tank turn-left))
                ((right) (send tank turn-right))
                ((up) (send tank move-forward))
                ((down) (send tank move-backward))
                ((#\space) (send tank shoot)))
              (redraw))]))
    (define dc (send canvas get-dc))
    (define (draw-background)
      (let-values (((width height) (send canvas get-client-size)))
        (send dc set-pen no-pen)
        (send dc set-brush green-brush)
        (send dc draw-rectangle 0 0 width height)))
    (define/public (show)
      (send frame show #t))
    (define tank
      (new tank% [canvas canvas][x 100] [y 100] [direction 0]))
    (super-new)))

(define game (new game% [title "Tank \"game\""] [width 300] [height 300]))

(send game show)

Name: Anonymous 2010-05-15 15:10

>>66
default-load-handler: cannot open input file: "/usr/lib/plt/collects/scheme/set.ss" (No such file or directory; errno=2)

Name: Anonymous 2010-05-15 15:28

>>67
what version are you using?

Name: Anonymous 2010-05-15 15:31

>>68
4.2.4. Updated to full-4.2.5.16, then it worked.

Name: Anonymous 2010-05-15 15:39

>>69
update to myanus

Name: Anonymous 2010-05-15 15:53

All submissions have been received, the challenge is now closed.
We will start reviewing your submissions and decide which ever coder won.

Thank you for your time.

Name: Anonymous 2010-05-15 16:49

Bampu for excitement!

Name: Anonymous 2010-05-15 16:51

THANK YOU FOR MY ANUS

Name: >>66 2010-05-15 17:51

>>74
I'm sorry to say that the Goatse Prostate License isn't my invention :( and so I will decline your prize.

Name: Anonymous 2010-05-15 17:57

Two prizes for Xarn. Looking forward to the next one.

Name: Anonymous 2010-05-15 18:01

>>66
This is what happens when you read SICP.

Name: Anonymous 2010-05-15 22:27

This was a good thread. We should have more of them.

Name: Anonymous 2010-05-16 1:03

>>78
agreed

Name: Anonymous 2010-05-16 9:54

Where can I find <math.h> <allegro.h> ? The ones on sourceforge dont work

Name: Anonymous 2010-05-16 10:06

>>80
LOOK IN MY ANUS

Name: Anonymous 2010-05-16 10:15

>>80
sudo apt-get install libc6-dev liballegro4.2-dev

Name: Anonymous 2010-05-16 15:29

>>82

C:\>sudo apt-get install libc6-dev liballegro4.2-dev
'sudo' is not recognized as an internal or external command,
operable program or batch file.

Name: Anonymous 2010-05-16 15:41

>>83
Your platform doesn't even have a C compiler. Your efforts are wasted, due to nobody's fault but your own.

Name: Anonymous 2010-05-16 15:55

>>82
$ sudo apt-get install libc6-dev liballegro4.2-dev
This is not Ubuntu, faggot.

Name: Anonymous 2010-05-16 16:09

>>83

C:\> <- I think I found your problem.

Last time I checked, windows doesn't have sudo, apt-get or any unix command.

Name: Anonymous 2010-05-16 16:12

>>86
Before anybody blasts me... I know apt-get is not "unix" nor is it used in real "unix" systems, because they use a ports system. I was more or less talking about *nix userlandish commands.

Name: Anonymous 2010-05-16 16:21

>>86-87
CLAP FUCKING CLAP

Name: Anonymous 2010-05-16 16:24

>>86
It does have a posix subsystem, and there's also cygwin and mingw. As for the native C compiler: it comes with many development packages, but since most packages are distributed as binaries by default, there's no need to include the compiler unless the user is a developer, in which case he can install everything he needs himself.

Name: Anonymous 2010-05-16 17:29

>>85
It's assumed that anyone who doesn't use Ubanto knows what he's doing to an extent sufficient that he can locate and install libc and one of the most popular C game programming libraries around himself.

Name: Anonymous 2010-05-16 17:39

>>90
HIBT? or am I really going to have to explain a relatively old joke?

Name: Anonymous 2010-05-16 18:27

2D tank
#-The perspective of the user must be fixed and facing down at the tank.

I know I'm late to the party but umm.... you ain't gunna see shit captain

Name: Anonymous 2010-05-16 18:34

>>91
Idiot. The fact that it's a meme doesn't mean that it's empty of content, and >>90 replied to that content. You're the kind of person that gives meme-spouters a bad name.

>>92
Just go away. Your interpretation has been noted and implemented even before your joke was made the first time, thirty posts ago.

Name: Anonymous 2010-05-16 18:41

>>90
Haha, fuck you, idiot.

Name: Anonymous 2010-05-17 2:20

>>25
END_OF_MAIN() is optional in the latest version of allegro.

Name: Anonymous 2010-05-17 4:16

>>82
I'm on windows

Name: Anonymous 2010-05-17 4:29

Name: Anonymous 2010-05-17 4:44

>>97
fuck that shit I'm putting in a Linux Mint livecd

Name: Anonymous 2010-05-17 4:45

>>98
linux mint is just some gay ubuntu wannabe distro.

Name: !GtGMOOTdOg 2010-05-17 4:56

100GET!

Name: Anonymous 2010-05-17 4:58

>>100
ZOMG EPIC WIN!

Name: Anonymous 2010-05-17 5:06

>>99
Why does it matter to virgin nerds what linux distro I use?

Name: Anonymous 2010-05-17 5:28

>>102
it doesn't, as long as you don't come back complaining about how much your ass hurts.

Name: Anonymous 2010-05-17 5:33

>>103
Are you an queer!

Name: Anonymous 2010-05-17 5:36

>>104
sorry, i'm not. you'll have to find someone else to have buttsex with.

Name: Anonymous 2010-05-17 5:52

>>105
I volunteer!

Name: Anonymous 2010-05-17 6:01

I unvolunteer >>106 and instead volunteer >>109

Name: Anonymous 2010-05-17 6:19

>>107
U MENA >>105

Name: Anonymous 2010-05-17 6:44

You require my services >>109?

Name: Anonymous 2010-05-17 8:12

>>102
This, especially Gentoo users.

Name: Anonymous 2010-05-17 13:04

Thank goodness you guys have gotten back to quality distro-bashing and accusations of homosexuality. I was worried that there might actually be from programming going on here.

Name: Anonymous 2010-05-17 17:00

>>111
WORRY MY ANUS

Name: Anonymous 2010-05-17 17:29

>>85
Hey, you seem pretty knowledgeable about this kind of thing; how do I install SDL in cygwin for mingw?

Name: Anonymous 2010-05-17 17:54

>>111
Well, this thread is basically over, now that the winners have been announced. What more do you expect?

Name: Anonymous 2010-05-17 18:20

>>113
download the source and compile it with -mno-cygwin.
or just forget about mingw and use cygwin's setup.exe.

Name: Anonymous 2010-05-17 21:27

>>115
Will the SDL only be able to use X11 that way?

Name: Anonymous 2010-05-17 21:52

>>116
if you compile the source yourself, that depends on how you configure it.

Name: Help!! 2010-05-18 9:39

>>16

Tank.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘-’ token
Tank.c:1: error: stray ‘`’ in program
Tank.c:1: error: stray ‘`’ in program
In file included from /usr/include/stdio.h:75,
                 from Tank.c:24:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:364: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:373: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:493: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from Tank.c:24:
/usr/include/stdio.h:312: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:319: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:361: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:363: error: format string argument not a string type
/usr/include/stdio.h:365: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:678: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:684: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:706: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:708: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
Tank.c:26:21: error: allegro.h: No such file or directory
Tank.c: In function ‘main’:
Tank.c:38: error: ‘fixed’ undeclared (first use in this function)
Tank.c:38: error: (Each undeclared identifier is reported only once
Tank.c:38: error: for each function it appears in.)
Tank.c:38: error: expected ‘;’ before ‘tangle’
Tank.c:40: error: ‘BITMAP’ undeclared (first use in this function)
Tank.c:40: error: ‘background’ undeclared (first use in this function)
Tank.c:40: error: ‘tank’ undeclared (first use in this function)
Tank.c:40: error: ‘miss’ undeclared (first use in this function)
Tank.c:40: error: ‘buffa’ undeclared (first use in this function)
Tank.c:47: error: ‘GFX_AUTODETECT_WINDOWED’ undeclared (first use in this function)
Tank.c:67: error: ‘mangle’ undeclared (first use in this function)
Tank.c:68: error: ‘tangle’ undeclared (first use in this function)
Tank.c:69: error: ‘screen’ undeclared (first use in this function)
Tank.c:78: error: ‘KEY_SPACE’ undeclared (first use in this function)
Tank.c:87: error: ‘KEY_LEFT’ undeclared (first use in this function)
Tank.c:91: error: ‘KEY_RIGHT’ undeclared (first use in this function)
Tank.c:95: error: ‘KEY_UP’ undeclared (first use in this function)
Tank.c:99: error: ‘KEY_DOWN’ undeclared (first use in this function)
Tank.c: In function ‘END_OF_MAIN’:
Tank.c:117: error: expected ‘{’ at end of input

Name: Anonymous 2010-05-18 11:55

>>118
That's really impressive.

Name: Anonymous 2010-05-18 11:57

>>118
Tank.c:26:21: error: allegro.h: No such file or directory

Name: Anonymous 2010-05-18 13:28

>>118
Expert Eclipse user.

Name: Anonymous 2010-05-18 18:50

>>118
I find it interesting that, in the phrase first use in this function, all of the words except for first are highlighted as keywords.

Maybe this is some sort of protest message against the use of first/rest in place of car/cdr in Lisp?

Name: Anonymous 2010-05-18 19:26

car use in this function

Name: Anonymous 2010-05-19 15:58

We need more threads like this. Can we get a date for the next one?

Name: Anonymous 2010-05-19 16:06

>>124
whenever someone thinks up a new one

Name: Anonymous 2010-05-19 17:48

fixed or not, use string in this function

Name: Anonymous 2010-05-19 18:33

>>117
So what about if I install with setup.exe? And if I were to compile it myself, how ought I to configure it?

Name: Anonymous 2010-05-19 19:30


goto register for new and explicit private friend

Name: Anonymous 2010-05-19 19:39


do do do do do do do#########################################
for do do do do goto
do do do do do do do#########################################
for do do do do goto
do do do do do do do#########################################
for do do do do goto
do do do do do do do#########################################

#############################################################

#############################################################

#############################################################

Name: Anonymous 2010-05-19 19:43


____________________________
|                           |
|                           |
|            /**/           |
|          /******/         |
|        /**********/       |
|       /************/      |
|        /**********/       |
|          /******/         |
|            /**/           |
|                           |
|                           |
|___________________________|

Name: Anonymous 2010-05-19 19:45

BONJOUR MY ANUS

reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################
reinterpret_case                ################

Name: Anonymous 2010-05-19 19:46

MERDE! J'AI ULTRAFAIL

reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################
reinterpret_cast                ################

Name: Anonymous 2010-05-19 19:47

CIAO MY ANUS

"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS
"HAXMYANUSHAXMYANUS"                  #HAXMYANUSHAXMYANUS

Name: Anonymous 2010-05-19 19:53

Do Vatican City next.

Name: Anonymous 2010-05-19 19:56

>>134
n ou

Name: Anonymous 2010-05-19 21:51

Bump for /prog/scii art. This is a truly innovative art form the likes of which has likely never been seen before.

Name: Anonymous 2010-05-19 23:02

>>132
Oh this is legendary.

Name: Anonymous 2010-05-20 1:43

Ill get right to that, as soon as I figure out how to get this snot off my fingers

Name: Anonymous 2010-05-20 6:53


/**/   extern  /**/ extern    /**/
  /**/   goto  /**/ goto    /**/
if  /**/   if  /**/ if    /**/  if
goto  /**/     /**/     /**/  goto
extern  /**/   /**/   /**/  extern
operator  /**/ /**/ /**/  operator
               /**/
/*********************************/
/*********************************/
               /**/
operator  /**/ /**/ /**/  operator
extern  /**/   /**/   /**/  extern
goto  /**/     /**/     /**/  goto
if  /**/   if  /**/ if    /**/  if
  /**/   goto  /**/ goto    /**/
/**/   extern  /**/ extern    /**/

Name: Anonymous 2010-05-20 6:55

>>139
God save the queen! ಥ_ಥ

Name: Anonymous 2010-05-20 9:53

Fuck America, we got real liberty.

##################################################
##################################################
##################################################
##################################################
##################################################
##################################################
##################################################







reinterpret_cast reinterpret_cast reinterpret_cast
reinterpret_cast reinterpret_cast reinterpret_cast
reinterpret_cast reinterpret_cast reinterpret_cast
reinterpret_cast reinterpret_cast reinterpret_cast
reinterpret_cast reinterpret_cast reinterpret_cast
reinterpret_cast reinterpret_cast reinterpret_cast
reinterpret_cast reinterpret_cast reinterpret_cast

Name: Anonymous 2010-05-20 11:39

>>141
Luxembourg?

Name: Anonymous 2010-05-20 12:12

>>141
Why is the bottom right black?

Name: Anonymous 2010-05-20 12:16


####################################################
####################################################
####################################################
::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::
####################################################
####################################################
####################################################

Name: Anonymous 2010-05-20 12:55

It's to show the multicutural society of the Netherlands

Name: Anonymous 2010-05-20 13:10

>>145
or more likey:

BB CODE FAIL

Name: Anonymous 2010-05-20 13:57

Java has saved us all!

Name: Anonymous 2010-05-20 14:21

>>147
Java
saved

I don't think so, Tim!

Name: Anonymous 2010-05-20 15:01

Isn't there any image apart from a flag that's comprised of nothing but red, green, blue, #EFEFEF and black?

Name: Anonymous 2010-05-20 17:26

. /  | /  / /  /  / // / ハ.    ヽ    ヽ. \
/' 丁|'  i l /   /// 〃/  \ ̄ \!     |\|
\/ j|  ,レ' _ / /.///./  _ \  |\. | |/
. /__」ヒ.´_彡'_>=,ニドノ'  //  'ァ,.'ニ=<} '  | | 
/  {{ ̄ { \ #⌒!|  //    "⌒!i ノ ,'   /! /
,/  {ハ..  \__, ゞ冖^  /' !     ̄^` ブ ///
   ハ. \   く             __  ∠ イ ,ノ'
  ,/ ,ハ 7`ト _,>       __,. イ !   /〃/
f´ ̄ヽ ヾ、'.{}ヘ.     `'マ二..__ /   /{}ヽ》
_) >┴=く¨ヽ ヽ.、       --     , イ   }}
/  '´   \レ-、V__. 、      _,. イ/{{ヽ{}/《
  .'      `て{ ヽ\ `  -- /  / {{-- −}}
 '    '    __j| ,ヘ \.  ∧_/  {{ /{}ヽ }}
,'    ,'   (_ |ヽ{i,ハ   ヽ、」.  \ {{.    }}
    ,'     〕|__ __ |/.,二f丑:‐ 、\{ ヽ {} /}}
         ( }}/{}ヽ|/  /ハ 「 \ヽ|{ ー i ‐.}}

Name: Anonymous 2010-05-20 19:03

>>150
Sugoi!

Name: Anonymous 2010-05-20 20:45

>>150
Excellent use of code tags.

Name: Anonymous 2010-05-20 21:48


#include <SDL/SDL.h>
#include <OpenGL/gl.h>
#include <iostream>
#include <list>
#include <math.h>
#include "Sound.h"

#define square(x) ((x) * (x))

enum Type {kSprite, kObstacle, kLaser, kTank};

using namespace std;

list<struct Sprite*> gSprites;
unsigned char *gKeys;
float gTime = 0.0; // time in seconds
float gTimeIncrement;

struct Point{
    float x, y;
    };

// should draw in range -1 to 1
struct Sprite{
    float x, y;
    float oldX, oldY;
    float angle;
    float size;
    float speed;
    float turn;
    int player; // 0 is non-player sprite
    Type type;
    void MoveTo(float newX, float newY){
        oldX = x, oldY = y;
        x = newX, y = newY;
        }
    void UndoMove(){ x = oldX, y = oldY; }
    float Speed() { return speed * gTimeIncrement; }
    float Turn() { return turn * gTimeIncrement; }
    void Forward(float distance) {
        MoveTo(x + distance * sin(angle),
            y + distance * cos(angle));
        }
    // translate to global coordinates
    Point Vector(float pX, float pY){
        Point p;
        float sine = sin(angle), cosine = cos(angle);
        p.x = size * (pY * sine + pX * cosine);
        p.y = size * (pY * cosine - pX * sine);
        return p;
        }
    Point Global(float pX, float pY){
        Point p;
        float sine = sin(angle), cosine = cos(angle);
        p.x = size * (pY * sine + pX * cosine) + x;
        p.y = size * (pY * cosine - pX * sine) + y;
        return p;
        }
    virtual void Draw() {}
    virtual void Move() { Forward(Speed()); }
    virtual void Collision(Sprite *sprite) {}
    Sprite(){
        x = 0, y = 0;
        angle = 0, size = 10;
        speed = 0, turn = 4;
        player = 0, type = kSprite;
        }
    };

struct Maze : Sprite{
   
    virtual void Draw(){
        glLineWidth(10.0);
        glBegin(GL_LINE_STRIP);
        glColor3f(0,1,0);
        glVertex2f(-99,-74);
        glVertex2f(99,-74);
        glVertex2f(99,74);
        glVertex2f(-99,74);
        glVertex2f(-99,-74);
        glEnd();
        }
    Maze(){ size = 1; }
    };

struct Obstacle : Sprite{
    virtual void Draw(){
        float i;
        glLineWidth(3);
        glBegin(GL_LINE_STRIP);
        glColor3f(0,1,0);
        for(i = 0; i < 2 * M_PI; i += .4)
            glVertex2f(cos(i),sin(i));
        glVertex2f(cos(2 * M_PI), sin(2 * M_PI));
        glEnd();
        }
    Obstacle(float pX, float pY, float theSize){
        x = pX, y = pY, size = theSize, type = kObstacle;
        }
    };

struct Laser : Sprite{
    float decay; // invisible once decay == 0
    bool bounced; // only bounces once
    virtual void Move() {
        if(decay <= 0) gSprites.remove(this);
        decay -= gTimeIncrement * (bounced ? .6 : .3);
        Sprite::Move();
        }
    virtual void Draw(){
        glLineWidth(5.0);
        glBegin(GL_LINES);
        glColor4f(1, .5, 0, decay);
        glVertex2f(0,-1);
        glColor4f(1, 1, 0, decay);
        glVertex2f(0,1);
        glEnd();
        }
    virtual void Collision(Sprite *s){
        if(!bounced){
            switch(s->type){
                case kTank:
                    if(s->player != player){
                        Point impact = Vector(0,.02);
                        s->x += impact.x;
                        s->y += impact.y;
                        }
                    else break;
                case kObstacle:
                    angle += M_PI + ((rand() %101) - 50.0) / 50.0;
                    bounced = true;
                };
            }
        }
    Laser(int thePlayer, Point p, float a){
        x = p.x, y = p.y, size = 10,
        angle = a, speed = 80;
        player = thePlayer, type = kLaser;
        decay = 1.0, bounced = false;
       
        }
    };

struct Tank : Sprite{
    int fireAngle; // 0,1, or 2
    int soundChannel;
    void ShootLaser() {
        float laserAngle = ((rand() % 41) - 20.0) / 200.0 + angle;
        gSprites.push_back(new Laser(player,Global(0,.7),laserAngle));
        if(soundChannel == -1 || !IsPlaying(soundChannel));
            soundChannel = PlaySound("laser2");
        }
    virtual void Draw(){
        glBegin(GL_TRIANGLES);
        glColor3f(0, .5, 1);
        glVertex2f(-1, -1);
        glVertex2f(1, -1);
        glColor3f(0,1,1);
        glVertex2f(0,1);
        glEnd();
        }
    virtual void Collision(Sprite *sprite){
        if(sprite->type == kObstacle) UndoMove();
        }
    Tank(){
        size = 7; speed = 40; type = kTank, soundChannel = -1;
        }
    };

struct Player : Tank{
    virtual void Move(){
        if(player == 1){
            if(gKeys[SDLK_RIGHT]) angle += Turn();
            if(gKeys[SDLK_LEFT]) angle -= Turn();
            if(gKeys[SDLK_UP]) Forward(Speed());
            if(gKeys[SDLK_DOWN]) Forward(-Speed());
            if(gKeys[SDLK_SPACE]) ShootLaser();
            }
        if(player == 2){
            if(gKeys[SDLK_e]) angle += Turn();
            if(gKeys[SDLK_a]) angle -= Turn();
            if(gKeys[SDLK_COMMA]) Forward(Speed());
            if(gKeys[SDLK_o]) Forward(-Speed());
            if(gKeys[SDLK_TAB]) ShootLaser();
            }
        }
    Player(int playerNumber){
        player = playerNumber;
        if(player == 1) x = 80, angle -= M_PI / 2.0;
        if(player == 2) x = -80, angle += M_PI / 2.0;
        }
    };

int gDone;// = 0;

void MoveSprites();
void DetectCollisions();
void DrawSprites();

int SDL_main(int argc,char* argv[])
{
SDL_Surface *screen;
SDL_Event event;

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
InitializeSound();
LoadSounds();

screen = SDL_SetVideoMode(800, 600, 32, SDL_OPENGL/* | SDL_FULLSCREEN*/);
glViewport(0, 0, screen->w, screen->h);
glOrtho(-100, 100, -75, 75, 0, 1);
glClearColor(0, 0, 0, 1);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_LINE_SMOOTH);

gSprites.push_back(new Maze());
gSprites.push_back(new Obstacle(50,40,20));
gSprites.push_back(new Obstacle(-30,-10,30));
gSprites.push_back(new Obstacle(60,-20,10));

gSprites.push_back(new Player(1));
gSprites.push_back(new Player(2));

while(!gDone){
    if(!SDL_PollEvent(&event)){
        gKeys = SDL_GetKeyState(NULL);
        gTimeIncrement = (double)SDL_GetTicks() / (double)1000.0 - gTime;
        gTime += gTimeIncrement;
       
        MoveSprites();
        DetectCollisions();
        DrawSprites();
        SDL_Delay(15);
        continue;
        }
    switch(event.type){
        case SDL_MOUSEBUTTONDOWN:
            gDone = 1;
            break;
        }
    }

SDL_Quit();

return 0;
}

void MoveSprites()
{
list<Sprite*>::iterator i;

for(i = gSprites.begin(); i != gSprites.end(); ++i)
    (*i)->Move();
}

void DetectCollisions()
{
list<Sprite*>::iterator i;

//cerr << "@";
for(i = gSprites.begin(); i != gSprites.end(); ++i){
    Sprite *sprite = (*i);
    list<Sprite*>::iterator i2 = i;
   
    //cerr << ".";
    for(++i2; i2 != gSprites.end(); ++i2){
        Sprite *sprite2 = (*i2);
        float dx = sprite2->x - sprite->x;
        float dy = sprite2->y - sprite->y;
       
        //cerr << "!";
        // first objects are probably more permanent
        // (bullets might want to delete themselves on collision)
        if(square(dx) + square(dy) <= square(sprite->size + sprite2->size)){
            //cerr << "W";
            sprite->Collision(sprite2);
            sprite2->Collision(sprite);
            }
        }
    }
}

void DrawSprites()
{
list<Sprite*>::iterator i;

glClear(GL_COLOR_BUFFER_BIT);
for(i = gSprites.begin(); i != gSprites.end(); ++i){
    Sprite *sprite = *i;
    float spriteSize = sprite->size;
   
    glPushMatrix();
    glTranslatef(sprite->x, sprite->y, 0);
    glRotatef(180.0 * sprite->angle / M_PI, 0, 0, -1);
    glScalef(spriteSize, spriteSize, spriteSize);
    sprite->Draw();
    glPopMatrix();
    }
SDL_GL_SwapBuffers();
}

Name: Anonymous 2010-05-21 0:19

>>153
It's 2 player!  If only I had friends...

Name: Anonymous 2010-05-21 1:19

>>154
So submit an RFE to include "new friends."

Name: Anonymous 2010-05-21 12:13

>>153
to run on *nix :

--- original.cpp    2010-05-21 18:06:19.913591576 +0200
+++ linux.cpp    2010-05-21 18:11:20.216878465 +0200
@@ -1,9 +1,9 @@
+/* g++ -lSDL -lGL tank.cpp && ./a.out */
 #include <SDL/SDL.h>
-#include <OpenGL/gl.h>
+#include <GL/gl.h>
 #include <iostream>
 #include <list>
 #include <math.h>
-#include "Sound.h"
 
 #define square(x) ((x) * (x))
 
@@ -143,12 +143,9 @@
 
 struct Tank : Sprite{
     int fireAngle; // 0,1, or 2
-    int soundChannel;
     void ShootLaser() {
         float laserAngle = ((rand() % 41) - 20.0) / 200.0 + angle;
         gSprites.push_back(new Laser(player,Global(0,.7),laserAngle));
-        if(soundChannel == -1 || !IsPlaying(soundChannel));
-            soundChannel = PlaySound("laser2");
         }
     virtual void Draw(){
         glBegin(GL_TRIANGLES);
@@ -163,7 +160,7 @@
         if(sprite->type == kObstacle) UndoMove();
         }
     Tank(){
-        size = 7; speed = 40; type = kTank, soundChannel = -1;
+        size = 7; speed = 40; type = kTank;
         }
     };
 
@@ -197,14 +194,12 @@
 void DetectCollisions();
 void DrawSprites();
 
-int SDL_main(int argc,char* argv[])
+int main(int argc,char* argv[])
 {
 SDL_Surface *screen;
 SDL_Event event;
 
 SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
-InitializeSound();
-LoadSounds();
 
 screen = SDL_SetVideoMode(800, 600, 32, SDL_OPENGL/* | SDL_FULLSCREEN*/);
 glViewport(0, 0, screen->w, screen->h);

Name: Anonymous 2010-05-21 12:20

>>156
RUN ON MY ANUS

Name: Anonymous 2010-05-21 14:49

I didn't even use any classes.

import sys, os
import pygame
import math
import random
import time
from pygame.locals import *

if not pygame.font : print "Fonts's turned off"
if not pygame.mixer : print "Sound's turned off"
if not pygame.key : print "Input's turned off"

pygame.init ()
pygame.font.init()
clock = pygame.time.Clock()
def input(events):
    for event in events:
        if event.type == QUIT:
            sys.exit (0)
        else :
            print event
           
os.environ['SDL_VIDEO_CENTERED'] = '1'
window = pygame.display.set_mode ((800, 600))
pygame.display.set_caption (' Simple Shooter' )
screen = pygame.display.get_surface ()


tangent = pygame.key.get_pressed
spelare_y = 0
spelare_x = 100
spelare_rect = pygame.Rect (spelare_x, spelare_y, 80, 60 )

pos_x = 400
pos_y = 400
target_rect = pygame.Rect (pos_x, pos_y, 80, 60)

cirkel_y = spelare_y
cirkel_x = spelare_x + 50
cirkel_rect = pygame.Rect (cirkel_x, cirkel_y, 30, 30)
cirkel_aktiv = 0

targetz = 0

font = pygame.font.SysFont (None, 48)
font_2 = pygame.font.SysFont (None, 22)
start_text = font.render ("A GAME!", True, (255,255,255))
score_int = 0
score_str = str(score_int)
score_text = font_2.render ("Score:" + score_str, True, (255,255,255))

screen.blit (start_text, (0,0))
pygame.display.update()
time.sleep (3.0)
screen.fill ((0,0,0))

while True:
    pygame.key.get_pressed()
    input(pygame.event.get())
    clock.tick(60)
    if tangent() [K_ESCAPE] == True:
        pygame.quit()
        sys.exit()
       
    if tangent() [K_UP]== True:
        if spelare_y >= 15 :
            spelare_y = spelare_y - 15
            if cirkel_aktiv == 0:
                cirkel_y = spelare_y
               
    if tangent () [K_DOWN] == True:
        if spelare_y <= 525:
            spelare_y = spelare_y + 15
            if cirkel_aktiv == 0:
                cirkel_y = spelare_y

    if pos_y >= 15:
           
        pos_y = pos_y + random.choice ([-4,-5,-2, -3, +2, +3])
        target_rect = pygame.Rect (pos_x, pos_y, 80, 60)

       
        if pos_y <= 525 +60:
            
            pos_y = pos_y + random.choice ([+8,+4,+3, - 3, -2, -5])
            target_rect = pygame.Rect (pos_x, pos_y, 80, 60)
           
       
    if tangent () [K_SPACE] == True:
        cirkel_aktiv = 1
       
    if cirkel_aktiv == 1:
        cirkel_x = cirkel_x + 10
        pygame.draw.circle(screen, (30,97,200), (cirkel_x, cirkel_y), 20, 0)
        cirkel_rect = pygame.Rect (cirkel_x, cirkel_y, 30, 30)
        pygame.display.update()
       
    if cirkel_x >= 799:
        cirkel_aktiv = 0
        cirkel_y = spelare_y + 30
        cirkel_x = spelare_x + 120
        pygame.draw.circle(screen, (30,97,200), (cirkel_x, cirkel_y), 20, 0)
        cirkel_rect = pygame.Rect (cirkel_x, cirkel_y, 30, 30)
       
    if cirkel_rect.colliderect (target_rect) == True:
        cirkel_aktiv = 0
        cirkel_x = spelare_x +  20
        cirkel_y = spelare_y + 30
        cirkel_rect = pygame.Rect (cirkel_x, cirkel_y, 30, 30)
        score_int = score_int + 10
        score_str = str(score_int)
        score_text = font_2.render ("Score:" + score_str, True, (255,255,255))
       
    screen.fill ((0,0,0))
    pygame.draw.rect (screen, (230,160, 125), (pos_x,pos_y,80,60)) 
    pygame.draw.rect(screen, (200,200,200),(spelare_x, spelare_y, 80, 60))
    screen.blit (score_text, (0,0))
   
    if cirkel_aktiv == 0:
        pygame.display.update()

Name: Anonymous 2010-05-21 14:53

>>158
I didn't even use any [code] tags.
Fixed that for you.

Name: Anonymous 2010-05-21 17:05

>>159
Back to proggit, Please!

Name: Anonymous 2010-05-21 17:35

>>160
Go read SICP or something.

Name: Anonymous 2010-05-22 6:41

>>159
I didn't even use any glasses.
Well, WHOOP-DE-DOO, ``he with perfect sight''

Name: Anonymous 2010-05-22 19:47

.lol(

Name: Anonymous 2010-05-26 4:16

What happened to the results?!? Where is >>74 ?!?!? WTF?

Name: Anonymous 2010-05-26 4:50

>>164
ok thats fucked up. what butt hurt mod deleted it?

Name: Anonymous 2010-05-26 5:30

What was >>74?

Name: Anonymous 2010-05-26 5:34

>>166
The results of who one each category.

Name: Anonymous 2010-05-26 5:38

>>167
*won

Name: Anonymous 2010-05-26 10:45

I think every program won in at least one category. Obviously the result of pragu'es hidden communist agenda!

If we ever have another good thread like this again, we should properly critique programs and rate them from 1-10 on the INDUSTRY STANDARD PTS (Prague Troll Scale).

Name: Anonymous 2010-05-26 11:04

[b]NEW RESULTS:[b]
EVERYONE IS A WINNER!!!!!!!!!!!!!!!!!!!!!!!!

Name: 170 2010-05-26 11:04

except me /b

Name: Anonymous 2010-05-26 15:43

So, who is up for Round 2: 3D Tank?

Requirements: Same as above, only in 3D perspective. Additionally, must be no more than 4kb of executable code and data (total) and include an award-winning soundtrack no less than 20 minutes in duration.

Name: Anonymous 2010-05-26 15:55

>>170
Loser.

Name: Anonymous 2010-05-26 16:02

>>172
A 20 minute soundtrack in less than 4kb, that's going to be very repetitive.

Name: Anonymous 2010-05-26 16:04

>>174
No it isn't. Think outside of your stored data box.

Name: Anonymous 2010-05-26 16:04

>>172

>>58 is a 3D version, in ~2kb of code, although it doesn't have sound.

Of course, that's probably not what you meant. But I don't think anyone here can produce a 4k executable that fulfills those requirements.

Name: Anonymous 2010-05-26 16:08

>>172
Hold on let me go back to the early 90s when programmers had Amigas and executable space was still an issue

Name: Anonymous 2010-05-26 16:34

>>177
and fractal generators were all the rage, that might make >>175-kun happy.

Name: Anonymous 2010-05-26 17:24

>>176
I meant full executable size, statically linked. I should have been more clear.

>>177
:| This isn't about necessity. It's about badassery. I figured you would have learned the difference when I fucked your mom, ``son.''

http://www.youtube.com/watch?v=_YWMGuh15nE

Name: Anonymous 2010-05-26 17:26

>>174
http://www.youtube.com/watch?v=rD-U_wGFt5s
http://www.youtube.com/watch?v=_YWMGuh15nE
http://www.youtube.com/watch?v=MwVsATdGdpg
Have a browse, there's plenty more of those.

I could probably do the sound dev for that challenge, but I'm kind of over 4k stuff. But I bet if you extended it to 8kb you could very easily stuff in a full networked version.

Name: >>172,179 2010-05-26 20:20

>>180
4k challenges on /prog/ are about as sensible as shutting up, getting things done and not trolling each other on /prog/: never mind the implications, it's just not going to happen. I only brought it up because I felt like shitposting.

Name: Anonymous 2010-05-26 20:39

>>181
What if I do it?

Name: Anonymous 2010-05-26 21:19

>>182
The "award-winning" requirement was put there to ensure you don't. If you do manage to pull it off I am sure someone will be happy to suck your dick for it.

Name: Anonymous 2010-05-29 6:04

>>16

line 38: variable 'tangle' not found
'tangle = 0, mangle = 0 int'

Name: Anonymous 2010-05-29 6:42

>>172
Stream it from YouTube.

Name: Anonymous 2010-05-29 10:34

>>184
Your compiler is broken, or you don't know how to use it. tangle is clearly declared.

Name: Anonymous 2010-05-29 11:54

>>186
My compiler is smarter and quicker

Name: Anonymous 2010-05-29 12:05

>>185
STREAM MY ANUS
>>187
130kb of pure lean code amirite?

Name: Anonymous 2010-05-29 12:53

>>188
amirite

Back to /b/, please

Name: Anonymous 2010-05-29 13:40

Name: Anonymous 2010-05-29 13:45

Name: Anonymous 2010-05-30 2:25

>>191
Hey!
That doesn't exist yet!

Name: Anonymous 2010-05-30 7:06

i am so glad i stopped wasting my life with programming. now i have so much time to waste on other, more enjoyable things like games and explicitly sexual videos(no homosex).

Name: Anonymous 2010-05-30 8:18

>>193
Back to /b/ please

Name: Anonymous 2010-05-30 8:50

>>193
Same here, i watch anime and rock/metal videos.
Programming for fun is like cleaning oil spills for fun.

Name: Anonymous 2010-05-30 10:31

>>193,195
Read SICP

Name: Anonymous 2010-05-30 13:37

Can someone compile >>16 as an .exe for me?

Name: Anonymous 2010-05-30 15:19

>>197
If this isn't a perfect opportunity to fuck up some random idiot's computer, I don't know what is.

Except I'm too lazy to bother writing something malicious.

Name: Anonymous 2010-05-30 15:48

>>198
Rest assured nigger, I'll run it in a VM.

Name: Anonymous 2010-05-30 15:58

>>199
But I am not black!

Name: Anonymous 2010-05-30 16:25

>>200
But you're as dumb as one fuck-stick

Name: Anonymous 2010-05-30 16:41

>>199
So, you can set up a VM, but you can't manage to compile a single-file program?

Name: Anonymous 2010-05-30 16:53

>>202
I did; I get an error on line 38 but Bjarne Xarn says there is no error.

Name: Anonymous 2010-05-30 17:00

>>203
Replace it with a float, if your implementation doesn't support it. It must be some c99 abuse.

Name: Anonymous 2010-05-30 17:09

>>201
How dumb is one fuck-stick?

Name: Anonymous 2010-05-30 17:13

>>205
twice as dumb as half a fuck-stick

Name: Anonymous 2010-05-30 17:36

>>204
Xarn writes perfect ANSI C. If it's erroring on allegro_init(), which is line 38, >>203 has fucked up either his Allegro install or his compiler arguments.

If you're talking about fixed, which >>203 wasn't, that's part of Allegro, not C99.

Name: Anonymous 2010-05-31 2:15

Xarnbump.

Name: Anonymous 2010-05-31 4:49

>>207
I use Miracle C compiler the best C compiler known to man

Name: Anonymous 2010-05-31 5:54

>>209
o rly

Name: Anonymous 2010-05-31 8:47

Use this --> http://en.wikipedia.org/wiki/Troll2D. Much better than Allegro.

Name: Anonymous 2010-05-31 9:07

>>211
That's a Sepples library, dipshit.

Name: Anonymous 2011-02-03 5:43

Name: Anonymous 2011-02-03 8:12

Name: Anonymous 2013-07-07 21:21

Golang version when?

Name: Anonymous 2013-07-07 21:38

Shit, I'm three years late. Can I have an extension?

Name: Anonymous 2013-07-08 1:10

>>216
Only for another 8 months, bucko.

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