PacDessert1436.QSharpApp.Template
1.0.2
Please use version 1.0.7 or later because of several packaging issues on previous versions (either missing actual project content or incorrect template configuration).
See the version list below for details.
dotnet new install PacDessert1436.QSharpApp.Template@1.0.2
PacDessert1436.QSharpApp.Template
A .NET template for creating Q# (QSharp) console applications, with Quantum Game of Life as an example implementation.
Important Note: Please use version 1.0.2 or later because:
- Version 1.0.0 had packaging issues (incorrectly included LICENSE file and misplaced
.template.configfolder).- Version 1.0.1 was missing actual project content (Q# program and the project file).
Features
- 🚀 Ready-to-use Q# console application template
- 🎮 Quantum Game of Life simulation using quantum randomness
- 📦 Pre-configured with Microsoft Quantum Development Kit
- ✨ Clean project structure with best practices
Getting Started
Prerequisites
- .NET 8 SDK or later
- Microsoft Quantum Development Kit (QDK)
Installation
Install the template from NuGet:
dotnet new install PacDessert1436.QSharpApp.Template
Or install locally from source:
cd QSharpAppTemplate
dotnet new install .
Create a New Project
Use the template to create a new Q# console application:
dotnet new qsharpapp -n MyQuantumApp
cd MyQuantumApp
Run the Application
dotnet run
Template Structure
MyQuantumApp/
├── AppMain.qs # Main Q# program with Game of Life
└── MyQuantumApp.csproj # Project configuration
Quantum Game of Life
This template implements Conway's Game of Life using quantum randomness for initial grid generation. Each cell's initial state is determined by measuring a qubit in superposition, creating a truly random starting configuration.
Key Q# Operations
QuantumRandomBit()- Generates a random bit using quantum superpositionGenerateRandomGrid()- Creates a grid with quantum-random initial statesNextGeneration()- Computes the next generation using Game of Life rulesPrintGrid()- Displays the grid in the console
Configuration
Modify the Main() operation in AppMain.qs to customize:
let cfg = GameOfLifeConfig(Width, Height, Generations);
- Width: Number of columns in the grid (default: 30)
- Height: Number of rows in the grid (default: 10)
- Generations: Number of simulation steps (default: 15)
Game of Life Rules
The simulation follows Conway's classic rules:
- Alive cell (
#symbol) survives if it has 2 or 3 live neighbors - Dead cell (
.symbol) becomes alive if it has exactly 3 live neighbors - All other cells die or remain dead
Development
Build the Template
cd QSharpAppTemplate
dotnet pack
Test the Template
dotnet new qsharpapp -o TestApp
cd TestApp
dotnet run
License
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
Resources
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.