little games

G

Gaijinco

Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Thanks a lot.
 
N

Nathan Mates

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.
I'm trying to look for other games suitable to those restrictions.

Pong? Breakout? Tetris? Asteriods? Lunar Lander? Basically, look at
games from the late 70s/early 80s, and tell your students to make one.

Nathan Mates
 
C

Clever Monkey

Gaijinco said:
Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Thanks a lot.
Hunt the Wumpus, for that old-skool flavour.
 
B

blangela

Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Thanks a lot.

Consider using the Allegro gaming library for your course. The gaming
library code is written in C and can therefore be used in both C and C+
+ courses. Will allow students to develop more interesting/complex
games. The library code is open source, so students can view
internals of functions if they so wish. Deitel Deitel's "C How To
Program" 5th edition has a good introduction in Chapter 15.

Cheers,

Bob L.
 
D

dominic.connor

To me a good game has a wide range of weapons with strengths and
weaknesses, maybe puzzles as well, just so long as things blow up :)

I'd drop the "graphics" bit, as far as I know it's been a *long* time
since any serious code was written with curses or ascii graphics.
Perhaps go for cleverness of coding, and gameplay, since they're not
anywhere near commercial graphics.

Thus I'd give them something like "adventure" to write. You wander
through some environment and encounter things that you can kill with
the right weapon, or are components of weapons, or enable you to get
to places where you can find weapons.

The interaction is Computer: "You are surrounded by goats"
Player "Kill goats with knife"
Computer : "The goats eat the knife, they thank you for the meal"
Style of fing...
If text parsing is too much work, then accept a grammar of
F1= List Items
F2,1 = Kill with item 1
F3,1 = Drop Item 1
F4 pick up item

I think this is a nice candidate for them to explore object
orientation.
You have a base class
ThingYouCanFind

Derive from it weapon, door key, clue, alien
Different methods, for each class, and of course if you have weapon
broken into components then you can have notions of what C++ class
structure should bring them togther.
Since weapons and alien classes will interact (usually violently) you
allow them to explore class interactions, maybe friends, maybe
pointers to functions.

A depressing % of my life is explaining to CS grads that their skills
are worthless to banks, so am happy that a university actually has a C+
+ professor.
If you have a very very good student with C++, I know some banks that
would like to hire him for sums that he will find wholly accetpable.
 
C

Christopher Benson-Manica

In comp.lang.c blangela said:
Consider using the Allegro gaming library for your course. The gaming
library code is written in C and can therefore be used in both C and C+
+ courses.

Not all C code can or should be used in a C++ course. The following
C program illustrates the point nicely:

#include <stdlib.h>

int main(void) {
char *new = malloc( 10 );
free( new );
return 0;
}

There are at least two features of this program that a C++ compiler
will choke on.
 
M

Marcus Kwok

In comp.lang.c++ Christopher Benson-Manica said:
Not all C code can or should be used in a C++ course. The following
C program illustrates the point nicely:

#include <stdlib.h>

int main(void) {
char *new = malloc( 10 );
free( new );
return 0;
}

There are at least two features of this program that a C++ compiler
will choke on.

True, but there is also a non-empty set of C programs that will compile
and run just fine when compiled with a C++ compiler. Personally, I know
nothing about the Allegro library, but it may fit in this latter
category (or it may not). However, many compilers also offer the option
to compile both C and C++ code, with switches to control which way the
code is interpreted; linking to the C library may require the use of
extern "C" modifiers though. A large part of C++'s design was to remain
somewhat compatible with existing C code.
 
R

Richard Heathfield

Christopher Benson-Manica said:
Not all C code can or should be used in a C++ course.

Nevertheless, the fact that Allegro has C bindings means that it can be
used as a "black box" library as part of a C++ course. Okay, it's not
exactly strictly conforming portable code, but it exists in (at least)
Win32 and Linux flavours, so there is a reasonable nod towards
cross-platformity.
The following
C program illustrates the point nicely:

#include <stdlib.h>

int main(void) {
char *new = malloc( 10 );
free( new );
return 0;
}

There are at least two features of this program that a C++ compiler
will choke on.

Irrelevant, since nobody is suggesting compiling Allegro with a C++
compiler. What matters is that it has C bindings, so it can be *linked*
into either a C program or a C++ program.
 
M

Malcolm McLean

Nathan Mates said:
Pong? Breakout? Tetris? Asteriods? Lunar Lander? Basically, look at
games from the late 70s/early 80s, and tell your students to make one.
Snake is a good one. Two players move snakes about trying to eat dots which
steadily get longer. When you crash you die.

You can write a perfectly acceptable space invaders in ASCII. Try to get
them to give it a twist, such as dead invaders come down in a plume of
asterisks and crash on top of your cities.

Maze programs are always nice. A fill in one in three maze is trivial to
program, a really good maze quite a bit harder.

Puzzles like connect 4, or draughts, or battleships can fairly easily be
programmed. Then there is always the mole game. Mole pops up, and you have
to hit the keypad button before he pops down again. Acceptable in these days
of detachable keyboards but not on a Beeb.

Hangman is a good cop-out for the weaker students.
 
S

Sherm Pendley

Gaijinco said:
Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Rogue and its many descendants:

<http://en.wikipedia.org/wiki/Roguelike>

sherm--
 
Z

zircher

Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Rogue-like adventure games easily fall within that definition.
Coincidentially, the 7 day rogue-like challenge is going on and it can
give an idea of the wide range of possibilities within that theme.

http://groups.google.com/group/rec.games.roguelike.development/topics?lnk=iggc
 
D

Default User

To me a good game has a wide range of weapons with strengths and
weaknesses, maybe puzzles as well, just so long as things blow up :)

I'd drop the "graphics" bit, as far as I know it's been a long time
since any serious code was written with curses or ascii graphics.
Perhaps go for cleverness of coding, and gameplay, since they're not
anywhere near commercial graphics.

Thus I'd give them something like "adventure" to write. You wander
through some environment and encounter things that you can kill with
the right weapon, or are components of weapons, or enable you to get
to places where you can find weapons.

The interaction is Computer: "You are surrounded by goats"
Player "Kill goats with knife"
Computer : "The goats eat the knife, they thank you for the meal"
Style of fing...
If text parsing is too much work, then accept a grammar of
F1= List Items
F2,1 = Kill with item 1
F3,1 = Drop Item 1
F4 pick up item


To really simplify the grammar and parser for a text-adventure game, go
back to the two-word verb/object system. Each input is a verb followed
by an optional noun.




Brian
 
C

Christopher Benson-Manica

In comp.lang.c Richard Heathfield said:
Irrelevant, since nobody is suggesting compiling Allegro with a C++
compiler.

No one explicitly suggested it, but in the absence of specific
knowledge concerning Allegro it seemed like an assumption in the
realm of possibility. I stand corrected.
 
K

Kornel Kisielewicz

In a state of madness zircher wrote the following :
Rogue-like adventure games easily fall within that definition.
Coincidentially, the 7 day rogue-like challenge is going on and it can
give an idea of the wide range of possibilities within that theme.

Do you truly believe you can ask students on a course to write a
roguelike? :p.
 
J

JoeC

Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Thanks a lot.

Hola, yo ha escrito una juego en la computora. Hice un in perl y orta
se llama pennies and prizes. Ellos estan puesto. Ha ido a Colombia y
me gusta hacer juegos e C++ y antes perl. Por Favor busca aqui:
http://www.planetsourcecode.com/vb/...lngWId=3&B1=Quick+Search&optSort=Alphabetical
http://www.planetsourcecode.com/vb/...lngWId=6&B1=Quick+Search&optSort=Alphabetical
 
J

JoeC

Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

Thanks a lot.

Aqui es otro que me gusta jugar no se como se hice pero son graphicos
ASCII.

http://www.adom.de/
 
R

Richard Heathfield

Christopher Benson-Manica said:
No one explicitly suggested it, but in the absence of specific
knowledge concerning Allegro it seemed like an assumption in the
realm of possibility. I stand corrected.

No harm done, Christopher. Was it me that suggested Allegro? I can't now
be bothered to check. If not, may I offer my congratulations to whoever
it was? Excellent idea. BUT don't ever buy an Austin Allegro, unless
you're a scrap metal dealer.
 
R

Richard Heathfield

Gaijinco said:
Hi my name is Carlos Obregón and I'm currently a profesor of C/C++
programming at the CUMD in Bogotá Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

This isn't really a great deal to do with C, but I do get fed up with
all the "you can't do spit in C" nonsense, and encouraging teachers to
teach standard C can't be a bad thing.

So yes, I have a game for you. I don't know what this game is called,
but it's easily doable within your restrictions. If you can play
Minesweeper (specify a location on the grid), you can play this. Here's
the game:

You have a grid, m * n cells in size. Clearly, this grid is composed of
four corner cells each having two neighbour cells, 2(m + n - 2) - 4
edge cells each having three neighbour cells, and (m-2)(n-2) internal
cells, each having four neighbour cells.

Let each cell have three characteristics - an owner, a capacity, and a
population. The owner is one of { None, Human, Computer }, and the
capacity is equal to the number of neighbour cells. We'll deal with
population in a second. The display should be somehow capable of
conveying both the ownership of a cell and its current population,
simultaneously. We'll cover that again in a minute.

All cells start with a population of 1. A cell can never be empty.

Human and computer take turns. Who starts? Up to you.

In each turn, the player simply selects a cell. That's all! It must be
either a cell that the player owns, or a neutral cell. (Equivalently,
it must not be a cell owned by the opposing player.) If a player
selects a neutral cell, he gains ownership of that cell.

The act of selecting a cell adds 1 to its population. If the resulting
population remains within the capacity of the cell, nothing happens.
Otherwise, the cell "explodes", and ALL the units of population that it
is storing (except one) are distributed equally amongst its neighbours,
adding 1 to their populations. This may in turn cause /them/ to
explode, distributing /their/ populations around the cells. Whenever a
cell explodes, the player gains ownership of all its neighbour cells.

Example from top left corner of board:

+-----+-----+-----+-----+-----+--...
| H | C | N | N | N |
| | | | | |
| 2 | 3 | 1 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| N | C | C | N | N |
| | | | | |
| 1 | 4 | 2 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| H | H | H | H | C |
| | | | | |
| 2 | 1 | 3 | 1 | 2 |
+-----+-----+-----+-----+-----+--...
| | | | | |

Computer selects the cell one-down one-right from the top left (the
details of the co-ordinate system for cell selection and of course the
way in which you display the grid is entirely up to you).

Since the selected cell has four neighbours, it has a capacity of 4. But
it also has a population of 4. So selecting it causes it to "explode",
with the following result:

+-----+-----+-----+-----+-----+--...
| H | C | N | N | N |
| | | | | |
| 2 | 4 | 1 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| C | C | C | N | N |
| | | | | |
| 2 | 1 | 3 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| H | C | H | H | C |
| | | | | |
| 2 | 2 | 3 | 1 | 2 |
+-----+-----+-----+-----+-----+--...
| | | | | |

Note that the computer has gained two cells as a direct result of this
explosion - one that was previously neutral, and one from the human. We
now note that there is a cell on the top row that has a population (4)
exceeding its capacity (3). (The capacity is 3 because the cell has
only three neighbours.) So we must now explode this cell, with the
following result:

+-----+-----+-----+-----+-----+--...
| C | C | C | N | N |
| | | | | |
| 3 | 1 | 2 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| C | C | C | N | N |
| | | | | |
| 2 | 2 | 3 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| H | C | H | H | C |
| | | | | |
| 2 | 2 | 3 | 1 | 2 |
+-----+-----+-----+-----+-----+--...
| | | | | |

The computer has gained another couple of cells here. And now the corner
cell exceeds its capacity, so we must explode that too:

+-----+-----+-----+-----+-----+--...
| C | C | C | N | N |
| | | | | |
| 1 | 2 | 2 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| C | C | C | N | N |
| | | | | |
| 3 | 2 | 3 | 1 | 1 |
+-----+-----+-----+-----+-----+--...
| H | C | H | H | C |
| | | | | |
| 2 | 2 | 3 | 1 | 2 |
+-----+-----+-----+-----+-----+--...
| | | | | |

All quiet again after the excitement, and it's the other player's turn.

Eminently programmable in ISO C. You might want to try to combine the
ownership and population information into a single symbol (e.g. 1234
for human 1234, ABCD for computer 1234, and . for neutral 1), as this
would save you from needing grid lines.
 
Z

zircher

Kornel said:
Do you truly believe you can ask students on a course to write a
roguelike? :p.

Sure! Think of all the things a rogue-like goal can teach students.
Displays, user input, file IO, objects, list management, conditional
logic, etc. The low technology requirements means that nearly any
machine can be used for such a class project. When I was teaching
myself how to program back in the day of 8-bit machines, I wrote a
dungeon crawl program so I know it is not an impossible goal. I
didn't even have the benefit of an instructor at the time.
 
R

Richard Bos

Gaijinco said:
Hi my name is Carlos Obreg=F3n and I'm currently a profesor of C/C++
programming at the CUMD in Bogot=E1 Colombia.

This last term I ask my students to develop an implementation of the
minesweeper game with ASCII graphics and input via keyboard.

I'm trying to look for other games suitable to those restrictions.

Does anyone knows a good candidate?

If you want a true ISO C program, without even the need to assume ASCII,
positionable screens, or pollable keyboards - IOW, something whose I/O
can be written using only <stdio.h> - you could try getting them to
write a text adventure.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top