Wednesday, January 31, 2018

Rubik cube game - 3- C Sharp

Rubik's cube game in C#
(Computer game for solving Rubik's cube puzzle)
(Written by me in c# 2010)
.
On last year's (2017) birthday of my niece,  one of my nephew,  gave her 2 gifts. One was a good looking Barbie doll and another was colorful Rubik's cube. While my niece preferred Barbie doll more, I started to analyze Rubik's cube to get some idea how to play with it, to make me able to teach my niece how to play with it. After making some un-successful tries I started searching Internet for tutorials about playing Rubik's cube.
And during searching and researching about Rubik's cube I got an usual idea. Idea was to make softwares for (1) playing Rubik's cube game (2) finding shortest solution for any given pattern of Rubik's cube. So I started making plans for these softwares and then started coding and in some days made them.
During coding of rotations of Rubik's cube I was getting disoriented again and again. So to solve that problem I made a small cube of hard paper. Made 3x3 boxes on it's each side with pencil and numbered them like 2d matrix. Then during coding I used it for reference. Before using this technique I was having difficult time in finding the bug in cube side/face rotation methods.
.
Salient features of Rubik's cube game:
All 6 sides of Rubik's cube are displayed side by side with their side name above them. Side rotating buttons are also above each side on left and right of side name. Game can be played in two modes: manual or auto. In manual human plays and in auto computer plays random moves.
.
Screen shots of game and their description:
Following are screen shots of Rubik's cube solving game at different stages with their description.
.
Game on Load:
Game looks like in the following image when it loads. Menus are on top line and status is at bottom line. Area in between them is divided in 3 columns.  In left column under 'Cube sides' heading are 6 colorful squares of 3x3 sub-squares. They are sides/faces of cube with their respective color. Each side's name is displayed above them. On left and right of each side name are buttons for rotating respective side. Left button for rotating  side clockwise and Right button for rotating side counter-clockwise. In center column Moves log and game controlling controls are displayed. In right column rotation buttons are explained.
.
.

.
Help menu expanded:
Game looks like in the following image when help menu is clicked. Showing it's 5 options: About, Purpose, User interface, How to use and Copyright. Each option of help menu is shown and explained in following.
.
.

.
Help/About:
Game looks like in the following image when 'About' in 'Help' menu is clicked. This menu-item displays basic information about game and it's author.
.
.

.
Help/Purpose:
Game looks like in the following image when 'Purpose' in 'Help' menu is clicked. This menu-item display text explaining purpose of the game.
.
.

.
Help/User interface:
Game looks like in the following image when 'User interface' in 'Help' menu is clicked. This menu option explains game's user interface as visible in following image.
.
.

.
Help/How to use:
Game looks like in the following image when 'How to use' in 'Help' menu is clicked. This menu option explains how to use this game application as visible in following image.
.
.

.
Help/Copyright:
Game looks like in the following image when 'Copyright' in 'Help' menu is clicked. This menu-item displays copyright text for this game application.
.
.

.
'New Game' button clicked
Game looks like in the following image when 'New Game' button in center column under 'Game' section is clicked. This button begins game starting process.
.
.

.
Play mode
Under 'New game' button are two radiobuttons called 'Manual' and 'Auto'. They are enabled only during after 'New game' button is clicked and before 'Start' button is clicked. They allow either human or computer to play the game. Select 'Manual' for human to play or select  'Auto' for computer to play. Computer only makes random moves so chances of computer solving the game is between in minimum moves possible to never.
.

.
'Shuffle colors' buttons
'Shuffle colors' button is also enabled only during after 'New game' button is clicked and before 'Start' button is clicked. Use this button for shuffling Rubik's cube.
.

.
'Start' button clicked (Manual mode):
Game looks like in the following image when 'Start' button in center column under 'Game' section is clicked in manual mode. Only Rubik's cube patterns may be different. I used Rubik's cube patterns in following image in an online Rubik's cube solver to test my game and my game worked correctly.
..
.

.
Some moves are made (Manual mode):
Game looks like in the following image when game is started in manual mode and some moves made.  This image is not sequence of above image. Only Rubik's cube patterns may be different.
.
.

.
'New Game' clicked during running game 'Manual':
Game looks like in the following image when 'New Game' button in center column under 'Game' section is clicked in 'Manual' mode while a game is already running. This option is useful for aborting an running game. This option gives options for actually aborting game or continue with the running game.
.
.

.
'Start' button clicked (Auto mode):
Game looks like in the following image when 'Start' button in center column under 'Game' section is clicked in 'Auto' mode and some moves are made.
.
.

.
'New Game' clicked during running game 'Auto':
Game looks like in the following image when 'New Game' button in center column under 'Game' section is clicked in 'Auto' mode while a game is already running. This option is useful for aborting an running game. This option gives options for actually aborting game or continue with the running game.
.
.

Game completed 'Manual':
Game looks like in the following image when it is completed/solved while game is in 'Manual' mode. Meaning all side/face square's are arranged in the same color as in the respective center square. When this happens game displays an alert message and a message in status bar to congratulate the player. This result was achieved by using generated moves from an online Rubik's cube solver site where I used starting patterns as mentioned above in "'Start' button clicked (Manual mode)"section. And felt happy on finding that my game was working correctly.
.
..

.
After a completed game:
Game looks like in the following image when it is completed/solved and 'Congratulating' alert message is also closed. Now game is ready for player to start New game.
.
.

.
I decided to display all 6 sides/faces of Rubik's cube side by side instead of displaying it as a rotate-able cube because 'side by side' way looks better and easy to understand to me.
.
Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it.



Monday, January 1, 2018

Laptop of My dreams - 2018

Laptop of My dreams - 2018
(A laptop I am making in my mind since some years)
.
Since some years, may be around at least a decade, I am thinking about, making in my mind, a computer which will be able to fit my requirements. And while doing so I am also making a laptop in my mind side by side. For example how it will look, what parts it will have. What it will be able to do. etc.
Although I was thinking and thinking again and again but things were not fitting together as I wanted them to fit. But suddenly a very important part of idea came from word 'Notebook'. Idea was that as there can be many pages in notebook why not have same type of arrangement in laptop. Laptops now a days already have 2 pages. One is it's display and other is it's remaining part. This idea simplified every thing for my dream laptop design.
Specifications of my dream laptop, in simple words, are as follows:
(1)_Overall look: It will have a big screen may be something around 20" so laptop will be large and thick and heavy.
(2)_Multi-paged: It's chassis/body will have more then 2 pages. Each containing a specific part. It's pages are described bellow.
(2a)_Display page: This will be top page and will contain laptop's display. Laptop will support either one or three displays. In case of three displays one called main display will be attached to laptop's chassis and remaining two called left display and right display will be attached to respective sides of main display. Both left and right displays will open and close like door and will have 2 way displays. So opening all displays for doing simple task will not be necessary.
(2b)_Keyboard page: This will be second from top page and will contain desktop like full size Keyboard, track pad etc only. Most chances are that this page will be totally like touch screen. So it will be possible to arrange it's contents in a lot of ways.
(2c)_Motherboard page: As is obvious from name this page will contain laptop's mother board and also main HDD etc.
(2d)_RAM page: This page will contain board with lot of slots for RAMs. Thus this facility will allow laptop to have huge quantity of RAM.
(2e)_Processor page: This page will contain board with a lot of slots for Processors. Suppose there will be N number of slots in this board. Idea is that Processors will be able to work as an individual or as a group of 2 or more processors. Meaning either N processors will work separately OR all as a one processor OR in any combination posibble between these 2 situations. Thus giving very great and versatile computing abilities to laptop.
(2f)_HDD page: This page will contain facility to attach a lot of HDD/SDD etc in it. So giving laptop ability to have huge quantity of external storage.
(2g)_Battery+Adapter page: This will be bottom page and will contain facility for attaching more then one powerful batteries. Plus this page will also contain built in adapter because carrying external adapter with laptop do not look good to me. Idea is that batteries will be so powerful that they will last for a weak while laptop continuously doing all power consuming task in parallel through out this time.
(*) It will be possible to have more then one page for any category  of page except display-page. Meaning this way it will be possible to have more then one motherboard OR more processing power OR more RAM OR more external storage OR more battery power etc in my dream Laptop.
.

If there are any mistakes then I will surely remove them whenever found.

.
.