Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7165259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:12:37+00:00 2026-05-28T14:12:37+00:00

Working in a business environment, I don’t really get to code or use the

  • 0

Working in a business environment, I don’t really get to code or use the good old console anymore. My work is repetitive and thus not really challenging.

I decided to challenge myself by writing a snake game in a C# console; and boy did it make my brain work. I never have to think this hard on a day-to-day basis, but I felt like my programming skills weren’t getting any better.

I have a problem though. The basic approach I took was to create a snake class and a food class. The snake class uses an array to store all coordinates and then a drawing class decides what coords to draw on-screen.

The problem is that as you move the snake, the array fills up (maxsize is 250 for performance), so when I reach the end of the array I want to copy the last few coords to a temp array, flush the original array and copy the temp coords back to the main array.

The problem I have is copying x coords back to the original array. I decided to do it manually to test but this solution always makes my poor snake leave behind one of its segments on the screen when it shouldn’t be there.

How would I go about doing this programmatically?

spoints[4, 0] = stemp[249, 0];
spoints[4, 1] = stemp[249, 1];
spoints[4, 2] = stemp[249, 2];

spoints[3, 0] = stemp[248, 0];
spoints[3, 1] = stemp[248, 1];
spoints[3, 2] = stemp[248, 2];

spoints[2, 0] = stemp[247, 0];
spoints[2, 1] = stemp[247, 1];
spoints[2, 2] = stemp[247, 2];

spoints[1, 0] = stemp[246, 0];
spoints[1, 1] = stemp[246, 1];
spoints[1, 2] = stemp[246, 2];

spoints[0, 0] = stemp[245, 0];
spoints[0, 1] = stemp[245, 1];
spoints[0, 2] = stemp[245, 2];

I really don’t mind posting the whole game here if someone really wants to dig into the code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:12:38+00:00Added an answer on May 28, 2026 at 2:12 pm

    Consider using an array for ‘general points’ not drawing points, create another class called something like SnakePart so your Snake class has manageable parts.

    You could also create a custom array class so in each part of the grid you would only have a value hasSnakePart and manipulate that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the business requirement of the project I'm working on a really complex, we
I am working on a business problem in C#.NET. I have two classes, named
I am working with some business objects that relate to one another through their
Background I am working on a legacy small-business automation system (inventory, sales, procurement, etc.)
I am currently working on a silverlight business application, so I have come across
When you're working on enhancements to an existing line of business application, do you
Possible Duplicate: Business Case for Resharper I've just recently graduated and I'm working for
I am currently working on a module that takes one of our business objects
I have been working on a WCF service library where hopefully all the business
I am working on maintaining an ASP.NET website, and I've noticed the business layer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.