> Programming is about writing programs...
Gavino --- I'm going to be like a teacher and give you an assignment! These are the rules of the assignment:
1.) Until you finish your assignment, you are not allowed to start any more of these idiotic threads on comp.lang.forth (or comp.lang.lisp etc.) --- if you do, you will just be reminded that you haven't finished your assignment.
2.) When you finish your assignment, I will put your program in the novice-package --- you will be famous! --- there is no better path to Forth fame than this!
Here is the assignment: write a BreakOut game in ANS-Forth. I did this myself on the Commodore Vic-20 in line-number BASIC when I was about 16 years old (not as complicated as what I'm describing here; I ran into severe speed problems and had to keep things simple). I had to take recourse in unlawful carnal knowledge of BASIC to get my program to run at reasonable speed. You can write your program in ANS-Forth though because the modern computers are much faster than the Vic-20. Use these characters:
] these represent the left wall
[ these represent the right wall
O this represents your ball
[#] these represent the bricks, which form a wall along the top of the screen (a space between)
[=] these are like bricks, except that if you hit one you get another life
[V] these represent spikes which are among the bricks in the wall along the top
[O] these represent balls which are among the bricks in the wall along the top
===== this represents your paddle, which moves along the bottom of the screen
The game is like a one-player version of Pong. You slide your paddle left and right (the left and right arrow keys can be used) to hit the ball so it bounces upwards. The ball bounces off the walls and off the bricks.
1.) When the ball hits a [#] it not only bounces off the brick, but it causes the brick to disappear.
2.) When the ball hits a [V] it not only bounces off the spike, but it causes the V to fall. Also, the ball bounces at a random angle.
3.) When the ball hits a [O] it not only bounces off the ball, but it causes the ball to fly away in the direction that the original ball came from.
The wall looks like this:
[#] [#] [#] [O] [#] [#] [#] [#] [V] [#] [O] [#] [#] [V] [#] [#] [#] [#] [#]
[#] [#] [V] [#] [#] [V] [#] [O] [#] [#] [#] [#] [#] [#] [O] [#] [#] [#] [#]
[#] [#] [#] [#] [V] [#] [#] [V] [#] [#] [#] [=] [#] [#] [#] [V] [#] [#] [#]
[V] [#] [#] [#] [#] [=] [#] [#] [#] [#] [#] [V] [V] [#] [#] [#] [V] [#] [#]
The [V] and [O] and [=] are distributed randomly in the wall. You can have several levels of difficulty. The first level would have only [#] in the wall. The next level would have some [V] in the wall. The next level would also have some [O] in the wall.
The goal of the game is to break through the wall.
If you fail to hit a ball with your paddle and the ball goes out the bottom of the screen, then you lose a life.
If you hit a [=] then it disappears like a brick, but you also get another life.
If you hit a [V] then the V drops (also, the ball bounces at a random angle) --- you have to avoid the falling spike because if it hits your paddle then you lose a life.
If you hit a [O] then that O becomes live --- now you have more than one ball that you must keep in play with your paddle.
Because we are using characters rather than graphics, there are a limited number of vectors that the ball can travel on:
up 1 right 1
up 1 right 2
up 2 right 1
up 1 left 1
up 1 left 2
up 2 left 1
down 1 right 1
down 1 right 2
down 2 right 1
down 1 left 1
down 1 left 2
down 2 left 1
Write your program as a paced loop. This means that every X milliseconds, your ball(s) and spike(s) move up or down 1 char (you will have to figure out X by experimentation; determine what speed makes the game fun, but not so fast as to be unplayable). Unfortunately, one of the many failings of ANS-Forth is that it doesn't provide a standard way to check the system clock to determine how many milliseconds have elapsed (the TIME&DATE word is only accurate to seconds). You need these words:
INIT-TIME ( -- ) initializes the time to zero
TIME ( -- ms ) returns the number of milliseconds since SET-TIME was called
Just choose an ANS-Forth compiler and ask your friendly compiler-vendor to provide these words for you. I recommend that you choose VFX because SwiftForth might be too slow for your game to be playable without recourse to assembly-language --- you don't want to have to delve into assembly-language on your first-ever program (these aren't the bad-old-days of the Vic-20 in which assembly-language was a must for almost any program; you have that advantage over me when I was writing this program).
Good luck with your assignment! You can post messages on comp.lang.forth asking specific questions related to your assignment. You can't post any more idiotic messages such as: "could you re-implement myth2 soul-blighter game in forth?" You also can't post vague messages such as: "Um, my source-code file is empty. How should I, um, begin?" Note that these rules apply whether you accept the assignment or not --- quite frankly, we are all sick and tired of your idiotic questions --- you have to complete the assignment or nobody will respond to your posts any more! Programming is all about discipline --- you have to force yourself to work on the assignment until it is complete!
Note that there is an element of irony in the choice of BreakOut as your first-ever Forth program. You have been trapped in the doldrums of attention-deficit-disorder for over 30 years --- now it is time to break out of the doldrums and write an actual computer program! --- you will have something to be proud of when you succeed!