Wednesday 7 December 2016

Some Progress?


What's Done and What isn't?


If I miss anything forgive me its the middle of the night and i am totally lost. Plus C++ and python and so many other things are just driving me crazy (lol like i wasnt before :P). This update isnt as great as I hoped it would be but there is some progress, especially made by Fariha, so here's to that. Now to get on with a few boring details before i end this update (I know you couldnt care less about all that you just want to read my blabbering, but see the point of this blog is to discuss the project so please bear with  me :P).
So we have managed to get the console based version of the game and we also know how to work with the images and get them where we want by linking them to the screen. The problem now is in getting the animation. If we make a 2D animation first just to be safe and then we start on a 3D animation that would be waste, especially as we have very less time. However, we do not know for sure exactly how the 3D animation will work and now we are figuring that out. 
Now as for the console based code it uses lists of course, and it actually allows the user to decide how many disks the tower should be of. The code for the solution of the hanoi is actually a really long code as we decided not to go with the recursive method. The recursive method may have been shorter but we were not sure how that could be animated and how each move could be show. I actually tried a bunch of ways that just gave weird outputs.



This screenshot doesn't show the worst of it but this is one issue. However, as you can see the rings look nice no? :P The point is that we know better how to get it to work through loops and conditionals and so that is how we made the solution. Well that is it for now. Need to catch up on sleep and to projects (need to catch up to the semester as a whole actually but eh ). Thanks for reading these tired ramblings and please hope that me and Fariha manage to finish this properly because we just have what? a day and a about 20 hours? But we don't need luck because we can do this! ( a little false optimism can go a long way hehe :P :) ).

Sunday 27 November 2016

Another Project Another Torture



Towers


So now I have another Project to make for the course and this time it is paired work so I will be working on it with a partner, Fariha Farooq. (Since it is a shared project I'll let these posts be more sane than the prior ones, especially since the two of us will be writing them). We have decided to make the Tower of Hanoi Animation for this project. Since the level of this project is supposed to be very high we have been told that it should not be a simple animation but rather should have more to it. Hence, we decided to make it a 3D animation of Towers of Hanoi. We have also decided to have to options to it. So firstly, the animation will play itself and solve the tower, but also the user can solve the puzzle too and play the game. We have very little time to do this so lets hope we manage to make it as amazing as we plan on making it. 
Anyways the Tower of Hanoi is a logical puzzle and it involves three tower. The aim is to move the disks on one of the towers to another tower, moving one disk at time. Larger disks cannot be placed over smaller ones. There can be any number of disks but for the purpose of our project we will stick to a fixed number. This puzzle is based on a legend.

In the next update we will hopefully show some sufficient progress with the game but for now let us get to work.







Saturday 29 October 2016

Almost There?

print("GAME OVER")


Well, kind of. There is still a lot that i could have added to my game such as double jumps, king pawns, AI and a better interface. I also feel like there may be bugs that I am missing out on but oh well.. The game may not be perfect or even complete but I have met the requirements of the project and reached the deadline so what I have is enough for now. And after all a good developer know that their software/game is never complete. Perhaps I will continue working on it in my own time for my own learning. If I get any further with it I may even blog about it here ( LOL me blog by choice? nah... but lets still see )

So let me just give an over view of the game that I have now:
- The game can be played with both the mouse and the keyboard. I actually managed to figure out the mouse press event. I just needed to add a sort of counter for the first move and the second move. Once i got this i managed to link it with a key press event as well. However, this was the last thing that I did. The left and right keys can be used to make a move, however the mouse still has to be used to select the pawn.
- The game can end as win, lose or tie. The player with the most pieces left when the game ends will be the winner.
- I cannot say if my graphics are great but I feel like I have met the requirement for mature graphics(?).

Here are a few screen shots of my game now:



print("Goodbye World!")

Sunday 23 October 2016

Sleepless Nights

Print("Life as a Programmer")


Yeah being a programmer is the absolute best. I always wanted to stay up late writing code ( please note the sarcasm). Well anyway on with the point. I spent ages trying to figure how to get the pieces to move on the screen but all the effort I did was really for nothing because the point was that all the work that I was doing was on the front end and that is pointless. Therefore, I then decided to go try and make a console based version of the game first and then link that to my GUI. This meant that all the previous effort was in vain but oh well that is what programming is about. I really did learn something though. Next time I should get work on a console based logic and then go to the GUI from there. Well lesson learnt i went forth with my quest, and finding inspiration from some sources on the internet like the following, i decided to make the game object oriented (or at least try to):
https://github.com/yono38/Simplified-Checkers/blob/master/checkers.py


With my limited knowledge of Object Oriented Programming in Python (although I am studying OOP in C++) and my almost zero knowledge of pyglet i meandered into unknown waters and somehow ended up with a little progress and a lot of dark circles (the dark circles weren't really new but the sleepless nights that caused them sure were).

Yeah The screen looks like nothing but there is a lot of back end work here that cannot be seen. I made the classes i would need with their functions and i also added mouse press functionality, although that is annoying me now and is the next thing that I want to work on.What it does now is that the first press just works once (that is the one that removes a pawn from the board) and then the other left clicks keep adding pawns to the board like this. That is obviously not what I want. So much for the weeks spent on this. It seems like I have done nothing. But you don't know the effort it took to set it properly on the screen when i had to relate it an internal two dimensional array which represents the board. getting the indices just right took a long time. I stayed up till two once trying to figure it out with no luck but then I solved the issue the next day (my luck in things like this is just strange....). Well anyway i have the game without the jump condition right now. And i also have to do something about this mouse press event. Linking it is very annoying and I still don't know quite how it works. Well anyways I should go now. I hope the next time I post I have something much more to show you.. Maybe I will just be left with the AI(as if!)

print("Google I think I am ready for you now! Well I am ready to beat you not be you!")

Sunday 16 October 2016

Long Overdue First Update


print("First Update")


To start of I had to install pyglet on  my computer, which was simple enough. After that, as I experimented with my code, I realised that I should change my IDE. So, I decided that I would start using the PyCharm IDE instead of the regular IDLE IDE, and really PyCharm did not fail to astound. It is absolutely perfect and makes the code so much cleaner. It really works like a dream. So, I decided that I would be using it to make my code. 
Now the next step was to select the board, logo and pawns for the game. I decided to create them myself using paint as that provided me more control over dimensions and will also make the game more my own.
Using pyglet I generated a window and used the .blit(x, y) command to draw my board on the screen as background. Using different commands I set up the window how I wanted and even added an icon to the window. Then I loaded the pawns on the screen as sprites. This was all the work for the GUI and it was completed a while back, I know this update is late but Oh well nothing can be done now. 
I'll hopefully be back in a few hours to update you on the next part of this code, the part that really makes me want to be a programmer all the more (yeahhhh about that... ). I should also have some nice screenshots by then. 
print("later!")

Sunday 2 October 2016

Game-plans are necessary

print("Game-plan")


It feels strange not using std::cout but oh well. Now what is the deal with this game-plan that I am talking about? I need to post about what my plan is for this project. You know type out all the details like the description of project (do you really want to know?), a list of functionalities that the project will have (and what's so special about my project? What makes it different/unique? Well the fact that I am making it what else do you need?), a list of tools/technologies that will be used for the project (well python for duh!), why I selected this project (that is a tough one), what I plan to learn from this project (umm.. for one i'll relearn python again see i just learnt how to print) and last and most definitely the least what my initial plan for project is (you think I have a plan? Like please! if i did I would be done already!). Well that is it for the interesting part now on with the Project. You will finally know the big secret. I am making.... wait for it.....

print("Checkers") #can I get clapping in the background too?

Well that was too much hype for nothing but you all aren't allowed to say that.

Description of the Project

Okay so basically I'll be making a GUI based game of checkers. Checkers is a game that is played on an 8 by 8 grid with alternating colours (Oh who am I kidding? I'm sure you all know what checkers is. If not well let me clear to you that it is NOT chess!). There are 12 pieces of the two colours (You can have black and white, black and red or even some other colour pairing but black starts first). The pawns can only move diagonally. To eliminate the other pawn they must jump over it. The game ends when all pawns of one colour are eliminated or when no other move is possible. To understand it better go to the following links:

Functionalities


  • Mature Graphics
  • It will be controlled using the mouse and the keyboard
  • It will have game win/lost detection
  • It will (hopefully) give a choice to play against the computer or with another player
  • Still thinking of more functionalities that I could add

Tools/Technologies

I'll be using Python 3.5 with the IDLE IDE and I will use the pyglet library.

Why I selected this project

Well from the list of project options that we were given, I gave myself two options. Sudoku or Checkers. I kind of wanted to make Sudoku more but the logic for checkers was clearer in my head. Plus, what fun would a GUI version of Sudoku be anyway? Games like that are more fun on paper. So I went with checkers. The added complication of adding AI to the game makes the project challenging too and when am I not up for a challenge like that?


What I plan to learn from this project

Well this project will definitely improve my coding skills and teach me how to use languages like python to make games. Maybe next I can make something like chess using the skills I learnt making checkers. Who knows? Plus the next project would be an even more complicated game so I really do need to learn a lot from this first project. Furthermore, creating the logic and planning the game will help me improve my programming practices and my algorithm writing skills. This is what I plan to learn and what I think i'll learn, but who knows, i'm sure i'll learn a lot more than I can even anticipate I will.


Initial Plan

I already have the required software on my laptop. Pyglet is also installed and ready to be used. So now to start of with the game. I have some of the logic formed in my head and some on paper and I have a relative idea of how to go about things. First I will make the board (more like just get an image of a board and get that image on a window). Then I will place the pieces as sprites on the board. Those pieces that are supposed to be visible at the start will then be visible and the rest invisible. Once the pieces are placed I will add then configure the board for mouse clicks. So basically the first week will be spent setting up the interface and getting that right. Once that is done, I will spend the next week on implementing the game logic (so basically the movement of the tiles, the elimination of the tiles, possibility of moves etc.) but I will leave the AI part of it for the third week. In the beginning I will design the game for two players to play using the same screen. 


Well that is all for now.. See you all for the next update where I will hopefully have substantial progress to show you! (Ha sure... )

print("over and out")

Saturday 1 October 2016

A matter of 10%....


Hello World


open(); //open sesame!
std::cout << "Hello World" << std::endl;
std::cout << "Should I introduce myself? " << std::endl;
std::cout << "Name: Ramsha Saad\nMajor: Computer Science\n Superpower: Female" << std::endl;
Well see learning C++ has made me forget everything else but I need to make a game on python now, which i knew well once upon a time (Well up until the start of this semester tbh... but let's pretend that's not true.) And i need to write this blog about it too. Me blog? That's a joke but well 10% of my grade for the project is no joke so I'm hoping for the best. Maybe I'll get into the habit of blogging about my programs through this and that would be really great in the future. Or maybe i don't but i can still look back at this when I'm working at google (LOL!).
std::cout << "Goodbye for now World, I'll get back to you in a bit with the boring stuff. Details about the project and what not.\nBut i promise I'll try and make it fun (Haha nice joke)" << std::cout;
close(); //wish I could avada kedavra and kill this whole thing but thats not possible... for now....