Snake在组件中,使用什么数据结构? [英] Snake in assembly , what datastructure to use?

查看:52
本文介绍了Snake在组件中,使用什么数据结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对装配完全陌生,信不信由你,所以我们的第一个任务是在装配中制造蛇.我应该如何存放蛇?我应该将其放在堆栈中还是应该将其放入某个寄存器中?我已经对这种可怕的"语言进行了大约三天的研究,但无法找到一个好的上手方法.我可能会在c ++中使用某种形式的链表,但不幸的是,这不是c ++.

Im totally new to assembly and believe it or not, our first assignment is to create snake in assembly. How should i store the snake? should i have it in the stack, or should i place it into some register? I have done some research about this "terrible" language for about 3 days, but cant figure out a good way to start. I would probably use a linked list of some sort in c++ , but unfortunately this is not c++.

非常感谢您的帮助

推荐答案

我应该如何存放蛇?我应该将它放在堆栈中还是应该将其放入某个寄存器中?

How should i store the snake? should i have it in the stack, or should i place it into some register?

假设您要谈论的是Snake动画/游戏,答案可能都不是.您很可能会使用二维数组来表示屏幕"上的单元格,并将蛇的身体表示为给定颜色"的单元格.

Assuming you are talking about a Snake animation / game, the answer is probably neither. You most likely use a 2-D array to represent the cells on the "screen", and represent the snake's body as cells of a given "colour".

我可能首先会想出一种最简单的方式,以在不使用任何数据结构库的情况下,使用C或C ++来实现代码……然后在汇编器中对算法进行重新编码.

I would probably start by working out the simplest way to implement the code in C or C++ ... without using any data structure libraries ... and then recode the algorithm in assembler.

这篇关于Snake在组件中,使用什么数据结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆