[Python] Creating a 2D grid for a board game in python

Discussão em 'Python' iniciado por Stack, Agosto 2, 2025.

  1. Stack

    Stack Membro Participativo

    I'm taking an introductory course to computer science using Python and we were given an exercise to make a board game(dogems). I'm having troubles constructing the board. The program is suppose to take a given argument and, using a function make_board(size), constructs a board of equal rows and columns with numbers along the bottom and letters along the side. A function show_board(board) then displays it. e.g. Board size:4 would give:

    a . . .
    b . . .
    c . . .
    . 1 2 3


    whereas, a board size:5 would give:

    a . . . .
    b . . . .
    c . . . .
    d . . . .
    . 1 2 3 4


    My question is basically, how would I go about writing these functions to construct a board of this nature?

    Continue reading...

Compartilhe esta Página