

We can draw it at the beginning and "pseudo-clear" the console. Right? So we don't have to keep on drawing the border. The same applies for the bottom row of the border. You can write the entire horizontal bar in one go with one Console.Write("■■■■■■■■■■■■■■") statement. Also, the drawing of the border was a bit long winded. The constant Console.Clear() operations made the screen flicker quite a bit. When I ran the game I found it a bit laggy.
#SNAKE VS BLOCK ICON CODE#
Yes, there are some improvements in the code and so on, and all of the above comments are spot on, so I'm not going to hammer on the same points.

My version is far from perfect and I am sure I made some pitfalls myself. Please let me know if there is anything unclear in the comments. If ((ConsoleKey.RightArrow) & movement != "LEFT" & buttonpressed = "no")Ĭonsole.SetCursorPosition(screenwidth / 5, screenheight / 2) Ĭonsole.WriteLine("Game over, Score: "+ score) Ĭonsole.SetCursorPosition(screenwidth / 5, screenheight / 2 +1) If ((ConsoleKey.LeftArrow) & movement != "RIGHT" & buttonpressed = "no")

If ((ConsoleKey.DownArrow) & movement != "UP" & buttonpressed = "no") If ((ConsoleKey.UpArrow) & movement != "DOWN" & buttonpressed = "no") If (hoofd.xpos = screenwidth-1 || hoofd.xpos = 0 ||hoofd.ypos = screenheight-1 || hoofd.ypos = 0)ĬonsoleKeyInfo toets = Console.ReadKey(true) Int berryy = randomnummer.Next(0, screenheight) Int berryx = randomnummer.Next(0, screenwidth) Since Scratch didn't have classes and methods I have a feeling this code could be a lot more streamlined, neat, efficient, more read-able, shorter and in general just better. I've used Scratch (drag and drop programming for kids) for quite some time.
