snake game

1,713 views
Skip to first unread message

orenpa11

unread,
Jan 23, 2019, 1:01:19 PM1/23/19
to Racket Users
Hi
I am trying to implemet this code of "snake game "

in DrRacket (Pretty big)
 But when I run it it is not working .
any Idea ?

Thanks
Or

s2.jpg

David Storrs

unread,
Jan 23, 2019, 1:25:32 PM1/23/19
to orenpa11, Racket Users
What happens when you run it? Are you getting any error messages?
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

orenpa11

unread,
Jan 23, 2019, 1:44:48 PM1/23/19
to Racket Users
Hi David,
Thanks for your swift response ,I simply do not know how to run this program.
I thought that when I press the run button I should see the snake GUI .

Maybe the language is not pretty big ?
Thanks,
Or

John Clements

unread,
Jan 23, 2019, 2:17:59 PM1/23/19
to orenpa11, Racket Users
Interesting problem; your screenshot shows header text that should not appear in the window, which suggests to me that you copied and pasted the text from somewhere else into a buffer where the language level was already set. It looks to me like you should do the following:

1) Delete the first three lines of the file.
2) Set the language level to “beginner with list abbreviations”.
3) Click “run”

John Clements

K H

unread,
Jan 23, 2019, 2:32:56 PM1/23/19
to John Clements, orenpa11, Racket Users
Hello Or,

The language is not "Pretty Big".

You should be using "Beginning Student with List Abbreviations".

The DrRacket metadata lines referred to by John set the correct language. In your case you must have changed the language somehow. Or perhaps the file needs to be saved before the metadata is acted upon.

HTH,

Kieron.

K H

unread,
Jan 23, 2019, 3:49:01 PM1/23/19
to John Clements, orenpa11, Racket Users
It seems the metadata lines added by DrRacket (mentioned by John) are processed when the a source file is loaded into DrRacket (via the menu option File/Open), but are not processed if the source code is directly copied (e.g. from a browser window) into a DrRacket window and then executed with the 'Run' button.

The metadata includes a #reader directive, e.g.:
(#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) ...)

This reader directive appears to be silently ignored by DrRacket when the source is 'Run', even though DrRacket shows "#reader" in red (as when an error is detected). The actions taken by DrRacket when 'Run' is pressed seem to depend on the settings in effect when the code is executed, which could be nothing, or throwing a confusing error.

The solution for the original poster's issue is as John directs; remove the metadata (i.e. #reader directive) and manually set the language.

However, I feel that DrRacket should recognize and act on (and perhaps also remove/hide from view) the metadata if the metadata occurs as from a copy/paste directly into a DrRacket window (e.g. as from a URL). The current behaviour is, I think, a bug and a trap (perhaps showstopping) for a new user experimenting with Racket.

Note that the Racket executable seems to process the metadata properly, understanding the language to use, etc.. so that the code behaves as intended.

orenpa11

unread,
Jan 23, 2019, 4:59:40 PM1/23/19
to Racket Users
Thanks I will check it.

orenpa11

unread,
Jan 23, 2019, 5:01:01 PM1/23/19
to Racket Users
Thanks

orenpa11

unread,
Jan 24, 2019, 6:33:26 AM1/24/19
to Racket Users
Hi,
when I removed the line
#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname snake-full) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))

And changed the  language to pretty big.
I recived this error:
Welcome to DrRacket, version 7.1 [3m].
Language: Pretty Big; memory limit: 128 MB.
. . check-expect: undefined;
 cannot reference an identifier before its definition

Any idea ?

Thanks,
Or





On Wednesday, January 23, 2019 at 10:49:01 PM UTC+2, Kieron Hardy wrote:
error_1.jpg

Kieron Hardy

unread,
Jan 24, 2019, 8:29:11 AM1/24/19
to orenpa11, Racket Users
The language you should be using is "Beginning Student with List Abbreviations".
<error_1.jpg>

orenpa11

unread,
Jan 24, 2019, 12:56:43 PM1/24/19
to Racket Users
Hi
I need to create a project in pertty big .
why this code is not been supported ?

Thanks,
Or

George Neuner

unread,
Jan 24, 2019, 1:17:39 PM1/24/19
to orenpa11, racket users

On 1/24/2019 12:56 PM, orenpa11 wrote:
> I need to create a project in pertty big .
> why this code is not been supported ?

"Pretty Big" is supported.
  - go to the Language menu
  - select "Choose Language"
  - go down to "Other Languages"

If you don't see a list under "Other Languages", click the circle next
to it.
You will find "Pretty Big" there.

George

Matthias Felleisen

unread,
Jan 24, 2019, 2:19:14 PM1/24/19
to orenpa11, Racket Users


Where did you find the snake game?
Where did it say it’s written in Pretty Big?

We have not used Pretty Big in over a decade in education,
neither does anyone in the Racket edu community proper.

This community supports people readily wth answers, but
we need to know what you know.

— Matthias

orenpa11

unread,
Jan 24, 2019, 3:44:13 PM1/24/19
to Racket Users
Hi Matthias ,
Unfortunately I need to write the project in pretty big language.
The game is not written in pretty big language as far as I know.
I thought that can copy andycode that was written in any language in racket to pretty big.
Is there a way to transfer code that was written in  "Beginning Student with List Abbreviations" to pretty big ?

Thanks,
Or

Matthias Felleisen

unread,
Jan 24, 2019, 4:54:34 PM1/24/19
to orenpa11, Racket Users

Yes there is. Use (require test-engine/racket-tests)
at the top and (test) at the bottom.

But it sounds like you’re copying and pasting homework
solutions. Hmph.

orenpa11

unread,
Jan 24, 2019, 11:11:50 PM1/24/19
to Racket Users
Hi
where can I find the  test-engine ?
I would like to copy the code  and  "play" with it.
So I can understand it better .
just copying the code is not helpful because I need to understand it.

Thanks,
Or

Matthias Felleisen

unread,
Jan 25, 2019, 6:39:12 AM1/25/19
to orenpa11, Racket Users

DrRacket -> File -> Open Require Path -> enter test- -> use mouse 

orenpa11

unread,
Jan 25, 2019, 8:53:52 AM1/25/19
to Racket Users
Hi,
Sorry but I did not get it.
should I add the path to the rkt file or add the code ?

Thanks,
Or
question.jpg

Robby Findler

unread,
Jan 25, 2019, 9:08:40 AM1/25/19
to orenpa11, Racket Users
You've opened the right dialog. Now type "test-" into it. You should
see the file appear. Click on it.

Robby

orenpa11

unread,
Jan 25, 2019, 10:27:17 AM1/25/19
to Racket Users
OK,
Got it , but how can I import the code of the snake program that was written in "Beginning Student with List Abbreviations"  and chnage it to  pretty big ?
question2.jpg

Matthias Felleisen

unread,
Jan 25, 2019, 10:33:50 AM1/25/19
to orenpa11, Racket Users

See below. I gave precise instructions.
> <question2.jpg>

orenpa11

unread,
Jan 26, 2019, 2:55:48 PM1/26/19
to Racket Users
Hi Matthias ,
I am sorry but I still did get it.
should I import the snake file that was written in "Beginning Student with List Abbreviations"  and the code will be chnaged to  pretty big ?
or only the "check-expect" is been chnaged from  "Beginning Student with List Abbreviations"  to  pretty big ?
Does Pretty Big has  drawing functions ?

Thanks,
Or

Matthias Felleisen

unread,
Jan 26, 2019, 3:04:45 PM1/26/19
to orenpa11, Racket Users

This is a working PB program: 

(require test-engine/racket-tests)
(require 2htdp/image)
(require 2htdp/universe)

(big-bang 100
  (to-draw (lambda (x) (circle (+ x 1) 'solid 'red)))
  (on-tick sub1)
  (stop-when zero?))

(test)


Now please do the rest of your homework yourself. 

orenpa11

unread,
Jan 28, 2019, 5:33:39 AM1/28/19
to Racket Users
Thanks
Or
Reply all
Reply to author
Forward
0 new messages