Sponsored Content
Contact Us Post Here to Contact Site Administrators and Moderators Comments on "How Will the World End?" Post 302551130 by KenJackson on Monday 29th of August 2011 12:54:29 PM
Old 08-29-2011
Quote:
Originally Posted by Neo
FWIW, Here is a forum blog post from Oct 2010, We Run a Tight, but Very Effective, Ship.
I appreciate your tight ship very much, Neo. I like this forum. And I suppose you are tiring of this part of the discussion.

But the particular statement that was deleted above was in no way a violation your tight ship policy. It did not in any way disrespect, disparage or trample the rights of anyone else. Also, the deletion violates this paragraph that you quoted above:
Quote:
Running a tight ship means true freedom. Everyone is free to post and not be bullied, as long as they show respect to the rest of the community and follow a few simple guidelines. In order to have freedom, the rights of the individual to express themselves must not be compromised, as long as the person expressing themselves does not infringe upon the rights of others.
I'm not advocating purely religious discussions here, but all topics of discussion bump into religion. I know some people get vicious when anything of a remotely religious nature is mentioned. But it is their comments that should be deleted, not the good.

I encourage you to run a good and fair tight ship, not a mean tight ship.
 

7 More Discussions You Might Find Interesting

1. Programming

Couldn't compile the simple "Hello World"

So, this is my first C++ program under linux. My OS is Red Hat 8.0, and my codes are like following: $vi hello.cpp #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } $ g++ -o hello hello.cpp the error message are: ... (3 Replies)
Discussion started by: HOUSCOUS
3 Replies

2. Shell Programming and Scripting

Use "read" with a text file with comments

Hi, I read a .txt file with read command. while read PC USER PASS SHARE EXCL do ... done The file is like this: pc1 usr pc01 parts pc2 usr pc02 parts nobackup pc3 usr pc03 parts pc4 usr pc04 parts pc10 usr pc10 parts nobackup pc13 usr pc13 share,share_2 noshare,noshare_2But if I want... (3 Replies)
Discussion started by: mbarberis
3 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Purpose of "read" and "$END$" in ksh ?

Hi, Could anyone please shed some light on the following script lines and what is it doing as it was written by an ex-administrator? cat $AMS/version|read a b verno d DBVer=$(/usr/bin/printf "%7s" $verno) I checked that the cat $AMS/version command returns following output: ... (10 Replies)
Discussion started by: dbadmin100
10 Replies

5. Programming

Exact meaning of the "world" in "hello world"

Hello! I have a question to native English-speaking people. In the popular program's "hello world" greeting, what meaning the "world" has: "all", "everybody", "people", "friends" or "whole world", "planet", "Earth", "Universe"? In other words, to whom this greeting is addressed: to the... (14 Replies)
Discussion started by: Eugene Muzychen
14 Replies

6. Shell Programming and Scripting

Removing "^M" from the end of a String (i.e. "Ctrl+M")?

Hello All, I have an Expect script that ssh's to a remote server and runs some commands before exiting. One of the commands I run is the "hostname" Command. After I run this command I save the output using this line in the code below... Basically it executes the hostname command, then I... (2 Replies)
Discussion started by: mrm5102
2 Replies

7. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
SDL::Tutorial::LunarLander(3)				User Contributed Perl Documentation			     SDL::Tutorial::LunarLander(3)

NAME
Lunar Lander - a small tutorial on Perl SDL INTRODUCTION
This is a quick introduction to Games, Perl, and SDL (Simple DirectMedia Layer, a cross-platform multimedia programming library). We'll write a small game -- Lunar Lander -- in 100 lines of code, or less. CREATING A DEMO You can see the final version of the demo code by doing: perl -MSDL::Tutorial::LunarLander=lander.pl -e1 this will create all three files used in the tutorial: FIRST VERSION We'll start with a text version of the game. "What?", you may ask. "I thought it was a SDL tutorial". Yes, it is -- thank you for reminding me. But we'll leave the SDL part for later. We must build the game logic first! One of the traps of game programming is focusing too much on the interface. If we start with a simpler simulation, we can worry with the presentation later. So, here's the initial code: #!/usr/bin/perl use strict; use warnings; my $height = 1000; # m my $velocity = 0; # m/s my $gravity = 1; # m/s^2 my $t = 0; while ( $height > 0 ) { print "at $t s height = $height m, velocity = $velocity m/s "; $height = $height - $velocity; $velocity = $velocity + $gravity; $t = $t + 1; } if ( $velocity > 10 ) { print "CRASH!!! "; } else { print "You landed on the surface safely! :-D "; } Run the code and you'll see something like this: at 0 s height = 1000 m, velocity = 0 m/s at 1 s height = 1000 m, velocity = 1 m/s at 2 s height = 999 m, velocity = 2 m/s at 3 s height = 997 m, velocity = 3 m/s at 4 s height = 994 m, velocity = 4 m/s at 5 s height = 990 m, velocity = 5 m/s ... at 43 s height = 97 m, velocity = 43 m/s at 44 s height = 54 m, velocity = 44 m/s at 45 s height = 10 m, velocity = 45 m/s CRASH!!! "What happened? How do I control the ship???" CONTROLLING THE SHIP The problem with our first spaceship is that it had no controls! So, let's fix this problem, making the spaceship scriptable. (We could write some code to handle keyboard and joysticks now, but an scriptable spaceship will be easier to start. Remember, focus on the game logic!) So, create add this simple script to the end of your file: __DATA__ at 41s, accelerate 10 m/s^2 up at 43s, 10 m/s^2 at 45s, 10 at 47s, 10 at 49s, 10 The script is straightforward: it simply states a time when we will push the spaceship up with a given acceleration. It accepts free text: any two numbers you type will work. We can parse the script using this regular expression: my $script_re = qr/(d+) D+ (d+)/x; And we can build a hash of ( time => acceleration ) with: my %up = map { $_ =~ $script_re } <DATA>; So the middle section of the program will become: my $script_re = qr/(d+) D+ (d+)/x; my %up = map { $_ =~ $script_re } <DATA>; while ( $height > 0 ) { print "at $t s height = $height m, velocity = $velocity m/s "; if ( $up{$t} ) { my $a = $up{$t}; print "(accellerating $a m/s^2) "; $velocity = $velocity - $a; } $height = $height - $velocity; $velocity = $velocity + $gravity; $t = $t + 1; } That's it! Try to run the program, and the ship should land safely: ./lunar.pl autopilot.txt at 0 s height = 1000 m, velocity = 0 m/s at 1 s height = 1000 m, velocity = 1 m/s at 2 s height = 999 m, velocity = 2 m/s at 3 s height = 997 m, velocity = 3 m/s at 4 s height = 994 m, velocity = 4 m/s at 5 s height = 990 m, velocity = 5 m/s ... at 54 s height = 19 m, velocity = 4 m/s at 55 s height = 15 m, velocity = 5 m/s at 56 s height = 10 m, velocity = 6 m/s at 57 s height = 4 m, velocity = 7 m/s You landed on the surface safely! :-D Cool, but... HOW ABOUT THE GRAPHICS? Okay, okay... now that we have a working prototype, we can work on the graphics. But, first of all, we'll need... THE GRAPHICS Yes, the graphics. We won't use anything fancy here, just two images: a large one, for the background, and a smaller one for the spaceship. Create the images using the Gimp, or use the images provided by this tutorial; Save these images in a subdirectory called "images": (""images/background.jpg"" and ""images/ship.png""). USING SDL First step: use the required libraries: use SDL; #needed to get all constants use SDL::App; use SDL::Surface; use SDL::Rect; Second step: initialize "SDL::App": my $app = SDL::App->new( -title => "Lunar Lander", -width => 800, -height => 600, -depth => 32, ); Third step: load the images and create the necessary "rectangles": my $background = SDL::Surface->new( -name => 'images/background.jpg', ); my $ship = SDL::Surface->new( -name => 'images/ship.png', ); my $background_rect = SDL::Rect->new( -height => $background->height(), -width => $background->width(), ); my $ship_rect = SDL::Rect->new( -height => $ship->height(), -width => $ship->width(), ); Fourth step: create a sub to draw the spaceship and background: sub draw { my ( $x, $y ) = @_; # spaceship position # fix $y for screen resolution $y = 450 * ( 1000 - $y ) / 1000; # background $background->blit( $background_rect, $app, $background_rect ); # ship my $ship_dest_rect = SDL::Rect->new( -height => $ship->height(), -width => $ship->width(), -x => $x, -y => $y, ); $ship->blit( $ship_rect, $app, $ship_dest_rect ); $app->update($background_rect); } Note that this sub first combines all the bitmaps, using a blit ("Block Image Transfer") operation -- which is quite fast, but does not update the display. The combined image is displayed in the last line. This process of combining first, and displaying later, avoids that annoying fading between cycles ("flickering"). Finally, add the following lines to the end of the main loop, so that we call the "draw()" function with the correct spaceship coordinates: while ( $height > 0 ) { # ... draw( 100, $height ); $app->delay(10); } That's it! Run the program and watch the spaceship landing safely on the surface of the moon. COPYRIGHT &; LICENSE Copyright 2009 Nelson Ferraz, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2010-07-05 SDL::Tutorial::LunarLander(3)
All times are GMT -4. The time now is 02:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy