Issue using Pop() in Towers Of Hanoi


In my Towers of Hanoi project I have a game class with the logic of the game. I’ve made a new method inside that class called MovePiece to do what it sounds.

It’s quite possible I’m making a mistake by trying to call my Tower class with my stack inside it

It makes sense in my head at the moment to do it this way but I have an error under Pop telling me my Tower class doesn’t contain a definition for it. I have System.Collections and System.Collections.Generic at the top of my file so it shouldn’t need a definition. I think I’m missing something and would appreciate any help!


Hi Sam, think about what exactly it is you are trying to pop off. Is it a tower or a stack of blocks within the tower? Also think about what the variable “item” is. Take a look at your print board method and try to apply similar logic.