Skip to main content

Posts

Alto's Adventure -An endless snowboarding odyssey

এক দশক ধরে স্মার্টফোনের জয়জয়কার চলছে। স্মার্টফোন শুধু কমিউনিকেশনের মাধ্যম থেকে পার হয়ে বহুদূর এগিয়ে গেছে। প্রজন্মের একটা বড় অংশ বিনোদনের প্রধান উপকরন হিসেবে স্মার্টফোনকে দেখে। সেই বিনোদনেরও একটা উপায় হলো মোবাইলে গেম খেলা। একটা বিশেষ গেমের সাথে পরিচয় করিয়ে দিতে লিখতে বসেছি। গেমটার নাম "Alto's Adventure"। ইতোমধ্যেই গেমটি বেশ সুনাম কুড়িয়েছে। গেমটা প্রমান দেয় যে একটা সফল গেমের জন্য ধুমন্ধার অ্যাকশন বা মগজের উপর জোর দেয়া, এই বিষয় গুলো না থাকলেও চলে। গেমের মুল থিমটা হলো স্নো বোর্ডিং। মূল নায়ক অলতোকে নিয়ে পাহাড়ে স্নো বোর্ডিং করতে হবে। কি? ইচ্ছা দমে গেলো? আসলেও স্নো বোর্ডিং বা এই ধরনের রিয়েল লাইফ গেম নিয়ে এর আগে হাজার হাজার গেম বানানো হয়েছে। তা এতে এমন কি আছে যে আলাদা ভাবে লিখতে হবে। আছে জনাব, তা অবশ্যই আছে। গেমটা খেলে প্রথম যেই চিন্তাটা মাথায় আসে তা হলো, এত রিল্যাক্সিং কি করে হতে পারে? তাও আবার একটা গেম? রিল্যাক্সিং হবার অন্যতম কারন হচ্ছে এর ব্যাকগ্রাউন্ড মিউজিক। পিয়ানোর ছন্দগুলো শুনলেই মনটা ভালো হয়ে যায়। তার সাথে বৃষ্টির সম সেটার আওয়াজ, বাজ পড়ার আওয়াজ ইত্যাদি পারিপার্শ্বিক
Recent posts

Building a Tic Tac Toe Console Game in C#

When learning a new programming language, a common exercise is to create a classic game, such as Tic Tac Toe. In this post, I'll guide you through creating a simple, console-based Tic Tac Toe game in C#. First, let's start with the challenge we're trying to solve: Tic Tac Toe is a two-player game. We need to handle input from two players and alternate between them. The game is played on a 3x3 grid. We need to keep track of the state of this grid. A player wins by marking three spots in a row, either horizontally, vertically, or diagonally. The game continues until a player has won or all spots on the grid have been marked, in which case the game is a draw. To address these challenges, we need to develop a problem-solving mindset. Let's break down the problem into smaller, manageable pieces and think about how we could solve each one. This process is known as "decomposition" and it's a fundamental skill in programming and problem-solving in general. Step 1:

Desktop Application Project: Building a Simple Library Management System in C#

 Let's create a simple library management system using the concepts we've covered throughout this series. The system will manage books, users, and borrow records. The project will include classes, inheritance, interfaces, events, delegates, generics, collections, LINQ, and exception handling. using System; using System.Collections.Generic; using System.Linq; // Chapter 2.1: Understanding classes, objects, and inheritance public class User { // Chapter 2.4: Understanding properties and indexers public int Id { get ; set ; } public string Name { get ; set ; } public DateTime JoinDate { get ; set ; } // Chapter 2.2: Understanding constructors and destructors public User( int id, string name) { Id = id; Name = name; JoinDate = DateTime.Now; } // Chapter 2.3: Understanding access modifiers (public, private, protected, internal) protected void PrintUserDetails() { Console.WriteLine( $ "ID: {I

Chapter 6.4: Working with .NET Classes: Understanding System.Linq

 Introduction: In the previous article , Chapter 6.3, we discussed the System.Collections and System.Collections.Generic namespaces, which provide classes for working with collections of objects in C# applications. In this final article of our series, we'll explore the System.Linq namespace, which offers powerful querying capabilities for collections, allowing you to filter, sort, and transform data with ease. After completing this article, you should have a solid understanding of C# and its core concepts. We encourage you to start a project to implement what you've learned and further strengthen your skills. System.Linq Namespace: The System.Linq namespace provides Language Integrated Query (LINQ) functionality, which allows you to perform complex queries on collections using a concise and expressive syntax. LINQ works with both generic and non-generic collections, as well as with other data sources like XML and relational databases. Some key features of LINQ include:

Chapter 6.3: Working with .NET Classes: Understanding System.Collections and System.Collections.Generic

 Introduction: In the previous article , Chapter 6.2, we explored the System.Text and System.Text.Encoding namespaces, which are important for working with text and character encodings in C# applications. In this article, we'll discuss the System.Collections and System.Collections.Generic namespaces, which provide classes for working with collections of objects. In the next article, we'll dive into the System.Linq namespace, which offers powerful querying capabilities for collections. System.Collections Namespace: The System.Collections namespace provides non-generic collection classes, such as ArrayList, Hashtable, and Queue. These classes store objects, but they don't enforce type safety: ArrayList list = new ArrayList(); list.Add(42); list.Add( "Hello, world!" ); foreach ( object item in list) { // Process item } System.Collections.Generic Namespace: The System.Collections.Generic namespace offers type-safe, generic collection classe

Chapter 6.2: Working with .NET Classes: Understanding System.Text and System.Text.Encoding

 Introduction: In the previous article , Chapter 6.1, we discussed the System.IO namespace, which provides classes for working with files, directories, and streams. In this article, we'll explore the System.Text and System.Text.Encoding namespaces, which are important for working with text and character encodings in C# applications. In the next article, we'll discuss the System.Collections and System.Collections.Generic namespaces, which are essential for working with collections of objects. System.Text Namespace: The System.Text namespace contains classes and interfaces for working with text and character encodings. Some key classes include: StringBuilder: Provides a mutable string buffer for efficient string manipulation. Encoding: Represents a character encoding, such as UTF-8, UTF-16, or UTF-32. Decoder/Encoder: Convert between different character encodings and byte arrays. StringBuilder: The StringBuilder class is useful for efficient string manipula

Chapter 6.1: Working with .NET Classes: Understanding the System.IO Namespace

 Introduction: In this new chapter, we'll explore working with .NET classes, which are essential for developing robust and efficient C# applications. In this first article, we'll discuss the System.IO namespace, which provides classes for working with files, directories, and streams. In the next article, we'll delve into the System.Text and System.Text.Encoding namespaces, which are important for working with text and character encodings. System.IO Namespace: The System.IO namespace contains classes for performing various operations on files, directories, and streams. Some key classes include: File: Provides static methods for creating, copying, deleting, and moving files, as well as opening files for reading and writing. Directory: Provides static methods for creating, deleting, and moving directories, and enumerating files and directories. FileStream: Represents a file stream, allowing you to read and write data to a file. StreamReader/StreamWriter:

Chapter 5.2: File I/O and Serialization: Understanding Serialization and Deserialization of Objects

 Introduction: In the previous article , Chapter 5.1, we discussed reading and writing text and binary files, essential skills for working with data in C#. In this article, we'll explore serialization and deserialization of objects, which are important for persisting and restoring object states. In the next article, we'll discuss working with .NET classes, an important aspect of developing C# applications. Serialization: Serialization is the process of converting an object's state into a format that can be stored or transmitted. In C#, the .NET framework provides several serialization mechanisms, such as binary, XML, and JSON serialization: // Binary Serialization BinaryFormatter formatter = new BinaryFormatter(); using (FileStream stream = new FileStream( "data.bin" , FileMode.Create)) { formatter.Serialize(stream, myObject); } Deserialization: Deserialization is the process of reconstructing an object's state from a serialized forma