You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
Hi everyone . I want to make an array inside a struct and randomly generate initial states.
- Posts: 8
- Joined: Thu Jul 12, 2012 7:39 am
Too vague for me. What dialect are you implementing this in and what have you tried so far?
A general hunch is that you need to create the array then traverse it using a random function to give each slot a value. The fact that the array is in a struct is not very relevant.
- Posts: 113
- Joined: Mon Jul 11, 2011 2:53 pm
If you are using defstruct, you will need to create a separate function to initialize the contents. If you are using defclass, then you can use "(defmethod initialize-instance :after" to do the initialization.
- Posts: 525
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Return to Homework
Who is online
Users browsing this forum: No registered users and 2 guests