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

Simple Challenge: Link vs Goombas

Name: Anonymous 2010-06-07 17:22

Program a game in which the 'player' controls the likeness of Link(Zelda). The objective of the game is to defeat as many 'Goombas'(Mario Bros.) as they can before dieing. The rest is up to you.

Only one factor of your program will be judged: fun-ness.

Get to work!

Name: Anonymous 2010-06-07 17:26

The homeworks are getting more and more retarded.

Name: Anonymous 2010-06-07 17:27

>>1
How is this simple?

Also: INB4 import pygame

Name: Anonymous 2010-06-07 17:28

>>2
and yet if its called a challenge, people are willing to do it.

Name: Anonymous 2010-06-07 17:31

>>4
That remains to be seen.

Name: Anonymous 2010-06-07 17:33

#!/bin/sh
# Link vs Goombas v0.01
# "The rest is up to you."
#       - Anonymous, 2010-06-07 17:22
if ! which VisualBoyAdvance; then \
 wget 'http://downloads.sourceforge.net/project/vba/VisualBoyAdvance/1.7.2/VisualBoyAdvance-src-1.7.2.tar.gz?use_mirror=ovh'
 tar -xf VisualBoyAdvance-src-1.7.2.tar.gz
 cd Visual*
 ./configure && make && sudo make install
 cd -
fi
for i in find ~ -iname zelda; do \
 VisualBoyAdvance $i
done

Name: Anonymous 2010-06-07 17:48

When's the deadline? If you'll give me a few days I'll take a shot at it.

Name: OP 2010-06-07 17:50

>>7
OK: Thursday, 11:59 pm

Name: Anonymous 2010-06-07 18:09

>>8
yes that's perfect as the home work is due on friday

Name: Anonymous 2010-06-07 18:10

I would participate, but I am finishing up my Tetris clone and hopefully going to start making it multiplayer sometime in the next few days (never done that before, or gotten a project this far) so I will be busy

NEXT /prog/ CHALLENGE WILL BE MINE

Name: Anonymous 2010-06-07 18:10

>>9
[quote=Professor] Everyone, I want you to write me a Nintendo-based minigame by Friday.[/quote]

Name: Anonymous 2010-06-07 20:42

>>11
I wish my college was this awesome.

Name: Anonymous 2010-06-07 21:02

wtf it's not a challenge.  It's too vague.


while 1:
    raw_input('PRESS ENTER TO KILL GOOMBA')
    print'DEAD\n'

Name: Anonymous 2010-06-07 21:06

>>13
Something tells me you aren't going to win.

Name: Anonymous 2010-06-07 21:09

>>14
If nobody else submits code then he may just win.

Name: Anonymous 2010-06-07 21:30

>>3
seems pretty simple, making it fun is a waste of time though.

Name: Anonymous 2010-06-07 22:51

>>13
Nope, your entry isn't fun at all.

Its actually very challenging in a sense that its based on creativity rather than technical prowess.

Name: Anonymous 2010-06-07 22:59

>>17
Technical prowess also comes into it to a fairly significant extent. It's a pretty good challenge, really, and I'm sure as soon as Xarn posts his first entry the others will join in.

Name: Anonymous 2010-06-07 23:52

Antu s[etrm

Name: Anonymous 2010-06-08 0:41

My game is the best

#include <signal.h>
#include <stdio.h>

main() {
  (void) signal(0xFFFFFFFF,handler);
  FILE* f = fopen("blah","w");
  f->_ptr=0;
  for(;;) {
     fprintf(f,"DEAD FUCKING GOOMBA");
  }
}

void handler(int sig)
{
  return;
}

Name: Anonymous 2010-06-08 1:18

>>20
Please change it so that the signal handler kills the Goomba. You'll want to avoid printf() though.

Name: Anonymous 2010-06-08 1:26

>>20
Nobody run this. Shit was annoying.

Name: Anonymous 2010-06-08 1:27

>>20
Someone please ban this fucker.

Name: Anonymous 2010-06-08 1:30

>>20
FFFFFFFFFFFFFFFUUU

Name: Anonymous 2010-06-08 1:31

>Lets run 6 lines of C code that we don't understand... it has an infinite loop in it though it must be cool!!"

Name: Anonymous 2010-06-08 1:34

>>22
>>23
>>24
This is what reading SICP does to young programmers.

Name: Anonymous 2010-06-08 2:47

>>1
I'll do this if nobody else does by tomorrow BUT I REFUSE TO MAKE IT FUN.

Name: ❣IHBT❣ 2010-06-08 4:03

>>22-24
LEARN C ALREADY

Name: Anonymous 2010-06-08 5:21

>>28
No! Its not functional. Its a terrible way to go about programming. I suffer from acute cognitive dissonance.

Name: Anonymous 2010-06-08 5:35

>>29
As someone whose code is mostly functional, wether I write it in Lisp or in C, I don't see how this matters. C is an imperative language, but you can write in a functional manner in any language. Use clear inputs, don't modify inputs in the function, unless such an argument is marked as an output parameter (it's not uncommon in C to use output parameters as there's no multiple return values in C), don't cause any side-effects to the outside environment inside the function, unless that's the function's purpose to begin with. Don't have your function depending on internal state that's not part of the argument if you can help it(for example, it cannot be helped for things like the PRNG or I/O). It makes testing code easier and you end up with more robust programs. You can apply these ideas to any language worth its salt.

However, using a purely functional language that forces you to emulate state when you need state seems more like S&M to me.

Name: !!6jdcWKmuoBWAEld 2010-06-08 5:37

Name: Anonymous 2010-06-08 6:04

>>30
USE BINARY HEAPS NEWBY

Name: Anonymous 2010-06-08 8:41

First entry?

~:javac Mario.java
~:java Mario


import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

public class Mario extends JFrame implements KeyListener, Runnable {
    public static void main(String[] args) {
        Mario m = new Mario();
        while(true) m.restart();
    }
   
    private static final int G = 4;
    private static final int WIDTH = 50;
    private static final int HEIGHT = 30;
    private static final int WGRID = 20;
    private static final int HGRID = 20;
    private static final long GAMERATE = 50;

    private double px, py, pvx, pvy, pay;
    private BufferedImage canvas;
    private Random rand;
    private Thread painter;
    private boolean l, r, failure;
    private ArrayList<Integer> goombas;
    private long startTime;
    private int bounces;
   
    public Mario() {
        super("Link v. Goombas");
        setSize(WIDTH * WGRID, HEIGHT * HGRID);
        setResizable(false);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        addKeyListener(this);
        rand = new Random();
        setVisible(true);
        canvas = new BufferedImage(WIDTH * WGRID, HEIGHT * HGRID, BufferedImage.TYPE_3BYTE_BGR);
    }
    public void restart() {
        if(painter != null) painter.interrupt();
        goombas = new ArrayList<Integer>();
        px = WIDTH*WGRID/2 - WGRID/2;
        py = pvx = pvy = 0;
        pay = G;
        failure = false;
        bounces = 0;
        l = r = false;
        goombas.add((int)px);
        startTime = System.currentTimeMillis();
        painter = new Thread(this);
        painter.start();
        try {
            painter.join();
        }
        catch(Exception e) { }
    }
    public void run() {
        long ltime = System.currentTimeMillis();
        while(true) {
            long ctime = System.currentTimeMillis();
            if(ctime != ltime) {
                react((ctime - ltime)/(double)GAMERATE);
                paint(getGraphics());
                ltime = ctime;
            }
            if(failure) return;
            try {
                Thread.sleep(1);
            }
            catch(Exception e) {
                return;
            }
        }
    }
    public void react(double frac) {
        double vfrac = frac;
        if(l == true && pvx > -30) pvx -= 3*frac;
        else if(r == true && pvx < 30) pvx += 3*frac;
        else {
            if(pvx > 0) pvx = Math.max(0, pvx-1*frac);
            if(pvx < 0) pvx = Math.min(0, pvx+1*frac);
        }
        px += pvx*frac;
        if(py + pvy * frac + HGRID >= (HEIGHT - 2) * HGRID) {
            double nfrac = ((HEIGHT - 3) * HGRID - py)/pvy;
            py += pvy * nfrac;
            vfrac = (frac - nfrac);
            for(int i = 0; i < goombas.size(); i++) {
                if(goombas.get(i) <= px + HGRID && goombas.get(i) + 2*HGRID >= px) {
                    pvy = -pvy;
                    goombas.remove(i);
                    bounces++;
                    break;
                }
            }
        }
        py += pvy*vfrac;
        double opvy = pvy;
        if((pvy <= 60 || pay <= 0) && (pvy >= -60 || pay >= 0)) pvy += pay*vfrac;
        if(opvy <= 0 && pvy >= 0) {
            int expectedGoombas = Math.max(1, 5-((int)((System.currentTimeMillis() - startTime)/1000))/15);
            for(int i = goombas.size(); i < expectedGoombas; i++) {
                int k;
                while(true) {
                    k = rand.nextInt((WIDTH-2) * HGRID);
                    boolean col = false;
                    for(int g : goombas) if(k <= g + HGRID*2 && k + 2*HGRID >= g) col = true;
                    if(!col) break;
                }
                goombas.add(k);
            }
        }
        if(py >= (HEIGHT - 1) * HGRID) {
            JOptionPane.showMessageDialog(this, "You lost! You bounced " + bounces + " time(s) and survived " + (System.currentTimeMillis() - startTime)/1000 + " seconds.");
            failure = true;
        }
        if(px < 0 && pvx < 0) pvx = -pvx;
        if(px >= (WIDTH - 1) * WGRID && pvx > 0) pvx = -pvx;
    }
    public void paint(Graphics gr) {
        Graphics g = canvas.getGraphics();
        g.setColor(Color.gray);
        g.fillRect(0, 0, WIDTH * WGRID, HEIGHT * HGRID);
        g.setColor(Color.green);
        g.fillRect(0, (HEIGHT - 1) * HGRID, WIDTH * WGRID, HEIGHT * HGRID);
        g.setColor(new Color(139, 69, 19));
        for(Integer i : goombas) g.fillRect(i, (HEIGHT-2) * HGRID, WGRID*2, HGRID);
        g.setColor(Color.red);
        g.fillRect((int)px, (int)py, WGRID, HGRID);
        gr.drawImage(canvas, 0, 0, null);
    }
    public void keyPressed(KeyEvent e) {
        switch(e.getKeyCode()) {
            case KeyEvent.VK_LEFT: l = true; r = false; break;
            case KeyEvent.VK_RIGHT: r = true; l = false; break;
            default: break;
        }
    }
    public void keyReleased(KeyEvent e) {
        switch(e.getKeyCode()) {
            case KeyEvent.VK_LEFT: l = false; break;
            case KeyEvent.VK_RIGHT: r = false; break;
            default: break;
        }
    }
    public void keyTyped(KeyEvent e) {}
}

Name: Anonymous 2010-06-08 8:54

>>33
Hey, I've played this before.

Name: Anonymous 2010-06-08 10:10

* Goombae

Name: Anonymous 2010-06-08 10:53

Goomba, Goomba, Goombam, Goombae, Goombae, Goomba.
Goombae, Goombae, Goombas, Goombarum, Goombis, Goombis.

Name: Anonymous 2010-06-08 11:41

>>33

sombody make this a .deb

Name: Anonymous 2010-06-08 11:55

>>37
GTFO

Name: Anonymous 2010-06-08 12:05

>>38

i just don't have native java script support in Ubuntu dumbass

Name: Anonymous 2010-06-08 12:09

>>39
Well then you have two problems.

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