Unix/Linux Go Back    


What is on Your Mind? Come inside and relax a while. Discuss whatever is on your mind. New members can introduce themselves. However, technical Q&A should happen in our other forums.

Snake game challenge in UNIX

What is on Your Mind?


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 04-22-2017
amit14august amit14august is offline
Registered User
 
Join Date: Nov 2016
Last Activity: 16 May 2017, 11:08 AM EDT
Posts: 7
Thanks: 4
Thanked 0 Times in 0 Posts
Snake game challenge in UNIX

Hey Guys,

I have made this basic snake game but it a little bit different from conventional snake game. Learned some basics of Unix. Hope you enjoy playing it.
Please download and run on your machine and suggest any changes i can make. and let me know if someone could score 1000 points Linux

Thanks,
Amit

Last edited by amit14august; 4 Weeks Ago at 04:18 PM..
Sponsored Links
    #2  
Old Unix and Linux 4 Weeks Ago
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 27 May 2017, 6:00 AM EDT
Location: Loughborough
Posts: 1,202
Thanks: 362
Thanked 320 Times in 250 Posts
Hi amit14august...
You must be using a bash version 4.x.x as it cannot be used on anything previous.
On OSX 10.12.4, DEFAULT bash terminal below occurs...

Code:
Last login: Sun Apr 23 09:13:49 on ttys000
AMIGA:amiga~> bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.
AMIGA:amiga~> cd Desktop/Code/Shell
AMIGA:amiga~/Desktop/Code/Shell> ./snakegame.sh






Your green snake must stay away from pink ones

control : I = UP  J = LEFT  K = DOWN  L = RIGHT

 Game will start in 3 seconds


your score is : 1      top score is 1000
./snakegame.sh: line 283: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
                                             
                                             
                                             
                                             
                                             
                                             
@@@@@                                        
                                             
                                             
                        ***                  
                                             
                                             
                                             
                                             
                                             
./snakegame.sh: line 221: init_snake: bad array subscript
./snakegame.sh: line 222: init_snake: bad array subscript
./snakegame.sh: line 167: read: .025: invalid timeout specification
./snakegame.sh: line 88: [: -eq: unary operator expected
./snakegame.sh: line 95: init_helper_one: bad array subscript
./snakegame.sh: line 96: init_helper_one: bad array subscript
./snakegame.sh: line 100: 1 -  : syntax error: operand expected (error token is " ")
AMIGA:amiga~/Desktop/Code/Shell> _

So it is not backwards compatible.
To find your bash version:-

Code:
Last login: Mon Apr 24 07:15:34 on console
AMIGA:amiga~> bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.
AMIGA:amiga~> _

It is not easy to include users who do not have versions of languages that you write for and possibly unable to upgrade to. So be aware when you write your code to state which version of language you are using as that helps the user to decide whether or not to run your code.
We all learn the hard way.
Good luck and keep up with the programming learning curve.
We look forwards to seeing more from you...

Bazza.
The Following User Says Thank You to wisecracker For This Useful Post:
amit14august (4 Weeks Ago)
Sponsored Links
    #3  
Old Unix and Linux 3 Days Ago
cb88 cb88 is offline
Registered User
 
Join Date: May 2017
Last Activity: 25 May 2017, 12:49 AM EDT
Posts: 13
Thanks: 0
Thanked 1 Time in 1 Post
Heh, I wrote an incomplete snake clone a few years ago on my SparcStation LX running Gentoo. I'll post a link to a video of it once I get a chance who knows I might even dig up the source and see about finishing it. It's just plain ncurses... and uses a pretty inefficient implementation so the longer your "Wooly Bear" as I called it gets the slower it runs! Here is a link to a video of my LX running and me dorking around with it SparcStation LX booting Gentoo Linux - YouTube

Last edited by cb88; 3 Days Ago at 10:35 PM..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Anyone like a challenge? BatterBits Shell Programming and Scripting 18 02-13-2015 11:41 PM
Snake and ladder game ayarlaga Shell Programming and Scripting 7 07-30-2013 05:47 AM
safeword challenge blowtorch UNIX for Advanced & Expert Users 2 10-10-2006 10:44 PM
UNIX 'adventure'/game. TARFU UNIX for Dummies Questions & Answers 3 02-16-2006 05:18 PM



All times are GMT -4. The time now is 12:42 PM.